From 2f9d38f9f9d6f17bc274934b23915417012eeed8 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Fri, 29 May 2020 22:38:34 -0400 Subject: 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. --- test/hello-world.s | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'test/hello-world.s') 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 +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 -- cgit v1.2.3-13-gbd6f