- [FIX] Interrupts now exit CPU from HALT

This commit is contained in:
2024-04-15 22:14:28 +02:00
parent 2d0b0e45cc
commit 4b4aad7658

10
z80.cpp
View File

@@ -83,6 +83,7 @@ namespace z80
uint8_t *_rW = (uint8_t*)&regs[27];
uint8_t iff1, iff2, im;
bool exit_from_halt = false;
#define rA (*_rA)
#define rF (*_rF)
@@ -585,6 +586,7 @@ namespace z80
void interrupt()
{
if (!iff1) return;
exit_from_halt = true;
PUSH(rPC);
rPC = 0x38;
}
@@ -620,8 +622,12 @@ namespace z80
void HALT()
{
printf("HALT\n");
rPC--;
if (exit_from_halt) {
exit_from_halt = false;
} else {
printf("HALT\n");
rPC--;
}
}
static inline const uint8_t RLC(const uint8_t v)