summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2019-12-08 20:45:55 -0500
committermrb0nk500 <b0nk@b0nk.xyz>2019-12-08 20:45:55 -0500
commit3dfde833082fc66cededd0206ae5fc76162867b6 (patch)
tree70ab1961552731bf58c13e82f57199b817ef8c5f /test
parent1e3787256c8fb98c41e3263fe697f30557a895fe (diff)
Added support for resolving fixup labels.
AKA, referencing a label before it has been declared yet.
Diffstat (limited to 'test')
-rw-r--r--test/fib.s68
-rw-r--r--test/test-stack.s19
-rw-r--r--test/test-the-tests.s32
3 files changed, 60 insertions, 59 deletions
diff --git a/test/fib.s b/test/fib.s
index 9188a3c..40489ec 100644
--- a/test/fib.s
+++ b/test/fib.s
@@ -7,62 +7,62 @@
; Variables for thread 0.
.org $1000
x:
-.qword $0
+ .qword $0
y:
-.qword $0
+ .qword $0
z:
-.qword $0
+ .qword $0
; Variables for thread 1.
.org $2000
x2:
-.qword $0
+ .qword $0
y2:
-.qword $0
+ .qword $0
z2:
-.qword $0
+ .qword $0
.org $0
init:
-cps ; Clear the Processor Status register.
+ cps ; Clear the Processor Status register.
start:
-lda #$0 ; Clear the accumulator.
-ldy #$1 ; y=1.
-sty.q y ; Store y into memory.
+ lda #$0 ; Clear the accumulator.
+ ldy #$1 ; y=1.
+ sty.q y ; Store y into memory.
fib:
-ldx #$0 ; x=0.
-ldx.q x ; Output the value of x.
-adc.q y ; Add x with y.
-sta.q z ; z=x+y
-ldy.q y
-sty.q x ; x=y.
-sta.q y ; y=z.
-lda.q x
-bcs start ; Start all over again, if the carry flag was set.
-jmp fib ; Otherwise, keep looping.
+ ldx #$0 ; x=0.
+ ldx.q x ; Output the value of x.
+ adc.q y ; Add x with y.
+ sta.q z ; z=x+y
+ ldy.q y
+ sty.q x ; x=y.
+ sta.q y ; y=z.
+ lda.q x
+ bcs start ; Start all over again, if the carry flag was set.
+ jmp fib ; Otherwise, keep looping.
.org $8000
init2:
-cps ; Clear the Processor Status register.
+ cps ; Clear the Processor Status register.
start2:
-lda #$0 ; Clear the accumulator.
-ldy #$1 ; y2=1.
-sty.q y2 ; Store y into memory.
+ lda #$0 ; Clear the accumulator.
+ ldy #$1 ; y2=1.
+ sty.q y2 ; Store y into memory.
fib2:
-ldx #$0 ; x2=0.
-ldx.q x2 ; Output the value of x2.
-adc.q y2 ; Add x2 with y2.
-sta.q z2 ; z2=x2+y2
-ldy.q y2
-sty.q x2 ; x2=y2.
-sta.q y2 ; y2=z2.
-lda.q x2
-bcs start2 ; Start all over again, if the carry flag was set.
-jmp fib2 ; Otherwise, keep looping.
+ ldx #$0 ; x2=0.
+ ldx.q x2 ; Output the value of x2.
+ adc.q y2 ; Add x2 with y2.
+ sta.q z2 ; z2=x2+y2
+ ldy.q y2
+ sty.q x2 ; x2=y2.
+ sta.q y2 ; y2=z2.
+ lda.q x2
+ bcs start2 ; Start all over again, if the carry flag was set.
+ jmp fib2 ; Otherwise, keep looping.
; Set up the thread vectors.
.org $FF50
diff --git a/test/test-stack.s b/test/test-stack.s
index 88ed25c..5c7e0fd 100644
--- a/test/test-stack.s
+++ b/test/test-stack.s
@@ -1,10 +1,25 @@
init:
cps
+ldx.w #$FFFF
+txs
+ldx.d #$00
loop:
iax
-pha #$8
-ply #$8
+pha #$08
+ply #$08
jmp loop
+
+.org $FFC0
+.qword init
+.org $FF50
+.qword init
+.qword init
+.qword init
+.qword init
+.qword init
+.qword init
+.qword init
+
done
diff --git a/test/test-the-tests.s b/test/test-the-tests.s
index 314ed45..5f1e255 100644
--- a/test/test-the-tests.s
+++ b/test/test-the-tests.s
@@ -6,7 +6,7 @@ lstart:
lda #$01
lshft:
-lsl #$1
+lsl #$01
bcs rstart
jmp lshft
@@ -18,31 +18,17 @@ lsr #$1
bcs lstart
jmp rshft
-
-.org $8000
-init2:
-cps
-
-lstart2:
-lda #$01
-
-lshft2:
-lsl #$1
-bcs rstart2
-jmp lshft2
-
-rstart2:
-lda.q #$8000000000000000
-
-rshft2:
-lsr #$1
-bcs lstart2
-jmp rshft2
-
.org $FFC0
.qword init
.org $FF50
-.qword init2
+.qword init
+.qword init
+.qword init
+.qword init
+.qword init
+.qword init
+.qword init
+.qword init
done