Looping strings
Posted: Fri Jan 15, 2021 9:59 am
Hi there,
I've wanted to know how to loop strings. I've tried using the register B as what "carries" the loop. I wrote my PrintString correctly, but I have no idea how to make the word "Test" constantly repeating.
Thank you.
I've wanted to know how to loop strings. I've tried using the register B as what "carries" the loop. I wrote my PrintString correctly, but I have no idea how to make the word "Test" constantly repeating.
Code: Select all
org &8100
PrintChar equ &BB5A
ld hl,Message
ld b, 10
call Loop
Message: db 'Test',0
PrintString:
ld a,(hl)
cp 0
ret z
inc hl
call PrintChar
jr PrintString
Loop:
dec b
call PrintString
cp 255
djnz Loop