GB Video: Fix up timing after skipping BIOS
Vicki Pfau vi@endrift.com
Wed, 13 May 2020 19:58:23 -0700
1 files changed,
7 insertions(+),
1 deletions(-)
jump to
M
src/gb/video.c
→
src/gb/video.c
@@ -218,10 +218,16 @@ void GBVideoSkipBIOS(struct GBVideo* video) {
video->mode = 1; video->modeEvent.callback = _endMode1; + int32_t next; if (video->p->model == GB_MODEL_CGB) { video->ly = GB_VIDEO_VERTICAL_PIXELS; video->p->memory.io[REG_LY] = video->ly; video->stat = GBRegisterSTATClearLYC(video->stat); + next = 20; + } else { + video->ly = GB_VIDEO_VERTICAL_TOTAL_PIXELS; + video->p->memory.io[REG_LY] = 0; + next = 56; } video->stat = GBRegisterSTATSetMode(video->stat, video->mode);@@ -229,7 +235,7 @@ video->p->memory.io[REG_IF] |= (1 << GB_IRQ_VBLANK);
GBUpdateIRQs(video->p); video->p->memory.io[REG_STAT] = video->stat; mTimingDeschedule(&video->p->timing, &video->modeEvent); - mTimingSchedule(&video->p->timing, &video->modeEvent, GB_VIDEO_HORIZONTAL_LENGTH << video->p->doubleSpeed); + mTimingSchedule(&video->p->timing, &video->modeEvent, next); } void _endMode0(struct mTiming* timing, void* context, uint32_t cyclesLate) {