Fixed timing when turning the LCD display on during double speed mode
This commit is contained in:
parent
54eb51d8db
commit
9b490396bb
@ -299,11 +299,11 @@ static void update_display_state(GB_gameboy_t *gb, uint8_t cycles)
|
||||
for (; cycles; cycles -= atomic_increase) {
|
||||
|
||||
gb->display_cycles += atomic_increase;
|
||||
/* The very first line is 2 (4 from the CPU's perseptive) clocks shorter when the LCD turns on.
|
||||
Todo: Verify on the 3 CGB modes, especially double speed mode. */
|
||||
if (gb->first_scanline && gb->display_cycles >= LINE_LENGTH - atomic_increase) {
|
||||
/* The very first line is 4 clocks shorter when the LCD turns on. Verified on SGB2, CGB in CGB mode and
|
||||
CGB in double speed mode. */
|
||||
if (gb->first_scanline && gb->display_cycles >= LINE_LENGTH - 4) {
|
||||
gb->first_scanline = false;
|
||||
gb->display_cycles += atomic_increase;
|
||||
gb->display_cycles += 4;
|
||||
}
|
||||
bool should_compare_ly = true;
|
||||
uint8_t ly_for_comparison = gb->io_registers[GB_IO_LY] = gb->display_cycles / LINE_LENGTH;
|
||||
|
@ -454,8 +454,6 @@ static void write_high_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
|
||||
|
||||
case GB_IO_LCDC:
|
||||
if ((value & 0x80) && !(gb->io_registers[GB_IO_LCDC] & 0x80)) {
|
||||
/* It appears that there's a slight delay after enabling the screen? */
|
||||
/* Todo: verify this. */
|
||||
gb->display_cycles = 0;
|
||||
gb->first_scanline = true;
|
||||
if (gb->frame_skip_state == GB_FRAMESKIP_SECOND_FRAME_RENDERED) {
|
||||
|
Loading…
Reference in New Issue
Block a user