From ab52a08a05d80aaa733c089d5a4075020ed1ca60 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Tue, 3 Dec 2024 00:45:09 +0200 Subject: [PATCH] Fix m3_scx_high_5_bits on DMG --- Core/sm83_cpu.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Core/sm83_cpu.c b/Core/sm83_cpu.c index de2540328..e25b10ac8 100644 --- a/Core/sm83_cpu.c +++ b/Core/sm83_cpu.c @@ -25,7 +25,7 @@ typedef enum { GB_CONFLICT_LCDC_CGB_DOUBLE, GB_CONFLICT_STAT_CGB_DOUBLE, GB_CONFLICT_NR10_CGB_DOUBLE, - GB_CONFLICT_SCX_CGB_DOUBLE, + GB_CONFLICT_SCX_DMG_AND_CGB_DOUBLE, } conflict_t; static const conflict_t cgb_conflict_map[0x80] = { @@ -48,7 +48,7 @@ static const conflict_t cgb_double_conflict_map[0x80] = { [GB_IO_WY] = GB_CONFLICT_READ_OLD, [GB_IO_STAT] = GB_CONFLICT_STAT_CGB_DOUBLE, [GB_IO_NR10] = GB_CONFLICT_NR10_CGB_DOUBLE, - [GB_IO_SCX] = GB_CONFLICT_SCX_CGB_DOUBLE, + [GB_IO_SCX] = GB_CONFLICT_SCX_DMG_AND_CGB_DOUBLE, [GB_IO_WX] = GB_CONFLICT_READ_OLD, }; @@ -59,15 +59,12 @@ static const conflict_t dmg_conflict_map[0x80] = { [GB_IO_LCDC] = GB_CONFLICT_DMG_LCDC, [GB_IO_SCY] = GB_CONFLICT_READ_NEW, [GB_IO_STAT] = GB_CONFLICT_STAT_DMG, - [GB_IO_BGP] = GB_CONFLICT_PALETTE_DMG, [GB_IO_OBP0] = GB_CONFLICT_PALETTE_DMG, [GB_IO_OBP1] = GB_CONFLICT_PALETTE_DMG, [GB_IO_WY] = GB_CONFLICT_READ_OLD, [GB_IO_WX] = GB_CONFLICT_WX_DMG, - - /* Todo: these were not verified at all */ - [GB_IO_SCX] = GB_CONFLICT_READ_NEW, + [GB_IO_SCX] = GB_CONFLICT_SCX_DMG_AND_CGB_DOUBLE, }; /* Todo: Verify on an SGB1 */ @@ -77,15 +74,12 @@ static const conflict_t sgb_conflict_map[0x80] = { [GB_IO_LCDC] = GB_CONFLICT_SGB_LCDC, [GB_IO_SCY] = GB_CONFLICT_READ_NEW, [GB_IO_STAT] = GB_CONFLICT_STAT_DMG, - [GB_IO_BGP] = GB_CONFLICT_READ_NEW, [GB_IO_OBP0] = GB_CONFLICT_READ_NEW, [GB_IO_OBP1] = GB_CONFLICT_READ_NEW, [GB_IO_WY] = GB_CONFLICT_READ_OLD, [GB_IO_WX] = GB_CONFLICT_WX_DMG, - - /* Todo: these were not verified at all */ - [GB_IO_SCX] = GB_CONFLICT_READ_NEW, + [GB_IO_SCX] = GB_CONFLICT_SCX_DMG_AND_CGB_DOUBLE, }; static uint8_t cycle_read(GB_gameboy_t *gb, uint16_t addr) @@ -302,7 +296,7 @@ static void cycle_write(GB_gameboy_t *gb, uint16_t addr, uint8_t value) break; } - case GB_CONFLICT_SCX_CGB_DOUBLE: + case GB_CONFLICT_SCX_DMG_AND_CGB_DOUBLE: GB_advance_cycles(gb, gb->pending_cycles - 2); GB_write_memory(gb, addr, value); gb->pending_cycles = 6;