HBlank HDMA should start instantly when starting during HBlank. Fixes 3-D Ultra Pinball.

This commit is contained in:
Lior Halphon 2017-02-25 15:42:26 +02:00
parent 9fbcce689c
commit dbd04f09e8
1 changed files with 4 additions and 0 deletions

View File

@ -577,6 +577,10 @@ static void write_high_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
}
gb->hdma_on = (value & 0x80) == 0;
gb->hdma_on_hblank = (value & 0x80) != 0;
if (gb->hdma_on_hblank && (gb->io_registers[GB_IO_STAT] & 3) == 0) {
gb->hdma_on = true;
gb->hdma_cycles = 0;
}
gb->io_registers[GB_IO_HDMA5] = value;
gb->hdma_steps_left = (gb->io_registers[GB_IO_HDMA5] & 0x7F) + 1;
/* Todo: Verify this. Gambatte's DMA tests require this. */