Refine BIOS and unmapped memory accesses

Turns out there's a couple of inaccuracies that do affect a couple of
games. Most of them are buggy games but emulating these accesses
correctly helps jumping over some bugs.
This commit is contained in:
David Guillen Fandos 2023-04-15 11:44:48 +02:00
parent 08372aae64
commit 3f976c9557
2 changed files with 10 additions and 6 deletions

4
cpu.c
View File

@ -868,7 +868,7 @@ const u32 spsr_masks[4] = { 0x00000000, 0x000000EF, 0xF0000000, 0xF00000EF };
} \
if(((_address >> 24) == 0) && (pc >= 0x4000)) \
{ \
ror(dest, reg[REG_BUS_VALUE], (_address & 0x03) << 3); \
dest = (type)(reg[REG_BUS_VALUE] >> ((_address & 0x03) << 3)); \
} \
else \
\
@ -950,7 +950,7 @@ const u32 spsr_masks[4] = { 0x00000000, 0x000000EF, 0xF0000000, 0xF00000EF };
fast_read_memory(8, u8, address, dest) \
#define load_memory_u16(address, dest) \
fast_read_memory(16, u32, address, dest) \
fast_read_memory(16, u16, address, dest) \
#define load_memory_u32(address, dest) \
fast_read_memory(32, u32, address, dest) \

View File

@ -569,10 +569,14 @@ u32 function_cc read_eeprom(void)
{ \
case 0x00: \
/* BIOS */ \
if(reg[REG_PC] >= 0x4000) \
ror(value, reg[REG_BUS_VALUE], (address & 0x03) << 3); \
else \
value = readaddress##type(bios_rom, address & 0x3FFF); \
if (address < 0x4000) { \
if(reg[REG_PC] >= 0x4000) \
value = (u##type)(reg[REG_BUS_VALUE] >> ((address & 0x03) << 3)); \
else \
value = readaddress##type(bios_rom, address & 0x3FFF); \
} else { \
read_open##type(); \
} \
break; \
\
case 0x02: \