all repos — mgba @ 21704ab37a52766309ddc326ab73661eb833a4fd

mGBA Game Boy Advance Emulator

Allow use of wrong LZ77 destination
Jeffrey Pfau jeffrey@endrift.com
Mon, 22 Apr 2013 22:55:49 -0700
commit

21704ab37a52766309ddc326ab73661eb833a4fd

parent

11d1de39e15f4a348b42c8b14f6baab0db951161

1 files changed, 11 insertions(+), 3 deletions(-)

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

@@ -88,10 +88,18 @@ case 0xC:

_FastCpuSet(gba); break; case 0x11: - _unLz77(&gba->memory, gba->cpu.gprs[0], &((uint8_t*) gba->memory.wram)[(gba->cpu.gprs[1] & (SIZE_WORKING_RAM - 1))]); - break; case 0x12: - _unLz77(&gba->memory, gba->cpu.gprs[0], &((uint8_t*) gba->video.vram)[(gba->cpu.gprs[1] & 0x0001FFFF)]); + switch (gba->cpu.gprs[1] >> BASE_OFFSET) { + case REGION_WORKING_RAM: + _unLz77(&gba->memory, gba->cpu.gprs[0], &((uint8_t*) gba->memory.wram)[(gba->cpu.gprs[1] & (SIZE_WORKING_RAM - 1))]); + break; + case REGION_VRAM: + _unLz77(&gba->memory, gba->cpu.gprs[0], &((uint8_t*) gba->video.vram)[(gba->cpu.gprs[1] & 0x0001FFFF)]); + break; + default: + GBALog(GBA_LOG_WARN, "Bad LZ77 destination"); + break; + } break; case 0x1F: _MidiKey2Freq(gba);