6502-OS/programs/print_slow.s65

47 lines
1.1 KiB
Plaintext
Raw Normal View History

2023-11-09 12:06:48 +01:00
.ifndef INCLUDE_PRINT_SLOW
INCLUDE_PRINT_SLOW = 1
2023-12-08 22:56:35 +01:00
.include "system.h65"
.include "sleep.s65"
.include "lcd.h65"
2023-11-09 12:06:48 +01:00
2023-12-08 22:56:35 +01:00
.code
2023-11-09 12:06:48 +01:00
;********************************************************************************
; @function Print a null-terminated string
; @param ARG0-1: Address of the string to print
; @param x: time to sleep in centiseconds
;********************************************************************************
.proc print_slow
ldy #$00
@print_loop:
lda (ARG0),y
beq @print_end
phx
jsr sleep
plx
2023-12-08 22:56:35 +01:00
jsr lcd::print_char
2023-11-09 12:06:48 +01:00
iny
bra @print_loop
@print_end:
rts
.endproc
;********************************************************************************
; @macro Print a null-terminated string
; @param message: Address of the message
; @param time_cs: time to sleep in centiseconds
;********************************************************************************
.macro PrintSlow message,time_cs
2023-12-08 22:56:35 +01:00
jsr lcd::clear
2023-12-08 00:03:52 +01:00
lda #<message
2023-11-09 12:06:48 +01:00
sta ARG0
2023-12-08 00:03:52 +01:00
lda #>message
2023-11-09 12:06:48 +01:00
sta ARG1
phx
ldx #time_cs
jsr print_slow
plx
.endmacro
.endif ; guard