mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-12-22 09:30:32 +00:00
First stage "halt" reimplementation: allow the clock to run during halt, but nothing else.
Signed-off-by: Adrian.Conlon <adrian.conlon@gmail.com>
This commit is contained in:
parent
42b0fdc23d
commit
57e48e389f
@ -335,23 +335,24 @@ int EightBit::LR35902::run(int limit) {
|
||||
do {
|
||||
auto interruptEnable = m_bus.readRegister(Bus::IE);
|
||||
auto interruptFlags = m_bus.readRegister(Bus::IF);
|
||||
auto ime = IME();
|
||||
|
||||
auto masked = (IME() ? interruptEnable : 0) & interruptFlags;
|
||||
if (masked)
|
||||
auto masked = interruptEnable & interruptFlags;
|
||||
if (ime && masked)
|
||||
m_bus.writeRegister(Bus::IF, 0);
|
||||
|
||||
if (masked & Bus::Interrupts::VerticalBlank) {
|
||||
if (ime && (masked & Bus::Interrupts::VerticalBlank)) {
|
||||
current += interrupt(0x40);
|
||||
} else if (masked & Bus::Interrupts::DisplayControlStatus) {
|
||||
} else if (ime && (masked & Bus::Interrupts::DisplayControlStatus)) {
|
||||
current += interrupt(0x48);
|
||||
} else if (masked & Bus::Interrupts::TimerOverflow) {
|
||||
} else if (ime && (masked & Bus::Interrupts::TimerOverflow)) {
|
||||
current += interrupt(0x50);
|
||||
} else if (masked & Bus::Interrupts::SerialTransfer) {
|
||||
} else if (ime && (masked & Bus::Interrupts::SerialTransfer)) {
|
||||
current += interrupt(0x58);
|
||||
} else if (masked & Bus::Interrupts::Keypad) {
|
||||
} else if (ime && (masked & Bus::Interrupts::Keypad)) {
|
||||
current += interrupt(0x60);
|
||||
} else {
|
||||
current += step();
|
||||
current += isHalted() ? 1 : step();
|
||||
}
|
||||
|
||||
m_bus.checkTimers(current);
|
||||
|
Loading…
Reference in New Issue
Block a user