summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2020-04-09 02:06:50 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2020-04-09 02:06:50 -0400
commitc5150ee31f07208422f1435de9b35a0d0168cbb5 (patch)
tree78150bf0339cf81401c00973f96c94a3c231015e /test
parent59dc46ca8fe1eb6f98abb98fe8579aeaedd2ff15 (diff)
Completely changed the assembler.
It now has a lexer/tokenizer, along with a parser. I have also made the emulator even smaller.
Diffstat (limited to 'test')
-rw-r--r--test/fib-new.s46
-rw-r--r--test/lex.s40
-rw-r--r--test/reg-transfer.s23
3 files changed, 72 insertions, 37 deletions
diff --git a/test/fib-new.s b/test/fib-new.s
index 43538a0..ed0aa50 100644
--- a/test/fib-new.s
+++ b/test/fib-new.s
@@ -7,59 +7,57 @@
; Variables for thread 0.
.org $0
x:
- .qword $0
+ .byte $0
y:
- .qword $0
+ .byte $0
z:
- .qword $0
+ .byte $0
; Variables for thread 1.
x2:
- .qword $0
+ .byte $0
y2:
- .qword $0
+ .byte $0
z2:
- .qword $0
+ .byte $0
.org $1000
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 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
+ 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
bcs start ; Start all over again, if the carry flag was set.
jmp fib ; Otherwise, keep looping.
.org $2000
init2:
cps ; Clear the Processor Status register.
-
start2:
lda #$0 ; Clear the accumulator.
ldy #$1 ; y2=1.
- sty.q y2 ; Store y into memory.
+ sty 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
+ ldx x2 ; Output the value of x2.
+ adc y2 ; Add x2 with y2.
+ sta z2 ; z2=x2+y2
+ ldy y2
+ sty x2 ; x2=y2.
+ sta y2 ; y2=z2.
+ lda x2
bcs start2 ; Start all over again, if the carry flag was set.
jmp fib2 ; Otherwise, keep looping.
diff --git a/test/lex.s b/test/lex.s
new file mode 100644
index 0000000..543a3d8
--- /dev/null
+++ b/test/lex.s
@@ -0,0 +1,40 @@
+; aaaaaaaaaaaaaaaaa
+SYM = $10
+SYM1 = 10
+SYM2 = %00000010
+.org $A000
+; String Literals/Constants.
+tok:
+ .byte "dab"
+msg:
+ .byte "oof, you divided a, and b on me.\n"
+string:
+ .byte "Please, type something.\n"
+string2:
+ .byte "You typed, "
+.org $1000
+lex:
+ .byte $0
+.org $2000
+lex2:
+ .qword lex
+cmd_buf:
+ .word $0
+
+.org $8000
+reset:
+ cps ; cool, and eboc
+ lda #SYM ; nice symbols
+ sta lex ; great label
+ sta (lex2), y ; the pointers are cia niggers
+ sta (lex2, x) ; >mfw pointer to array is accessed as a pointer array
+ sta (lex2) ; normal pointer
+ sta lex, y ; arrays are good
+ sta lex, x ; same with this one
+ sta $1000 ; lol
+ lda.w #cmd_buf+8;
+
+a
+.org $A000
+v
+q
diff --git a/test/reg-transfer.s b/test/reg-transfer.s
index 580020c..abedc5b 100644
--- a/test/reg-transfer.s
+++ b/test/reg-transfer.s
@@ -2,21 +2,18 @@
;
; by mr b0nk 500 <b0nk @b0nk.xyz>
-cps
-inc ; Increment the accumulator.
-tay ; Transfer the accumulator to the y register.
-tax ; Do the same thing, but with the x register.
-jmp $1 ; Loop forever.
-
.org $8000
-cps
-inc ; Increment the accumulator.
-tay ; Transfer the accumulator to the y register.
-tax ; Do the same thing, but with the x register.
-jmp $1 ; Loop forever.
+reset:
+ cps
+bench:
+ inc ; Increment the accumulator.
+ tay ; Transfer the accumulator to the y register.
+ tax ; Do the same thing, but with the x register.
+ tab ;
+ jmp bench ; Loop forever.
-.org $FF50
-.qword $8000
+.org $FFC0
+.qword reset
; Execute the program.
done