aboutsummaryrefslogtreecommitdiffstats
path: root/src/syscall.asm
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/syscall.asm14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/syscall.asm b/src/syscall.asm
index 870a2ff..cb2c996 100644
--- a/src/syscall.asm
+++ b/src/syscall.asm
@@ -122,17 +122,21 @@ KGetc::
jp sys_getb ; B=fd -> A=byte, CF=EOF
.console
.poll
+ call pad_poll ; poll joypad; drive the on-screen keyboard
+ call osk_handle ; CF set + A = byte if a key was typed
+ jr c, .done
ld a, $80
ld [rSC], a
ld a, [rSC]
bit 7, a
- jr z, .got
+ jr nz, .yield
+ ld a, [rSB] ; A = serial byte
+.done
+ and a ; CF = 0 (not EOF)
+ ret
+.yield
call SchedYield
jr .poll
-.got
- ld a, [rSB]
- and a ; CF = 0
- ret
; -----------------------------------------------------------------------------
; KPutc(E = byte) - write to this process's stdout (console/file).