Mode 0 interrupts do not occur in the glitched mode 0 of the first line 0. The extra OAM interrupt bug also affects DMG.
This commit is contained in:
parent
0a2d6e6dcb
commit
73dc3560a5
@ -245,7 +245,7 @@ void GB_STAT_update(GB_gameboy_t *gb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (gb->io_registers[GB_IO_STAT] & 3) {
|
switch (gb->io_registers[GB_IO_STAT] & 3) {
|
||||||
case 0: gb->stat_interrupt_line = (gb->io_registers[GB_IO_STAT] & 8); break;
|
case 0: gb->stat_interrupt_line = (gb->io_registers[GB_IO_STAT] & 8) && !gb->is_first_line_mode2; break;
|
||||||
case 1: gb->stat_interrupt_line = gb->io_registers[GB_IO_STAT] & 0x10; break;
|
case 1: gb->stat_interrupt_line = gb->io_registers[GB_IO_STAT] & 0x10; break;
|
||||||
case 2: gb->stat_interrupt_line = gb->io_registers[GB_IO_STAT] & 0x20; break;
|
case 2: gb->stat_interrupt_line = gb->io_registers[GB_IO_STAT] & 0x20; break;
|
||||||
}
|
}
|
||||||
@ -431,6 +431,7 @@ void GB_display_run(GB_gameboy_t *gb, uint8_t cycles)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Handle the very first line 0 */
|
/* Handle the very first line 0 */
|
||||||
|
gb->is_first_line_mode2 = true;
|
||||||
gb->current_line = 0;
|
gb->current_line = 0;
|
||||||
gb->ly_for_comparison = 0;
|
gb->ly_for_comparison = 0;
|
||||||
gb->io_registers[GB_IO_STAT] &= ~3;
|
gb->io_registers[GB_IO_STAT] &= ~3;
|
||||||
@ -448,6 +449,7 @@ void GB_display_run(GB_gameboy_t *gb, uint8_t cycles)
|
|||||||
gb->vram_read_blocked = !gb->is_cgb;
|
gb->vram_read_blocked = !gb->is_cgb;
|
||||||
gb->oam_write_blocked = true;
|
gb->oam_write_blocked = true;
|
||||||
gb->vram_write_blocked = !gb->is_cgb;
|
gb->vram_write_blocked = !gb->is_cgb;
|
||||||
|
gb->is_first_line_mode2 = false;
|
||||||
GB_STAT_update(gb);
|
GB_STAT_update(gb);
|
||||||
|
|
||||||
gb->cycles_for_line += 2;
|
gb->cycles_for_line += 2;
|
||||||
@ -727,7 +729,7 @@ void GB_display_run(GB_gameboy_t *gb, uint8_t cycles)
|
|||||||
if (!gb->is_cgb) {
|
if (!gb->is_cgb) {
|
||||||
gb->ly_for_comparison = -1;
|
gb->ly_for_comparison = -1;
|
||||||
}
|
}
|
||||||
if (gb->is_cgb && gb->current_line == LINES) {
|
if (gb->current_line == LINES) {
|
||||||
gb->io_registers[GB_IO_STAT] &= ~3;
|
gb->io_registers[GB_IO_STAT] &= ~3;
|
||||||
gb->io_registers[GB_IO_STAT] |= 2;
|
gb->io_registers[GB_IO_STAT] |= 2;
|
||||||
GB_STAT_update(gb);
|
GB_STAT_update(gb);
|
||||||
|
@ -429,6 +429,7 @@ struct GB_gameboy_internal_s {
|
|||||||
uint8_t oam_search_index;
|
uint8_t oam_search_index;
|
||||||
uint8_t accessed_oam_row;
|
uint8_t accessed_oam_row;
|
||||||
uint8_t extra_penalty_for_sprite_at_0;
|
uint8_t extra_penalty_for_sprite_at_0;
|
||||||
|
bool is_first_line_mode2;
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Unsaved data. This includes all pointers, as well as everything that shouldn't be on a save state */
|
/* Unsaved data. This includes all pointers, as well as everything that shouldn't be on a save state */
|
||||||
|
Loading…
Reference in New Issue
Block a user