summaryrefslogtreecommitdiff
path: root/test/add-sub.s
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2020-05-18 13:14:08 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2020-05-18 13:14:08 -0400
commit5dd788d5a1acc7f23835882420d50e9f020728ac (patch)
tree2b9226863fc44e5bce88eb85be1f0ee97ede1922 /test/add-sub.s
parent545bb8591e8003912b6c6b494acefd74e6b3abfd (diff)
Did alot of stuff while I was up at the family trailer.
- Moved the large enums, and large tables into separate header files. - Added enums for implementing the base extension - Fixed a bug in the assembler. - Worked more on SuBAsm.
Diffstat (limited to 'test/add-sub.s')
-rw-r--r--test/add-sub.s27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/add-sub.s b/test/add-sub.s
new file mode 100644
index 0000000..694931d
--- /dev/null
+++ b/test/add-sub.s
@@ -0,0 +1,27 @@
+; Test adding, and subtracting.
+;
+; Written by mr b0nk 500 <b0nk@b0nk.xyz>
+
+; Main Program.
+.org 0
+reset:
+ cps ; Clear the processor status register.
+ ldx.w #$FFFF ; Reset the stack pointer.
+ txs ;
+ lsr #16 ; Reset A.
+ tab ; Reset B.
+ tax ; Reset X.
+up:
+ inc ; Increment the counter.
+ cmp #$FF ; Did the accumulator overflow?
+ bcs down ; Yes, so start decrementing.
+ jmp up ; No, so keep incrementing.
+down:
+ dec ; Did the accumulator underflow?
+ beq up ; Yes, so start incrementing.
+ jmp down ; No, so keep decrementing.
+
+.org $FFC0
+.qword reset
+a
+d