feat(buzbee): implement terminal echo and backspace handling
This commit is contained in:
@@ -48,10 +48,14 @@ INPLOOP
|
|||||||
beq NOCHAR@
|
beq NOCHAR@
|
||||||
cmpa #$1B ; ESC?
|
cmpa #$1B ; ESC?
|
||||||
beq HESC@ ; Handle ESC
|
beq HESC@ ; Handle ESC
|
||||||
|
cmpa #$08 ; BS?
|
||||||
|
beq HBACKSPC@ ; Backup a char
|
||||||
cmpa #$0D ; CR?
|
cmpa #$0D ; CR?
|
||||||
beq EXIT@ ; Then parse input buffer
|
beq EXIT@ ; Then parse input buffer
|
||||||
cmpy #BBIN_DEPTH ; Are we at the end of the input buffer?
|
cmpy #BBIN_DEPTH ; Are we at the end of the input buffer?
|
||||||
beq FULLBUF@ ; Handle the buffer being full
|
beq FULLBUF@ ; Handle the buffer being full
|
||||||
|
ECHO@
|
||||||
|
jsr POUTCHAR ; Echo char back, this includes BS chars
|
||||||
sta BBIN_BASE,y ; Add it to the input buffer
|
sta BBIN_BASE,y ; Add it to the input buffer
|
||||||
leay 1,y
|
leay 1,y
|
||||||
NOCHAR@
|
NOCHAR@
|
||||||
@@ -81,6 +85,11 @@ HESC@
|
|||||||
jsr POUTCHAR
|
jsr POUTCHAR
|
||||||
ldy #$0000 ; On return we cmpy #$0000 and if eq then newline.
|
ldy #$0000 ; On return we cmpy #$0000 and if eq then newline.
|
||||||
rts
|
rts
|
||||||
|
HBACKSPC@
|
||||||
|
clrb ; Clear last char
|
||||||
|
leay -1,y
|
||||||
|
stb BBIN_BASE
|
||||||
|
bra ECHO@ ; Echo the char in A
|
||||||
FULLBUF@
|
FULLBUF@
|
||||||
lda #$07 ; ASCII BEL
|
lda #$07 ; ASCII BEL
|
||||||
jsr POUTCHAR
|
jsr POUTCHAR
|
||||||
|
Reference in New Issue
Block a user