From fc0cdede5526d0ef606018d9233c43723f2442fc Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Tue, 16 Apr 2019 19:45:05 -0400 Subject: [PATCH] Move print(n)str from core to shell These routines had hardcoded references to ACIA and didn't belong to the core. --- parts/core.asm | 35 ----------------------------------- parts/shell.asm | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/parts/core.asm b/parts/core.asm index 9c4e957..3914a0d 100644 --- a/parts/core.asm +++ b/parts/core.asm @@ -176,41 +176,6 @@ parseHexPair: pop bc ret -; print null-terminated string pointed to by HL -printstr: - push af - push hl - -.loop: - ld a, (hl) ; load character to send - or a ; is it zero? - jr z, .end ; if yes, we're finished - call aciaPutC - inc hl - jr .loop - -.end: - pop hl - pop af - ret - -; print A characters from string that HL points to -printnstr: - push bc - push hl - - ld b, a -.loop: - ld a, (hl) ; load character to send - call aciaPutC - inc hl - djnz .loop - -.end: - pop hl - pop bc - ret - ; Compares strings pointed to by HL and DE up to A count of characters. If ; equal, Z is set. If not equal, Z is reset. strncmp: diff --git a/parts/shell.asm b/parts/shell.asm index 3044871..6b5217b 100644 --- a/parts/shell.asm +++ b/parts/shell.asm @@ -123,6 +123,41 @@ shellLoop: .prompt: .db "> ", 0 +; print null-terminated string pointed to by HL +printstr: + push af + push hl + +.loop: + ld a, (hl) ; load character to send + or a ; is it zero? + jr z, .end ; if yes, we're finished + SHELL_PUTC + inc hl + jr .loop + +.end: + pop hl + pop af + ret + +; print A characters from string that HL points to +printnstr: + push bc + push hl + + ld b, a +.loop: + ld a, (hl) ; load character to send + SHELL_PUTC + inc hl + djnz .loop + +.end: + pop hl + pop bc + ret + printcrlf: ld a, ASCII_CR SHELL_PUTC