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
+3 -3
View File
@@ -25,7 +25,7 @@ $(BUILDDIR)/%.bin: ./%.asm $(BUILDDIR)/memory.inc
echo '>$<' echo '>$<'
$(ASM) $(ASMFLAGS) $< $@ $(ASM) $(ASMFLAGS) $< $@
$(BUILDDIR)/basic.bin: $(BUILDDIR)/memory.inc basic:
$(MAKE) -C apps/basic $(or $(MAKECMDGOALS),all) --no-print-directory $(MAKE) -C apps/basic $(or $(MAKECMDGOALS),all) --no-print-directory
$(BUILDDIR)/memory.inc: memory.mk $(BUILDDIR)/memory.inc: memory.mk
@@ -33,7 +33,7 @@ $(BUILDDIR)/memory.inc: memory.mk
@awk 'BEGIN { print "; Generated from rom_layout.mk; do not edit." } \ @awk 'BEGIN { print "; Generated from rom_layout.mk; do not edit." } \
/^[A-Z][A-Z0-9_]*[[:space:]]*:=[[:space:]]*/ { print $$1 " .equ " $$3 }' $< > $@ /^[A-Z][A-Z0-9_]*[[:space:]]*:=[[:space:]]*/ { print $$1 " .equ " $$3 }' $< > $@
$(BUILDDIR)/rom.bin: $(BUILDDIR)/bios.bin $(BUILDDIR)/basic.bin $(BUILDDIR)/rom.bin: $(BUILDDIR)/bios.bin basic
echo "bios: $(shell wc -c < $(BUILDDIR)/bios.bin) / $$(($(BIOS_ROM_SIZE)+0))" echo "bios: $(shell wc -c < $(BUILDDIR)/bios.bin) / $$(($(BIOS_ROM_SIZE)+0))"
echo "basic: $(shell wc -c < $(BUILDDIR)/basic.bin) / $$(($(BASIC_ROM_SIZE)+0))" echo "basic: $(shell wc -c < $(BUILDDIR)/basic.bin) / $$(($(BASIC_ROM_SIZE)+0))"
objcopy --pad-to=$$(($(BIOS_ROM_START)+$(BIOS_ROM_SIZE))) \ objcopy --pad-to=$$(($(BIOS_ROM_START)+$(BIOS_ROM_SIZE))) \
@@ -43,4 +43,4 @@ $(BUILDDIR)/rom.bin: $(BUILDDIR)/bios.bin $(BUILDDIR)/basic.bin
cat $(BUILDDIR)/bios_padded.bin $(BUILDDIR)/basic_padded.bin > $(BUILDDIR)/rom.bin cat $(BUILDDIR)/bios_padded.bin $(BUILDDIR)/basic_padded.bin > $(BUILDDIR)/rom.bin
.PHONY: $(TOPTARGETS) $(SUBDIRS) .PHONY: $(TOPTARGETS) $(SUBDIRS) basic
+24 -7
View File
@@ -13,6 +13,7 @@
; - fixed ram size instead of poking at ram locations ; - fixed ram size instead of poking at ram locations
; - BIOS calls instead of using RST ; - BIOS calls instead of using RST
; - Unsupported functions cause FCERR, not a reset or REM ; - 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 ; 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" CTRLC .EQU 03H ; Control "C"
CTRLG .EQU 07H ; Control "G" CTRLG .EQU 07H ; Control "G"
BKSP .EQU 7FH ; Back space BKSP .EQU 08H ; Back space
LF .EQU 0AH ; Line feed LF .EQU 0AH ; Line feed
CS .EQU 0CH ; Clear screen CS .EQU 0CH ; Clear screen
CR .EQU 0DH ; Carriage return CR .EQU 0DH ; Carriage return
@@ -62,7 +63,7 @@ CTRLR .EQU 12H ; Control "R"
CTRLS .EQU 13H ; Control "S" CTRLS .EQU 13H ; Control "S"
CTRLU .EQU 15H ; Control "U" CTRLU .EQU 15H ; Control "U"
ESC .EQU 1BH ; Escape ESC .EQU 1BH ; Escape
DEL .EQU 08H ; Delete DEL .EQU 7fH ; Delete
; BASIC WORK SPACE LOCATIONS ; BASIC WORK SPACE LOCATIONS
@@ -942,10 +943,25 @@ ECHDEL: DEC B ; Count bytes in buffer
CALL OUTC ; Echo it CALL OUTC ; Echo it
JP MORINP ; Get more input JP MORINP ; Get more input
DELCHR: DEC B ; Count bytes in buffer DELCHR: ;DEC B ; Count bytes in buffer
DEC HL ; Back space buffer ;DEC HL ; Back space buffer
CALL OUTC ; Output character in A ;CALL OUTC ; Output character in A
JP NZ,MORINP ; Not end - Get more ;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 OTKLN: CALL OUTC ; Output character in A
KILIN: CALL PRNTCRLF ; Output CRLF KILIN: CALL PRNTCRLF ; Output CRLF
JP TTYLIN ; Get line again 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 MORINP: CALL CLOTST ; Get character and test ^O
LD C,A ; Save character in C LD C,A ; Save character in C
CP DEL ; Delete character? 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 LD A,(NULFLG) ; Get null flag
OR A ; Test null flag status OR A ; Test null flag status
JP Z,PROCES ; Reset - Process character JP Z,PROCES ; Reset - Process character