WY is tested every cycle

This commit is contained in:
Lior Halphon 2020-02-26 22:24:08 +02:00
parent b37a0b285a
commit 9c7a8fdb1b
3 changed files with 9 additions and 6 deletions

View File

@ -382,6 +382,7 @@ void GB_lcd_off(GB_gameboy_t *gb)
gb->ly_for_comparison = 0; gb->ly_for_comparison = 0;
gb->accessed_oam_row = -1; gb->accessed_oam_row = -1;
gb->wy_triggered = false;
} }
static void add_object_from_index(GB_gameboy_t *gb, unsigned index) static void add_object_from_index(GB_gameboy_t *gb, unsigned index)

View File

@ -645,6 +645,10 @@ static void write_high_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
if (addr < 0xFF80) { if (addr < 0xFF80) {
/* Hardware registers */ /* Hardware registers */
switch (addr & 0xFF) { switch (addr & 0xFF) {
case GB_IO_WY:
if (value == gb->current_line) {
gb->wy_triggered = true;
}
case GB_IO_WX: case GB_IO_WX:
case GB_IO_IF: case GB_IO_IF:
case GB_IO_SCX: case GB_IO_SCX:
@ -652,7 +656,6 @@ static void write_high_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
case GB_IO_BGP: case GB_IO_BGP:
case GB_IO_OBP0: case GB_IO_OBP0:
case GB_IO_OBP1: case GB_IO_OBP1:
case GB_IO_WY:
case GB_IO_SB: case GB_IO_SB:
case GB_IO_UNKNOWN2: case GB_IO_UNKNOWN2:
case GB_IO_UNKNOWN3: case GB_IO_UNKNOWN3:

View File

@ -31,7 +31,6 @@ static const GB_conflict_t cgb_conflict_map[0x80] = {
[GB_IO_OBP0] = GB_CONFLICT_PALETTE_CGB, [GB_IO_OBP0] = GB_CONFLICT_PALETTE_CGB,
[GB_IO_OBP1] = GB_CONFLICT_PALETTE_CGB, [GB_IO_OBP1] = GB_CONFLICT_PALETTE_CGB,
/* Todo: most values not verified, and probably differ between revisions */ /* Todo: most values not verified, and probably differ between revisions */
}; };
@ -46,9 +45,9 @@ static const GB_conflict_t dmg_conflict_map[0x80] = {
[GB_IO_BGP] = GB_CONFLICT_PALETTE_DMG, [GB_IO_BGP] = GB_CONFLICT_PALETTE_DMG,
[GB_IO_OBP0] = GB_CONFLICT_PALETTE_DMG, [GB_IO_OBP0] = GB_CONFLICT_PALETTE_DMG,
[GB_IO_OBP1] = GB_CONFLICT_PALETTE_DMG, [GB_IO_OBP1] = GB_CONFLICT_PALETTE_DMG,
[GB_IO_WY] = GB_CONFLICT_READ_OLD,
/* Todo: these were not verified at all */ /* Todo: these were not verified at all */
[GB_IO_WY] = GB_CONFLICT_READ_NEW,
[GB_IO_WX] = GB_CONFLICT_READ_NEW, [GB_IO_WX] = GB_CONFLICT_READ_NEW,
[GB_IO_SCX] = GB_CONFLICT_READ_NEW, [GB_IO_SCX] = GB_CONFLICT_READ_NEW,
}; };
@ -64,9 +63,9 @@ static const GB_conflict_t sgb_conflict_map[0x80] = {
[GB_IO_BGP] = GB_CONFLICT_READ_NEW, [GB_IO_BGP] = GB_CONFLICT_READ_NEW,
[GB_IO_OBP0] = GB_CONFLICT_READ_NEW, [GB_IO_OBP0] = GB_CONFLICT_READ_NEW,
[GB_IO_OBP1] = GB_CONFLICT_READ_NEW, [GB_IO_OBP1] = GB_CONFLICT_READ_NEW,
[GB_IO_WY] = GB_CONFLICT_READ_OLD,
/* Todo: these were not verified at all */ /* Todo: these were not verified at all */
[GB_IO_WY] = GB_CONFLICT_READ_NEW,
[GB_IO_WX] = GB_CONFLICT_READ_NEW, [GB_IO_WX] = GB_CONFLICT_READ_NEW,
[GB_IO_SCX] = GB_CONFLICT_READ_NEW, [GB_IO_SCX] = GB_CONFLICT_READ_NEW,
}; };