From faad4c5752ee01186840c0703da731e1607eb871 Mon Sep 17 00:00:00 2001 From: Dreaded_X Date: Mon, 18 Jan 2021 18:01:18 +0100 Subject: [PATCH] Added platform specific fast put_char and put_string routines --- include/console.h | 2 ++ src/console.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/include/console.h b/include/console.h index 01d792b..263c19b 100644 --- a/include/console.h +++ b/include/console.h @@ -5,3 +5,5 @@ char get_char(); void put_string(char* s); +void put_char_fast(char c); +void put_string_fast(char* s); diff --git a/src/console.c b/src/console.c index f3ac80e..badb5c6 100644 --- a/src/console.c +++ b/src/console.c @@ -21,9 +21,37 @@ void put_char(char c) __naked { __endasm; } +void put_char_fast(char c) __naked { + c; + __asm + conout: + in a, (0x03) + and #0x01 + jp z, debug + + ld iy, #2 + add iy, sp + ld a, 0(iy) + + out (0x02), a + ret + debug: + ld a, #0 + out (0xFF), a + jp conout + __endasm; +} + void put_string(char* s) { while (*s) { put_char(*s); s++; } } + +void put_string_fast(char* s) { + while (*s) { + put_char_fast(*s); + s++; + } +}