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/utils.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/utils.s')
-rw-r--r-- | programs/sub-suite/utils.s | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/programs/sub-suite/utils.s b/programs/sub-suite/utils.s index 046164a..3ab948b 100644 --- a/programs/sub-suite/utils.s +++ b/programs/sub-suite/utils.s @@ -176,7 +176,7 @@ isdelm2: @loop: ldb dtab2, x ; Get the compare value. beq @other ; We hit the end of the table, so check for the others. - cab ; Are they the same? + cmp b ; Are they the same? beq @r1 ; Yes, so return 1. inx ; No, so increment the table index. bra @loop ; Keep looping. @@ -202,11 +202,11 @@ isdelm2: isdelm: ldx #0 ; Reset X. - stx a ; Reset the shift value. + stx rega ; Reset the shift value. @loop: ldb dtab, x ; Get the compare value. beq @other ; We hit the end of the table, so check for the others. - cab ; Are they the same? + cmp b ; Are they the same? beq @rshft ; Yes, so return 1 << index. inx ; No, so increment the table index. bra @loop ; Keep looping. @@ -222,10 +222,10 @@ isdelm: lda #0 ; Return 0. rts ; End of isdelm. @rshft: - stx a ; Save the shift value. + stx rega ; Save the shift value. ldx #0 ; Reset X. lda #1 ; Set up the bitshift. - lsl a ; Return 1 << X. + lsl rega ; Return 1 << X. rts ; End of isdelm. @@ -235,7 +235,7 @@ get_ptok: @loop: ldb ptok_tab, x ; Get the compare value. beq @other ; We hit the end of the table, so check for the others. - cab ; Are they the same? + cmp b ; Are they the same? beq @rtab ; Yes, so return X. inx ; No, so increment the table index. bra @loop ; Keep looping. |