diff options
Diffstat (limited to 'test/hello-world.s')
-rw-r--r-- | test/hello-world.s | 22 |
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 |