all repos — mgba @ d588b8c462d780cea27489a0dc697bf0c5e36984

mGBA Game Boy Advance Emulator

GBA BIOS: Implement Stop
Jeffrey Pfau jeffrey@endrift.com
Sun, 19 Jul 2015 18:12:56 -0700
commit

d588b8c462d780cea27489a0dc697bf0c5e36984

parent

7a9e97ca52de3d7785f7caa4bdd03996c87c5f41

6 files changed, 20 insertions(+), 1 deletions(-)

jump to
M CHANGESCHANGES

@@ -28,6 +28,7 @@ - Undo-able savestate loading and saving

- Controller profiles now store shortcut settings - Default controller profiles for several common controllers - Libretro now supports BIOS and rumble + - Implement BIOS call Stop, for sleep mode Bugfixes: - ARM7: Fix SWI and IRQ timings - GBA Audio: Force audio FIFOs to 32-bit
M src/gba/bios.csrc/gba/bios.c

@@ -191,6 +191,9 @@ break;

case 0x2: GBAHalt(gba); break; + case 0x3: + GBAStop(gba); + break; case 0x05: // VBlankIntrWait // Fall through:
M src/gba/gba.csrc/gba/gba.c

@@ -82,6 +82,7 @@ gba->logHandler = 0;

gba->logLevel = GBA_LOG_WARN | GBA_LOG_ERROR | GBA_LOG_FATAL; gba->stream = 0; gba->keyCallback = 0; + gba->stopCallback = 0; gba->biosChecksum = GBAChecksum(gba->memory.bios, SIZE_BIOS);

@@ -551,6 +552,14 @@

void GBAHalt(struct GBA* gba) { gba->cpu->nextEvent = 0; gba->cpu->halted = 1; +} + +void GBAStop(struct GBA* gba) { + if (!gba->stopCallback) { + return; + } + gba->cpu->nextEvent = 0; + gba->stopCallback->stop(gba->stopCallback); } static void _GBAVLog(struct GBA* gba, enum GBALogLevel level, const char* format, va_list args) {
M src/gba/gba.hsrc/gba/gba.h

@@ -112,6 +112,7 @@ GBALogHandler logHandler;

enum GBALogLevel logLevel; struct GBAAVStream* stream; struct GBAKeyCallback* keyCallback; + struct GBAStopCallback* stopCallback; enum GBAIdleLoopOptimization idleOptimization; uint32_t idleLoop;

@@ -155,6 +156,7 @@ void GBAWriteIME(struct GBA* gba, uint16_t value);

void GBARaiseIRQ(struct GBA* gba, enum GBAIRQ irq); void GBATestIRQ(struct ARMCore* cpu); void GBAHalt(struct GBA* gba); +void GBAStop(struct GBA* gba); void GBAAttachDebugger(struct GBA* gba, struct ARMDebugger* debugger); void GBADetachDebugger(struct GBA* gba);
M src/gba/interface.hsrc/gba/interface.h

@@ -66,6 +66,10 @@ struct GBAKeyCallback {

uint16_t (*readKeys)(struct GBAKeyCallback*); }; +struct GBAStopCallback { + void (*stop)(struct GBAStopCallback*); +}; + struct GBARotationSource { void (*sample)(struct GBARotationSource*);
M src/gba/io.csrc/gba/io.c

@@ -505,7 +505,7 @@ value &= 0x80;

if (!value) { GBAHalt(gba); } else { - GBALog(gba, GBA_LOG_STUB, "Stop unimplemented"); + GBAStop(gba); } return; }