mirror of
https://github.com/MatthewCallis/language-65asm.git
synced 2025-02-19 17:30:47 +00:00
Rework cc65 support
This commit is contained in:
parent
6de1c1dfed
commit
bca192fbc7
@ -13,12 +13,12 @@ patterns: [
|
||||
# Respository starts here -----------------------------------------------------
|
||||
repository:
|
||||
|
||||
# 6502 pseudo op codes
|
||||
# 6502x pseudo opcodes
|
||||
'mnemonics-6502x':
|
||||
patterns: [
|
||||
# mnemonics
|
||||
{
|
||||
match: '\\b(?i:ALR|ANC|ARR|AXS|DCP|ISC|LAS|LAX|RLA|RRA|SAX|SLO|SRE)\\b'
|
||||
name: 'keyword.mnemonic.6502.6502x-opcodes'
|
||||
name: 'keyword.mnemonic.6502x.6502x-opcodes'
|
||||
}
|
||||
]
|
||||
|
23
grammars/65816-aliases.cson
Normal file
23
grammars/65816-aliases.cson
Normal file
@ -0,0 +1,23 @@
|
||||
# Aliases for certain opcodes used by many assemblers
|
||||
|
||||
scopeName: 'source.65816-aliases'
|
||||
|
||||
patterns: [
|
||||
# The 65816 instruction set aliases
|
||||
{
|
||||
include: '#mnemonics-65816-aliases'
|
||||
}
|
||||
]
|
||||
|
||||
# Respository starts here -----------------------------------------------------
|
||||
repository:
|
||||
|
||||
# 65816 instruction set aliases
|
||||
'mnemonics-65816-aliases':
|
||||
patterns: [
|
||||
# mnemonics
|
||||
{
|
||||
match: '\\b(?i:BGE|BLT|CPA|DEA|INA|SWA|TAD|TAS|TDA|TSA)\\b'
|
||||
name: 'keyword.mnemonic.65816.65816-aliases'
|
||||
}
|
||||
]
|
@ -1,5 +1,5 @@
|
||||
# Extends the basic 6502 instruction set with the 65c02 op codes
|
||||
# NOTE: rmb, bbr, smb, bbs not supported yet
|
||||
# Extends the basic 6502 instruction set with the 65c02 opcodes
|
||||
# NOTE: rmb, bbr, smb, bbs not supported
|
||||
|
||||
scopeName: 'source.65c02-opcodes'
|
||||
|
||||
@ -8,7 +8,7 @@ patterns: [
|
||||
{
|
||||
include: 'source.6502-opcodes'
|
||||
}
|
||||
# The added 65c02 op codes
|
||||
# The added 65c02 opcodes
|
||||
{
|
||||
include: '#mnemonics-65c02'
|
||||
}
|
||||
@ -17,7 +17,7 @@ patterns: [
|
||||
# Respository starts here -----------------------------------------------------
|
||||
repository:
|
||||
|
||||
# basic 6502 instruction set
|
||||
# 65c02 instruction set extension
|
||||
'mnemonics-65c02':
|
||||
patterns: [
|
||||
# mnemonics
|
||||
|
13
grammars/cc65-816-toolchain.cson
Normal file
13
grammars/cc65-816-toolchain.cson
Normal file
@ -0,0 +1,13 @@
|
||||
# Syntax Highlighting for the cc65 toolchain and 65816 support
|
||||
|
||||
scopeName: 'source.cc65-816-toolchain'
|
||||
name: '65816 Assembly (cc65)' # Name shown in Atom Editor grammar selection
|
||||
# File extensions associated with this grammar
|
||||
fileTypes: [
|
||||
's'
|
||||
]
|
||||
patterns: [
|
||||
{ include: 'source.65816-opcodes' } # add basic 65816 instruction set, includes 6502 and 65c02 opcodes
|
||||
{ include: 'source.6502x-opcodes' } # extend with 6502X opcodes
|
||||
{ include: 'source.cc65-directives' } # include the directives for the cc65 toolchain
|
||||
]
|
135
grammars/cc65-directives.cson
Normal file
135
grammars/cc65-directives.cson
Normal file
@ -0,0 +1,135 @@
|
||||
# Syntax Highlighting for the cc65 toolchain directives
|
||||
|
||||
scopeName: 'source.cc65-directives'
|
||||
|
||||
patterns: [
|
||||
# # The 65c02 instruction set
|
||||
# {
|
||||
# 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'
|
||||
}
|
||||
# symbols, constants, numbers
|
||||
{
|
||||
include: '#symbols'
|
||||
}
|
||||
# directives
|
||||
{
|
||||
include: '#directives'
|
||||
}
|
||||
]
|
||||
|
||||
# Repository starts here ------------------------------------------------------
|
||||
repository:
|
||||
|
||||
# comments
|
||||
comments:
|
||||
patterns: [
|
||||
# semicolon comments
|
||||
{
|
||||
match: ';.*$'
|
||||
name: 'comment.line.semicolon.cc65-directives'
|
||||
}
|
||||
]
|
||||
|
||||
# symbols
|
||||
symbols:
|
||||
patterns: [
|
||||
{
|
||||
begin: '"'
|
||||
beginCaptures:
|
||||
0:
|
||||
name: 'punctuation.definition.string.begin.cc65-directives'
|
||||
end: '"'
|
||||
endCaptures:
|
||||
0:
|
||||
name: 'punctuation.definition.string.end.cc65-directives'
|
||||
name: 'string.quoted.double.assembly.cc65-directives'
|
||||
}
|
||||
# absolut addressing/numbering
|
||||
{
|
||||
match: '\\#(\'.\'|[^\\s\']+)'
|
||||
name: 'constant.numeric.hex.cc65-directives'
|
||||
}
|
||||
# hex, prefixed with ampersand($)
|
||||
{
|
||||
match: '-?\\$[A-Fa-f0-9]+'
|
||||
name: 'constant.numeric.hex.cc65-directives'
|
||||
}
|
||||
# hex, suffixed with h(h)
|
||||
{
|
||||
match: '-?([0-9]+)h'
|
||||
name: 'constant.numeric.hex.cc65-directives'
|
||||
}
|
||||
# binary
|
||||
{
|
||||
match: '%[01]+'
|
||||
name: 'constant.numeric.binary.cc65-directives'
|
||||
}
|
||||
# decimal
|
||||
{
|
||||
match: '\\b([0-9]+)\\b'
|
||||
name: 'constant.numeric.decimal.cc65-directives'
|
||||
}
|
||||
]
|
||||
|
||||
# assembler directives
|
||||
directives:
|
||||
patterns: [
|
||||
# ca65 pseudo variables
|
||||
{
|
||||
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'
|
||||
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'
|
||||
}
|
||||
# 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'
|
||||
}
|
||||
# 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'
|
||||
}
|
||||
# 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'
|
||||
}
|
||||
# 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'
|
||||
}
|
||||
# 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'
|
||||
}
|
||||
# Operators
|
||||
{
|
||||
match: '!|&|&&|\\^|\\*|\\/|\\-|\\+|~|=|<=|>=|<<|>>|<>|<|>|\\||\\|\\|'
|
||||
name: 'keyword.operator.cc65-directives'
|
||||
}
|
||||
# Operators II
|
||||
{
|
||||
match: '(\\.)\\b(?i:and|(bit)?(and|not|or|xor)|mod|shl|shr)\\b'
|
||||
name: 'keyword.operator.cc65-directives'
|
||||
}
|
||||
]
|
@ -1,139 +1,14 @@
|
||||
# Syntax Highlighting for the cc65 toolchain
|
||||
# Syntax Highlighting for the cc65 toolchain ans 6502 support
|
||||
|
||||
scopeName: 'source.cc65-toolchain'
|
||||
name: '6502 Assembly (cc65)' # Name shown in Atom Editor grammar selection
|
||||
# File extensions associated with this package
|
||||
# File extensions associated with this grammar
|
||||
fileTypes: [
|
||||
's'
|
||||
]
|
||||
# include all opcodes and directives the toolchain supports
|
||||
patterns: [
|
||||
# The 65c02 instruction set
|
||||
{
|
||||
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'
|
||||
}
|
||||
# symbols, constants, numbers
|
||||
{
|
||||
include: '#symbols'
|
||||
}
|
||||
# directives
|
||||
{
|
||||
include: '#directives'
|
||||
}
|
||||
{ include: 'source.65c02-opcodes' } # the 65c02 opcodes, includes the basic 6502 instruction set
|
||||
{ include: 'source.6502x-opcodes' } # extend with 6502X opcodes
|
||||
{ include: 'source.cc65-directives' } # include the directives for the cc65 toolchain
|
||||
]
|
||||
|
||||
# Repository starts here ------------------------------------------------------
|
||||
repository:
|
||||
|
||||
# comments
|
||||
comments:
|
||||
patterns: [
|
||||
# semicolon comments
|
||||
{
|
||||
match: ';.*$'
|
||||
name: 'comment.line.semicolon.cc65-toolchain'
|
||||
}
|
||||
]
|
||||
|
||||
# symbols
|
||||
symbols:
|
||||
patterns: [
|
||||
{
|
||||
begin: '"'
|
||||
beginCaptures:
|
||||
0:
|
||||
name: 'punctuation.definition.string.begin.cc65-toolchain'
|
||||
end: '"'
|
||||
endCaptures:
|
||||
0:
|
||||
name: 'punctuation.definition.string.end.cc65-toolchain'
|
||||
name: 'string.quoted.double.assembly.cc65-toolchain'
|
||||
}
|
||||
# absolut addressing/numbering
|
||||
{
|
||||
match: '\\#(\'.\'|[^\\s\']+)'
|
||||
name: 'constant.numeric.hex.cc65-toolchain'
|
||||
}
|
||||
# hex, prefixed with ampersand($)
|
||||
{
|
||||
match: '-?\\$[A-Fa-f0-9]+'
|
||||
name: 'constant.numeric.hex.cc65-toolchain'
|
||||
}
|
||||
# hex, suffixed with h(h)
|
||||
{
|
||||
match: '-?([0-9]+)h'
|
||||
name: 'constant.numeric.hex.cc65-toolchain'
|
||||
}
|
||||
# binary
|
||||
{
|
||||
match: '%[01]+'
|
||||
name: 'constant.numeric.binary.cc65-toolchain'
|
||||
}
|
||||
# decimal
|
||||
{
|
||||
match: '\\b([0-9]+)\\b'
|
||||
name: 'constant.numeric.decimal.cc65-toolchain'
|
||||
}
|
||||
]
|
||||
|
||||
# assembler directives
|
||||
directives:
|
||||
patterns: [
|
||||
# ca65 pseudo variables
|
||||
{
|
||||
match: '(\\.)?\\b(?i:\\*|asize|cpu|isize|paramcount|time|version)\\b'
|
||||
name: 'support.function.pseudo.cc65-toolchain'
|
||||
}
|
||||
# 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'
|
||||
name: 'support.function.pseudo.cc65-toolchain'
|
||||
}
|
||||
# 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-toolchain'
|
||||
}
|
||||
# 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-toolchain'
|
||||
}
|
||||
# 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-toolchain'
|
||||
}
|
||||
# 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-toolchain'
|
||||
}
|
||||
# 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-toolchain'
|
||||
}
|
||||
# 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-toolchain'
|
||||
}
|
||||
# Operators
|
||||
{
|
||||
match: '!|&|&&|\\^|\\*|\\/|\\-|\\+|~|=|<=|>=|<<|>>|<>|<|>|\\||\\|\\|'
|
||||
name: 'keyword.operator.cc65-toolchain'
|
||||
}
|
||||
# Operators II
|
||||
{
|
||||
match: '(\\.)\\b(?i:and|(bit)?(and|not|or|xor)|mod|shl|shr)\\b'
|
||||
name: 'keyword.operator.cc65-toolchain'
|
||||
}
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user