summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2020-08-08 18:11:35 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2020-08-08 18:11:35 -0400
commitf16af793a58a9f398fc598a0c129e3bb90eb61f6 (patch)
tree2f674574f2955a1bc52ee3a6818516226833ea9b /test
parent1ec19679b3db209429b0897f6ccda6d09d018a70 (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 'test')
-rw-r--r--test/fib2.s2
-rw-r--r--test/ind-addr.s5
-rw-r--r--test/popcnt2.s2
3 files changed, 4 insertions, 5 deletions
diff --git a/test/fib2.s b/test/fib2.s
index 9bb2406..ee58697 100644
--- a/test/fib2.s
+++ b/test/fib2.s
@@ -11,7 +11,7 @@ start:
clc ;
fib:
tya ;
- aab ; Add x with y. But did we also carry over?
+ adc b ; Add x with y. But did we also carry over?
bcs start ; Yes, so restart.
tax ;
tya ;
diff --git a/test/ind-addr.s b/test/ind-addr.s
index 005c016..aa4686b 100644
--- a/test/ind-addr.s
+++ b/test/ind-addr.s
@@ -14,11 +14,11 @@ main:
jmp main
rotate_left:
- rlb
+ rol b
rts
rotate_right:
- rrb
+ ror b
rts
.org $FFC0
@@ -26,4 +26,3 @@ rotate_right:
a
d
-
diff --git a/test/popcnt2.s b/test/popcnt2.s
index aaa4743..503b074 100644
--- a/test/popcnt2.s
+++ b/test/popcnt2.s
@@ -10,7 +10,7 @@ popcnt:
tab ; Place the value in the B register.
deb ; Decrement the temp value by one.
iny ; Increment the bit count.
- aba ; AND value with value-1.
+ and b ; AND value with value-1.
bra @loop ; Keep looping.
@end:
tya ; Return the bit count.