808x: Suspend trap for 1 instruction after POPF and do not do it after IRET.

This commit is contained in:
OBattler
2025-07-08 05:21:44 +02:00
parent a2354599c6
commit 42c0077703

View File

@@ -1243,7 +1243,7 @@ check_interrupts(int nec_hlt)
int i_flag = (cpu_state.flags & I_FLAG) || nec_hlt; int i_flag = (cpu_state.flags & I_FLAG) || nec_hlt;
if (irq_pending(nec_hlt)) { if (irq_pending(nec_hlt)) {
if ((cpu_state.flags & T_FLAG) && !noint) { if ((cpu_state.flags & T_FLAG) && !(noint & 1)) {
interrupt(1); interrupt(1);
return; return;
} }
@@ -3031,16 +3031,19 @@ execx86(int cycs)
tempw = (cpu_state.flags & 0x0fd7) | 0xf000; tempw = (cpu_state.flags & 0x0fd7) | 0xf000;
push(&tempw); push(&tempw);
break; break;
case 0x9D: /*POPF*/ case 0x9D: { /*POPF*/
uint16_t old_flags = cpu_state.flags;
access(25, 16); access(25, 16);
if (is_nec && cpu_md_write_disable) if (is_nec && cpu_md_write_disable)
cpu_state.flags = pop() | 0x8002; cpu_state.flags = pop() | 0x8002;
else else
cpu_state.flags = pop() | 0x0002; cpu_state.flags = pop() | 0x0002;
wait_cycs(1, 0); wait_cycs(1, 0);
if ((old_flags ^ cpu_state.flags) & T_FLAG)
noint = 1;
sync_to_i8080(); sync_to_i8080();
break; break;
case 0x9E: /*SAHF*/ } case 0x9E: /*SAHF*/
wait_cycs(1, 0); wait_cycs(1, 0);
cpu_state.flags = (cpu_state.flags & 0xff02) | AH; cpu_state.flags = (cpu_state.flags & 0xff02) | AH;
wait_cycs(2, 0); wait_cycs(2, 0);
@@ -3309,7 +3312,7 @@ execx86(int cycs)
else else
cpu_state.flags = pop() | 0x0002; cpu_state.flags = pop() | 0x0002;
wait_cycs(5, 0); wait_cycs(5, 0);
noint = 1; noint = 2;
nmi_enable = 1; nmi_enable = 1;
if (is_nec && !(cpu_state.flags & MD_FLAG)) if (is_nec && !(cpu_state.flags & MD_FLAG))
sync_to_i8080(); sync_to_i8080();