; Hello world. ; Writen in Sux assembly by mr b0nk 500 ; Initialize, and declare variables. .org $8000 string: .byte "Hello, world!\n" ; Text buffer. .org $2000 buffer: ; Get CPU into a known state. .org $0 reset: cps ; Reset the processor status. ldx.w #$FFFF ; Set up the stack pointer. txs ; Reset the stack pointer. ; Start of main program. start: ldx.w #$0 ; Reset x. jmp print 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. ; 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. 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 spin: nop nop nop jmp spin .org $FFC0 .qword reset .org $FF50 .qword spin .qword spin .qword spin .qword spin .qword spin .qword spin .qword spin done