From a5c4276325c82f2ebfd0882b4d6a069c781b91b5 Mon Sep 17 00:00:00 2001 From: Robert Pengelly Date: Tue, 20 Oct 2026 12:54:16 +0100 Subject: [PATCH] Added video status emulation and DOS console input support --- cpu.c | 4 ++-- interrupts.c | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/cpu.c b/cpu.c index 8acacc0..72ff30c 100644 --- a/cpu.c +++ b/cpu.c @@ -706,8 +706,8 @@ static uint8_t io_read8 (CPU8086 *cpu, uint16_t port) { case 0x3DA: /* CGA/EGA/VGA status */ - cpu->vga_status_flip ^= 1; - return cpu->vga_status_flip ? 0x08 : 0x00; /* vertical retrace bit */ + cpu->vga_status_flip++; + return (uint8_t) ((cpu->vga_status_flip & 0x01) | ((cpu->vga_status_flip & 0xE0) == 0xE0 ? 0x08 : 0x00)); default: diff --git a/interrupts.c b/interrupts.c index dcba2a8..103d907 100644 --- a/interrupts.c +++ b/interrupts.c @@ -4501,6 +4501,23 @@ static void int_21 (CPU8086 *cpu) { } + case 0x07: { /* Direct Character Input without Echo */ + + int c = host_read_key (cpu); + + if (c == EOF) { + c = '\r'; + } + + if (c == '\n') { + c = '\r'; + } + + set_reg8 (cpu, REG_AX, (uint8_t) c); + break; + + } + case 0x09: { FILE *out = dos_get_handle_file (cpu, 1); -- 2.34.1