From 071edf621a6722f94027f37720a5a5f73d9696c0 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Tue, 17 Mar 2020 15:07:20 -0400 Subject: Revamped the opcode table, made the emulator more efficient, and ported SuBEditor to C. I revamped the opcode table to add another prefix bit for the addressing mode, finally giving access to all addresses, without wasting any bytes. I made the stack based operations more efficient, by sort of applying Duff's device to it. And I ported SuBEditor to C, to make it easier for me to figure out how to implement SuBAsm. --- programs/subasm-2.s | 151 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 programs/subasm-2.s (limited to 'programs/subasm-2.s') diff --git a/programs/subasm-2.s b/programs/subasm-2.s new file mode 100644 index 0000000..f77116b --- /dev/null +++ b/programs/subasm-2.s @@ -0,0 +1,151 @@ +; SuBAsm +; The Sux Bootstrapped Assembler. +; +; by mr b0nk 500 + + +.org $A000 +; String Constants. +prg_name: + .byte "SuBAsm" +ver_txt: + .byte ", version " +ver_num: + .byte "0.1" + +; Directives. +dir: + .byte "org" + .byte "byte" + .byte "word" + .byte "dword" + .byte "qword" +tok: + .byte '.' + .byte '#' + .byte '$' + .byte '%' + .byte '(' + .byte ')' + .byte ',' + +mne: + .byte "AAB" + .byte "ABA" + .byte "ADC" + .byte "AND" + .byte "ARB" + .byte "ASR" + .byte "BCC" + .byte "BCS" + .byte "BEQ" + .byte "BNE" + .byte "BNG" + .byte "BPO" + .byte "BRK" + .byte "BVC" + .byte "BVS" + .byte "CAB" + .byte "CLC" + .byte "CLI" + .byte "CLV" + .byte "CMP" + .byte "CPB" + .byte "CPS" + .byte "CPX" + .byte "CPY" + .byte "DAB" + .byte "DEB" + .byte "DEC" + .byte "DEX" + .byte "DEY" + .byte "DIV" + .byte "ENT" + .byte "INB" + .byte "INC" + .byte "INX" + .byte "INY" + .byte "JMP" + .byte "JSL" + .byte "JSR" + .byte "LDA" + .byte "LDB" + .byte "LDX" + .byte "LDY" + .byte "LLB" + .byte "LRB" + .byte "LSL" + .byte "LSR" + .byte "MAB" + .byte "MUL" + .byte "NOP" + .byte "OAB" + .byte "ORA" + .byte "PHA" + .byte "PHB" + .byte "PHP" + .byte "PHX" + .byte "PHY" + .byte "PLA" + .byte "PLB" + .byte "PLP" + .byte "PLX" + .byte "PLY" + .byte "RLB" + .byte "ROL" + .byte "ROR" + .byte "RRB" + .byte "RTI" + .byte "RTL" + .byte "RTS" + .byte "SAB" + .byte "SBC" + .byte "SEC" + .byte "SEI" + .byte "STA" + .byte "STB" + .byte "STT" + .byte "STX" + .byte "STY" + .byte "TAB" + .byte "TAX" + .byte "TAY" + .byte "TBA" + .byte "TSX" + .byte "TXA" + .byte "TXS" + .byte "TXY" + .byte "TYA" + .byte "TYX" + .byte "WAI" + .byte "XAB" + .byte "XOR" + +; Start of program code. +.org $8600 +subasm: + ldb #0 + lda.w #tok + sta.q ptr2 + tba + jsl chk_tok + + jsl chk_mne +chk_tok: + phy #2 + txy + lda (ptr6), y + cmp (ptr2), y + ply #2 + cpx #7 + beq tok_false +tok_true: + inb +tok_false: + stb f +tok_end: + ldb #0 + rtl + +chk_mne: + ply #2 -- cgit v1.2.3-13-gbd6f