Compare commits

...

13 Commits

Author SHA1 Message Date
Kelvin Sherlock
0466fe1791 update syntax 2023-07-22 16:19:10 -04:00
Kelvin Sherlock
e87d04edcc sn asm 2023-07-20 16:42:43 -04:00
Kelvin Sherlock
135b909b0d orca/m macgen: ! is a comment character 2023-05-15 19:35:27 -04:00
Kelvin Sherlock
5ceb1a3418 fix yaml 2022-09-13 16:54:11 -04:00
ksherlock
f85bd90adc
Merge pull request #1 from decrazyo/master
add ca65 predefined macro packages
2022-07-07 15:30:37 -04:00
decrazyo
4dda716df5 add ca65 predefined macro packages 2022-07-05 21:30:49 -05:00
Kelvin Sherlock
d2a2e53078 S-C Assembler 2021-07-29 17:59:57 -04:00
Kelvin Sherlock
f3fb502073 fix DCB 2021-07-29 17:59:31 -04:00
Kelvin Sherlock
a6f23cc030 local identifiers 2021-07-15 19:59:44 -04:00
Kelvin Sherlock
9c9afb75ef merlin linker - gequ 2021-04-09 00:23:49 -04:00
Kelvin Sherlock
c5f707686d add some missing m740 instructions 2021-01-29 23:48:43 -05:00
Kelvin Sherlock
6609004905 add micol macro assembler syntax. 2020-08-15 13:32:01 -04:00
Kelvin Sherlock
16a2e8f434 MPW Asm PRINT operand can take multiple parameters. 2020-07-14 22:27:34 -04:00
10 changed files with 670 additions and 7 deletions

View File

@ -34,7 +34,7 @@ contexts:
scope: keyword.mnemonic.65816.alt
mnemonics-65c02-m740:
- match: \b(?i:CLT|COM|LDM|RRF|SET|TST)\b
- match: \b(?i:CLT|COM|LDM|RRF|SET|TST|MUL|DIV|CLB|SEB|BBC|BBS)\b
scope: keyword.mnemonic.m740
mnemonics-sweet16:

View File

@ -70,7 +70,7 @@ contexts:
scope: support.function.macro.toolbox
- match: \b((?i)DC|DCB|DS)([.](.))?
- match: \b((?i)DCB|DC|DS)([.](.))?
scope: meta.dc.directive
captures:
1: keyword.directive.data
@ -219,12 +219,11 @@ contexts:
operand-print:
- include: macro-parm
- match: ','
- match: \b(?i:ON|OFF|PUSH|POP)\b
scope: constant.language
set: expect-comment
- match: \b(?i:NO)?(?i:GEN|PAGE|WARN|MCALL|OBJ|DATA|MDIR|HDR|LITS|STAT|SYM)\b
scope: constant.language
set: expect-comment
- include: expect-comment

View File

@ -99,7 +99,7 @@ contexts:
set: expect-comment
# numeric operand
- match: \b(?i:ORG|ADR|DS|KND|KIND?|LKV|VER|DO|EQU|GEQ|ALI|RTY|RID|RAT|AUX)\b
- match: \b(?i:ORG|ADR|DS|KND|KIND?|LKV|VER|DO|EQU|GEQU?|ALI|RTY|RID|RAT|AUX)\b
scope: keyword.directive
set: operand-number

View File

@ -7,6 +7,7 @@ scope: source.asm.65816.merlin
variables:
ws: '[ \t]+'
ident: '[:-~][0-~]*'
lident: '[\]:][0-~]*'
contexts:
prototype:
@ -27,7 +28,7 @@ contexts:
- match: '^({{ident}}){{ws}}((?i)MAC)\b'
captures:
1: entity.name.macro
1: entity.name.function
2: keyword.directive
push: operand
@ -50,10 +51,12 @@ contexts:
2: keyword.directive
push: operand
- match: '^{{lident}}'
scope: entity.name.label.local
- match: '^{{ident}}'
scope: entity.name.label
scope: entity.name.function
opcode:

