summaryrefslogtreecommitdiff
path: root/test/hello-world.s
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2020-05-29 22:38:34 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2020-05-29 22:38:34 -0400
commit2f9d38f9f9d6f17bc274934b23915417012eeed8 (patch)
treeb72aff709261d5e22f026835191eec9b73a77ff5 /test/hello-world.s
parent47cb4ad67be723a4df8e6ccd3cad6be79e3e7765 (diff)
Make JSL, JSR absolute, and remove RTL.
The reason for doing this was because JSL, and RTL are redundent, as they both do the same thing as JSR, and RTS.
Diffstat (limited to 'test/hello-world.s')
-rw-r--r--test/hello-world.s22
1 files changed, 14 insertions, 8 deletions
diff --git a/test/hello-world.s b/test/hello-world.s
index 9138bc7..f3b540a 100644
--- a/test/hello-world.s
+++ b/test/hello-world.s
@@ -1,8 +1,12 @@
; Hello world.
; Writen in Sux assembly by mr b0nk 500 <b0nk@b0nk.xyz>
+status = $100 ; Status.
+scr = $101 ; Screen output.
+
+
; Initialize, and declare variables.
-.org $8000
+.org $A000
string:
.byte "Hello, world!\n"
@@ -12,7 +16,7 @@ buffer:
; Get CPU into a known state.
-.org $0
+.org $8000
reset:
cps ; Reset the processor status.
ldx.w #$FFFF ; Set up the stack pointer.
@@ -25,21 +29,22 @@ start:
line_count:
iny ; Increment the line count.
- cpy #$32
- beq spin ; Have we printed 50 lines?
- jmp start ; Keep looping until we have printed 50 lines.
+ cpy #50 ; Have we printed 50 lines?
+ beq disp ; Yes, so we're done.
+ jmp start ; No, so keep looping.
; Printing sub routine.
print:
lda string, x ; Get character at offset x.
beq line_count ; Did we find a null terminator?
- sta $C001 ; Print character.
+ sta scr ; Print character.
inx ; Increment offset.
jmp print ; Keep printing more characters.
; The other threads would clash, if we're running the same code.
; So, have them spin instead, please?
-.org $1000
+disp:
+ lda status
spin:
nop
nop
@@ -58,5 +63,6 @@ spin:
.qword spin
.qword spin
.qword spin
-done
+a
+d