From 7b13335cafa89deec85a32f58d81732c522895e5 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 20 Feb 2017 16:55:14 -0800 Subject: [PATCH] DS: Unstub TestIRQ --- src/ds/ds.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/ds/ds.c b/src/ds/ds.c index 4bda3ce1e..f092a19ee 100644 --- a/src/ds/ds.c +++ b/src/ds/ds.c @@ -577,16 +577,26 @@ void DSBreakpoint(struct ARMCore* cpu, int immediate) { 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; } }