summaryrefslogtreecommitdiff
path: root/programs
diff options
context:
space:
mode:
Diffstat (limited to 'programs')
-rw-r--r--programs/sub-suite/subeditor.s15
1 files changed, 9 insertions, 6 deletions
diff --git a/programs/sub-suite/subeditor.s b/programs/sub-suite/subeditor.s
index 4723b60..6e603ae 100644
--- a/programs/sub-suite/subeditor.s
+++ b/programs/sub-suite/subeditor.s
@@ -147,25 +147,28 @@ getchar:
print_str:
pha.q ; Preserve A.
phb.q ; Preserve B.
+ phx.q ; Preserve X.
and #0 ; Reset A.
- tba ; Reset B.
+ mov b, d ; Get the string pointer.
+ tax ; Reset X.
@loop:
mov regb, #1 ; Enable replace mode.
- and #0 ; Reset A.
- mov b, (d) ; Are we at the end of the string?
+ xor d, d ; Reset D.
+ mov d, (b+x) ; Are we at the end of the string?
beq @end ; Yes, so we're done.
jsr update_ptr ; No, so get the screen buffer index.
tay ; Save it in Y.
- tba ; Get the character back.
- inc d ; Increment the string pointer.
+ mov a, d ; Get the character back.
+ inx ; Increment the index.
jsr print_char ; Print the character.
bra @loop ; Keep looping.
@end:
stz regb ; Enable insert mode.
and #0 ; Reset A.
tab ; Reset B.
- pla.q ; Restore A.
+ plx.q ; Restore X.
plb.q ; Restore B.
+ pla.q ; Restore A.
rts ; End of print_str.