all repos — mgba @ b619ebf965ce430f6e20b65433cdbfdbe5f16ce2

mGBA Game Boy Advance Emulator

GBA BIOS: Kill GBA_LOG_SWI
Jeffrey Pfau jeffrey@endrift.com
Mon, 08 Feb 2016 05:25:46 -0800
commit

b619ebf965ce430f6e20b65433cdbfdbe5f16ce2

parent

4f43b574e2df578159a38a984ce715ac2060395d

3 files changed, 23 insertions(+), 19 deletions(-)

jump to
M src/gba/bios.csrc/gba/bios.c

@@ -13,6 +13,8 @@

const uint32_t GBA_BIOS_CHECKSUM = 0xBAAE187F; const uint32_t GBA_DS_BIOS_CHECKSUM = 0xBAAE1880; +mLOG_DEFINE_CATEGORY(GBA_BIOS, "GBA BIOS"); + static void _unLz77(struct GBA* gba, int width); static void _unHuffman(struct GBA* gba); static void _unRl(struct GBA* gba, int width);

@@ -254,7 +256,7 @@ cpu->gprs[0] = result.quot;

cpu->gprs[1] = result.rem; cpu->gprs[3] = abs(result.quot); } else { - GBALog(gba, GBA_LOG_GAME_ERROR, "Attempting to divide %i by zero!", num); + mLOG(GBA_BIOS, GAME_ERROR, "Attempting to divide %i by zero!", num); // If abs(num) > 1, this should hang, but that would be painful to // emulate in HLE, and no game will get into a state where it hangs... cpu->gprs[0] = (num < 0) ? -1 : 1;

@@ -265,7 +267,7 @@ }

