From: Robert Pengelly Date: Sat, 24 Oct 2026 02:15:26 +0000 (+0100) Subject: Fix 32-bit OR immediate handling and memory corruption X-Git-Url: https://git.candlhat.org/?a=commitdiff_plain;h=9f033845685adcb394615fbc12b077e9ded8ebca;p=dosemu.git Fix 32-bit OR immediate handling and memory corruption --- diff --git a/cpu.c b/cpu.c index ffe5602..abb8f60 100644 --- a/cpu.c +++ b/cpu.c @@ -2288,11 +2288,14 @@ fetch_instruction: } - case 0x0D: { /* OR AX, imm16 */ + case 0x0D: { /* OR AX/EAX, imm16/imm32 */ - uint16_t imm16 = fetch16 (cpu); /* Fetch the 16-bit immediate value */ + if (cpu->has_operand_override) { + set_reg32 (cpu, REG_AX, or32 (cpu, get_reg32 (cpu, REG_AX), fetch32 (cpu))); + } else { + cpu->regs[REG_AX] = or16 (cpu, cpu->regs[REG_AX], fetch16 (cpu)); + } - cpu->regs[REG_AX] = or16 (cpu, cpu->regs[REG_AX], imm16); /* Perform OR and update flags */ break; }