Added video status emulation and DOS console input support
authorRobert Pengelly <robertapengelly@hotmail.com>
Tue, 20 Oct 2026 11:54:16 +0000 (12:54 +0100)
committerRobert Pengelly <robertapengelly@hotmail.com>
Tue, 20 Oct 2026 11:54:16 +0000 (12:54 +0100)
cpu.c
interrupts.c

diff --git a/cpu.c b/cpu.c
index 8acacc0116dcb77304a4ace5bd7a56b854cf39a0..72ff30ce47d032809a4bcaa605a5c366852f8fc8 100644 (file)
--- 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:
         
index dcba2a8d23c8eae34cdc1d2eede915ecfd012a06..103d9074210f36090188d9ce62691f8be563978f 100644 (file)
@@ -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);