mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-03-13 07:33:34 +00:00
Second stage halt implementation: allow halt state to be exited by an interrupt.
Signed-off-by: Adrian.Conlon <adrian.conlon@gmail.com>
This commit is contained in:
parent
57e48e389f
commit
8716035396
@ -338,8 +338,14 @@ int EightBit::LR35902::run(int limit) {
|
||||
auto ime = IME();
|
||||
|
||||
auto masked = interruptEnable & interruptFlags;
|
||||
if (ime && masked)
|
||||
m_bus.writeRegister(Bus::IF, 0);
|
||||
if (masked) {
|
||||
if (ime) {
|
||||
m_bus.writeRegister(Bus::IF, 0);
|
||||
} else {
|
||||
if (isHalted())
|
||||
proceed();
|
||||
}
|
||||
}
|
||||
|
||||
if (ime && (masked & Bus::Interrupts::VerticalBlank)) {
|
||||
current += interrupt(0x40);
|
||||
|
@ -50,6 +50,7 @@ namespace EightBit {
|
||||
|
||||
bool isHalted() const { return m_halted; }
|
||||
void halt() { --PC().word; m_halted = true; }
|
||||
void proceed() { ++PC().word; m_halted = false; }
|
||||
|
||||
virtual void initialise();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user