Prevent Hblank HDMAs when the LCD is off
This commit is contained in:
parent
f4a364c3db
commit
c5ce14dad1
@ -315,13 +315,20 @@ static void update_display_state(GB_gameboy_t *gb, uint8_t cycles)
|
|||||||
gb->stat_interrupt_line = false;
|
gb->stat_interrupt_line = false;
|
||||||
|
|
||||||
if (!(gb->io_registers[GB_IO_LCDC] & 0x80)) {
|
if (!(gb->io_registers[GB_IO_LCDC] & 0x80)) {
|
||||||
/* LCD is disabled, do nothing */
|
/* LCD is disabled, state is constant */
|
||||||
|
|
||||||
/* When the LCD is off, LY is 0 and STAT mode is 0.
|
/* When the LCD is off, LY is 0 and STAT mode is 0.
|
||||||
Todo: Verify the LY=LYC flag should be on. */
|
Todo: Verify the LY=LYC flag should be on. */
|
||||||
gb->io_registers[GB_IO_LY] = 0;
|
gb->io_registers[GB_IO_LY] = 0;
|
||||||
gb->io_registers[GB_IO_STAT] &= ~3;
|
gb->io_registers[GB_IO_STAT] &= ~3;
|
||||||
gb->io_registers[GB_IO_STAT] |= 4;
|
gb->io_registers[GB_IO_STAT] |= 4;
|
||||||
|
if (gb->hdma_on_hblank) {
|
||||||
|
gb->hdma_on_hblank = false;
|
||||||
|
gb->hdma_on = false;
|
||||||
|
|
||||||
|
/* Todo: is this correct? */
|
||||||
|
gb->hdma_steps_left = 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
/* Keep sending vblanks to user even if the screen is off */
|
/* Keep sending vblanks to user even if the screen is off */
|
||||||
gb->display_cycles += cycles;
|
gb->display_cycles += cycles;
|
||||||
|
Loading…
Reference in New Issue
Block a user