Permalink
Browse files
GB Video: Fix initialization
- Loading branch information...
Showing
with
9 additions
and
1 deletion.
-
+2
−0
src/gb/gb.c
-
+5
−1
src/gb/io.c
-
+2
−0
src/gb/video.c
|
|
@@ -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);
|
|
|
}
|
|
|
|
|
|
@@ -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);
|
|
|
|
|
|
@@ -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;
|
|
|
|
0 comments on commit
746f2b8