From a494a3f00ee3bd35ee9ab76f8cd4f164da080113 Mon Sep 17 00:00:00 2001 From: David Guillen Fandos Date: Thu, 25 Mar 2021 21:02:06 +0100 Subject: Move OAM update flag to a register Fix a small bug in MIPS dynarec that affects non -G0 targets --- gba_memory.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'gba_memory.c') diff --git a/gba_memory.c b/gba_memory.c index a51f183..e647304 100644 --- a/gba_memory.c +++ b/gba_memory.c @@ -342,14 +342,9 @@ gamepak_swap_entry_type *gamepak_memory_map; // a lot. FILE *gamepak_file_large = NULL; -u32 direct_map_vram = 0; - // Writes to these respective locations should trigger an update // so the related subsystem may react to it. -// If OAM is written to: -u32 oam_update = 1; - // If GBC audio is written to: u32 gbc_sound_update = 0; @@ -755,7 +750,7 @@ cpu_alert_type function_cc write_io_register8(u32 address, u32 value) u32 dispcnt = io_registers[REG_DISPCNT]; if((value & 0x07) != (dispcnt & 0x07)) - oam_update = 1; + reg[OAM_UPDATED] = 1; address8(io_registers, 0x00) = value; break; @@ -1171,7 +1166,7 @@ cpu_alert_type function_cc write_io_register16(u32 address, u32 value) { u32 dispcnt = io_registers[REG_DISPCNT]; if((value & 0x07) != (dispcnt & 0x07)) - oam_update = 1; + reg[OAM_UPDATED] = 1; address16(io_registers, 0x00) = value; break; @@ -1934,7 +1929,7 @@ void function_cc write_rtc(u32 address, u32 value) \ case 0x07: \ /* OAM RAM */ \ - oam_update = 1; \ + reg[OAM_UPDATED] = 1; \ address##type(oam_ram, address & 0x3FF) = value; \ break; \ \ @@ -2529,7 +2524,7 @@ dma_region_type dma_region_map[16] = dma_smc_vars_##type() #define dma_oam_ram_dest() \ - oam_update = 1 \ + reg[OAM_UPDATED] = 1 \ #define dma_vars_oam_ram(type) \ dma_oam_ram_##type() \ @@ -3331,7 +3326,7 @@ void gba_load_state(const void* src) wipe_caches(); #endif - oam_update = 1; + reg[OAM_UPDATED] = 1; gbc_sound_update = 1; for(i = 0; i < 512; i++) -- cgit v1.2.3 From 7ea6c5e247a742af6f7acfbf215c23264410451f Mon Sep 17 00:00:00 2001 From: David Guillen Fandos Date: Thu, 25 Mar 2021 23:01:20 +0100 Subject: Move OAM RAM to stubs also Makes accesses more efficient for MIPS. Make accesses also fast for palette reads. --- gba_memory.c | 1 - 1 file changed, 1 deletion(-) (limited to 'gba_memory.c') diff --git a/gba_memory.c b/gba_memory.c index e647304..b66dce7 100644 --- a/gba_memory.c +++ b/gba_memory.c @@ -305,7 +305,6 @@ u32 gamepak_waitstate_sequential[2][3][3] = } }; -u16 oam_ram[512]; u16 io_registers[1024 * 16]; u8 ewram[1024 * 256 * 2]; u8 iwram[1024 * 32 * 2]; -- cgit v1.2.3