From e0f58c262a7e481b41912f8f050410eabf1f783e Mon Sep 17 00:00:00 2001 From: "matthias@rpi" Date: Thu, 9 Nov 2023 12:06:48 +0100 Subject: [PATCH] add print slow --- programs/print_slow.s65 | 46 +++++++++++++++++++++++++++++++++++++++++ programs/printer.s65 | 2 +- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 programs/print_slow.s65 diff --git a/programs/print_slow.s65 b/programs/print_slow.s65 new file mode 100644 index 0000000..62b8a7d --- /dev/null +++ b/programs/print_slow.s65 @@ -0,0 +1,46 @@ + +.ifndef INCLUDE_PRINT_SLOW +INCLUDE_PRINT_SLOW = 1 + +.include "programs/sleep.s65" +.include "system/lcd.s65" + + +;******************************************************************************** +; @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 + jsr lcd_char + 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 + jsr lcd_clear + lda #.LOBYTE(message) + sta ARG0 + lda #.HIBYTE(message) + sta ARG1 + phx + ldx #time_cs + jsr print_slow + plx +.endmacro + +.endif ; guard diff --git a/programs/printer.s65 b/programs/printer.s65 index 1a1e64c..25aa2ec 100644 --- a/programs/printer.s65 +++ b/programs/printer.s65 @@ -13,4 +13,4 @@ printer: jeq return_home jsr lcd_char bra @printer_loop -.endif +.endif ; guard