Initialize child AX register correctly during DOS EXEC
authorRobert Pengelly <robertapengelly@hotmail.com>
Sun, 18 Oct 2026 15:06:22 +0000 (16:06 +0100)
committerRobert Pengelly <robertapengelly@hotmail.com>
Sun, 18 Oct 2026 15:06:22 +0000 (16:06 +0100)
interrupts.c

index 54db0dbe84c44c120b319d39adfcf358e711c244..f015c8e07c49d795cf22c7514f61f32f1f70540c 100644 (file)
@@ -6334,6 +6334,17 @@ static void int_21 (CPU8086 *cpu) {
             
             }
             
+            /* EXEC reports invalid default FCB drives in the initial AX. */
+            cpu->regs[REG_AX] = 0;
+            
+            if (mem_read8 (cpu->mem, cpu->mem_size, get_phys (child_psp, 0x5C)) > 26) {
+                cpu->regs[REG_AX] |= 0x00FF;
+            }
+            
+            if (mem_read8 (cpu->mem, cpu->mem_size, get_phys (child_psp, 0x6C)) > 26) {
+                cpu->regs[REG_AX] |= 0xFF00;
+            }
+            
             cpu->psp_seg = child_psp;
             cpu->ds = child_psp;
             cpu->es = child_psp;