GB I/O: Alternate fix for #1329 that doesn't break tests

This commit is contained in:
Vicki Pfau 2019-03-03 18:07:10 -08:00
parent 3a313a6133
commit 3c9c3c01c0
2 changed files with 3 additions and 3 deletions

View File

@ -630,7 +630,7 @@ void GBDetectModel(struct GB* gb) {
}
void GBUpdateIRQs(struct GB* gb) {
int irqs = gb->memory.ie & gb->memory.io[REG_IF];
int irqs = gb->memory.ie & gb->memory.io[REG_IF] & 0x1F;
if (!irqs) {
gb->cpu->irqPending = false;
return;

View File

@ -465,7 +465,7 @@ void GBIOWrite(struct GB* gb, unsigned address, uint8_t value) {
}
break;
case REG_IE:
gb->memory.ie = value & 0x1F;
gb->memory.ie = value;
GBUpdateIRQs(gb);
return;
default:
@ -578,7 +578,7 @@ uint8_t GBIORead(struct GB* gb, unsigned address) {
case REG_JOYP:
return _readKeysFiltered(gb);
case REG_IE:
return gb->memory.ie | 0xE0;
return gb->memory.ie;
case REG_WAVE_0:
case REG_WAVE_1:
case REG_WAVE_2: