mirror of
https://github.com/MatthewCallis/language-65asm.git
synced 2024-06-09 13:29:30 +00:00
Rework dasm support
This commit is contained in:
parent
bca192fbc7
commit
4182828612
|
@ -1,65 +0,0 @@
|
||||||
'fileTypes': []
|
|
||||||
'foldingStartMarker': '/\\*\\*|\\{\\s*$'
|
|
||||||
'foldingStopMarker': '\\*\\*/|^\\s*\\}'
|
|
||||||
'name': '6502 Assembly (DASM)'
|
|
||||||
'patterns': [
|
|
||||||
{
|
|
||||||
'match': '\\b(adc|and|asl|bit|clc|cld|cli|clv|cmp|cpx|cpy|dec|dex|dey|eor|inc|inx|iny|lda|ldx|ldy|lsr|nop|ora|pha|php|pla|plp|rol|ror|sbc|sec|sed|sei|sta|stx|sty|tax|txa|tay|tya|tsx|txs)\\b'
|
|
||||||
'name': 'keyword'
|
|
||||||
}
|
|
||||||
{
|
|
||||||
'match': '\\b(bcc|bcs|beq|bmi|bne|bpl|brk|bvc|bvs|jmp|jsr|rti|rts)\\b'
|
|
||||||
'name': 'keyword.control'
|
|
||||||
}
|
|
||||||
{
|
|
||||||
'captures':
|
|
||||||
'1':
|
|
||||||
'name': 'punctuation.definition.comment'
|
|
||||||
'match': '(;).*$\\n?'
|
|
||||||
'name': 'comment.line.semicolon'
|
|
||||||
}
|
|
||||||
{
|
|
||||||
'match': '\\b(SET|WORD|BYTE|HEX)\\b'
|
|
||||||
'name': 'storage.type'
|
|
||||||
}
|
|
||||||
{
|
|
||||||
'match': '\\b(ALIGN)\\b'
|
|
||||||
'name': 'storage.modifier'
|
|
||||||
}
|
|
||||||
{
|
|
||||||
'match': '\\b(REPEAT|REPEND|MAC|ENDM|SUBROUTINE)\\b'
|
|
||||||
'name': 'support.function'
|
|
||||||
}
|
|
||||||
{
|
|
||||||
'match': '\\b(processor|org)\\b'
|
|
||||||
'name': 'constant.language'
|
|
||||||
}
|
|
||||||
{
|
|
||||||
'begin': '"'
|
|
||||||
'end': '"'
|
|
||||||
'name': 'string.quoted.double.untitled'
|
|
||||||
'patterns': [
|
|
||||||
{
|
|
||||||
'match': '\\\\.'
|
|
||||||
'name': 'constant.character.escape.untitled'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
{
|
|
||||||
'match': '^[A-Za-z_][A-Za-z0-9_]*'
|
|
||||||
'name': 'entity.name.label'
|
|
||||||
}
|
|
||||||
{
|
|
||||||
'match': '^\\.[A-Za-z_][A-Za-z0-9_]*'
|
|
||||||
'name': 'entity.name.label.local'
|
|
||||||
}
|
|
||||||
{
|
|
||||||
'match': '#?\\$[0-9a-fA-F]+'
|
|
||||||
'name': 'constant.numeric.hex'
|
|
||||||
}
|
|
||||||
{
|
|
||||||
'match': '{[0-9]+}'
|
|
||||||
'name': 'variable.parameter.macro'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
'scopeName': 'source.assembly.6502.dasm'
|
|
|
@ -23,13 +23,3 @@ repository:
|
||||||
name: 'keyword.mnemonic.6502.6502-opcodes'
|
name: 'keyword.mnemonic.6502.6502-opcodes'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
# 'M65816':
|
|
||||||
# 'match': '\\b(?i:BRL|COP|JML|JSL|MVN|MVP|PEA|PEI|PER|PHB|PHD|PHK|PLB|PLD|REP|RTL|SEP|TCD|TCS|TDC|TSC|TXY|TYX|WDM|XBA|XCE)\\b'
|
|
||||||
# 'name': 'keyword.mnemonic.65816'
|
|
||||||
# 'M65816_alias':
|
|
||||||
# 'match': '\\b(?i:BGE|BLT|CPA|DEA|INA|SWA|TAD|TAS|TDA|TSA)\\b'
|
|
||||||
# 'name': 'keyword.mnemonic.65816_alias'
|
|
||||||
# 'M65C02':
|
|
||||||
# 'match': '\\b(?i:BRA|PHX|PHY|PLX|PLY|STP|STZ|TRB|TSB|WAI)\\b'
|
|
||||||
# 'name': 'keyword.mnemonic.65c02'
|
|
||||||
# 'scopeName': 'source.assembly.6502'
|
|
||||||
|
|
|
@ -3,15 +3,7 @@
|
||||||
scopeName: 'source.cc65-directives'
|
scopeName: 'source.cc65-directives'
|
||||||
|
|
||||||
patterns: [
|
patterns: [
|
||||||
# # The 65c02 instruction set
|
# comments
|
||||||
# {
|
|
||||||
# include: 'source.65c02-opcodes'
|
|
||||||
# }
|
|
||||||
# # Include the 6502ex op codes
|
|
||||||
# {
|
|
||||||
# include: 'source.6502x-opcodes'
|
|
||||||
# }
|
|
||||||
# The cc65 toolchain considers everything after a semicolon(;) as comment
|
|
||||||
{
|
{
|
||||||
include: '#comments'
|
include: '#comments'
|
||||||
}
|
}
|
||||||
|
@ -52,7 +44,7 @@ repository:
|
||||||
name: 'punctuation.definition.string.end.cc65-directives'
|
name: 'punctuation.definition.string.end.cc65-directives'
|
||||||
name: 'string.quoted.double.assembly.cc65-directives'
|
name: 'string.quoted.double.assembly.cc65-directives'
|
||||||
}
|
}
|
||||||
# absolut addressing/numbering
|
# absolut address/number
|
||||||
{
|
{
|
||||||
match: '\\#(\'.\'|[^\\s\']+)'
|
match: '\\#(\'.\'|[^\\s\']+)'
|
||||||
name: 'constant.numeric.hex.cc65-directives'
|
name: 'constant.numeric.hex.cc65-directives'
|
||||||
|
|
116
grammars/dasm.cson
Normal file
116
grammars/dasm.cson
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
# Syntax Highlighting for 6502 programming with DASM
|
||||||
|
# Improvements: absolut addresses/numbers, equ, seg, ds, word
|
||||||
|
# Not working: labels
|
||||||
|
|
||||||
|
scopeName: 'source.dasm-6502' # Prevents conflicts with other architectures supported by dasm
|
||||||
|
name: '6502 Assembly (DASM)' # Name shown in Atom Editor grammar selection'fileTypes': []
|
||||||
|
foldingStartMarker: '/\\*\\*|\\{\\s*$'
|
||||||
|
foldingStopMarker: '\\*\\*/|^\\s*\\}'
|
||||||
|
# File extensions associated with this grammar
|
||||||
|
fileTypes: []
|
||||||
|
# include all opcodes and directives the toolchain supports
|
||||||
|
patterns: [
|
||||||
|
{ include: 'source.6502-opcodes' } # include basic 6502 instruction set
|
||||||
|
{ include: '#comments' }
|
||||||
|
{ include: '#directives' }
|
||||||
|
{ include: '#symbols' }
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Repository starts here ------------------------------------------------------
|
||||||
|
repository:
|
||||||
|
|
||||||
|
# comments
|
||||||
|
comments:
|
||||||
|
patterns: [
|
||||||
|
# semicolon comments
|
||||||
|
{
|
||||||
|
# captures:
|
||||||
|
# 1:
|
||||||
|
# name: 'punctuation.definition.comment'
|
||||||
|
match: '(;).*$\\n?'
|
||||||
|
name: 'comment.line.semicolon.dasm-6502'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
# symbols
|
||||||
|
symbols:
|
||||||
|
patterns: [
|
||||||
|
# strings
|
||||||
|
{
|
||||||
|
begin: '"'
|
||||||
|
end: '"'
|
||||||
|
name: 'string.quoted.double.untitled.dasm-6502'
|
||||||
|
patterns: [
|
||||||
|
{
|
||||||
|
match: '\\\\.'
|
||||||
|
name: 'constant.character.escape.untitled.dasm-6502'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
# labels
|
||||||
|
{
|
||||||
|
match: '^[A-Za-z_][A-Za-z0-9_]*'
|
||||||
|
name: 'entity.name.label.dasm-6502'
|
||||||
|
}
|
||||||
|
# local labels
|
||||||
|
{
|
||||||
|
match: '^\\.[A-Za-z_][A-Za-z0-9_]*'
|
||||||
|
name: 'entity.name.label.local.dasm-6502'
|
||||||
|
}
|
||||||
|
# absolut address/number
|
||||||
|
{
|
||||||
|
match: '\\#(\'.\'|[^\\s\']+)'
|
||||||
|
name: 'constant.numeric.hex.cc65-directives'
|
||||||
|
}
|
||||||
|
# binary numbers
|
||||||
|
{
|
||||||
|
match: '%[01]+'
|
||||||
|
name: 'constant.numeric.binary.dasm-6502'
|
||||||
|
}
|
||||||
|
# decimal numbers
|
||||||
|
{
|
||||||
|
match: '\\b([0-9]+)\\b'
|
||||||
|
name: 'constant.numeric.decimal.dasm-6502'
|
||||||
|
}
|
||||||
|
# hex numbers
|
||||||
|
{
|
||||||
|
match: '\\$[0-9a-fA-F]+'
|
||||||
|
name: 'constant.numeric.hex.dasm-6502'
|
||||||
|
}
|
||||||
|
# macro parameters
|
||||||
|
{
|
||||||
|
match: '{[0-9]+}'
|
||||||
|
name: 'variable.parameter.macro.dasm-6502'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
#
|
||||||
|
# assembler directives
|
||||||
|
directives:
|
||||||
|
patterns: [
|
||||||
|
# data directives
|
||||||
|
{
|
||||||
|
match: '\\b(?i:SET|WORD|.?BYTE|HEX|DS|.?WORD)\\b'
|
||||||
|
name: 'storage.type.dasm-6502'
|
||||||
|
}
|
||||||
|
# linker directives
|
||||||
|
{
|
||||||
|
match: '\\b(?i:ALIGN)\\b'
|
||||||
|
name: 'storage.modifier.dasm-6502'
|
||||||
|
}
|
||||||
|
# subroutines and macros
|
||||||
|
{
|
||||||
|
match: '\\b(?i:REPEAT|REPEND|MAC|ENDM|SUBROUTINE|INCLUDE)\\b'
|
||||||
|
name: 'support.function.dasm-6502'
|
||||||
|
}
|
||||||
|
# processor and org
|
||||||
|
{
|
||||||
|
match: '\\b(?i:processor|org)\\b'
|
||||||
|
name: 'constant.language.dasm-6502'
|
||||||
|
}
|
||||||
|
# pseudo opcodes
|
||||||
|
{
|
||||||
|
match: '\\b(?i:equ|seg(\\.u)?)\\b'
|
||||||
|
name: 'support.function.pseudo.dasm-6502'
|
||||||
|
}
|
||||||
|
]
|
Loading…
Reference in New Issue
Block a user