all repos — mgba @ b83f0377998bb198606a69109fd5e8fb90b102e1

mGBA Game Boy Advance Emulator

DS: Add CPSR-reading skeleton, sans IRQs
Jeffrey Pfau jeffrey@endrift.com
Wed, 01 Jun 2016 21:42:02 -0700
commit

b83f0377998bb198606a69109fd5e8fb90b102e1

parent

5939af0a2bdcc64dd0f2f49243ce8077dd5b6bb3

1 files changed, 21 insertions(+), 2 deletions(-)

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

@@ -37,10 +37,13 @@

static void DSInit(void* cpu, struct mCPUComponent* component); static void DS7Reset(struct ARMCore* cpu); +static void DS7TestIRQ(struct ARMCore* cpu); static void DS7InterruptHandlerInit(struct ARMInterruptHandler* irqh); static void DS9Reset(struct ARMCore* cpu); +static void DS9TestIRQ(struct ARMCore* cpu); static void DS9InterruptHandlerInit(struct ARMInterruptHandler* irqh); + static void DSProcessEvents(struct ARMCore* cpu); static void DSHitStub(struct ARMCore* cpu, uint32_t opcode);

@@ -104,7 +107,7 @@ irqh->processEvents = DSProcessEvents;

irqh->swi16 = NULL; irqh->swi32 = NULL; irqh->hitIllegal = DSIllegal; - irqh->readCPSR = NULL; + irqh->readCPSR = DS7TestIRQ; irqh->hitStub = DSHitStub; irqh->bkpt16 = DSBreakpoint; irqh->bkpt32 = DSBreakpoint;

@@ -116,7 +119,7 @@ irqh->processEvents = DSProcessEvents;

irqh->swi16 = NULL; irqh->swi32 = NULL; irqh->hitIllegal = DSIllegal; - irqh->readCPSR = NULL; + irqh->readCPSR = DS9TestIRQ; irqh->hitStub = DSHitStub; irqh->bkpt16 = DSBreakpoint; irqh->bkpt32 = DSBreakpoint;

@@ -337,3 +340,19 @@ default:

break; } } + +void DS7TestIRQ(struct ARMCore* cpu) { + struct DS* ds = (struct DS*) cpu->master; + if (0) { + ds->springIRQ7 = 1; + cpu->nextEvent = cpu->cycles; + } +} + +void DS9TestIRQ(struct ARMCore* cpu) { + struct DS* ds = (struct DS*) cpu->master; + if (0) { + ds->springIRQ9 = 1; + cpu->nextEvent = cpu->cycles; + } +}