2013-04-10 21:29:02 -07:00
|
|
|
; goodbyeworld.s for C= 8-bit machines, ca65 assembler format.
|
|
|
|
|
; String printing limited to strings of 256 characters or less.
|
|
|
|
|
|
|
|
|
|
a_cr = $0d ; Carriage return.
|
2019-09-12 10:33:56 -07:00
|
|
|
bsout = $ffd2 ; C64 KERNEL ROM, output a character to current device.
|
2018-06-22 20:57:24 +00:00
|
|
|
; use $fded for Apple 2
|
2013-04-10 21:29:02 -07:00
|
|
|
.code
|
|
|
|
|
|
|
|
|
|
ldx #0 ; Starting index 0 in X register.
|
|
|
|
|
printnext:
|
|
|
|
|
lda text,x ; Get character from string.
|
|
|
|
|
beq done ; If we read a 0 we're done.
|
|
|
|
|
jsr bsout ; Output character.
|
|
|
|
|
inx ; Increment index to next character.
|
|
|
|
|
bne printnext ; Repeat if index doesn't overflow to 0.
|
|
|
|
|
done:
|
|
|
|
|
rts ; Return from subroutine.
|
|
|
|
|
|
|
|
|
|
.rodata
|
|
|
|
|
|
|
|
|
|
text:
|
2015-11-18 06:14:39 +00:00
|
|
|
.byte "Hello world!", a_cr, 0
|