From dd4fd4804ed2fdd1e793105f5a32b8101d54e2ed Mon Sep 17 00:00:00 2001 From: Robert Pengelly Date: Tue, 20 Oct 2026 17:42:55 +0100 Subject: [PATCH] Fixed Backspace key handling on Unix --- interrupts.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/interrupts.c b/interrupts.c index 6f2fba7..f20270c 100644 --- a/interrupts.c +++ b/interrupts.c @@ -1338,6 +1338,10 @@ static int host_read_key_from (FILE *source) { ch = read (fd, &byte, 1) == 1 ? byte : EOF; + if (ch == 0x7F) { + ch = 0x08; + } + if (ch == 0x1B) { FD_ZERO (&ready); @@ -1500,7 +1504,13 @@ static int host_poll_key_from (FILE *source) { } if (changed_termios) { + tcsetattr (fd, TCSANOW, &oldt); + + if (ch == 0x7F) { + ch = 0x08; + } + } } @@ -1618,6 +1628,10 @@ static int bios_read_key (CPU8086 *cpu, int wait) { ch = byte; + if (ch == 0x7F) { + ch = 0x08; + } + if (ch == 0x1B) { FD_ZERO (&ready); -- 2.34.1