all repos — mgba @ 746f2b8e6a8a360289f40c6b7425abc1c07d5d91

mGBA Game Boy Advance Emulator

GB Video: Fix initialization
Vicki Pfau vi@endrift.com
Thu, 28 Jun 2018 11:52:43 -0700
commit

746f2b8e6a8a360289f40c6b7425abc1c07d5d91

parent

302d4860f3101b15b64a1aa042b40d80784f853f

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

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

@@ -547,6 +547,8 @@

mTimingDeschedule(&gb->timing, &gb->timer.event); mTimingSchedule(&gb->timing, &gb->timer.event, 0); + GBIOWrite(gb, REG_LCDC, 0x91); + if (gb->biosVf) { GBUnmapBIOS(gb); }
M src/gb/io.csrc/gb/io.c

@@ -182,7 +182,11 @@ GBIOWrite(gb, REG_NR42, 0x00);

GBIOWrite(gb, REG_NR43, 0x00); GBIOWrite(gb, REG_NR50, 0x77); GBIOWrite(gb, REG_NR51, 0xF3); - GBIOWrite(gb, REG_LCDC, 0x91); + if (!gb->biosVf) { + GBIOWrite(gb, REG_LCDC, 0x91); + } else { + GBIOWrite(gb, REG_LCDC, 0x00); + } GBIOWrite(gb, REG_SCY, 0x00); GBIOWrite(gb, REG_SCX, 0x00); GBIOWrite(gb, REG_LYC, 0x00);
M src/gb/video.csrc/gb/video.c

@@ -419,6 +419,7 @@ if (!GBRegisterLCDCIsEnable(video->p->memory.io[REG_LCDC]) && GBRegisterLCDCIsEnable(value)) {

video->mode = 2; video->modeEvent.callback = _endMode2; int32_t next = GB_VIDEO_MODE_2_LENGTH - 5; // TODO: Why is this fudge factor needed? Might be related to T-cycles for load/store differing + mTimingDeschedule(&video->p->timing, &video->modeEvent); mTimingSchedule(&video->p->timing, &video->modeEvent, next << video->p->doubleSpeed); video->ly = 0;

@@ -445,6 +446,7 @@ video->p->memory.io[REG_LY] = 0;

video->renderer->writePalette(video->renderer, 0, video->dmgPalette[0]); mTimingDeschedule(&video->p->timing, &video->modeEvent); + mTimingDeschedule(&video->p->timing, &video->frameEvent); mTimingSchedule(&video->p->timing, &video->frameEvent, GB_VIDEO_TOTAL_LENGTH); } video->p->memory.io[REG_STAT] = video->stat;