fame: always update the fetch map

should just get rid of that thing, it's annoying
This commit is contained in:
notaz 2017-09-25 23:34:34 +03:00
parent 6d8782a1f9
commit c6b118c0ad
3 changed files with 24 additions and 27 deletions

View file

@ -1179,12 +1179,6 @@ static void bank_switch(int b)
cpu68k_map_set(m68k_read16_map, 0x900000, 0x900000 + rs - 1, Pico.rom + bank, 0);
elprintf(EL_32X, "bank %06x-%06x -> %06x", 0x900000, 0x900000 + rs - 1, bank);
#ifdef EMU_F68K
// setup FAME fetchmap
for (rs = 0x90; rs < 0xa0; rs++)
PicoCpuFM68k.Fetch[rs] = (unsigned long)Pico.rom + bank - 0x900000;
#endif
}
// -----------------------------------------------------------------

View file

@ -1071,23 +1071,6 @@ static void remap_word_ram(u32 r3)
cpu68k_map_set(s68k_write8_map, 0x080000, 0x0bffff, s68k_dec_write8[b0 ^ 1][m], 1);
cpu68k_map_set(s68k_write16_map, 0x080000, 0x0bffff, s68k_dec_write16[b0 ^ 1][m], 1);
}
#ifdef EMU_F68K
// update fetchmap..
int i;
if (!(r3 & 4))
{
for (i = M68K_FETCHBANK1*2/16; (i<<(24-FAMEC_FETCHBITS)) < 0x240000; i++)
PicoCpuFM68k.Fetch[i] = (unsigned long)Pico_mcd->word_ram2M - 0x200000;
}
else
{
for (i = M68K_FETCHBANK1*2/16; (i<<(24-FAMEC_FETCHBITS)) < 0x220000; i++)
PicoCpuFM68k.Fetch[i] = (unsigned long)Pico_mcd->word_ram1M[r3 & 1] - 0x200000;
for (i = M68K_FETCHBANK1*0x0c/0x100; (i<<(24-FAMEC_FETCHBITS)) < 0x0e0000; i++)
PicoCpuFS68k.Fetch[i] = (unsigned long)Pico_mcd->word_ram1M[(r3&1)^1] - 0x0c0000;
}
#endif
}
void pcd_state_loaded_mem(void)

View file

@ -63,6 +63,17 @@ void cpu68k_map_set(uptr *map, int start_addr, int end_addr,
const void *func_or_mh, int is_func)
{
xmap_set(map, M68K_MEM_SHIFT, start_addr, end_addr, func_or_mh, is_func);
#ifdef EMU_F68K
// setup FAME fetchmap
if (!is_func)
{
int shiftout = 24 - FAMEC_FETCHBITS;
int i = start_addr >> shiftout;
uptr base = (uptr)func_or_mh - (i << shiftout);
for (; i <= (end_addr >> shiftout); i++)
PicoCpuFM68k.Fetch[i] = base;
}
#endif
}
// more specialized/optimized function (does same as above)
@ -89,6 +100,17 @@ void cpu68k_map_all_ram(int start_addr, int end_addr, void *ptr, int is_sub)
addr >>= 1;
for (i = start_addr >> shift; i <= end_addr >> shift; i++)
r8map[i] = r16map[i] = w8map[i] = w16map[i] = addr;
#ifdef EMU_F68K
// setup FAME fetchmap
{
M68K_CONTEXT *ctx = is_sub ? &PicoCpuFS68k : &PicoCpuFM68k;
int shiftout = 24 - FAMEC_FETCHBITS;
i = start_addr >> shiftout;
addr = (uptr)ptr - (i << shiftout);
for (; i <= (end_addr >> shiftout); i++)
ctx->Fetch[i] = addr;
}
#endif
}
static u32 m68k_unmapped_read8(u32 a)
@ -799,14 +821,12 @@ PICO_INTERNAL void PicoMemSetup(void)
{
int i;
// by default, point everything to first 64k of ROM
for (i = 0; i < M68K_FETCHBANK1; i++)
for (i = 0; i < M68K_FETCHBANK1 * 0xe0 / 0x100; i++)
PicoCpuFM68k.Fetch[i] = (unsigned long)Pico.rom - (i<<(24-FAMEC_FETCHBITS));
// now real ROM
for (i = 0; i < M68K_FETCHBANK1 && (i<<(24-FAMEC_FETCHBITS)) < Pico.romsize; i++)
PicoCpuFM68k.Fetch[i] = (unsigned long)Pico.rom;
// .. and RAM
for (i = M68K_FETCHBANK1*14/16; i < M68K_FETCHBANK1; i++)
PicoCpuFM68k.Fetch[i] = (unsigned long)Pico.ram - (i<<(24-FAMEC_FETCHBITS));
// RAM already set
}
#endif
#ifdef EMU_M68K