feat(buzbee): implement terminal echo and backspace handling

This commit is contained in:
2025-09-28 15:28:16 -05:00
parent dce0719796
commit 35a2f12cce

View File

@@ -48,10 +48,14 @@ INPLOOP
beq NOCHAR@
cmpa #$1B ; ESC?
beq HESC@ ; Handle ESC
cmpa #$08 ; BS?
beq HBACKSPC@ ; Backup a char
cmpa #$0D ; CR?
beq EXIT@ ; Then parse input buffer
cmpy #BBIN_DEPTH ; Are we at the end of the input buffer?
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
leay 1,y
NOCHAR@
@@ -81,6 +85,11 @@ HESC@
jsr POUTCHAR
ldy #$0000 ; On return we cmpy #$0000 and if eq then newline.
rts
HBACKSPC@
clrb ; Clear last char
leay -1,y
stb BBIN_BASE
bra ECHO@ ; Echo the char in A
FULLBUF@
lda #$07 ; ASCII BEL
jsr POUTCHAR