Merge pull request #10 from georgjz/master

Fix DASM and Merlin, add Asar, improve cc65
This commit is contained in:
Matthew Callis 2018-06-21 10:37:18 -07:00 committed by GitHub
commit a32c1f73a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 746 additions and 323 deletions

View File

@ -3,7 +3,8 @@
Adds syntax highlighting to 65816/65C816/65802/6502/65C02 files in Atom, with extra support for various compilers:
- [ACME Crossassembler](https://sourceforge.net/projects/acme-crossass/)
- [cc65 (SNES Syntax: 65816, SPC700, SuperFX)](http://oliverschmidt.github.io/cc65/)
- [Asar SNES Assembler](https://github.com/RPGHacker/asar)
- [cc65 (SNES Syntax: 65816, SPC700, SuperFX)](https://github.com/cc65/cc65)
- [DASM](http://dasm-dillon.sourceforge.net/) (6502)
- [EDASM](https://archive.org/details/EDASM-ProDOS_Assembler_Tools_Manual)
- [Merlin](http://en.wikipedia.org/wiki/Merlin_(assembler))

View File

@ -1,65 +1,112 @@
'fileTypes': []
'foldingStartMarker': '/\\*\\*|\\{\\s*$'
'foldingStopMarker': '\\*\\*/|^\\s*\\}'
'name': '6502 Assembly (DASM)'
'patterns': [
# Syntax highlighting for the DASM macro assembler
scopeName: 'source.assembly.6502.dasm'
fileTypes: []
name: '6502 Assembly (DASM)'
patterns: [
{ include: 'source.6502-opcodes' }
{ include: '#comments' }
{ include: '#symbols' }
{ include: '#directives' }
]
# Repository starts here ------------------------------------------------------
repository:
# comments
comments:
patterns: [
# semicolon comments
{
'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: ';.*$'
name: 'comment.line.semicolon.dasm'
}
]
}
# symbols
symbols:
patterns: [
# strings
{
'match': '^[A-Za-z_][A-Za-z0-9_]*'
'name': 'entity.name.label'
begin: '"'
beginCaptures:
0:
name: 'punctuation.definition.string.begin.dasm'
end: '"'
endCaptures:
0:
name: 'punctuation.definition.string.end.dasm'
name: 'string.quoted.double.dasm'
}
# global labels
{
'match': '^\\.[A-Za-z_][A-Za-z0-9_]*'
'name': 'entity.name.label.local'
captures:
1:
name: 'entity.name.function.label.dasm'
match: '\\b([A-Za-z0-9_]+):'
name: 'meta.function.label.dasm'
}
# local labels
{
'match': '#?\\$[0-9a-fA-F]+'
'name': 'constant.numeric.hex'
captures:
1:
name: 'entity.name.function.label.dasm'
match: '\\.\\b([A-Za-z0-9_]+):'
name: 'meta.function.label.dasm'
}
# absolut addressing/numbers
{
'match': '{[0-9]+}'
'name': 'variable.parameter.macro'
match: '\\#(\'.\'|[^\\s\']+)'
name: 'constant.numeric.hex.dasm'
}
# hex, prefixed with dollar sign($)
{
match: '-?\\$\\b[a-fA-F0-9]+\\b'
name: 'constant.numeric.hex.dasm'
}
# octal, prefixed with zero(0)
{
match: '-?\\b0[1-7]+\\b'
name: 'constant.numeric.octal.dasm'
}
# binary
{
match: '%[01]+'
name: 'constant.numeric.binary.65816-generic'
}
# decimal
{
match: '\\b([0-9]+)\\b'
name: 'constant.numeric.decimal.65816-generic'
}
]
# directives
directives:
patterns: [
# file and symbol control
{
match: '\\b(?i:seg(\\.u)?|include|incbin|incdir|hex|err|r?org|processor|echo|rend|align|subroutine)\\b'
name: 'support.function.pseudo.dasm'
}
# data control
{
match: '\\b(?i:d[csv](.bwl)?|hex|eq[um]|set|list\\s(on|off))\\b'
name: 'support.function.pseudo.dasm'
}
# data control II
{
match: '\\.\\b(?i:byte|word)\\b'
name: 'support.function.pseudo.dasm'
}
# Macro control
{
match: '\\b(?i:mac|endm|mexit)\\b'
name: 'support.function.pseudo.acme'
}
# Conditional control
{
match: '\\b(?i:ifn?const|if|else|e(nd)?if|repeat|repend)\\b'
name: 'keyword.control.conditional.acme'
}
]
'scopeName': 'source.assembly.6502.dasm'

View File

@ -5,7 +5,7 @@ fileTypes: []
name: '65816 Assembly'
patterns: [
{ include: 'source.65816-opcodes' } # add basic 65816 instruction set, includes 6502 and 65c02 opcodes
{ include: 'source.65816l-opcodes' } # extend with 6502X opcodes
{ include: 'source.65816l-opcodes' } # extend with 65816L opcodes
{ include: '#comments' }
{ include: '#symbols' }
]
@ -35,21 +35,21 @@ repository:
endCaptures:
0:
name: 'punctuation.definition.string.end.65816-generic'
name: 'string.quoted.double.assembly.65816-generic'
name: 'string.quoted.double.65816-generic'
}
# absolut address/number
{
match: '\\#(\'.\'|[^\\s\']+)'
name: 'constant.numeric.hex.65816-generic'
}
# hex, prefixed with ampersand($)
# hex, prefixed with dollar sign($)
{
match: '-?\\$[A-Fa-f0-9]+'
match: '-?\\$\\b[a-fA-F0-9]+\\b'
name: 'constant.numeric.hex.65816-generic'
}
# hex, suffixed with h(h)
{
match: '-?([0-9]+)h'
match: '-?([a-fA-F0-9]+)h'
name: 'constant.numeric.hex.65816-generic'
}
# binary

View File

@ -0,0 +1,23 @@
# Pseudo opcodes for the 65816 used by some assemblers
scopeName: 'source.65816alt-opcodes'
patterns: [
# The 65816 instruction set
{
include: '#mnemonics-65816alt'
}
]
# Respository starts here -----------------------------------------------------
repository:
# 65816 instruction set
'mnemonics-65816alt':
patterns: [
# mnemonics
{
match: '\\b(?i:tas|tsa|swa|tad|tda|blt|bge)\\b'
name: 'keyword.mnemonic.65816.65816alt-opcodes'
}
]

View File

@ -4,7 +4,7 @@ scopeName: 'source.assembly.6502.65c02-generic'
fileTypes: []
name: '6502 Assembly'
patterns: [
{ include: 'source.65c02-opcodes' } # add basic 65816 instruction set, includes 6502 and 65c02 opcodes
{ include: 'source.65c02-opcodes' } # include 6502 and 65c02 opcodes
{ include: 'source.6502x-opcodes' }
{ include: '#comments' }
{ include: '#symbols' }
@ -35,7 +35,7 @@ repository:
endCaptures:
0:
name: 'punctuation.definition.string.end.65c02-generic'
name: 'string.quoted.double.assembly.65c02-generic'
name: 'string.quoted.double.65c02-generic'
}
# absolut address/number
{
@ -44,12 +44,12 @@ repository:
}
# hex, prefixed with ampersand($)
{
match: '-?\\$[A-Fa-f0-9]+'
match: '-?\\$\\b[A-Fa-f0-9]+\\b'
name: 'constant.numeric.hex.65c02-generic'
}
# hex, suffixed with h(h)
{
match: '-?([0-9]+)h'
match: '-?([a-fA-F0-9]+)h'
name: 'constant.numeric.hex.65c02-generic'
}
# binary

View File

@ -43,7 +43,7 @@ repository:
endCaptures:
0:
name: 'punctuation.definition.string.end.acme'
name: 'string.quoted.double.assembly.acme'
name: 'string.quoted.double.acme'
}
# absolut addressing/numbering
{

198
grammars/asar.cson Normal file
View File

@ -0,0 +1,198 @@
# Adds Syntax highlighting for the Asar SNES Assembler
scopeName: 'source.assembly.65816.asar'
fileTypes: [
'asm'
]
name: 'Asar SNES Assembler'
patterns: [
{ include: 'source.65816-opcodes' }
{ include: 'source.65816l-opcodes' }
{ include: 'source.65816alt-opcodes' }
{ include: 'source.spc700-opcodes' }
{ include: 'source.superfx-opcodes' }
{ include: '#comments' }
{ include: '#symbols' }
{ include: '#directives' }
]
# Repository starts here ------------------------------------------------------
repository:
# comments
comments:
patterns: [
# semicolon line comment
{
match: ';.*$'
name: 'comment.line.semicolon.asar'
}
]
# symbols
symbols:
patterns: [
# delimited strings
{
begin: '"'
beginCaptures:
0: name: 'punctuation.definition.string.begin.asar'
end: '"'
endCaptures:
0: name: 'punctuation.definition.string.end.asar'
name: 'string.quoted.double.assembly.asar'
}
# labels
{
captures:
1: name: 'entity.name.function.label.asar'
2: name: 'entity.name.function.label.asar'
match: '(\\.*)\\b([A-Za-z0-9_]+):'
name: 'meta.label.asar'
}
# defines
{
captures:
1: name: 'keyword.operator.asar'
2: name: 'entity.name.function.label.asar'
match: '(!)\\b([A-Za-z0-9_]+)\\b'
name: 'meta.define.asar'
}
# absolut address/number
{
match: '\\#(\'.\'|[^\\s\']+)'
name: 'constant.numeric.hex.asar'
}
# hex, prefixed with ampersand($)
{
match: '-?\\$[A-Fa-f0-9]+'
name: 'constant.numeric.hex.asar'
}
# binary
{
match: '-?%[01]+'
name: 'constant.numeric.binary.asar'
}
# decimal
{
match: '-?\\b([0-9]+)\\b'
name: 'constant.numeric.decimal.asar'
}
]
# assembler directives
directives:
patterns: [
# arch command
{
captures:
1: name: 'support.function.pseudo.asar'
2: name: 'constant.language.asar'
match: '\\b(arch)\\s+(65816|spc700(-inline)?|superfx)'
name: 'meta.arch.directive.asar'
}
# warn xkas command
{
captures:
1: name: 'support.function.pseudo.asar'
2: name: 'support.function.pseudo.asar'
3: name: 'constant.language.asar'
match: '\\b(warn)\\s+(xkas)\\s+(on|off)\\b'
name: 'meta.warn.directive.asar'
}
# math command
{
captures:
1: name: 'support.function.pseudo.asar'
2: name: 'support.function.pseudo.asar'
3: name: 'constant.language.asar'
match: '\\b(math)\\s+(pri|round)\\s+(on|off)\\b'
name: 'meta.math.directive.asar'
}
# namespace command
{
begin: '\\b(namespace)\\b'
captures:
1:
name: 'support.function.pseudo.asar'
end: '$'
name: 'meta.namespace.directive.asar'
patterns: [
# nested
{
captures:
1: name: 'support.function.pseudo.asar'
2: name: 'constant.language.asar'
match: '\\b(nested)\\s+(on|off)\\b'
name: 'meta.namespace.nested.asar'
}
# off
{
match: '\\b(off)\\b'
name: 'constant.language.asar'
}
# identifier
{
match: '\\b[a-zA-Z0-9_]+\\b'
name: 'entity.name.function.label.asar'
}
]
}
# base command
{
captures:
1: name: 'support.function.pseudo.asar'
2: name: 'constant.language.asar'
match: '\\b(base)\\s+(off)*'
name: 'meta.base.directive.asar'
}
# bank command
{
captures:
1: name: 'support.function.pseudo.asar'
2: name: 'constant.language.asar'
match: '\\b(bank)\\s+(noassume|auto)*'
name: 'meta.bank.directive.asar'
}
# struct command
{
captures:
1: name: 'support.function.pseudo.asar'
2: name: 'entity.name.function.label.asar'
3: name: 'constant.numeric.hex.asar'
match: '\\b(struct)\\s+([a-zA-Z0-9_]+)\\s+(\\S+)\\b'
name: 'meta.struct.directive.asar'
}
# endstruct command
{
captures:
1: name: 'support.function.pseudo.asar'
2: name: 'support.function.pseudo.asar'
3: name: 'constant.numeric.decimal.asar'
match: '\\b(endstruct)\\s+(align)*\\s+(\\S+)*'
name: 'meta.struct.directive.asar'
}
# data control
{
match: '\\b(inc(bin|src)|(push|pull)(pc|base)|warnpc|skip|asar|org|rep|d[bdlw]|(ex)?(lo|hi)rom|(full)?sa1rom|(no|sfx)rom|function)\\b'
name: 'support.function.pseudo.asar'
}
# conditional control
{
match: '\\b((end)?if)\\b'
name: 'keyword.control.conditional.asar'
}
# macro control
# TODO: fix identifier
{
match: '\\b((end)?macro)\\b'
# name: 'support.function.pseudo.asar'
name: 'keyword.directive.macro.asar'
}
# operators
{
match: '[-+/*^><|#\\[\\]()=.!&]'
name: 'keyword.operator.asar'
}
# TODO: Add built-in functions
]

View File

@ -24,6 +24,7 @@ repository:
# symbols
symbols:
patterns: [
# strings
{
begin: '"'
beginCaptures:
@ -33,21 +34,21 @@ repository:
endCaptures:
0:
name: 'punctuation.definition.string.end.cc65-directives'
name: 'string.quoted.double.assembly.cc65-directives'
name: 'string.quoted.double.cc65-directives'
}
# absolut address/number
# absolut addressing/numbers
{
match: '\\#(\'.\'|[^\\s\']+)'
name: 'constant.numeric.hex.cc65-directives'
}
# hex, prefixed with ampersand($)
# hex, prefixed with dollar sign($)
{
match: '-?\\$[A-Fa-f0-9]+'
match: '-?\\$\\b[a-fA-F0-9]+\\b'
name: 'constant.numeric.hex.cc65-directives'
}
# hex, suffixed with h(h)
{
match: '-?([0-9]+)h'
match: '-?\\b([a-fA-F0-9]+)h\\b'
name: 'constant.numeric.hex.cc65-directives'
}
# binary
@ -67,43 +68,48 @@ repository:
patterns: [
# ca65 pseudo variables
{
match: '(\\.)?\\b(?i:\\*|asize|cpu|isize|paramcount|time|version)\\b'
match: '(\\.)\\b(?i:\\*|asize|cpu|isize|paramcount|time|version)\\b'
name: 'support.function.pseudo.cc65-directives'
}
# ca65 pseudo functions
{
match: '(\\.)?\\b(?i:addrsize|bank(byte)?|blank|con(cat|st)|(hi|lo)(byte|word)|ident|left|x?match|max|mi[dn]|ref(erenced)?|right|sizeof|strat|sprintf|str(ing|len)|tcount)\\b'
match: '(\\.)\\b(?i:addrsize|bank(byte)?|blank|con(cat|st)|(hi|lo)(byte|word)|ident|left|x?match|max|mi[dn]|ref(erenced)?|right|sizeof|strat|sprintf|str(ing|len)|tcount)\\b'
name: 'support.function.pseudo.cc65-directives'
}
# ca65 control commands, A through C
{
match: '(\\.)?\\b(?i:a(8|16)|addr|align|asciiz|assert|autoimport|(bank|hi)bytes|bss|byte?|case|charmap|code|condes|(con|de)structor)\\b'
name: 'storage.modifier.cc65-directives'
match: '(\\.)\\b(?i:a(8|16)|addr|align|asciiz|assert|autoimport|(bank|hi)bytes|bss|byte?|case|charmap|code|condes|(con|de)structor)\\b'
name: 'support.function.pseudo.cc65-directives'
}
# ca65 control commands, D and E
{
match: '(\\.)?\\b(?i:data|dbyt|debuginfo|define|delmac(ro)?|def(ined(macro)?)?|dword|else(if)?|end(enum)?|end(enum|if|proc|rep(eat)?|scope|struct|union)?|endmac(ro)?|enum|error|exitmac(ro)?|export(zp)?)\\b'
name: 'storage.modifier.cc65-directives'
match: '(\\.)\\b(?i:data|dbyt|debuginfo|define|delmac(ro)?|def(ined(macro)?)?|dword|else(if)?|end(enum)?|end(enum|if|proc|rep(eat)?|scope|struct|union)?|endmac(ro)?|enum|error|exitmac(ro)?|export(zp)?)\\b'
name: 'support.function.pseudo.cc65-directives'
}
# ca65 control commands, F through I
{
match: '(\\.)?\\b(?i:faraddr|fatal|feature|f(ile)?opt|forceimport|global(zp)?|i(8|16)|if((n)?blank|const|(n)?def|(n)?ref|p02|p4510|p816|p(s)?c02)?|import(zp)?|inc(bin|lude)|interruptor|ismnem(onic)?)\\b'
name: 'storage.modifier.cc65-directives'
match: '(\\.)\\b(?i:faraddr|fatal|feature|f(ile)?opt|forceimport|global(zp)?|i(8|16)|if((n)?blank|const|(n)?def|(n)?ref|p02|p4510|p816|p(s)?c02)?|import(zp)?|inc(bin|lude)|interruptor|ismnem(onic)?)\\b'
name: 'support.function.pseudo.cc65-directives'
}
# ca65 control commands, L through R
{
match: '(\\.)?\\b(?i:linecont|list(bytes)?|lobytes|local(char)?|macpack|mac(ro)?|org|out|p02|p4510|p816|pagelen(gth)?|pc02|pop(cpu|seg)|proc|psc02|push(cpu|seg)|reloc|repeat|res|rodata)\\b'
name: 'storage.modifier.cc65-directives'
match: '(\\.)\\b(?i:linecont|list(bytes)?|lobytes|local(char)?|macpack|mac(ro)?|org|out|p02|p4510|p816|pagelen(gth)?|pc02|pop(cpu|seg)|proc|psc02|push(cpu|seg)|reloc|repeat|res|rodata)\\b'
name: 'support.function.pseudo.cc65-directives'
}
# ca65 control commands, S through Z
{
match: '(\\.)?\\b(?i:scope|segment|set(cpu)?|smart|struct|tag|undef(ine)?|union|warning|word|zeropage)\\b'
name: 'storage.modifier.cc65-directives'
match: '(\\.)\\b(?i:scope|segment|set(cpu)?|smart|struct|tag|undef(ine)?|union|warning|word|zeropage)\\b'
name: 'support.function.pseudo.cc65-directives'
}
# CPU constants
{
match: '\\b(CPU_6502|CPU_65SC02|CPU_65C02|CPU_65816|CPU_SWEET16|CPU_HUC6280|CPU_ISET_6502|CPU_ISET_65SC02|CPU_ISET_65C02|CPU_ISET_65816|CPU_ISET_SWEET16|CPU_ISET_HUC6280|__APPLE2__|__APPLE2ENH__|__ATARI__|__ATARIXL__|__ATMOS__|__BBC__|__C128__|__C16__|__C64__|__CBM__|__CBM510__|__CBM610__|__GEOS__|__GEOS_APPLE__|__GEOS_CBM__|__LUNIX__|__LYNX__|__NES__|__PET__|__PLUS4__|__SIM6502__|__SIM65C02__|__SUPERVISION__|__VIC20__)\\b'
name: 'constant.other.cc65-directives'
match: '\\b(CPU_6502|CPU_65SC02|CPU_65C02|CPU_65816|CPU_SWEET16|CPU_HUC6280|CPU_ISET_6502|CPU_ISET_65SC02|CPU_ISET_65C02|CPU_ISET_65816|CPU_ISET_SWEET16|CPU_ISET_HUC6280|__APPLE2__|__APPLE2ENH__|__ATARI__|__ATARIXL__|__ATMOS__|__BBC__|__C128__|__C16__|__C64__|__CBM__|__CBM510__|__CBM610__|__GEOS__|__GEOS_APPLE__|__GEOS_CBM__|__LUNIX__|__LYNX__|__NES__|__PET__|__PLUS4__|__SIM6502__|__SIM65C02__|__SUPERVISION__|__VIC20__|VER_MAJOR|VER_MINOR)\\b'
name: 'constant.language.cc65-directives'
}
# address sizes, macpack packages
{
match: '\\b(?i:direct|zeropage|zp|absolute|abs|near|far|long|dword|atari|cbm|cpu|generic|longbranch)\\b'
name: 'constant.language.cc65-directives'
}
# Operators
{

View File

@ -0,0 +1,101 @@
# Syntax Highlighting for linker config files used with ld65 of the cc65 toolchain
scopeName: 'source.assembly.cc65-linker-config'
name: 'Linker Config File (cc65)' # Name shown in Atom Editor grammar selection
# File extensions associated with this grammar
fileTypes: [
'cfg'
'txt'
]
# include all directives and commands the toolchain supports
patterns: [
{ include: '#comments' }
{ include: '#symbols' }
]
# Repository starts here ------------------------------------------------------
repository:
# comments
comments:
patterns: [
# hash comments
{
match: '\\#.*$'
name: 'comment.line.cc65-linker-config'
}
]
# symbols
symbols:
patterns: [
# strings
{
begin: '"'
beginCaptures:
0:
name: 'punctuation.definition.string.begin.cc65-linker-config'
end: '"'
endCaptures:
0:
name: 'punctuation.definition.string.end.cc65-linker-config'
name: 'string.quoted.double.cc65-linker-config'
}
# hex, prefixed with dollar sign($)
{
match: '\\$\\b[a-fA-F0-9]+\\b'
name: 'constant.numeric.hex.cc65-linker-config'
}
# hex, suffixed with h(h)
{
match: '\\b([a-fA-F0-9]+)h\\b'
name: 'constant.numeric.hex.cc65-linker-config'
}
# binary
{
match: '%[01]+'
name: 'constant.numeric.binary.cc65-linker-config'
}
# decimal
{
match: '\\b([0-9]+)\\b'
name: 'constant.numeric.decimal.cc65-linker-config'
}
# areas
{
match: '\\b(?i:memory|segments|files|formats|features|symbols|once|lowcode|startup|zpsave)\\b'
name: 'storage.modifier.cc65-linker-config'
}
# labels
{
captures:
1: name: 'entity.name.function.label.cc65-linker-config'
match: '\\b([A-Za-z0-9_]+):'
name: 'meta.function.label.cc65-linker-config'
}
# attributes
{
match: '\\b(?i:load|type|define|start|size|fill|file|run|format|os|version|import|export|label|count|segment|order|default|addrsize|align)\\b'
name: 'storage.modifier.cc65-linker-config'
}
# linker constants
{
match: '\\b(__NAME_LOAD__|__NAME_RUN__|__NAME_SIZE__|__DATA_LOAD__|__DATA_RUN__|__DATA_SIZE__|__STACK_START__|__STACK_SIZE__|__STACK_LAST__|__STACK_FILEOFFS__)\\b'
name: 'constant.language.cc65-linker-config'
}
# address sizes, functions
{
match: '\\b(?i:direct|zeropage|zp|absolut|abs|near|far|long|dword|atari|cbm|cpu|generic|longbranch|yes|ro|rw|bss|weak)\\b'
name: 'constant.other.cc65-linker-config'
}
# case sensitive symbols
{
match: '(%\\bO|\\bo65)\\b'
name: 'constant.other.cc65-linker-config'
}
# operators
{
match: '='
name: 'keyword.operator.cc65-linker-config'
}
]

View File

@ -1,228 +1,217 @@
'fileTypes': []
'name': 'Merlin'
'patterns': [
scopeName: 'source.assembly.65816.merlin'
fileTypes: []
name: 'Merlin'
patterns: [
{ include: 'source.65c02-opcodes' }
{ include: 'source.65816-opcodes' }
{ include: 'source.65816l-opcodes' }
{ include: 'source.65816alt-opcodes' }
{ include: '#comments' }
{ include: '#symbols' }
{ include: '#directives' }
# registers
# TODO: fix registers
# {
# 'match': '(?<=,)([xXyYsS])\\b'
# 'name': 'variable.language.register'
# }
]
repository:
# comments
comments:
patterns: [
# asterisk line comment
{
'include': '#M6502'
match: '^[*].*'
name: 'comment.line.asterisk.merlin'
}
# semicolon line comment
{
'include': '#M65C02'
match: ';.*$'
name: 'comment.line.semicolon.merlin'
}
]
# symbols
symbols:
patterns: [
# delimited strings
{
'include': '#M65816'
begin: '[\'"]'
beginCaptures:
0: name: 'punctuation.definition.string.begin.merlin'
end: '[\'"]'
endCaptures:
0: name: 'punctuation.definition.string.end.merlin'
name: 'string.quoted.double.assembly.merlin'
}
# TODO: highlight strings with all valid delimiters
# {
# captures:
# 1: name: 'string.delimited.begin.merlin'
# 2: name: 'string.delimited.merlin'
# 3: name: 'string.delimited.end.merlin'
# match: '\\b(\\S)(.*?)(\\1)\\b'
# }
# TODO: fix label scopes
# Variables
{
'include': '#M65816L'
match: '^][:-~][0-~]+'
# name: 'variable.named.merlin'
name: 'entity.name.function.label.merlin'
}
# Local labels
{
'include': '#hex_number'
match: '^:[:-~][0-~]+'
name: 'entity.name.function.label.merlin'
}
# Global labels
{
'include': '#decimal_number'
match: '^[:-~][0-~]+'
name: 'entity.name.function.merlin'
}
# absolut address/number
{
'match': '%[01][01_]*'
'name': 'constant.numeric.binary'
match: '\\#(\'.\'|[^\\s\']+)'
name: 'constant.numeric.hex.merlin'
}
# hex, prefixed with ampersand($)
{
'match': '\\b(?i:TAS|TSA|SWA|TAD|TDA|BLT|BGE)\\b'
'name': 'keyword.mnemonic.65816.alt'
match: '-?\\$[A-Fa-f0-9]+'
name: 'constant.numeric.hex.merlin'
}
# octal, prefixed with @
{
'match': '(?<=,)([xXyYsS])\\b'
'name': 'variable.language.register'
match: '@([0-7]+)\\b'
name: 'constant.numeric.octal.merlin'
}
# binary
{
'begin': '"'
'end': '"'
'name': 'string.quoted.double'
match: '%[01]+'
name: 'constant.numeric.binary.merlin'
}
# decimal
{
'begin': '\''
'end': '\''
'name': 'string.quoted.single'
match: '\\b([0-9]+)\\b'
name: 'constant.numeric.decimal.merlin'
}
]
# assembler directives
directives:
patterns: [
# file control
{
'match': '^[*].*'
'name': 'comment.line'
match: '\\b(?i:equ|ext|ent|org|rel|obj|var|typ|end|dum|dend|ast|dat|lstdo|pag|ttl|skp|chk|err|kbd|lup|--\\^|mx|pau|sw|usr|xc)\\b'
name: 'keyword.directive.merlin'
}
# data control
{
'match': ';.*'
'name': 'comment.line'
match: '\\b(?i:da|dw|ddb|db|dfb|adr|adrl|ds)\\b'
name: 'support.function.pseudo.merlin'
}
# conditional control
{
'match': '^][0-~]*\\b'
'name': 'entity.name.label.variable'
match: '\\b(?i:do|else|if|fin)\\b'
name: 'keyword.control.conditional.merlin'
}
# macro control
{
'match': '^:[0-~]*\\b'
'name': 'entity.name.label.local'
match: '\\b(?i:mac)\\b|<<<'
name: 'support.function.pseudo.merlin'
# name: 'keyword.directive.macro.merlin'
}
# operators
{
'match': '^[:-~][0-~]*\\b'
'name': 'entity.name.function'
match: '[-+/*^><|#\\[\\](),=.!&]'
name: 'keyword.operator.merlin'
}
# disk commands
{
'captures':
'1':
'name': 'keyword.directive'
'2':
'name': 'string.quoted.other.path'
'comment': 'eg: KEEP pathname'
'match': '\\b((?i)DSK|PUT|USE|SAV)\\s+(\\S*)'
'name': 'meta.path.directive'
captures:
1: name: 'support.function.pseudo.merlin'
2: name: 'string.quoted.other.path.merlin'
match: '\\b((?i:dsk|put|use|sav))\\s+(\\S*)'
name: 'meta.disk.directive.merlin'
}
# cycle count
{
'captures':
'1':
'name': 'keyword.directive'
'2':
'name': 'constant.language'
'comment': 'eg: KEEP pathname'
'match': '\\b((?i)CYC)\\s+((?i)ON|OFF|AVE)\\b'
'name': 'meta.cyc.directive'
captures:
1: name: 'support.function.pseudo.merlin'
2: name: 'constant.language.merlin'
match: '\\b((?i:cyc))\\s+((?i:on|off|ave))\\b'
name: 'meta.cyc.directive.merlin'
}
# expand control
{
'captures':
'1':
'name': 'keyword.directive'
'2':
'name': 'constant.language'
'comment': 'eg: KEEP pathname'
'match': '\\b((?i)EXP)\\s+((?i)ON|OFF|ONLY)\\b'
'name': 'meta.exp.directive'
captures:
1: name: 'support.function.pseudo.merlin'
2: name: 'constant.language.merlin'
match: '\\b((?i:exp))\\s+((?i:on|off|only))\\b'
name: 'meta.exp.directive.merlin'
}
# list control
{
'captures':
'1':
'name': 'keyword.directive'
'2':
'name': 'constant.language'
'comment': 'eg: KEEP pathname'
'match': '\\b((?i)LST)\\s+((?i)ON|OFF|RTN)\\b'
'name': 'meta.lst.directive'
captures:
1: name: 'support.function.pseudo.merlin'
2: name: 'constant.language.merlin'
match: '\\b((?i:lst))\\s+((?i:off))\\b'
name: 'meta.exp.directive.merlin'
}
# truncation control
{
'captures':
'1':
'name': 'keyword.directive'
'2':
'name': 'constant.language'
'comment': 'eg: KEEP pathname'
'match': '\\b((?i)LST)\\s+((?i)OFF)\\b'
'name': 'meta.lstdo.directive'
captures:
1: name: 'support.function.pseudo.merlin'
2: name: 'constant.language.merlin'
match: '\\b((?i:tr))\\s+((?i:on|off|adr))\\b'
name: 'meta.tr.directive.merlin'
}
# string command
{
'captures':
'1':
'name': 'keyword.directive'
'2':
'name': 'constant.language'
'comment': 'eg: KEEP pathname'
'match': '\\b((?i)TR)\\s+((?i)ON|OFF|ADR)\\b'
'name': 'meta.tr.directive'
captures:
1: name: 'support.function.pseudo.merlin'
2: name: 'string.delimited.begin.merlin'
3: name: 'string.delimited.merlin'
4: name: 'string.delimited.end.merlin'
5: name: 'constant.numeric.hex.merlin'
match: '\\b((?i:asc|dci|inv|fls|str))\\s+(\\S)(.*?)(\\2|\\S),([a-fA-F0-9]+)?'
}
# reverse command
{
'captures':
'1':
'name': 'keyword.directive.string'
'2':
'name': 'string.delimited.begin'
'3':
'name': 'string.delimited'
'4':
'name': 'string.delimited.end'
'5':
'name': 'keyword.operator'
'6':
'name': 'constant.numeric.hexadecimal'
'comment': 'optional trailing hex data'
'match': '\\b((?i)ASC|DCI|INV|FLS|STR)\\s+(\\S)(.*?)(\\2|$)(,([0-9A-Fa-f]+))?'
'name': 'meta.string.delimited'
captures:
1: name: 'support.function.pseudo.merlin'
2: name: 'string.delimited.begin.merlin'
3: name: 'string.delimited.merlin'
4: name: 'string.delimited.end.merlin'
match: '\\b((?i:rev))\\s+(\\S)(.*?)(\\2|$)'
}
# hex command
{
'captures':
'1':
'name': 'keyword.directive.string'
'2':
'name': 'string.delimited.begin'
'3':
'name': 'string.delimited'
'4':
'name': 'string.delimited.end'
'match': '\\b((?i)REV)\\s+(\\S)(.*?)(\\2|$)'
'name': 'meta.string.delimited.rev'
begin: '\\b((?i:hex))\\b'
captures:
1:
name: 'support.function.pseudo.merlin'
end: '$'
name: 'meta.hex.directive.merlin'
patterns: [
# hex without $
{
match: '\\b[a-fA-F0-9]{1,2}\\b'
name: 'constant.numeric.hex.merlin'
}
# semicolon comments
{
'begin': '\\b((?i)HEX)\\b'
'captures':
'1':
'name': 'keyword.directive.data'
'comment': 'HEX has a list of hex bytes w/o the $'
'end': '$'
'name': 'meta.hex'
'patterns': [
{
'match': '\\b[0-9A-Fa-f]{1,2}\\b'
'name': 'constant.numeric.hex'
match: ';.*'
name: 'comment.line.semicolon.merlin'
}
# number check
{
'match': ';.*$'
'name': 'comment.line'
}
{
'match': ','
'name': 'keyword.operator'
}
{
'match': '\\S'
'name': 'invalid.illegal'
match: '(?!,)\\S'
name: 'invalid.illegal.merlin'
}
]
}
{
'match': '\\b(?i:DSK|EQU|EXT|ENT|ORG|REL|OBJ|PUT|USE|VAR|SAV|TYP|END|DUM|DEND|AST|CYC|DAT|EXP|LST|LSTDO|PAG|TTL|SKP|TR|CHK|ERR|KBD|LUP|--\\^|MX|PAU|SW|USR|XC)\\b'
'name': 'keyword.directive'
}
{
'match': '\\b(?i:DA|DW|DDB|DB|DFB|ADR|ADRL|HEX|DS|ASC|DCI|INV|FLS|REV|STR)\\b'
'name': 'keyword.directive.data'
}
{
'match': '\\b(?i:DO|ELSE|IF|FIN)\\b'
'name': 'keyword.control.conditional'
}
{
'match': '\\b(?i:MAC)\\b|<<<'
'name': 'keyword.directive.macro'
}
{
'match': '[-+/*^><|#\\[\\](),=.!&]'
'name': 'keyword.operator'
}
]
'repository':
'M6502':
'match': '\\b(?i:ADC|AND|ASL|BCC|BCS|BEQ|BIT|BMI|BNE|BPL|BRK|BVC|BVS|CLC|CLD|CLI|CLV|CMP|CPX|CPY|DEC|DEX|DEY|EOR|INC|INX|INY|JMP|JSR|LDA|LDX|LDY|LSR|NOP|ORA|PHA|PHP|PLA|PLP|ROL|ROR|RTI|RTS|SBC|SEC|SED|SEI|STA|STX|STY|TAX|TAY|TSX|TXA|TXS|TYA)\\b'
'name': 'keyword.mnemonic.6502'
'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'
'M65816L':
'match': '\\b(?i:ADCL|ANDL|CMPL|EORL|LDAL|ORAL|SBCL|STAL)\\b'
'name': 'keyword.mnemonic.65816.long'
'M65C02':
'match': '\\b(?i:BRA|PHX|PHY|PLX|PLY|STP|STZ|TRB|TSB|WAI)\\b'
'name': 'keyword.mnemonic.65c02'
'binary_number':
'match': '%[01]+'
'name': 'constant.numeric.binary'
'decimal_number':
'match': '\\b([0-9]+)\\b'
'name': 'constant.numeric.decimal'
'hex_number':
'match': '\\$[A-Fa-f0-9]+'
'name': 'constant.numeric.hex'
'octal_number':
'match': '@([0-7]+)\\b'
'name': 'constant.numeric.octal'
'scopeName': 'source.assembly.65816.merlin'

View File

@ -0,0 +1,29 @@
# Opcodes for the Sony SPC-700 audio processing unit used in the SNES
scopeName: 'source.spc700-opcodes'
patterns: [
# The SPC700 instruction set aliases
{
include: '#mnemonics-spc700'
}
]
# Respository starts here -----------------------------------------------------
repository:
# SPC700 instruction set
'mnemonics-spc700':
patterns: [
# mnemonics
{
match: '\\b(?i:ADC|ADDW|AND|AND1|ASL|BBC|BBS|BCC|BCS|BEQ|BMI|BNE|BPL|BVC|BVS|BRA|BRK|CALL|CBNE|CLR1|CLRC|CLRP|CLRV|CMP|CMPW|DAA|DAS|DBNZ|DEC|DECW|DI|DIV|EI|EOR|EOR1|INC|INCW|JMP|LSR|MOV|MOV1|MOVW|MUL|NOP|NOT1|NOTC|OR|OR1|PCALL|POP|PUSH|RET|RETI|ROL|ROR|SBC|SET1|SETC|SETP|SLEEP|STOP|SUBW|TCALL|TCLR1|TSET1|XCN)\\b'
name: 'keyword.mnemonic.spc700.spc700-opcodes'
}
# registers
{
match: '\\b(?i:F[0-9A-F]|SP|PC|PSW)\\b'
name: 'support.function.pseudo.spc700-opcodes'
# name: 'storage.other.register.spc700-opcodes'
}
]

View File

@ -0,0 +1,29 @@
# Opcodes for the SuperFX DSP used in some SNES cartridges
scopeName: 'source.superfx-opcodes'
patterns: [
# The SPC700 instruction set aliases
{
include: '#mnemonics-superfx'
}
]
# Respository starts here -----------------------------------------------------
repository:
# SuperFX instruction set
'mnemonics-superfx':
patterns: [
# mnemonics
{
match: '\\b(?i:ADD|ADC|ALT1|ALT2|ALT3|AND|ASR|BCC|BCS|BEQ|BGE|BIC|BLT|BMI|BNE|BPL|BRA|BVC|BVS|CACHE|CMODE|CMP|COLOR|DEC|DIV2|FMULT|FROM|GETB|GETBH|GETBL|GETBS|GETC|HIB|IBT|INC|IWT|JAL|JMP|LDB|LDW|LEA|LINK|LJMP|LM|LMS|LMULT|LOB|LOOP|LSR|MERGE|MOVE|MOVEB|MOVES|MOVEW|MULT|NOP|NOT|OR|PLOT|POP|PUSH|RAMB|RET|ROL|ROMB|ROR|RPIX|SBC|SBK|SEX|SM|SMS|STB|STOP|STW|SUB|SWAP|TO|UMULT|WITH|XOR)\\b'
name: 'keyword.mnemonic.superfx.superfx-opcodes'
}
# registers
{
match: '\\b(?i:R0|R1|R2|R3|R4|R5|R6|R7|R8|R9|R10|R11|R12|R13|R14|R15|SP|LR|PC|SFR|BRAMR|PBR|ROMBR|CFGR|SCBR|CLSR|SCMR|VCR|RAMBR|CBR)\\b'
name: 'support.function.pseudo.superfx-opcodes'
# name: 'storage.other.register.superfx-opcodes'
}
]

View File

@ -34,21 +34,21 @@ repository:
endCaptures:
0:
name: 'punctuation.definition.string.end.wdc-toolchain'
name: 'string.quoted.double.assembly.wdc-toolchain'
name: 'string.quoted.double.wdc-toolchain'
}
# absolut addressing/numbering
# absolut addressing/numbers
{
match: '\\#(\'.\'|[^\\s\']+)'
name: 'constant.numeric.hex.wdc-toolchain'
}
# hex, prefixed with ampersand($)
# hex, prefixed with dollar sign($)
{
match: '-?\\$[A-Fa-f0-9]+'
match: '-?\\$\\b[a-fA-F0-9]+\\b'
name: 'constant.numeric.hex.wdc-toolchain'
}
# hex, suffixed with h(h)
{
match: '-?([0-9]+)h'
match: '-?\\b([a-fA-F0-9]+)h'
name: 'constant.numeric.hex.wdc-toolchain'
}
# binary prefixed with %
@ -63,7 +63,7 @@ repository:
}
# octal and decimal
{
match: '\\b([0-9]+(d|o|q)?)\\b'
match: '\\b([0-9]+[doq]?)\\b'
name: 'constant.numeric.decimal.wdc-toolchain'
}
]
@ -73,7 +73,7 @@ repository:
patterns: [
# File and Symbol control
{
match: '\\b(?i:append|include|insert|end(s|mod)?|exit|module|section|org|origin|equ(al)?|gequ|defl|set|var|extern(al|s)?|xref|globals?|public|xdef|message|messg|efunc|incdebug)\\b'
match: '\\b(?i:append|include|insert|end(s|mod)?|exit|module|section|ref_only|org|origin|equ(al)?|gequ|defl|set|var|extern(al|s)?|xref|globals?|public|xdef|message|messg|efunc|incdebug)\\b'
name: 'support.function.pseudo.wdc-toolchain'
}
# Parsing control
@ -108,7 +108,7 @@ repository:
}
# Operators II
{
match: '\\b(?i:and|not|mod|sh[lr]|x?or|eq|u?[gl]t)\\b'
match: '\\.\\b(?i:and|not|mod|sh[lr]|x?or|eq|u?[gl]t)\\b\\.'
name: 'keyword.operator.wdc-toolchain'
}
]