From 0b12c58d77572cd8150e4d2fe82361f6e159418c Mon Sep 17 00:00:00 2001 From: Sjoerd van der Berg Date: Tue, 8 Jul 2003 16:46:28 +0000 Subject: [PATCH] Check for interrupt flag and waiting irq's on moments where flags are changed. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1095 --- src/cpu/core_full/load.h | 11 +++++++---- src/cpu/core_full/save.h | 8 ++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/cpu/core_full/load.h b/src/cpu/core_full/load.h index 97e2b348..86634ccc 100644 --- a/src/cpu/core_full/load.h +++ b/src/cpu/core_full/load.h @@ -268,6 +268,10 @@ l_M_Ed: flags.type=t_UNKNOWN; CPU_IRET(false); LoadIP(); + if (GETFLAG(IF) && PIC_IRQCheck) { + SaveIP(); + return CBRET_NONE; + } goto nextopcode; case D_IRETd: flags.type=t_UNKNOWN; @@ -346,10 +350,9 @@ l_M_Ed: goto nextopcode; case D_STI: SETFLAGBIT(IF,true); - if (PIC_IRQCheck) { - SaveIP(); - PIC_runIRQs(); - LoadIP(); + if (GETFLAG(IF) && PIC_IRQCheck) { + LEAVECORE; + return CBRET_NONE; } goto nextopcode; case D_STC: diff --git a/src/cpu/core_full/save.h b/src/cpu/core_full/save.h index 9e849d18..a5e97eb1 100644 --- a/src/cpu/core_full/save.h +++ b/src/cpu/core_full/save.h @@ -103,9 +103,17 @@ switch (inst.code.save) { break; case S_FLGw: SETFLAGSw(inst.op1.w); + if (GETFLAG(IF) && PIC_IRQCheck) { + SaveIP(); + return CBRET_NONE; + } break; case S_FLGd: SETFLAGSd(inst.op1.d); + if (GETFLAG(IF) && PIC_IRQCheck) { + SaveIP(); + return CBRET_NONE; + } break; case 0: break;