View File

@ -0,0 +1,113 @@
%YAML 1.2
---
name: Micol Macro Assembler
scope: source.asm.65816.micol
# https://archive.org/details/Micol-Macro_Assembler_V2.01/
variables:
ws: '[ \t]+'
ident: '[A-Za-z][A-Za-z0-9_]*'
contexts:
prototype:
- include: eol
main:
- meta_include_prototype: false
- match: ^[;]
push:
- meta_scope: comment.line
- match: \n
pop: true
- match: '{{ws}}'
push: opcode
# all labels need an opcode.
# LABEL is a reserved label.
- match: ^{{ident}}
scope: entity.name.label
opcode:
- match: '{{ws}}'
set: operand
- include: scope:source.asm.65816#mnemonics-6502
- include: scope:source.asm.65816#mnemonics-65c02
- include: scope:source.asm.65816#mnemonics-65816
- include: mnemonics-65816-alt
- match: <<<|>>>
scope: keyword.directive
- match: \b(?i:EQU|ORG|PRG|EJT|LST|NLT|NPR|PRI|EMU|I08|I16|M08|M16|NAT)\b
scope: keyword.directive
- match: \b(?i:RES|ABS|ASC|BYT|LWD|WOR)\b
scope: keyword.directive.data
# macro
- match: \b(?i:EXP|MAC|TMC)\b
scope: keyword.directive
- match: \b(?i:CHN|INS)\b
scope: keyword.control.import
set: operand-path
- match: \b(?i:ELS|IFF|STP)\b
scope: keyword.control.conditional
mnemonics-65816-alt:
- match: \b(?i:DEA|INA)\b
scope: keyword.mnemonic.65816.alt
operand:
- include: numbers
- include: strings
# LABFW, LABBK, A, X, Y are reserved labels.
- match: \b(?i:LABEL|LABBK|LABFW|A|X|Y)\b
scope: entity.name.label
# scope: variable.language
# macro parms
- match: \?[0-9A-Za-z]\b
scope: variable.other
operand-path:
- match: \S+
scope: string.unquoted
numbers:
- match: \b\d+\b
scope: constant.numeric
- match: \$[0-9a-fA-F]+\b
scope: constant.numeric.hex
- match: \%[01]+\b
scope: constant.numeric.binary
- match: \@[0-7]+\b
scope: constant.numeric.oct
strings:
- match: "'"
scope: punctuation.definition.string.begin
push:
- meta_include_prototype: false
- meta_scope: string.quoted.single
- match: "'"
scope: punctuation.definition.string.end
pop: true
- match: '\n'
scope: invalid.illegal.newline.asm
pop: true
eol:
- match: '$'
pop: true

View File