void GBASwi16(struct ARMCore* cpu, int immediate) { struct GBA* gba = (struct GBA*) cpu->master; - GBALog(gba, GBA_LOG_SWI, "SWI: %02X r0: %08X r1: %08X r2: %08X r3: %08X", + mLOG(GBA_BIOS, DEBUG, "SWI: %02X r0: %08X r1: %08X r2: %08X r3: %08X", immediate, cpu->gprs[0], cpu->gprs[1], cpu->gprs[2], cpu->gprs[3]); if (gba->memory.fullBios) {

@@ -307,14 +309,14 @@ break;

case 0xB: case 0xC: if (cpu->gprs[0] >> BASE_OFFSET < REGION_WORKING_RAM) { - GBALog(gba, GBA_LOG_GAME_ERROR, "Cannot CpuSet from BIOS"); + mLOG(GBA_BIOS, GAME_ERROR, "Cannot CpuSet from BIOS"); return; } if (cpu->gprs[0] & (cpu->gprs[2] & (1 << 26) ? 3 : 1)) { - GBALog(gba, GBA_LOG_GAME_ERROR, "Misaligned CpuSet source"); + mLOG(GBA_BIOS, GAME_ERROR, "Misaligned CpuSet source"); } if (cpu->gprs[1] & (cpu->gprs[2] & (1 << 26) ? 3 : 1)) { - GBALog(gba, GBA_LOG_GAME_ERROR, "Misaligned CpuSet destination"); + mLOG(GBA_BIOS, GAME_ERROR, "Misaligned CpuSet destination"); } ARMRaiseSWI(cpu); break;

@@ -332,12 +334,12 @@ break;

case 0x11: case 0x12: if (cpu->gprs[0] < BASE_WORKING_RAM) { - GBALog(gba, GBA_LOG_GAME_ERROR, "Bad LZ77 source"); + mLOG(GBA_BIOS, GAME_ERROR, "Bad LZ77 source"); break; } switch (cpu->gprs[1] >> BASE_OFFSET) { default: - GBALog(gba, GBA_LOG_GAME_ERROR, "Bad LZ77 destination"); + mLOG(GBA_BIOS, GAME_ERROR, "Bad LZ77 destination"); // Fall through case REGION_WORKING_RAM: case REGION_WORKING_IRAM:

@@ -348,12 +350,12 @@ }

break; case 0x13: if (cpu->gprs[0] < BASE_WORKING_RAM) { - GBALog(gba, GBA_LOG_GAME_ERROR, "Bad Huffman source"); + mLOG(GBA_BIOS, GAME_ERROR, "Bad Huffman source"); break; } switch (cpu->gprs[1] >> BASE_OFFSET) { default: - GBALog(gba, GBA_LOG_GAME_ERROR, "Bad Huffman destination"); + mLOG(GBA_BIOS, GAME_ERROR, "Bad Huffman destination"); // Fall through case REGION_WORKING_RAM: case REGION_WORKING_IRAM:

@@ -365,12 +367,12 @@ break;

case 0x14: case 0x15: if (cpu->gprs[0] < BASE_WORKING_RAM) { - GBALog(gba, GBA_LOG_GAME_ERROR, "Bad RL source"); + mLOG(GBA_BIOS, GAME_ERROR, "Bad RL source"); break; } switch (cpu->gprs[1] >> BASE_OFFSET) { default: - GBALog(gba, GBA_LOG_GAME_ERROR, "Bad RL destination"); + mLOG(GBA_BIOS, GAME_ERROR, "Bad RL destination"); // Fall through case REGION_WORKING_RAM: case REGION_WORKING_IRAM:

@@ -383,12 +385,12 @@ case 0x16:

case 0x17: case 0x18: if (cpu->gprs[0] < BASE_WORKING_RAM) { - GBALog(gba, GBA_LOG_GAME_ERROR, "Bad UnFilter source"); + mLOG(GBA_BIOS, GAME_ERROR, "Bad UnFilter source"); break; } switch (cpu->gprs[1] >> BASE_OFFSET) { default: - GBALog(gba, GBA_LOG_GAME_ERROR, "Bad UnFilter destination"); + mLOG(GBA_BIOS, GAME_ERROR, "Bad UnFilter destination"); // Fall through case REGION_WORKING_RAM: case REGION_WORKING_IRAM:

@@ -399,13 +401,13 @@ }

break; case 0x19: // SoundBias is mostly meaningless here - GBALog(gba, GBA_LOG_STUB, "Stub software interrupt: SoundBias (19)"); + mLOG(GBA_BIOS, STUB, "Stub software interrupt: SoundBias (19)"); break; case 0x1F: _MidiKey2Freq(gba); break; default: - GBALog(gba, GBA_LOG_STUB, "Stub software interrupt: %02X", immediate); + mLOG(GBA_BIOS, STUB, "Stub software interrupt: %02X", immediate); } gba->memory.biosPrefetch = 0xE3A02004; }
M src/gba/bios.hsrc/gba/bios.h

@@ -8,13 +8,16 @@ #define GBA_BIOS_H

#include "util/common.h" -#include "arm.h" +#include "arm/arm.h" +#include "core/log.h" + +mLOG_DECLARE_CATEGORY(GBA_BIOS); void GBASwi16(struct ARMCore* cpu, int immediate); void GBASwi32(struct ARMCore* cpu, int immediate); uint32_t GBAChecksum(uint32_t* memory, size_t size); -const uint32_t GBA_BIOS_CHECKSUM; -const uint32_t GBA_DS_BIOS_CHECKSUM; +extern const uint32_t GBA_BIOS_CHECKSUM; +extern const uint32_t GBA_DS_BIOS_CHECKSUM; #endif
M src/gba/interface.hsrc/gba/interface.h

@@ -19,7 +19,6 @@ GBA_LOG_DEBUG = 0x10,

GBA_LOG_STUB = 0x20, GBA_LOG_GAME_ERROR = 0x100, - GBA_LOG_SWI = 0x200, GBA_LOG_STATUS = 0x400, GBA_LOG_SIO = 0x800,