GB Video: Fix initialization

This commit is contained in:
Vicki Pfau 2018-06-28 11:52:43 -07:00
parent 302d4860f3
commit 746f2b8e6a
3 changed files with 9 additions and 1 deletions

View File

@ -547,6 +547,8 @@ void GBSkipBIOS(struct GB* gb) {
mTimingDeschedule(&gb->timing, &gb->timer.event);
mTimingSchedule(&gb->timing, &gb->timer.event, 0);
GBIOWrite(gb, REG_LCDC, 0x91);
if (gb->biosVf) {
GBUnmapBIOS(gb);
}

View File

@ -182,7 +182,11 @@ void GBIOReset(struct GB* gb) {
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);

View File

@ -419,6 +419,7 @@ void GBVideoWriteLCDC(struct GBVideo* video, GBRegisterLCDC 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 @@ void GBVideoWriteLCDC(struct GBVideo* video, GBRegisterLCDC value) {
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;