From 9dfc8f84bcc8b5ad4b50c16615a84b76cb7bedca Mon Sep 17 00:00:00 2001
From: Greg King <gregdk@users.sf.net>
Date: Tue, 1 Oct 2019 05:30:36 -0400
Subject: [PATCH 044/170] Fixed cgetc().
The GETIN function doesn't protect CPU registers.
---
libsrc/cx16/cgetc.s | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libsrc/cx16/cgetc.s b/libsrc/cx16/cgetc.s
index 14cad5f5..2c5ea76d 100644
--- a/libsrc/cx16/cgetc.s
+++ b/libsrc/cx16/cgetc.s
@@ -1,5 +1,5 @@
;
-; 2019-09-23, Greg King
+; 2019-10-01, Greg King
;
; char cgetc (void);
; /* Return a character from the keyboard. */
@@ -34,7 +34,9 @@ L1: lda KEY_COUNT
L3: ldy IN_DEV ; Save current input device
stz IN_DEV ; Keyboard
+ phy
jsr GETIN ; Read char, and return in .A
+ ply
sty IN_DEV ; Restore input device
ldx #>$0000
rts
--
2.26.0