Add generic 65816 and 6502 grammars

This commit is contained in:
Georg Ziegler 2018-06-03 04:12:44 +02:00
parent bbc826f2cd
commit 356800f90e
10 changed files with 174 additions and 78 deletions

View File

@ -1,42 +0,0 @@
'fileTypes': []
'name': '65816 Assembly'
'patterns': [
{
'include': '#M6502'
}
{
'include': '#M65C02'
}
{
'include': '#M65816L'
}
{
'include': '#M65816'
}
]
'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'

View File

@ -0,0 +1,65 @@
# Generic 65816 grammar with semicolon comments
scopeName: 'source.assembly.65816.65816-generic'
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: '#comments' }
{ include: '#symbols' }
]
# Repository starts here ------------------------------------------------------
repository:
# comments
comments:
patterns: [
# semicolon comments
{
match: ';.*$'
name: 'comment.line.semicolon.65816-generic'
}
]
# symbols
symbols:
patterns: [
{
begin: '"'
beginCaptures:
0:
name: 'punctuation.definition.string.begin.65816-generic'
end: '"'
endCaptures:
0:
name: 'punctuation.definition.string.end.65816-generic'
name: 'string.quoted.double.assembly.65816-generic'
}
# absolut address/number
{
match: '\\#(\'.\'|[^\\s\']+)'
name: 'constant.numeric.hex.65816-generic'
}
# hex, prefixed with ampersand($)
{
match: '-?\\$[A-Fa-f0-9]+'
name: 'constant.numeric.hex.65816-generic'
}
# hex, suffixed with h(h)
{
match: '-?([0-9]+)h'
name: 'constant.numeric.hex.65816-generic'
}
# binary
{
match: '%[01]+'
name: 'constant.numeric.binary.65816-generic'
}
# decimal
{
match: '\\b([0-9]+)\\b'
name: 'constant.numeric.decimal.65816-generic'
}
]

View File

@ -0,0 +1,23 @@
# Pseudo opcodes for the 65816 used by some assemblers
scopeName: 'source.65816l-opcodes'
patterns: [
# The 65816 instruction set
{
include: '#mnemonics-65816l'
}
]
# Respository starts here -----------------------------------------------------
repository:
# 65816 instruction set
'mnemonics-65816l':
patterns: [
# mnemonics
{
match: '\\b(?i:ADCL|ANDL|CMPL|EORL|LDAL|ORAL|SBCL|STAL)\\b'
name: 'keyword.mnemonic.65816.65816l-opcodes'
}
]

View File

@ -0,0 +1,65 @@
# Generic 65C02 grammar with semicolon comments
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.6502x-opcodes' }
{ include: '#comments' }
{ include: '#symbols' }
]
# Repository starts here ------------------------------------------------------
repository:
# comments
comments:
patterns: [
# semicolon comments
{
match: ';.*$'
name: 'comment.line.semicolon.65c02-generic'
}
]
# symbols
symbols:
patterns: [
{
begin: '"'
beginCaptures:
0:
name: 'punctuation.definition.string.begin.65c02-generic'
end: '"'
endCaptures:
0:
name: 'punctuation.definition.string.end.65c02-generic'
name: 'string.quoted.double.assembly.65c02-generic'
}
# absolut address/number
{
match: '\\#(\'.\'|[^\\s\']+)'
name: 'constant.numeric.hex.65c02-generic'
}
# hex, prefixed with ampersand($)
{
match: '-?\\$[A-Fa-f0-9]+'
name: 'constant.numeric.hex.65c02-generic'
}
# hex, suffixed with h(h)
{
match: '-?([0-9]+)h'
name: 'constant.numeric.hex.65c02-generic'
}
# binary
{
match: '%[01]+'
name: 'constant.numeric.binary.65c02-generic'
}
# decimal
{
match: '\\b([0-9]+)\\b'
name: 'constant.numeric.decimal.65c02-generic'
}
]

View File

@ -1,13 +1,14 @@
# Syntax Highlighting for the cc65 toolchain and 65816 support
scopeName: 'source.cc65-816-toolchain'
scopeName: 'source.assembly.cc65-816-toolchain'
name: '65816 Assembly (cc65)' # Name shown in Atom Editor grammar selection
# File extensions associated with this grammar
fileTypes: [
's'
]
# include all opcodes and directives the toolchain supports
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
{ 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
]

View File

@ -3,17 +3,9 @@
scopeName: 'source.cc65-directives'
patterns: [
{
include: '#comments'
}
# symbols, constants, numbers
{
include: '#symbols'
}
# directives
{
include: '#directives'
}
{ include: '#comments' } # comments
{ include: '#symbols' } # symbols, constants, numbers
{ include: '#directives' } # cc65 assembler directives
]
# Repository starts here ------------------------------------------------------

View File

@ -1,6 +1,6 @@
# Syntax Highlighting for the cc65 toolchain ans 6502 support
scopeName: 'source.cc65-toolchain'
scopeName: 'source.assembly.cc65-toolchain'
name: '6502 Assembly (cc65)' # Name shown in Atom Editor grammar selection
# File extensions associated with this grammar
fileTypes: [
@ -8,7 +8,7 @@ fileTypes: [
]
# include all opcodes and directives the toolchain supports
patterns: [
{ 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
{ 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
]

View File

@ -1,6 +1,6 @@
# Syntax Highlighting for the Western Design Center toolchain and 65816 support
scopeName: 'source.wdc816-toolchain'
scopeName: 'source.wdc-816-toolchain'
name: '65816 Assembly (WDCTools)' # Name shown in Atom Editor grammar selection
# File extensions associated with this grammar
fileTypes: [
@ -8,7 +8,7 @@ fileTypes: [
]
# include all opcodes and directives the toolchain supports
patterns: [
{ include: 'source.65816-opcodes' } # the 65c02 opcodes, includes the basic 65c02 instruction set
{ include: 'source.65816-aliases' } # Opcode aliases for the 65816
{ include: 'source.wdc-directives' } # include the directives of the WDCxAS assemblers
{ include: 'source.65816-opcodes' } # the 65c02 opcodes, includes the basic 65c02 instruction set
{ include: 'source.65816-aliases' } # Opcode aliases for the 65816
{ include: 'source.wdc-directives' } # include the directives of the WDCxAS assemblers
]

View File

@ -3,17 +3,9 @@
scopeName: 'source.wdc-directives'
patterns: [
{
include: '#comments'
}
# symbols, constants, numbers
{
include: '#symbols'
}
# directives
{
include: '#directives'
}
{ include: '#comments' }
{ include: '#symbols' } # symbols, constants, numbers
{ include: '#directives' }
]
# Repository starts here ------------------------------------------------------

View File

@ -9,6 +9,6 @@ fileTypes: [
]
# include all opcodes and directives the toolchain supports
patterns: [
{ include: 'source.65c02-opcodes' } # the 65c02 opcodes, includes the basic 6502 instruction set
{ include: 'source.wdc-directives' } # include the directives of the WDCxAS assemblers
{ include: 'source.65c02-opcodes' } # the 65c02 opcodes, includes the basic 6502 instruction set
{ include: 'source.wdc-directives' } # include the directives of the WDCxAS assemblers
]