From 7b34a0a63ce751bdf3fc734d67b3745f57c51886 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Wed, 13 May 2020 19:58:23 -0700 Subject: [PATCH] GB Video: Fix up timing after skipping BIOS --- src/gb/video.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gb/video.c b/src/gb/video.c index 26c785369..575bdeb2f 100644 --- a/src/gb/video.c +++ b/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 @@ void GBVideoSkipBIOS(struct GBVideo* video) { 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) {