RosettaCodeData/Task/Repeat-a-string/6502-Assembly/repeat-a-string.6502

44 lines
598 B
Plaintext

CHROUT equ $FFD2 ;KERNAL call, prints the accumulator to the screen as an ascii value.
org $0801
db $0E,$08,$0A,$00,$9E,$20,$28,$32,$30,$36,$34,$29,$00,$00,$00
lda #>TestStr
sta $11
lda #<TestStr
sta $10
ldx #5 ;number of times to repeat
loop:
jsr PrintString
dex
bne loop
RTS ;RETURN TO BASIC
PrintString:
ldy #0
loop_PrintString:
lda ($10),y ;this doesn't actually increment the pointer itself, so we don't need to back it up.
beq donePrinting
jsr CHROUT
iny
jmp loop_PrintString
donePrinting:
rts
TestStr:
db "HA",0