- [FIX] Interrupts now exit CPU from HALT
This commit is contained in:
10
z80.cpp
10
z80.cpp
@@ -83,6 +83,7 @@ namespace z80
|
||||
uint8_t *_rW = (uint8_t*)®s[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)
|
||||
|
||||
Reference in New Issue
Block a user