From 4f844bcdc3af8e1236dccf2f1bec03b5473ca480 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Tue, 8 Feb 2022 23:41:58 -0800 Subject: [PATCH] GB: Fix BIOS skipping VRAM and palette for GBC --- src/gb/gb.c | 26 +++++++------------------- src/gb/video.c | 5 +++++ 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/gb/gb.c b/src/gb/gb.c index 6130964b8..a49b641af 100644 --- a/src/gb/gb.c +++ b/src/gb/gb.c @@ -608,15 +608,13 @@ void GBSkipBIOS(struct GB* gb) { output1 |= (byte & 0x01) << 0; output1 |= output1 << 1; - if (gb->model < GB_MODEL_CGB) { - GBPatch8(cpu, 0x8010 + i * 8, output0, NULL, 0); - GBPatch8(cpu, 0x8012 + i * 8, output0, NULL, 0); - GBPatch8(cpu, 0x8014 + i * 8, output1, NULL, 0); - GBPatch8(cpu, 0x8016 + i * 8, output1, NULL, 0); - } else { - GBPatch8(cpu, 0x8380 + i * 2, output0, NULL, 0); - GBPatch8(cpu, 0x8381 + i * 2, output1, NULL, 0); - } + GBPatch8(cpu, 0x8010 + i * 8, output0, NULL, 0); + GBPatch8(cpu, 0x8012 + i * 8, output0, NULL, 0); + GBPatch8(cpu, 0x8014 + i * 8, output1, NULL, 0); + GBPatch8(cpu, 0x8016 + i * 8, output1, NULL, 0); + } + for (i = 0; i < sizeof(_registeredTrademark); ++i) { + GBPatch8(cpu, 0x8190 + i * 2, _registeredTrademark[i], NULL, 0); } if (gb->model < GB_MODEL_CGB) { for (i = 0; i < 12; ++i) { @@ -624,16 +622,6 @@ void GBSkipBIOS(struct GB* gb) { GBPatch8(cpu, 0x9924 + i, i + 13, NULL, 0); } GBPatch8(cpu, 0x9910, 0x19, NULL, 0); - for (i = 0; i < sizeof(_registeredTrademark); ++i) { - GBPatch8(cpu, 0x8191 + i * 2, _registeredTrademark[i], NULL, 0); - } - } else { - for (i = 0; i < 7; ++i) { - GBPatch8(cpu, 0x99A7 + i, i + 0x38, NULL, 0); - } - for (i = 0; i < sizeof(_registeredTrademark); ++i) { - GBPatch8(cpu, 0x83E1 + i * 2, _registeredTrademark[i], NULL, 0); - } } if (gb->memory.mbcType == GB_UNL_SACHEN_MMC2) { diff --git a/src/gb/video.c b/src/gb/video.c index e4059a3e1..3991b0d7e 100644 --- a/src/gb/video.c +++ b/src/gb/video.c @@ -521,6 +521,11 @@ void GBVideoSkipBIOS(struct GBVideo* video) { int32_t next; if (video->p->model & GB_MODEL_CGB) { + int i; + for (i = 0; i < 0x40; ++i) { + video->palette[i] = 0x7FFF; + video->renderer->writePalette(video->renderer, i, video->palette[i]); + } video->ly = GB_VIDEO_VERTICAL_PIXELS; video->p->memory.io[GB_REG_LY] = video->ly; video->stat = GBRegisterSTATClearLYC(video->stat);