Fixed backspace in basic

This commit is contained in:
Joppe Blondel
2026-10-07 15:06:03 +02:00
parent 5637db47fd
commit 6454c1d978
2 changed files with 27 additions and 10 deletions
+24 -7
View File
@@ -13,6 +13,7 @@
; - fixed ram size instead of poking at ram locations
; - BIOS calls instead of using RST
; - Unsupported functions cause FCERR, not a reset or REM
; - modern backspace handling
;
;==================================================================================
; The updates to the original BASIC within this file are copyright Grant Searle
@@ -52,7 +53,7 @@ MC_RAM_END .EQU 0FFFFH
CTRLC .EQU 03H ; Control "C"
CTRLG .EQU 07H ; Control "G"
BKSP .EQU 7FH ; Back space
BKSP .EQU 08H ; Back space
LF .EQU 0AH ; Line feed
CS .EQU 0CH ; Clear screen
CR .EQU 0DH ; Carriage return
@@ -62,7 +63,7 @@ CTRLR .EQU 12H ; Control "R"
CTRLS .EQU 13H ; Control "S"
CTRLU .EQU 15H ; Control "U"
ESC .EQU 1BH ; Escape
DEL .EQU 08H ; Delete
DEL .EQU 7fH ; Delete
; BASIC WORK SPACE LOCATIONS
@@ -942,10 +943,25 @@ ECHDEL: DEC B ; Count bytes in buffer
CALL OUTC ; Echo it
JP MORINP ; Get more input
DELCHR: DEC B ; Count bytes in buffer
DEC HL ; Back space buffer
CALL OUTC ; Output character in A
JP NZ,MORINP ; Not end - Get more
DELCHR: ;DEC B ; Count bytes in buffer
;DEC HL ; Back space buffer
;CALL OUTC ; Output character in A
;JP NZ,MORINP ; Not end - Get more
LD A,B
CP 1
JP Z,MORINP
DEC B
DEC HL
LD A,(CURPOS)
DEC A
LD (CURPOS),A
LD A,BKSP
CALL MONOUT
LD A,' '
CALL MONOUT
LD A,BKSP
CALL MONOUT
JP MORINP
OTKLN: CALL OUTC ; Output character in A
KILIN: CALL PRNTCRLF ; Output CRLF
JP TTYLIN ; Get line again
@@ -958,7 +974,8 @@ TTYLIN: LD HL,BUFFER ; Get a line by character
MORINP: CALL CLOTST ; Get character and test ^O
LD C,A ; Save character in C
CP DEL ; Delete character?
JP Z,DODEL ; Yes - Process it
;JP Z,DODEL ; Yes - Process it
JP Z,DELCHR
LD A,(NULFLG) ; Get null flag
OR A ; Test null flag status
JP Z,PROCES ; Reset - Process character