From cc08ae4af19c506260d8fc1b1a420e35ed16ba1e Mon Sep 17 00:00:00 2001 From: Sven Oliver Moll Date: Wed, 5 Nov 2025 18:26:15 +0100 Subject: [PATCH] Add support for 6502 assembly variants 65C02, 65CE02 and 65816 Based upon the work by Kevin Zurawel and Michael Schmidt, just some pattern matching to add new mnemonics, addressing modes and tests --- src/components.json | 12 + src/languages/asm65816.js | 34 ++ src/languages/asm65c02.js | 34 ++ src/languages/asm65ce02.js | 34 ++ tests/languages/asm65816/comment_feature.test | 13 + .../languages/asm65816/directive_feature.test | 12 + tests/languages/asm65816/number_feature.test | 17 + tests/languages/asm65816/opcode_feature.test | 377 ++++++++++++++ .../asm65816/punctuation_feature.test | 12 + .../languages/asm65816/register_feature.test | 18 + tests/languages/asm65816/string_feature.test | 12 + tests/languages/asm65c02/comment_feature.test | 13 + .../languages/asm65c02/directive_feature.test | 12 + tests/languages/asm65c02/number_feature.test | 17 + tests/languages/asm65c02/opcode_feature.test | 401 +++++++++++++++ .../asm65c02/punctuation_feature.test | 10 + .../languages/asm65c02/register_feature.test | 18 + tests/languages/asm65c02/string_feature.test | 12 + .../languages/asm65ce02/comment_feature.test | 13 + .../asm65ce02/directive_feature.test | 12 + tests/languages/asm65ce02/number_feature.test | 17 + tests/languages/asm65ce02/opcode_feature.test | 465 ++++++++++++++++++ .../asm65ce02/punctuation_feature.test | 10 + .../languages/asm65ce02/register_feature.test | 18 + tests/languages/asm65ce02/string_feature.test | 12 + 25 files changed, 1605 insertions(+) create mode 100644 src/languages/asm65816.js create mode 100644 src/languages/asm65c02.js create mode 100644 src/languages/asm65ce02.js create mode 100644 tests/languages/asm65816/comment_feature.test create mode 100644 tests/languages/asm65816/directive_feature.test create mode 100644 tests/languages/asm65816/number_feature.test create mode 100644 tests/languages/asm65816/opcode_feature.test create mode 100644 tests/languages/asm65816/punctuation_feature.test create mode 100644 tests/languages/asm65816/register_feature.test create mode 100644 tests/languages/asm65816/string_feature.test create mode 100644 tests/languages/asm65c02/comment_feature.test create mode 100644 tests/languages/asm65c02/directive_feature.test create mode 100644 tests/languages/asm65c02/number_feature.test create mode 100644 tests/languages/asm65c02/opcode_feature.test create mode 100644 tests/languages/asm65c02/punctuation_feature.test create mode 100644 tests/languages/asm65c02/register_feature.test create mode 100644 tests/languages/asm65c02/string_feature.test create mode 100644 tests/languages/asm65ce02/comment_feature.test create mode 100644 tests/languages/asm65ce02/directive_feature.test create mode 100644 tests/languages/asm65ce02/number_feature.test create mode 100644 tests/languages/asm65ce02/opcode_feature.test create mode 100644 tests/languages/asm65ce02/punctuation_feature.test create mode 100644 tests/languages/asm65ce02/register_feature.test create mode 100644 tests/languages/asm65ce02/string_feature.test diff --git a/src/components.json b/src/components.json index 7dfe6d098d..d25b1df8cb 100644 --- a/src/components.json +++ b/src/components.json @@ -163,6 +163,18 @@ "title": "6502 Assembly", "owner": "kzurawel" }, + "asm65c02": { + "title": "65C02 Assembly", + "owner": "SvOlli" + }, + "asm65ce02": { + "title": "65CE02 Assembly", + "owner": "SvOlli" + }, + "asm65816": { + "title": "65816 Assembly", + "owner": "SvOlli" + }, "asmatmel": { "title": "Atmel AVR Assembly", "owner": "cerkit" diff --git a/src/languages/asm65816.js b/src/languages/asm65816.js new file mode 100644 index 0000000000..8dfc55ab19 --- /dev/null +++ b/src/languages/asm65816.js @@ -0,0 +1,34 @@ +/** @type {import('../types.d.ts').LanguageProto<'asm65816'>} */ +export default { + id: 'asm65816', + grammar: { + 'comment': /;.*/, + 'directive': { + pattern: /\.\w+(?= )/, + alias: 'property', + }, + 'string': /(["'`])(?:\\.|(?!\1)[^\\\r\n])*\1/, + 'op-code': { + pattern: + /\b(?:ADC|AND|ASL|BCC|BCS|BEQ|BIT|BMI|BNE|BPL|BRA|BRK|BRL|BVC|BVS|CLC|CLD|CLI|CLV|CMP|COP|CPX|CPY|DEC|DEX|DEY|EOR|INC|INX|INY|JML|JMP|JSL|JSR|LDA|LDX|LDY|LSR|MVN|MVP|NOP|ORA|PEA|PEI|PER|PHA|PHB|PHD|PHK|PHP|PHX|PHY|PLA|PLB|PLD|PLP|PLX|PLY|REP|ROL|ROR|RTI|RTL|RTS|SBC|SEC|SED|SEI|SEP|STA|STP|STX|STY|STZ|TAX|TAY|TCD|TCS|TDC|TRB|TSB|TSC|TSX|TXA|TXS|TXY|TYA|TYX|WAI|WDM|XBA|XCE|adc|and|asl|bcc|bcs|beq|bit|bmi|bne|bpl|bra|brk|brl|bvc|bvs|clc|cld|cli|clv|cmp|cop|cpx|cpy|dec|dex|dey|eor|inc|inx|iny|jml|jmp|jsl|jsr|lda|ldx|ldy|lsr|mvn|mvp|nop|ora|pea|pei|per|pha|phb|phd|phk|php|phx|phy|pla|plb|pld|plp|plx|ply|rep|rol|ror|rti|rtl|rts|sbc|sec|sed|sei|sep|sta|stp|stx|sty|stz|tax|tay|tcd|tcs|tdc|trb|tsb|tsc|tsx|txa|txs|txy|tya|tyx|wai|wdm|xba|xce)\b/, + alias: 'keyword', + }, + 'hex-number': { + pattern: /#?\$[\da-f]{1,6}\b/i, + alias: 'number', + }, + 'binary-number': { + pattern: /#?%[01]+\b/, + alias: 'number', + }, + 'decimal-number': { + pattern: /#?\b\d+\b/, + alias: 'number', + }, + 'register': { + pattern: /\b[xya]\b/i, + alias: 'variable', + }, + 'punctuation': /[\[\](),:]/, + }, +}; diff --git a/src/languages/asm65c02.js b/src/languages/asm65c02.js new file mode 100644 index 0000000000..e0c38ffe5c --- /dev/null +++ b/src/languages/asm65c02.js @@ -0,0 +1,34 @@ +/** @type {import('../types.d.ts').LanguageProto<'asm65c02'>} */ +export default { + id: 'asm65c02', + grammar: { + 'comment': /;.*/, + 'directive': { + pattern: /\.\w+(?= )/, + alias: 'property', + }, + 'string': /(["'`])(?:\\.|(?!\1)[^\\\r\n])*\1/, + 'op-code': { + pattern: + /\b(?:ADC|AND|ASL|BBR0|BBR1|BBR2|BBR3|BBR4|BBR5|BBR6|BBR7|BBS0|BBS1|BBS2|BBS3|BBS4|BBS5|BBS6|BBS7|BCC|BCS|BEQ|BIT|BMI|BNE|BPL|BRA|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|PHX|PHY|PLA|PLP|PLX|PLY|RMB0|RMB1|RMB2|RMB3|RMB4|RMB5|RMB6|RMB7|ROL|ROR|RTI|RTS|SBC|SEC|SED|SEI|SMB0|SMB1|SMB2|SMB3|SMB4|SMB5|SMB6|SMB7|STA|STP|STX|STY|STZ|TAX|TAY|TRB|TSB|TSX|TXA|TXS|TYA|WAI|adc|and|asl|bbr0|bbr1|bbr2|bbr3|bbr4|bbr5|bbr6|bbr7|bbs0|bbs1|bbs2|bbs3|bbs4|bbs5|bbs6|bbs7|bcc|bcs|beq|bit|bmi|bne|bpl|bra|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|phx|phy|pla|plp|plx|ply|rmb0|rmb1|rmb2|rmb3|rmb4|rmb5|rmb6|rmb7|rol|ror|rti|rts|sbc|sec|sed|sei|smb0|smb1|smb2|smb3|smb4|smb5|smb6|smb7|sta|stp|stx|sty|stz|tax|tay|trb|tsb|tsx|txa|txs|tya|wai)\b/, + alias: 'keyword', + }, + 'hex-number': { + pattern: /#?\$[\da-f]{1,4}\b/i, + alias: 'number', + }, + 'binary-number': { + pattern: /#?%[01]+\b/, + alias: 'number', + }, + 'decimal-number': { + pattern: /#?\b\d+\b/, + alias: 'number', + }, + 'register': { + pattern: /\b[xya]\b/i, + alias: 'variable', + }, + 'punctuation': /[(),:]/, + }, +}; diff --git a/src/languages/asm65ce02.js b/src/languages/asm65ce02.js new file mode 100644 index 0000000000..b71c3cd796 --- /dev/null +++ b/src/languages/asm65ce02.js @@ -0,0 +1,34 @@ +/** @type {import('../types.d.ts').LanguageProto<'asm65ce02'>} */ +export default { + id: 'asm65ce02', + grammar: { + 'comment': /;.*/, + 'directive': { + pattern: /\.\w+(?= )/, + alias: 'property', + }, + 'string': /(["'`])(?:\\.|(?!\1)[^\\\r\n])*\1/, + 'op-code': { + pattern: + /\b(?:ADC|AND|ASL|ASR|AUG|BBR0|BBR1|BBR2|BBR3|BBR4|BBR5|BBR6|BBR7|BBS0|BBS1|BBS2|BBS3|BBS4|BBS5|BBS6|BBS7|BCC|BCS|BEQ|BIT|BMI|BNE|BPL|BRA|BRK|BVC|BVS|CLC|CLD|CLE|CLI|CLV|CMP|CPX|CPY|CPZ|DEC|DEW|DEX|DEY|EOR|INC|INW|INX|INY|JMP|JSR|LDA|LDX|LDY|LDZ|LSR|NEG|NOP|ORA|PHA|PHP|PHX|PHY|PHZ|PLA|PLP|PLX|PLY|PLZ|RMB0|RMB1|RMB2|RMB3|RMB4|RMB5|RMB6|RMB7|ROL|ROR|RTI|RTN|RTS|SBC|SEC|SED|SEE|SEI|SMB0|SMB1|SMB2|SMB3|SMB4|SMB5|SMB6|SMB7|STA|STX|STY|STZ|TAB|TAX|TAY|TAZ|TBA|TRB|TSB|TSX|TXA|TXS|TSY|TYA|TYS|TZA|adc|and|asl|asr|aug|bbr0|bbr1|bbr2|bbr3|bbr4|bbr5|bbr6|bbr7|bbs0|bbs1|bbs2|bbs3|bbs4|bbs5|bbs6|bbs7|bcc|bcs|beq|bit|bmi|bne|bpl|bra|brk|bvc|bvs|clc|cld|cle|cli|clv|cmp|cpx|cpy|cpz|dec|dew|dex|dey|eor|inc|inw|inx|iny|jmp|jsr|lda|ldx|ldy|ldz|lsr|neg|nop|ora|pha|php|phx|phy|phz|pla|plp|plx|ply|plz|rmb0|rmb1|rmb2|rmb3|rmb4|rmb5|rmb6|rmb7|rol|ror|rti|rtn|rts|sbc|sec|sed|see|sei|smb0|smb1|smb2|smb3|smb4|smb5|smb6|smb7|sta|stx|sty|stz|tab|tax|tay|taz|tba|trb|tsb|tsx|txa|txs|tsy|tya|tys|tza)\b/, + alias: 'keyword', + }, + 'hex-number': { + pattern: /#?\$[\da-f]{1,4}\b/i, + alias: 'number', + }, + 'binary-number': { + pattern: /#?%[01]+\b/, + alias: 'number', + }, + 'decimal-number': { + pattern: /#?\b\d+\b/, + alias: 'number', + }, + 'register': { + pattern: /\b[xyza]\b/i, + alias: 'variable', + }, + 'punctuation': /[(),:]/, + }, +}; diff --git a/tests/languages/asm65816/comment_feature.test b/tests/languages/asm65816/comment_feature.test new file mode 100644 index 0000000000..d4b860167a --- /dev/null +++ b/tests/languages/asm65816/comment_feature.test @@ -0,0 +1,13 @@ +; +; foo bar baz + +------------------------- + +[ + ["comment", ";"], + ["comment", "; foo bar baz"] +] + +------------------------- + +Check for comments diff --git a/tests/languages/asm65816/directive_feature.test b/tests/languages/asm65816/directive_feature.test new file mode 100644 index 0000000000..1cf42c81d2 --- /dev/null +++ b/tests/languages/asm65816/directive_feature.test @@ -0,0 +1,12 @@ +.segment CODE + +------------------------- + +[ + ["directive", ".segment"], + " CODE" +] + +------------------------- + +Check for directives diff --git a/tests/languages/asm65816/number_feature.test b/tests/languages/asm65816/number_feature.test new file mode 100644 index 0000000000..7b5fd3b020 --- /dev/null +++ b/tests/languages/asm65816/number_feature.test @@ -0,0 +1,17 @@ +LDA #127 +STA $8000 +STA #$1 +LDX #%10001010 + +---------------------------------------------------- + +[ + ["op-code", "LDA"], ["decimal-number", "#127"], + ["op-code", "STA"], ["hex-number", "$8000"], + ["op-code", "STA"], ["hex-number", "#$1"], + ["op-code", "LDX"], ["binary-number", "#%10001010"] +] + +---------------------------------------------------- + +Check for numbers diff --git a/tests/languages/asm65816/opcode_feature.test b/tests/languages/asm65816/opcode_feature.test new file mode 100644 index 0000000000..5610e5b313 --- /dev/null +++ b/tests/languages/asm65816/opcode_feature.test @@ -0,0 +1,377 @@ +adc +and +asl +bcc +bcs +beq +bit +bmi +bne +bpl +bra +brk +brl +bvc +bvs +clc +cld +cli +clv +cmp +cop +cpx +cpy +dec +dex +dey +eor +inc +inx +iny +jml +jmp +jsl +jsr +lda +ldx +ldy +lsr +mvn +mvp +nop +ora +pea +pei +per +pha +phb +phd +phk +php +phx +phy +pla +plb +pld +plp +plx +ply +rep +rol +ror +rti +rtl +rts +sbc +sec +sed +sei +sep +sta +stp +stx +sty +stz +tax +tay +tcd +tcs +tdc +trb +tsb +tsc +tsx +txa +txs +txy +tya +tyx +wai +wdm +xba +xce +ADC +AND +ASL +BCC +BCS +BEQ +BIT +BMI +BNE +BPL +BRA +BRK +BRL +BVC +BVS +CLC +CLD +CLI +CLV +CMP +COP +CPX +CPY +DEC +DEX +DEY +EOR +INC +INX +INY +JML +JMP +JSL +JSR +LDA +LDX +LDY +LSR +MVN +MVP +NOP +ORA +PEA +PEI +PER +PHA +PHB +PHD +PHK +PHP +PHX +PHY +PLA +PLB +PLD +PLP +PLX +PLY +REP +ROL +ROR +RTI +RTL +RTS +SBC +SEC +SED +SEI +SEP +STA +STP +STX +STY +STZ +TAX +TAY +TCD +TCS +TDC +TRB +TSB +TSC +TSX +TXA +TXS +TXY +TYA +TYX +WAI +WDM +XBA +XCE + +---------------------------------------------------- + +[ + ["op-code", "adc"], + ["op-code", "and"], + ["op-code", "asl"], + ["op-code", "bcc"], + ["op-code", "bcs"], + ["op-code", "beq"], + ["op-code", "bit"], + ["op-code", "bmi"], + ["op-code", "bne"], + ["op-code", "bpl"], + ["op-code", "bra"], + ["op-code", "brk"], + ["op-code", "brl"], + ["op-code", "bvc"], + ["op-code", "bvs"], + ["op-code", "clc"], + ["op-code", "cld"], + ["op-code", "cli"], + ["op-code", "clv"], + ["op-code", "cmp"], + ["op-code", "cop"], + ["op-code", "cpx"], + ["op-code", "cpy"], + ["op-code", "dec"], + ["op-code", "dex"], + ["op-code", "dey"], + ["op-code", "eor"], + ["op-code", "inc"], + ["op-code", "inx"], + ["op-code", "iny"], + ["op-code", "jml"], + ["op-code", "jmp"], + ["op-code", "jsl"], + ["op-code", "jsr"], + ["op-code", "lda"], + ["op-code", "ldx"], + ["op-code", "ldy"], + ["op-code", "lsr"], + ["op-code", "mvn"], + ["op-code", "mvp"], + ["op-code", "nop"], + ["op-code", "ora"], + ["op-code", "pea"], + ["op-code", "pei"], + ["op-code", "per"], + ["op-code", "pha"], + ["op-code", "phb"], + ["op-code", "phd"], + ["op-code", "phk"], + ["op-code", "php"], + ["op-code", "phx"], + ["op-code", "phy"], + ["op-code", "pla"], + ["op-code", "plb"], + ["op-code", "pld"], + ["op-code", "plp"], + ["op-code", "plx"], + ["op-code", "ply"], + ["op-code", "rep"], + ["op-code", "rol"], + ["op-code", "ror"], + ["op-code", "rti"], + ["op-code", "rtl"], + ["op-code", "rts"], + ["op-code", "sbc"], + ["op-code", "sec"], + ["op-code", "sed"], + ["op-code", "sei"], + ["op-code", "sep"], + ["op-code", "sta"], + ["op-code", "stp"], + ["op-code", "stx"], + ["op-code", "sty"], + ["op-code", "stz"], + ["op-code", "tax"], + ["op-code", "tay"], + ["op-code", "tcd"], + ["op-code", "tcs"], + ["op-code", "tdc"], + ["op-code", "trb"], + ["op-code", "tsb"], + ["op-code", "tsc"], + ["op-code", "tsx"], + ["op-code", "txa"], + ["op-code", "txs"], + ["op-code", "txy"], + ["op-code", "tya"], + ["op-code", "tyx"], + ["op-code", "wai"], + ["op-code", "wdm"], + ["op-code", "xba"], + ["op-code", "xce"], + ["op-code", "ADC"], + ["op-code", "AND"], + ["op-code", "ASL"], + ["op-code", "BCC"], + ["op-code", "BCS"], + ["op-code", "BEQ"], + ["op-code", "BIT"], + ["op-code", "BMI"], + ["op-code", "BNE"], + ["op-code", "BPL"], + ["op-code", "BRA"], + ["op-code", "BRK"], + ["op-code", "BRL"], + ["op-code", "BVC"], + ["op-code", "BVS"], + ["op-code", "CLC"], + ["op-code", "CLD"], + ["op-code", "CLI"], + ["op-code", "CLV"], + ["op-code", "CMP"], + ["op-code", "COP"], + ["op-code", "CPX"], + ["op-code", "CPY"], + ["op-code", "DEC"], + ["op-code", "DEX"], + ["op-code", "DEY"], + ["op-code", "EOR"], + ["op-code", "INC"], + ["op-code", "INX"], + ["op-code", "INY"], + ["op-code", "JML"], + ["op-code", "JMP"], + ["op-code", "JSL"], + ["op-code", "JSR"], + ["op-code", "LDA"], + ["op-code", "LDX"], + ["op-code", "LDY"], + ["op-code", "LSR"], + ["op-code", "MVN"], + ["op-code", "MVP"], + ["op-code", "NOP"], + ["op-code", "ORA"], + ["op-code", "PEA"], + ["op-code", "PEI"], + ["op-code", "PER"], + ["op-code", "PHA"], + ["op-code", "PHB"], + ["op-code", "PHD"], + ["op-code", "PHK"], + ["op-code", "PHP"], + ["op-code", "PHX"], + ["op-code", "PHY"], + ["op-code", "PLA"], + ["op-code", "PLB"], + ["op-code", "PLD"], + ["op-code", "PLP"], + ["op-code", "PLX"], + ["op-code", "PLY"], + ["op-code", "REP"], + ["op-code", "ROL"], + ["op-code", "ROR"], + ["op-code", "RTI"], + ["op-code", "RTL"], + ["op-code", "RTS"], + ["op-code", "SBC"], + ["op-code", "SEC"], + ["op-code", "SED"], + ["op-code", "SEI"], + ["op-code", "SEP"], + ["op-code", "STA"], + ["op-code", "STP"], + ["op-code", "STX"], + ["op-code", "STY"], + ["op-code", "STZ"], + ["op-code", "TAX"], + ["op-code", "TAY"], + ["op-code", "TCD"], + ["op-code", "TCS"], + ["op-code", "TDC"], + ["op-code", "TRB"], + ["op-code", "TSB"], + ["op-code", "TSC"], + ["op-code", "TSX"], + ["op-code", "TXA"], + ["op-code", "TXS"], + ["op-code", "TXY"], + ["op-code", "TYA"], + ["op-code", "TYX"], + ["op-code", "WAI"], + ["op-code", "WDM"], + ["op-code", "XBA"], + ["op-code", "XCE"] +] + +---------------------------------------------------- + +Check for opcodes diff --git a/tests/languages/asm65816/punctuation_feature.test b/tests/languages/asm65816/punctuation_feature.test new file mode 100644 index 0000000000..b820c443c6 --- /dev/null +++ b/tests/languages/asm65816/punctuation_feature.test @@ -0,0 +1,12 @@ +[ ] ( ) , : + +---------------------------------------------------- + +[ + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ","], + ["punctuation", ":"] +] diff --git a/tests/languages/asm65816/register_feature.test b/tests/languages/asm65816/register_feature.test new file mode 100644 index 0000000000..10002bedc0 --- /dev/null +++ b/tests/languages/asm65816/register_feature.test @@ -0,0 +1,18 @@ +LDA $8000,x +ASL A + +---------------------------------------------------- + +[ + ["op-code", "LDA"], + ["hex-number", "$8000"], + ["punctuation", ","], + ["register", "x"], + + ["op-code", "ASL"], + ["register", "A"] +] + +---------------------------------------------------- + +Check for registers diff --git a/tests/languages/asm65816/string_feature.test b/tests/languages/asm65816/string_feature.test new file mode 100644 index 0000000000..0205074449 --- /dev/null +++ b/tests/languages/asm65816/string_feature.test @@ -0,0 +1,12 @@ +.include "header.asm" + +------------------------- + +[ + ["directive", ".include"], + ["string", "\"header.asm\""] +] + +------------------------- + +Check for strings diff --git a/tests/languages/asm65c02/comment_feature.test b/tests/languages/asm65c02/comment_feature.test new file mode 100644 index 0000000000..d4b860167a --- /dev/null +++ b/tests/languages/asm65c02/comment_feature.test @@ -0,0 +1,13 @@ +; +; foo bar baz + +------------------------- + +[ + ["comment", ";"], + ["comment", "; foo bar baz"] +] + +------------------------- + +Check for comments diff --git a/tests/languages/asm65c02/directive_feature.test b/tests/languages/asm65c02/directive_feature.test new file mode 100644 index 0000000000..1cf42c81d2 --- /dev/null +++ b/tests/languages/asm65c02/directive_feature.test @@ -0,0 +1,12 @@ +.segment CODE + +------------------------- + +[ + ["directive", ".segment"], + " CODE" +] + +------------------------- + +Check for directives diff --git a/tests/languages/asm65c02/number_feature.test b/tests/languages/asm65c02/number_feature.test new file mode 100644 index 0000000000..7b5fd3b020 --- /dev/null +++ b/tests/languages/asm65c02/number_feature.test @@ -0,0 +1,17 @@ +LDA #127 +STA $8000 +STA #$1 +LDX #%10001010 + +---------------------------------------------------- + +[ + ["op-code", "LDA"], ["decimal-number", "#127"], + ["op-code", "STA"], ["hex-number", "$8000"], + ["op-code", "STA"], ["hex-number", "#$1"], + ["op-code", "LDX"], ["binary-number", "#%10001010"] +] + +---------------------------------------------------- + +Check for numbers diff --git a/tests/languages/asm65c02/opcode_feature.test b/tests/languages/asm65c02/opcode_feature.test new file mode 100644 index 0000000000..789abab6ce --- /dev/null +++ b/tests/languages/asm65c02/opcode_feature.test @@ -0,0 +1,401 @@ +adc +and +asl +bbr0 +bbr1 +bbr2 +bbr3 +bbr4 +bbr5 +bbr6 +bbr7 +bbs0 +bbs1 +bbs2 +bbs3 +bbs4 +bbs5 +bbs6 +bbs7 +bcc +bcs +beq +bit +bmi +bne +bpl +bra +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 +phx +phy +pla +plp +plx +ply +rmb0 +rmb1 +rmb2 +rmb3 +rmb4 +rmb5 +rmb6 +rmb7 +rol +ror +rti +rts +sbc +sec +sed +sei +smb0 +smb1 +smb2 +smb3 +smb4 +smb5 +smb6 +smb7 +sta +stp +stx +sty +stz +tax +tay +trb +tsb +tsx +txa +txs +tya +wai +ADC +AND +ASL +BBR0 +BBR1 +BBR2 +BBR3 +BBR4 +BBR5 +BBR6 +BBR7 +BBS0 +BBS1 +BBS2 +BBS3 +BBS4 +BBS5 +BBS6 +BBS7 +BCC +BCS +BEQ +BIT +BMI +BNE +BPL +BRA +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 +PHX +PHY +PLA +PLP +PLX +PLY +RMB0 +RMB1 +RMB2 +RMB3 +RMB4 +RMB5 +RMB6 +RMB7 +ROL +ROR +RTI +RTS +SBC +SEC +SED +SEI +SMB0 +SMB1 +SMB2 +SMB3 +SMB4 +SMB5 +SMB6 +SMB7 +STA +STP +STX +STY +STZ +TAX +TAY +TRB +TSB +TSX +TXA +TXS +TYA +WAI + +---------------------------------------------------- + +[ + ["op-code", "adc"], + ["op-code", "and"], + ["op-code", "asl"], + ["op-code", "bbr0"], + ["op-code", "bbr1"], + ["op-code", "bbr2"], + ["op-code", "bbr3"], + ["op-code", "bbr4"], + ["op-code", "bbr5"], + ["op-code", "bbr6"], + ["op-code", "bbr7"], + ["op-code", "bbs0"], + ["op-code", "bbs1"], + ["op-code", "bbs2"], + ["op-code", "bbs3"], + ["op-code", "bbs4"], + ["op-code", "bbs5"], + ["op-code", "bbs6"], + ["op-code", "bbs7"], + ["op-code", "bcc"], + ["op-code", "bcs"], + ["op-code", "beq"], + ["op-code", "bit"], + ["op-code", "bmi"], + ["op-code", "bne"], + ["op-code", "bpl"], + ["op-code", "bra"], + ["op-code", "brk"], + ["op-code", "bvc"], + ["op-code", "bvs"], + ["op-code", "clc"], + ["op-code", "cld"], + ["op-code", "cli"], + ["op-code", "clv"], + ["op-code", "cmp"], + ["op-code", "cpx"], + ["op-code", "cpy"], + ["op-code", "dec"], + ["op-code", "dex"], + ["op-code", "dey"], + ["op-code", "eor"], + ["op-code", "inc"], + ["op-code", "inx"], + ["op-code", "iny"], + ["op-code", "jmp"], + ["op-code", "jsr"], + ["op-code", "lda"], + ["op-code", "ldx"], + ["op-code", "ldy"], + ["op-code", "lsr"], + ["op-code", "nop"], + ["op-code", "ora"], + ["op-code", "pha"], + ["op-code", "php"], + ["op-code", "phx"], + ["op-code", "phy"], + ["op-code", "pla"], + ["op-code", "plp"], + ["op-code", "plx"], + ["op-code", "ply"], + ["op-code", "rmb0"], + ["op-code", "rmb1"], + ["op-code", "rmb2"], + ["op-code", "rmb3"], + ["op-code", "rmb4"], + ["op-code", "rmb5"], + ["op-code", "rmb6"], + ["op-code", "rmb7"], + ["op-code", "rol"], + ["op-code", "ror"], + ["op-code", "rti"], + ["op-code", "rts"], + ["op-code", "sbc"], + ["op-code", "sec"], + ["op-code", "sed"], + ["op-code", "sei"], + ["op-code", "smb0"], + ["op-code", "smb1"], + ["op-code", "smb2"], + ["op-code", "smb3"], + ["op-code", "smb4"], + ["op-code", "smb5"], + ["op-code", "smb6"], + ["op-code", "smb7"], + ["op-code", "sta"], + ["op-code", "stp"], + ["op-code", "stx"], + ["op-code", "sty"], + ["op-code", "stz"], + ["op-code", "tax"], + ["op-code", "tay"], + ["op-code", "trb"], + ["op-code", "tsb"], + ["op-code", "tsx"], + ["op-code", "txa"], + ["op-code", "txs"], + ["op-code", "tya"], + ["op-code", "wai"], + ["op-code", "ADC"], + ["op-code", "AND"], + ["op-code", "ASL"], + ["op-code", "BBR0"], + ["op-code", "BBR1"], + ["op-code", "BBR2"], + ["op-code", "BBR3"], + ["op-code", "BBR4"], + ["op-code", "BBR5"], + ["op-code", "BBR6"], + ["op-code", "BBR7"], + ["op-code", "BBS0"], + ["op-code", "BBS1"], + ["op-code", "BBS2"], + ["op-code", "BBS3"], + ["op-code", "BBS4"], + ["op-code", "BBS5"], + ["op-code", "BBS6"], + ["op-code", "BBS7"], + ["op-code", "BCC"], + ["op-code", "BCS"], + ["op-code", "BEQ"], + ["op-code", "BIT"], + ["op-code", "BMI"], + ["op-code", "BNE"], + ["op-code", "BPL"], + ["op-code", "BRA"], + ["op-code", "BRK"], + ["op-code", "BVC"], + ["op-code", "BVS"], + ["op-code", "CLC"], + ["op-code", "CLD"], + ["op-code", "CLI"], + ["op-code", "CLV"], + ["op-code", "CMP"], + ["op-code", "CPX"], + ["op-code", "CPY"], + ["op-code", "DEC"], + ["op-code", "DEX"], + ["op-code", "DEY"], + ["op-code", "EOR"], + ["op-code", "INC"], + ["op-code", "INX"], + ["op-code", "INY"], + ["op-code", "JMP"], + ["op-code", "JSR"], + ["op-code", "LDA"], + ["op-code", "LDX"], + ["op-code", "LDY"], + ["op-code", "LSR"], + ["op-code", "NOP"], + ["op-code", "ORA"], + ["op-code", "PHA"], + ["op-code", "PHP"], + ["op-code", "PHX"], + ["op-code", "PHY"], + ["op-code", "PLA"], + ["op-code", "PLP"], + ["op-code", "PLX"], + ["op-code", "PLY"], + ["op-code", "RMB0"], + ["op-code", "RMB1"], + ["op-code", "RMB2"], + ["op-code", "RMB3"], + ["op-code", "RMB4"], + ["op-code", "RMB5"], + ["op-code", "RMB6"], + ["op-code", "RMB7"], + ["op-code", "ROL"], + ["op-code", "ROR"], + ["op-code", "RTI"], + ["op-code", "RTS"], + ["op-code", "SBC"], + ["op-code", "SEC"], + ["op-code", "SED"], + ["op-code", "SEI"], + ["op-code", "SMB0"], + ["op-code", "SMB1"], + ["op-code", "SMB2"], + ["op-code", "SMB3"], + ["op-code", "SMB4"], + ["op-code", "SMB5"], + ["op-code", "SMB6"], + ["op-code", "SMB7"], + ["op-code", "STA"], + ["op-code", "STP"], + ["op-code", "STX"], + ["op-code", "STY"], + ["op-code", "STZ"], + ["op-code", "TAX"], + ["op-code", "TAY"], + ["op-code", "TRB"], + ["op-code", "TSB"], + ["op-code", "TSX"], + ["op-code", "TXA"], + ["op-code", "TXS"], + ["op-code", "TYA"], + ["op-code", "WAI"] +] + +---------------------------------------------------- + +Check for opcodes diff --git a/tests/languages/asm65c02/punctuation_feature.test b/tests/languages/asm65c02/punctuation_feature.test new file mode 100644 index 0000000000..b0a75ee6f6 --- /dev/null +++ b/tests/languages/asm65c02/punctuation_feature.test @@ -0,0 +1,10 @@ +( ) , : + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ","], + ["punctuation", ":"] +] diff --git a/tests/languages/asm65c02/register_feature.test b/tests/languages/asm65c02/register_feature.test new file mode 100644 index 0000000000..10002bedc0 --- /dev/null +++ b/tests/languages/asm65c02/register_feature.test @@ -0,0 +1,18 @@ +LDA $8000,x +ASL A + +---------------------------------------------------- + +[ + ["op-code", "LDA"], + ["hex-number", "$8000"], + ["punctuation", ","], + ["register", "x"], + + ["op-code", "ASL"], + ["register", "A"] +] + +---------------------------------------------------- + +Check for registers diff --git a/tests/languages/asm65c02/string_feature.test b/tests/languages/asm65c02/string_feature.test new file mode 100644 index 0000000000..0205074449 --- /dev/null +++ b/tests/languages/asm65c02/string_feature.test @@ -0,0 +1,12 @@ +.include "header.asm" + +------------------------- + +[ + ["directive", ".include"], + ["string", "\"header.asm\""] +] + +------------------------- + +Check for strings diff --git a/tests/languages/asm65ce02/comment_feature.test b/tests/languages/asm65ce02/comment_feature.test new file mode 100644 index 0000000000..d4b860167a --- /dev/null +++ b/tests/languages/asm65ce02/comment_feature.test @@ -0,0 +1,13 @@ +; +; foo bar baz + +------------------------- + +[ + ["comment", ";"], + ["comment", "; foo bar baz"] +] + +------------------------- + +Check for comments diff --git a/tests/languages/asm65ce02/directive_feature.test b/tests/languages/asm65ce02/directive_feature.test new file mode 100644 index 0000000000..1cf42c81d2 --- /dev/null +++ b/tests/languages/asm65ce02/directive_feature.test @@ -0,0 +1,12 @@ +.segment CODE + +------------------------- + +[ + ["directive", ".segment"], + " CODE" +] + +------------------------- + +Check for directives diff --git a/tests/languages/asm65ce02/number_feature.test b/tests/languages/asm65ce02/number_feature.test new file mode 100644 index 0000000000..7b5fd3b020 --- /dev/null +++ b/tests/languages/asm65ce02/number_feature.test @@ -0,0 +1,17 @@ +LDA #127 +STA $8000 +STA #$1 +LDX #%10001010 + +---------------------------------------------------- + +[ + ["op-code", "LDA"], ["decimal-number", "#127"], + ["op-code", "STA"], ["hex-number", "$8000"], + ["op-code", "STA"], ["hex-number", "#$1"], + ["op-code", "LDX"], ["binary-number", "#%10001010"] +] + +---------------------------------------------------- + +Check for numbers diff --git a/tests/languages/asm65ce02/opcode_feature.test b/tests/languages/asm65ce02/opcode_feature.test new file mode 100644 index 0000000000..174d305333 --- /dev/null +++ b/tests/languages/asm65ce02/opcode_feature.test @@ -0,0 +1,465 @@ +adc +and +asl +asr +aug +bbr0 +bbr1 +bbr2 +bbr3 +bbr4 +bbr5 +bbr6 +bbr7 +bbs0 +bbs1 +bbs2 +bbs3 +bbs4 +bbs5 +bbs6 +bbs7 +bcc +bcs +beq +bit +bmi +bne +bpl +bra +brk +bvc +bvs +clc +cld +cle +cli +clv +cmp +cpx +cpy +cpz +dec +dew +dex +dey +eor +inc +inw +inx +iny +jmp +jsr +lda +ldx +ldy +ldz +lsr +neg +nop +ora +pha +php +phx +phy +phz +pla +plp +plx +ply +plz +rmb0 +rmb1 +rmb2 +rmb3 +rmb4 +rmb5 +rmb6 +rmb7 +rol +ror +rti +rtn +rts +sbc +sec +sed +see +sei +smb0 +smb1 +smb2 +smb3 +smb4 +smb5 +smb6 +smb7 +sta +stx +sty +stz +tab +tax +tay +taz +tba +trb +tsb +tsx +txa +txs +tsy +tya +tys +tza +ADC +AND +ASL +ASR +AUG +BBR0 +BBR1 +BBR2 +BBR3 +BBR4 +BBR5 +BBR6 +BBR7 +BBS0 +BBS1 +BBS2 +BBS3 +BBS4 +BBS5 +BBS6 +BBS7 +BCC +BCS +BEQ +BIT +BMI +BNE +BPL +BRA +BRK +BVC +BVS +CLC +CLD +CLE +CLI +CLV +CMP +CPX +CPY +CPZ +DEC +DEW +DEX +DEY +EOR +INC +INW +INX +INY +JMP +JSR +LDA +LDX +LDY +LDZ +LSR +NEG +NOP +ORA +PHA +PHP +PHX +PHY +PHZ +PLA +PLP +PLX +PLY +PLZ +RMB0 +RMB1 +RMB2 +RMB3 +RMB4 +RMB5 +RMB6 +RMB7 +ROL +ROR +RTI +RTN +RTS +SBC +SEC +SED +SEE +SEI +SMB0 +SMB1 +SMB2 +SMB3 +SMB4 +SMB5 +SMB6 +SMB7 +STA +STX +STY +STZ +TAB +TAX +TAY +TAZ +TBA +TRB +TSB +TSX +TXA +TXS +TSY +TYA +TYS +TZA + +---------------------------------------------------- + +[ + ["op-code", "adc"], + ["op-code", "and"], + ["op-code", "asl"], + ["op-code", "asr"], + ["op-code", "aug"], + ["op-code", "bbr0"], + ["op-code", "bbr1"], + ["op-code", "bbr2"], + ["op-code", "bbr3"], + ["op-code", "bbr4"], + ["op-code", "bbr5"], + ["op-code", "bbr6"], + ["op-code", "bbr7"], + ["op-code", "bbs0"], + ["op-code", "bbs1"], + ["op-code", "bbs2"], + ["op-code", "bbs3"], + ["op-code", "bbs4"], + ["op-code", "bbs5"], + ["op-code", "bbs6"], + ["op-code", "bbs7"], + ["op-code", "bcc"], + ["op-code", "bcs"], + ["op-code", "beq"], + ["op-code", "bit"], + ["op-code", "bmi"], + ["op-code", "bne"], + ["op-code", "bpl"], + ["op-code", "bra"], + ["op-code", "brk"], + ["op-code", "bvc"], + ["op-code", "bvs"], + ["op-code", "clc"], + ["op-code", "cld"], + ["op-code", "cle"], + ["op-code", "cli"], + ["op-code", "clv"], + ["op-code", "cmp"], + ["op-code", "cpx"], + ["op-code", "cpy"], + ["op-code", "cpz"], + ["op-code", "dec"], + ["op-code", "dew"], + ["op-code", "dex"], + ["op-code", "dey"], + ["op-code", "eor"], + ["op-code", "inc"], + ["op-code", "inw"], + ["op-code", "inx"], + ["op-code", "iny"], + ["op-code", "jmp"], + ["op-code", "jsr"], + ["op-code", "lda"], + ["op-code", "ldx"], + ["op-code", "ldy"], + ["op-code", "ldz"], + ["op-code", "lsr"], + ["op-code", "neg"], + ["op-code", "nop"], + ["op-code", "ora"], + ["op-code", "pha"], + ["op-code", "php"], + ["op-code", "phx"], + ["op-code", "phy"], + ["op-code", "phz"], + ["op-code", "pla"], + ["op-code", "plp"], + ["op-code", "plx"], + ["op-code", "ply"], + ["op-code", "plz"], + ["op-code", "rmb0"], + ["op-code", "rmb1"], + ["op-code", "rmb2"], + ["op-code", "rmb3"], + ["op-code", "rmb4"], + ["op-code", "rmb5"], + ["op-code", "rmb6"], + ["op-code", "rmb7"], + ["op-code", "rol"], + ["op-code", "ror"], + ["op-code", "rti"], + ["op-code", "rtn"], + ["op-code", "rts"], + ["op-code", "sbc"], + ["op-code", "sec"], + ["op-code", "sed"], + ["op-code", "see"], + ["op-code", "sei"], + ["op-code", "smb0"], + ["op-code", "smb1"], + ["op-code", "smb2"], + ["op-code", "smb3"], + ["op-code", "smb4"], + ["op-code", "smb5"], + ["op-code", "smb6"], + ["op-code", "smb7"], + ["op-code", "sta"], + ["op-code", "stx"], + ["op-code", "sty"], + ["op-code", "stz"], + ["op-code", "tab"], + ["op-code", "tax"], + ["op-code", "tay"], + ["op-code", "taz"], + ["op-code", "tba"], + ["op-code", "trb"], + ["op-code", "tsb"], + ["op-code", "tsx"], + ["op-code", "txa"], + ["op-code", "txs"], + ["op-code", "tsy"], + ["op-code", "tya"], + ["op-code", "tys"], + ["op-code", "tza"], + ["op-code", "ADC"], + ["op-code", "AND"], + ["op-code", "ASL"], + ["op-code", "ASR"], + ["op-code", "AUG"], + ["op-code", "BBR0"], + ["op-code", "BBR1"], + ["op-code", "BBR2"], + ["op-code", "BBR3"], + ["op-code", "BBR4"], + ["op-code", "BBR5"], + ["op-code", "BBR6"], + ["op-code", "BBR7"], + ["op-code", "BBS0"], + ["op-code", "BBS1"], + ["op-code", "BBS2"], + ["op-code", "BBS3"], + ["op-code", "BBS4"], + ["op-code", "BBS5"], + ["op-code", "BBS6"], + ["op-code", "BBS7"], + ["op-code", "BCC"], + ["op-code", "BCS"], + ["op-code", "BEQ"], + ["op-code", "BIT"], + ["op-code", "BMI"], + ["op-code", "BNE"], + ["op-code", "BPL"], + ["op-code", "BRA"], + ["op-code", "BRK"], + ["op-code", "BVC"], + ["op-code", "BVS"], + ["op-code", "CLC"], + ["op-code", "CLD"], + ["op-code", "CLE"], + ["op-code", "CLI"], + ["op-code", "CLV"], + ["op-code", "CMP"], + ["op-code", "CPX"], + ["op-code", "CPY"], + ["op-code", "CPZ"], + ["op-code", "DEC"], + ["op-code", "DEW"], + ["op-code", "DEX"], + ["op-code", "DEY"], + ["op-code", "EOR"], + ["op-code", "INC"], + ["op-code", "INW"], + ["op-code", "INX"], + ["op-code", "INY"], + ["op-code", "JMP"], + ["op-code", "JSR"], + ["op-code", "LDA"], + ["op-code", "LDX"], + ["op-code", "LDY"], + ["op-code", "LDZ"], + ["op-code", "LSR"], + ["op-code", "NEG"], + ["op-code", "NOP"], + ["op-code", "ORA"], + ["op-code", "PHA"], + ["op-code", "PHP"], + ["op-code", "PHX"], + ["op-code", "PHY"], + ["op-code", "PHZ"], + ["op-code", "PLA"], + ["op-code", "PLP"], + ["op-code", "PLX"], + ["op-code", "PLY"], + ["op-code", "PLZ"], + ["op-code", "RMB0"], + ["op-code", "RMB1"], + ["op-code", "RMB2"], + ["op-code", "RMB3"], + ["op-code", "RMB4"], + ["op-code", "RMB5"], + ["op-code", "RMB6"], + ["op-code", "RMB7"], + ["op-code", "ROL"], + ["op-code", "ROR"], + ["op-code", "RTI"], + ["op-code", "RTN"], + ["op-code", "RTS"], + ["op-code", "SBC"], + ["op-code", "SEC"], + ["op-code", "SED"], + ["op-code", "SEE"], + ["op-code", "SEI"], + ["op-code", "SMB0"], + ["op-code", "SMB1"], + ["op-code", "SMB2"], + ["op-code", "SMB3"], + ["op-code", "SMB4"], + ["op-code", "SMB5"], + ["op-code", "SMB6"], + ["op-code", "SMB7"], + ["op-code", "STA"], + ["op-code", "STX"], + ["op-code", "STY"], + ["op-code", "STZ"], + ["op-code", "TAB"], + ["op-code", "TAX"], + ["op-code", "TAY"], + ["op-code", "TAZ"], + ["op-code", "TBA"], + ["op-code", "TRB"], + ["op-code", "TSB"], + ["op-code", "TSX"], + ["op-code", "TXA"], + ["op-code", "TXS"], + ["op-code", "TSY"], + ["op-code", "TYA"], + ["op-code", "TYS"], + ["op-code", "TZA"] +] + +---------------------------------------------------- + +Check for opcodes diff --git a/tests/languages/asm65ce02/punctuation_feature.test b/tests/languages/asm65ce02/punctuation_feature.test new file mode 100644 index 0000000000..b0a75ee6f6 --- /dev/null +++ b/tests/languages/asm65ce02/punctuation_feature.test @@ -0,0 +1,10 @@ +( ) , : + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ","], + ["punctuation", ":"] +] diff --git a/tests/languages/asm65ce02/register_feature.test b/tests/languages/asm65ce02/register_feature.test new file mode 100644 index 0000000000..de914ed980 --- /dev/null +++ b/tests/languages/asm65ce02/register_feature.test @@ -0,0 +1,18 @@ +LDA $8000,z +ASL A + +---------------------------------------------------- + +[ + ["op-code", "LDA"], + ["hex-number", "$8000"], + ["punctuation", ","], + ["register", "z"], + + ["op-code", "ASL"], + ["register", "A"] +] + +---------------------------------------------------- + +Check for registers diff --git a/tests/languages/asm65ce02/string_feature.test b/tests/languages/asm65ce02/string_feature.test new file mode 100644 index 0000000000..0205074449 --- /dev/null +++ b/tests/languages/asm65ce02/string_feature.test @@ -0,0 +1,12 @@ +.include "header.asm" + +------------------------- + +[ + ["directive", ".include"], + ["string", "\"header.asm\""] +] + +------------------------- + +Check for strings