mirror of
https://github.com/hsoft/collapseos.git
synced 2024-12-26 04:28:05 +11:00
shell: improve reliability
Make ASCII_BS (sent when driven through kbd) make the same thing as ASCII_DEL. Also, don't crash on filling the buffer.
This commit is contained in:
parent
ad31c7f7f5
commit
b7cda6ed14
@ -87,6 +87,8 @@ shellLoop:
|
|||||||
jr z, .do ; char is LF? do!
|
jr z, .do ; char is LF? do!
|
||||||
cp ASCII_DEL
|
cp ASCII_DEL
|
||||||
jr z, .delchr
|
jr z, .delchr
|
||||||
|
cp ASCII_BS
|
||||||
|
jr z, .delchr
|
||||||
|
|
||||||
; Echo the received character right away so that we see what we type
|
; Echo the received character right away so that we see what we type
|
||||||
call stdioPutC
|
call stdioPutC
|
||||||
@ -98,8 +100,9 @@ shellLoop:
|
|||||||
xor a ; look for null
|
xor a ; look for null
|
||||||
call findchar ; HL points to where we need to write
|
call findchar ; HL points to where we need to write
|
||||||
; A is the number of chars in the buf
|
; A is the number of chars in the buf
|
||||||
cp SHELL_BUFSIZE
|
cp SHELL_BUFSIZE-1 ; -1 is because we always want to keep our
|
||||||
jr z, .do ; A == bufsize? then our buffer is full. do!
|
; last char at zero.
|
||||||
|
jr z, .do ; end of buffer reached? buffer is full. do!
|
||||||
|
|
||||||
; bring the char back in A
|
; bring the char back in A
|
||||||
ex af, af'
|
ex af, af'
|
||||||
@ -124,7 +127,6 @@ shellLoop:
|
|||||||
ld hl, .prompt
|
ld hl, .prompt
|
||||||
call printstr
|
call printstr
|
||||||
jr shellLoop
|
jr shellLoop
|
||||||
; no ret because we never return
|
|
||||||
|
|
||||||
.prompt:
|
.prompt:
|
||||||
.db "> ", 0
|
.db "> ", 0
|
||||||
|
Loading…
Reference in New Issue
Block a user