@ -0,0 +1,282 @@
%YAML 1.2
---
name: SN Assembler
scope: source.asm.65816.sn
# @ is the default local prefix, but /opt l can change it. : was common.
variables:
ws: '[ \t]+'
ident: '[A-Za-z_.][A-Za-z0-9_.]*'
local: '[@:][A-Za-z0-9_.]+'
contexts:
prototype:
- include: comment
- include: eol
main:
- meta_include_prototype: false
- match: '{{ws}}'
push: opcode
- match: '^({{ident}}){{ws}}((?i)MODULE)\b'
captures:
1: entity.name.function
2: keyword.directive
push: operand
- match: '^({{ident}}){{ws}}((?i)MACRO)\b'
captures:
1: entity.name.function
2: keyword.directive
push: operand-macro
- match: '^{{ident}}'
scope: entity.name.function
- match: '^{{local}}'
scope: entity.name.label.local
- include: comment
opcode:
- match: '{{ws}}'
set: operand
- include: scope:source.asm.65816#mnemonics-6502
- include: scope:source.asm.65816#mnemonics-65c02
- include: scope:source.asm.65816#mnemonics-65c02s
- include: scope:source.asm.65816#mnemonics-65816
- include: mnemonics-65816-alt
- match: \b(?i:DB|DW|DT|DL)\b
scope: keyword.directive
set: operand
- match: \b(?i:HEX)\b
scope: keyword.directive
set: operand
- match: \b(?i:DS|DCB)\b
scope: keyword.directive
set: operand
# reserve space
- match: \b(?i:RSRESET|RSSET|RB|RW)\b
scope: keyword.directive
set: operand
- match: \b(?i:EQU|SET)\b
scope: keyword.directive
set: operand
- match: \b(?i:MACRO|ENDM|MEXIT|SHIFT)\b
scope: keyword.directive
set: operand
- match: \b(?i:SECTION|GRP)\b
scope: keyword.directive
set: operand-section
- match: \b(?i:ORG|END|OPT|MX)\b
scope: keyword.directive
set: operand
- match: \b(?i:XDEF|XREF)\b
scope: keyword.directive
set: operand
- match: \b(?i:ASSUME)\b
scope: keyword.directive
set: operand
- match: \b(?i:MODULE|MODEND)\b
scope: keyword.directive
set: operand
- match: \b(?i:REPT|ENDR)\b
scope: keyword.directive.keyword.control
set: operand
- match: \b(?i:CASE|ENDCASE)\b
scope: keyword.directive.keyword.control
set: operand
- match: \b(?i:WHILE|ENDW)\b
scope: keyword.directive.keyword.control
set: operand
- match: \b(?i:DO|UNTIL)\b
scope: keyword.directive.keyword.control
set: operand
- match: \b(?i:IF|ELSE|ENDIF|ENDC)\b
scope: keyword.directive.keyword.control
set: operand
- match: \b(?i:PUBLIC)\b
scope: keyword.directive
set: operand-on-off
- match: \b(?i:LIST|NOLIST)\b
scope: keyword.directive
set: operand
- match: \b(?i:INFORM)\b
scope: keyword.directive
set: operand
- match: \b(?i:INCLUDE|INCBIN)\b
scope: keyword.directive
set: operand-path
operand:
- include: numbers
- include: strings
- match: \b(?i:__MX|__RS|_RADIX|_RCOUNT|_FILENAME|_CURRENT_FILE|_CURRENT_LINE)\b
scope: keyword.directive
- match: \b(?i:NARG)\b
scope: keyword.directive
- match: \b(?i:_YEAR|_MONTH|_DAY|_WEEKDAY|_HOURS|_MINUTES|_SECONDS)\b
scope: support.constant
- match: \b(?i:DEF|REF|TYPE|STRCMP|STRICMP|STRLEN|SUBSTR|GROUPEND|SECTEND|GROUPORG|SECTSIZE|GROUPSIZE|ALIGNMENT|SECT|OFFSET|FILESIZE|SQRT)\b
scope: support.function
operand-section:
- match: '\b{{ident}}\b'
scope: entity.name.function
set: expect-comment
- include: expect-comment
operand-on-off:
- match: \b(?i:ON|OFF)\b
scope: constant.language
set: expect-comment
- include: expect-comment
operand-ascii:
- meta_include_prototype: false
- match: '{{ws}}'
- match: '([^\r\n|]+)'
scope: string.unquoted
- match: \|
set: comment
- include: eol
operand-fcc:
- match: (\S)
scope: punctuation.definition.string.begin
push:
- meta_include_prototype: false
- meta_scope: string.quoted
- match: \1
scope: punctuation.definition.string.end
pop: true
- match: \n
scope: invalid.illegal
pop: true
operand-path:
- include: strings
operand-macro:
- match: '\b{{ident}}\b'
scope: variable.parameter
# comment char
# ...
# char
operand-comment:
- meta_include_prototype: false
- match: (\S)
scope: punctuation.definition.comment.begin.asm
set: [comment, comment-block]
- match: \n
scope: invalid.illegal.newline.asm
pop: true
comment-block:
- meta_include_prototype: false
- meta_scope: comment.block
- match: \1
scope: punctuation.definition.comment.end.asm
pop: true # pops to comment.
numbers:
- match: \b\d+\b
scope: constant.numeric
- match: \$[0-9a-fA-F]+\b
scope: constant.numeric.hex
- match: \%[01]+\b
scope: constant.numeric.binary
strings:
- match: "'"
scope: punctuation.definition.string.begin
push:
- meta_include_prototype: false
- meta_scope: string.quoted.single
- match: "'"
scope: punctuation.definition.string.end
pop: true
- match: \n
scope: invalid.illegal.newline.asm
pop: true
- match: '"'
scope: punctuation.definition.string.begin
push:
- meta_include_prototype: false
- meta_scope: string.quoted.double
- match: '"'
scope: punctuation.definition.string.end
pop: true
- match: \n
scope: invalid.illegal.newline.asm
pop: true
expect-comment:
- include: comment
- match: \S
scope: invalid.illegal.expect.comment
comment:
- match: ;
push:
- meta_scope: comment.line.partial
- match: \n
pop: true
- include: eol
mnemonics-65816-alt:
- match: \b(?i:BLT|BGE|CPA|DEA|INA|SWA|TAD|TAS|TDA|TSA)\b
scope: keyword.mnemonic.65816.alt
eol:
- match: '$'
pop: true

View File

@ -1,6 +1,7 @@
%YAML 1.2
---
name: CA65
file_extensions: []
scope: source.asm.ca65
variables:
@ -240,3 +241,13 @@ contexts:
- match: \b(?i:RTN|SET|LD|LDD|ST|STD|POP|POPD|STP|ADD|SUB|CPR|INR|DCR|BR|BNC|BC|BP|BM|BZ|BNZ|BM1|BNM1|BK|RS|BS)\b
scope: keyword.mnemonic.sweet16
set: operand
mnemonics-macpack-generic:
- match: \b(?i:ADD|SUB|BGE|BLT|BGT|BLE|BNZ|BZE)\b
scope: keyword.mnemonic.macpack.generic
set: operand
mnemonics-macpack-longbranch:
- match: \b(?i:JEQ|JNE|JMI|JPL|JCS|JCC|JVS|JVC)\b
scope: keyword.mnemonic.macpack.longbranch
set: operand

View File

@ -0,0 +1,220 @@
%YAML 1.2
---
name: S-C Assembler
file_extensions: []
scope: source.asm.sc-asm
variables:
ws: '[ \t]+'
xws: '[ \t\x08]*'
ident: '[A-Za-z][A-Za-z0-9.]*'
lident: '.[0-9]{1,2}'
contexts:
prototype:
- include: eol
main:
- meta_include_prototype: false
- match: ^[*]
push:
- meta_scope: comment.line
- match: \n
pop: true
# assembler commands. there are others but these are used by a2osx...
- match: '^{{xws}}((?i)NEW|AUTO|MANUAL|MAN|ASM)\b'
captures:
1: keyword.directive
# scope: keyword.directive
push:
- match: $
pop: true
- match: '^{{xws}}((?i)SAVE|LOAD)\b'
captures:
1: keyword.directive
# scope: keyword.directive
push: operand-path
- match: '{{ws}}'
push: opcode
- match: '^{{ws}}((?i)\.MA)\s({{ident}})'
captures:
2: keyword.directive
1: entity.name.function
push: eol
- match: '^({{ident}}){{ws}}\.((?i)EQ)\b'
captures:
1: entity.name.constant
2: keyword.directive
push: operand
- match: '^{{lident}}'
scope: entity.name.label.local
- match: '^{{ident}}'
scope: entity.name.function
opcode:
- match: '{{ws}}'
set: operand
- include: scope:source.asm.65816#mnemonics-6502
- include: scope:source.asm.65816#mnemonics-65c02
- include: scope:source.asm.65816#mnemonics-65c02s
- include: scope:source.asm.65816#mnemonics-65816
- include: mnemonics-6502-alt
- match: \.(?i:DA)\b
scope: keyword.directive.data
set: operand
- match: \.(?i:HS)\b
scope: keyword.directive.data
set: operand-hex
- match: \.(?i:AS|AT|AZ)\b
scope: keyword.directive.data
set: operand-string
- match: \.(?i:OP)\b
scope: keyword.directive
set: operand-op
- match: \.(?i:INB|IN|TF)\b
scope: keyword.control.import
set: operand-path
- match: \.(?i:LIST)\b
scope: keyword.directive
set: operand-list
- match: \.(?i:AC|AS|AT|AZ|BS|DA|DO|DUMMY|ED|ELSE|EM|EN|EP|EQ|FIN|HS|IN|INB|LIST|MA|OP|OR|PG|PH|TA|TF|TI|US)\b
scope: keyword.directive
- match: '>{{ident}}'
scope: variable.function.macro
set: operand
operand:
- include: numbers
- include: strings
- match: ']\d+'
scope: variable.other
#- include: macro-parm
operand-op:
- match: '(?i:6502|SW16|65C02|65R02|65802|65816)'
scope: constant.language
set: comment
- include: error
operand-hex:
- match: '[0-9A-Fa-f]{2}'
scope: constant.numeric.hex
- include: expect-comment
operand-path:
- match: \S+
scope: string.unquoted
set: expect-comment
- include: expect-comment
# -? delimiter (anything but delimiter)* delimiter
# pop: 1 needed for \1 backref matching.
operand-string:
- match: '-?([^ \t-])'
scope: punctuation.definition.string.begin
push: [comment, operand-string-inner]
# - include: expect-comment
operand-string-inner:
- meta_scope: string.quoted
- match: \1
scope: punctuation.definition.string.end
pop: true
operand-list:
# .LIST ON | OFF | CON | COFF | MON | MOFF | XON | XOFF
- match: \b(?i:[CMX]?ON|[CMX]?OFF)\b
scope: constant.language
set: comment
- include: error
error:
- match: \S
scope: invalid.illegal.expect.comment
expect-comment:
- include: comment
- match: \S
scope: invalid.illegal.expect.comment
comment:
- match: (?<=[\t ])
push:
- meta_scope: comment.line
- match: \n
pop: true
- include: eol
mnemonics-6502-alt:
- match: \b(?i:BLT|BGE)\b
scope: keyword.mnemonic.6502.alt
numbers:
- match: \b\d+\b
scope: constant.numeric
- match: \$[0-9a-fA-F]+\b
scope: constant.numeric.hex
- match: \%[01_]+\b
scope: constant.numeric.binary
strings:
- match: "'"
scope: punctuation.definition.string.begin
push:
- meta_include_prototype: false
- meta_scope: string.quoted.single
- match: "'"
scope: punctuation.definition.string.end
pop: true
- match: \n
scope: invalid.illegal.newline.asm
pop: true
eol:
- match: '$'
pop: true

View File

@ -283,6 +283,7 @@ class OrcaMacGen(sublime_plugin.TextCommand):
text = view.substr(r).rstrip()
if text == "": continue
if text[0] in "!*": continue
if re_comment.match(text): continue
tokens = re.split(re_ws, text, maxsplit=2)
if len(tokens) < 2: continue

View File

@ -0,0 +1,34 @@
{
"scope": "source.asm.sc-asm meta.directive",
"completions":
[
".ac",
".as",
".at",
".az",
".bs",
".da",
".do",
".dummy",
".ed",
".else",
".em",
".en",
".ep",
".eq",
".fin",
".hs",
".in",
".inb",
".list",
".ma",
".op",
".or",
".pg",
".ph",
".ta",
".tf",
".ti",
".us"
]
}