all repos — mgba @ 7b13335cafa89deec85a32f58d81732c522895e5

mGBA Game Boy Advance Emulator

DS: Unstub TestIRQ
Vicki Pfau vi@endrift.com
Mon, 20 Feb 2017 16:55:14 -0800
commit

7b13335cafa89deec85a32f58d81732c522895e5

parent

dfdc2b3eddc6810ab3c664dd3e72ba42482e8608

1 files changed, 14 insertions(+), 4 deletions(-)

jump to
M src/ds/ds.csrc/ds/ds.c

@@ -577,16 +577,26 @@ }

void DS7TestIRQ(struct ARMCore* cpu) { struct DS* ds = (struct DS*) cpu->master; - if (0) { - ds->ds7.springIRQ = 1; + if (!ds->memory.io7[DS_REG_IME >> 1]) { + return; + } + uint32_t test = (ds->memory.io7[DS_REG_IE_LO >> 1] & ds->memory.io7[DS_REG_IF_LO >> 1]); + test |= (ds->memory.io7[DS_REG_IE_HI >> 1] & ds->memory.io7[DS_REG_IF_HI >> 1]) << 16; + if (test) { + ds->ds7.springIRQ = test; cpu->nextEvent = cpu->cycles; } } void DS9TestIRQ(struct ARMCore* cpu) { struct DS* ds = (struct DS*) cpu->master; - if (0) { - ds->ds9.springIRQ = 1; + if (!ds->memory.io9[DS_REG_IME >> 1]) { + return; + } + uint32_t test = (ds->memory.io9[DS_REG_IE_LO >> 1] & ds->memory.io9[DS_REG_IF_LO >> 1]); + test |= (ds->memory.io9[DS_REG_IE_HI >> 1] & ds->memory.io9[DS_REG_IF_HI >> 1]) << 16; + if (test) { + ds->ds9.springIRQ = test; cpu->nextEvent = cpu->cycles; } }