summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2020-08-30 12:44:21 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2020-08-30 12:44:21 -0400
commit4ed07ca38b99abdca750c6612c512f30965f1714 (patch)
treec093a404b40f9e2c8d02a8d41eed99087483ced3 /test
parentd31aed21b27fbda68abe088d657ba18455607cc4 (diff)
- Did some more work on SuBAsm's lexer.
- Optimized the memory read, and write functions. - Made the emulator faster, and cleaner in general.
Diffstat (limited to 'test')
-rw-r--r--test/asr.s16
-rw-r--r--test/fib-new.s45
-rw-r--r--test/fib.s48
-rw-r--r--test/load-store.s22
-rw-r--r--test/nop.s2
-rw-r--r--test/reg-transfer.s2
6 files changed, 77 insertions, 58 deletions
diff --git a/test/asr.s b/test/asr.s
index b251a84..ffcd46b 100644
--- a/test/asr.s
+++ b/test/asr.s
@@ -2,23 +2,23 @@
;
; Writen by mr b0nk 500 <b0nk@b0nk.xyz>
+.org $8000
reset:
cps
start:
clc
- lda #0
- sbc.w #$FFFF
- ldb #0
- deb
+ and #0
+ dec
+ tab
+ lsl #$10
signshft:
asr #1
- cab
+ cmp b
beq start
- jmp signshft
+ bra signshft
.org $FFC0
.qword reset
a
-done
-
+d
diff --git a/test/fib-new.s b/test/fib-new.s
index 5a8ae83..6b0b717 100644
--- a/test/fib-new.s
+++ b/test/fib-new.s
@@ -5,21 +5,21 @@
; by mr b0nk 500 <b0nk@b0nk.xyz>
; Variables for thread 0.
-.org $0
-x:
- .byte $0
-y:
- .byte $0
-z:
- .byte $0
+.org 0
+x1:
+ .res 1
+y1:
+ .res 1
+z1:
+ .res 1
; Variables for thread 1.
x2:
- .byte $0
+ .res 1
y2:
- .byte $0
+ .res 1
z2:
- .byte $0
+ .res 1
.org $1000
init:
@@ -27,21 +27,21 @@ init:
start:
lda #$0 ; Clear the accumulator.
ldy #$1 ; y=1.
- sty y ; Store y into memory.
+ sty y1 ; Store y into memory.
fib:
ldx #$0 ; x=0.
- ldx x ; Output the value of x.
- adc y ; Add x with y.
- sta z ; z=x+y
- ldy y
- sty x ; x=y.
- sta y ; y=z.
- lda x
+ ldx x1 ; Output the value of x.
+ adc y1 ; Add x with y.
+ sta z1 ; z=x+y
+ ldy y1
+ sty x1 ; x=y.
+ sta y1 ; y=z.
+ lda x1
bcs start ; Start all over again, if the carry flag was set.
- jmp fib ; Otherwise, keep looping.
+ bra fib ; Otherwise, keep looping.
+
-.org $2000
init2:
cps ; Clear the Processor Status register.
start2:
@@ -59,7 +59,7 @@ fib2:
sta y2 ; y2=z2.
lda x2
bcs start2 ; Start all over again, if the carry flag was set.
- jmp fib2 ; Otherwise, keep looping.
+ bra fib2 ; Otherwise, keep looping.
.org $FFC0
.qword init
@@ -68,5 +68,4 @@ fib2:
.qword init2
; Execute the program.
a
-done
-
+d
diff --git a/test/fib.s b/test/fib.s
index dd8c618..65912ad 100644
--- a/test/fib.s
+++ b/test/fib.s
@@ -5,45 +5,44 @@
; by mr b0nk 500 <b0nk@b0nk.xyz>
; Variables for thread 0.
-.org $1000
-x:
- .qword $0
-y:
- .qword $0
-z:
- .qword $0
+.org 0
+x1:
+ .res 8
+y1:
+ .res 8
+z1:
+ .res 8
; Variables for thread 1.
-.org $2000
x2:
- .qword $0
+ .res 8
y2:
- .qword $0
+ .res 8
z2:
- .qword $0
+ .res 8
-.org $0
+.org $8000
init:
cps ; Clear the Processor Status register.
start:
lda #$0 ; Clear the accumulator.
ldy #$1 ; y=1.
- sty.q y ; Store y into memory.
+ sty.q y1 ; 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
+ ldx.q x1 ; Output the value of x.
+ adc.q y1 ; Add x with y.
+ sta.q z1 ; z=x+y
+ ldy.q y1
+ sty.q x1 ; x=y.
+ sta.q y1 ; y=z.
+ lda.q x1
bcs start ; Start all over again, if the carry flag was set.
- jmp fib ; Otherwise, keep looping.
+ bra fib ; Otherwise, keep looping.
+
-.org $8000
init2:
cps ; Clear the Processor Status register.
@@ -62,12 +61,11 @@ fib2:
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.
+ bra fib2 ; Otherwise, keep looping.
; Set up the thread vectors.
.org $FF50
.qword init2
; Execute the program.
a
-done
-
+d
diff --git a/test/load-store.s b/test/load-store.s
new file mode 100644
index 0000000..60a5a8f
--- /dev/null
+++ b/test/load-store.s
@@ -0,0 +1,22 @@
+.org $8000
+
+reset:
+ cps
+ ldx.w #$FFFF
+ txs
+@clear:
+ and #0
+ tax
+ tab
+ deb
+@loop:
+ lsl #8
+ lda #$FF
+ cmp b
+ beq @clear
+ bra @loop
+
+.org $FFC0
+.qword reset
+a
+d
diff --git a/test/nop.s b/test/nop.s
index 8fbb14f..8d0d75d 100644
--- a/test/nop.s
+++ b/test/nop.s
@@ -7,6 +7,6 @@ nop_loop:
nop
nop
nop
- jmp nop_loop
+ bra nop_loop
a
done
diff --git a/test/reg-transfer.s b/test/reg-transfer.s
index b9d1280..754940d 100644
--- a/test/reg-transfer.s
+++ b/test/reg-transfer.s
@@ -10,7 +10,7 @@ bench:
tay ; Transfer the accumulator to the y register.
tax ; Do the same thing, but with the x register.
tab ;
- jmp bench ; Loop forever.
+ bra bench ; Loop forever.
.org $FFC0
.qword reset