diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2020-08-08 18:11:35 -0400 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2020-08-08 18:11:35 -0400 |
commit | f16af793a58a9f398fc598a0c129e3bb90eb61f6 (patch) | |
tree | 2f674574f2955a1bc52ee3a6818516226833ea9b /programs/sub-suite/subasm.s | |
parent | 1ec19679b3db209429b0897f6ccda6d09d018a70 (diff) |
- Refactored the opcode table, in order to make the
instruction formatting simpler.
- Refactored the instruction table of the emulator's
assembler, it now has two parts, the addressing mode
bits, and the base value.
The base value is what's used to generate the actual
opcode, with the addressing mode bits telling the
assembler what addressing modes this instruction
supports.
The reason for doing this was to use less space. For
comparison, the previous version used 870 bytes for
the instruction table, while the new version uses
only 222 bytes. The new version is nearly 4 times
smaller than the pervious version.
- The B register based ALU instructions now use their
own addressing mode, and are specified by using 'b'
as the operand for those instructions.
For example, to add the Accumulator with the B
register, you now use "ADC B" instead of "AAB".
Diffstat (limited to 'programs/sub-suite/subasm.s')
-rw-r--r-- | programs/sub-suite/subasm.s | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/programs/sub-suite/subasm.s b/programs/sub-suite/subasm.s index 0a7640d..ec58a40 100644 --- a/programs/sub-suite/subasm.s +++ b/programs/sub-suite/subasm.s @@ -21,7 +21,7 @@ subasm: jsr set_ptr ; deb ; Reset B. tba ; Reset A. - lda f ; Get the command ID. + lda regf ; Get the command ID. cmp #8 ; Is the command ID greater than the command count? bcs @end ; Yes, so we're done. lsl #1 ; No, so multiply the command ID by two. @@ -55,12 +55,12 @@ chk_shcmd: @loop: ldb (ptr2), y ; Are we at the end of the table? beq @false ; Yes, so return that we failed. - cab ; No, so did the character match? + cmp b ; No, so did the character match? beq @found ; Yes, so check if there are any arguments. iny ; No, so check the next command. bra @loop ; Keep looping. @found: - sty f ; Save the command ID. + sty regf ; Save the command ID. ldy #1 ; Check the next character in the command buffer. lda (ptr), y ; Is this the end of the buffer? beq @true ; Yes, so return that we succeded. @@ -105,7 +105,7 @@ chk_cmd: bra @loop ; Keep looping. @true: ldb idx1 ; Get the command ID. - stb f ; Return the command ID. + stb regf ; Return the command ID. ldb #1 ; Return true. bra @end ; We are done. @false: |