- [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 *_rW = (uint8_t*)®s[27];
|
||||||
|
|
||||||
uint8_t iff1, iff2, im;
|
uint8_t iff1, iff2, im;
|
||||||
|
bool exit_from_halt = false;
|
||||||
|
|
||||||
#define rA (*_rA)
|
#define rA (*_rA)
|
||||||
#define rF (*_rF)
|
#define rF (*_rF)
|
||||||
@@ -585,6 +586,7 @@ namespace z80
|
|||||||
void interrupt()
|
void interrupt()
|
||||||
{
|
{
|
||||||
if (!iff1) return;
|
if (!iff1) return;
|
||||||
|
exit_from_halt = true;
|
||||||
PUSH(rPC);
|
PUSH(rPC);
|
||||||
rPC = 0x38;
|
rPC = 0x38;
|
||||||
}
|
}
|
||||||
@@ -620,8 +622,12 @@ namespace z80
|
|||||||
|
|
||||||
void HALT()
|
void HALT()
|
||||||
{
|
{
|
||||||
printf("HALT\n");
|
if (exit_from_halt) {
|
||||||
rPC--;
|
exit_from_halt = false;
|
||||||
|
} else {
|
||||||
|
printf("HALT\n");
|
||||||
|
rPC--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const uint8_t RLC(const uint8_t v)
|
static inline const uint8_t RLC(const uint8_t v)
|
||||||
|
|||||||
Reference in New Issue
Block a user