stdio: fix broken ReadC logic

Looping inside ReadC broke the shell's hook logic. We have to
return immediately when nothing is typed.
This commit is contained in:
Virgil Dupras 2019-07-19 14:44:47 -04:00
parent 253674ea05
commit 23354eba94

View File

@ -112,11 +112,14 @@ printHexPair:
; ;
; This routine also takes care of echoing received characters back to the TTY. ; This routine also takes care of echoing received characters back to the TTY.
; ;
; This routine doesn't wait after a typed char. If nothing is typed, we return
; immediately with Z flag unset.
;
; Note that this routine doesn't bother returning the typed character. ; Note that this routine doesn't bother returning the typed character.
stdioReadC: stdioReadC:
; Let's wait until something is typed. ; Let's wait until something is typed.
call stdioGetC call stdioGetC
jr nz, stdioReadC ; nothing typed? loop ret nz ; nothing typed? nothing to do
; got it. Now, is it a CR or LF? ; got it. Now, is it a CR or LF?
cp ASCII_CR cp ASCII_CR
jr z, .complete ; char is CR? buffer complete! jr z, .complete ; char is CR? buffer complete!