mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
32x: implement standard/ssf2 mapper, part 2
Turns out wasn't actually hooked in.
This commit is contained in:
parent
310d973b9e
commit
8fde2033ac
3 changed files with 75 additions and 17 deletions
|
@ -49,6 +49,9 @@ struct Pico32xMem *Pico32xMem;
|
|||
|
||||
static void bank_switch_rom_68k(int b);
|
||||
|
||||
static void (*m68k_write8_io)(u32 a, u32 d);
|
||||
static void (*m68k_write16_io)(u32 a, u32 d);
|
||||
|
||||
// addressing byte in 16bit reg
|
||||
#define REG8IN16(ptr, offs) ((u8 *)ptr)[(offs) ^ 1]
|
||||
|
||||
|
@ -857,12 +860,7 @@ static void PicoWrite8_32x_on(u32 a, u32 d)
|
|||
}
|
||||
|
||||
if ((a & 0xfc00) != 0x5000) {
|
||||
if (PicoIn.AHW & PAHW_MCD)
|
||||
PicoWrite8_mcd_io(a, d);
|
||||
else
|
||||
PicoWrite8_io(a, d);
|
||||
if (a == 0xa130f1)
|
||||
bank_switch_rom_68k(Pico32x.regs[4 / 2]);
|
||||
m68k_write8_io(a, d);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -884,6 +882,27 @@ static void PicoWrite8_32x_on(u32 a, u32 d)
|
|||
elprintf(EL_UIO, "m68k unmapped w8 [%06x] %02x @%06x", a, d & 0xff, SekPc);
|
||||
}
|
||||
|
||||
static void PicoWrite8_32x_on_io(u32 a, u32 d)
|
||||
{
|
||||
PicoWrite8_io(a, d);
|
||||
if (a == 0xa130f1)
|
||||
bank_switch_rom_68k(Pico32x.regs[4 / 2]);
|
||||
}
|
||||
|
||||
static void PicoWrite8_32x_on_io_cd(u32 a, u32 d)
|
||||
{
|
||||
PicoWrite8_mcd_io(a, d);
|
||||
if (a == 0xa130f1)
|
||||
bank_switch_rom_68k(Pico32x.regs[4 / 2]);
|
||||
}
|
||||
|
||||
static void PicoWrite8_32x_on_io_ssf2(u32 a, u32 d)
|
||||
{
|
||||
carthw_ssf2_write8(a, d);
|
||||
if ((a & ~0x0e) == 0xa130f1)
|
||||
bank_switch_rom_68k(Pico32x.regs[4 / 2]);
|
||||
}
|
||||
|
||||
static void PicoWrite16_32x_on(u32 a, u32 d)
|
||||
{
|
||||
if ((a & 0xfc00) == 0x5000)
|
||||
|
@ -895,12 +914,7 @@ static void PicoWrite16_32x_on(u32 a, u32 d)
|
|||
}
|
||||
|
||||
if ((a & 0xfc00) != 0x5000) {
|
||||
if (PicoIn.AHW & PAHW_MCD)
|
||||
PicoWrite16_mcd_io(a, d);
|
||||
else
|
||||
PicoWrite16_io(a, d);
|
||||
if (a == 0xa130f0)
|
||||
bank_switch_rom_68k(Pico32x.regs[4 / 2]);
|
||||
m68k_write16_io(a, d);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -920,6 +934,29 @@ static void PicoWrite16_32x_on(u32 a, u32 d)
|
|||
elprintf(EL_UIO, "m68k unmapped w16 [%06x] %04x @%06x", a, d & 0xffff, SekPc);
|
||||
}
|
||||
|
||||
static void PicoWrite16_32x_on_io(u32 a, u32 d)
|
||||
{
|
||||
PicoWrite16_io(a, d);
|
||||
if (a == 0xa130f0)
|
||||
bank_switch_rom_68k(Pico32x.regs[4 / 2]);
|
||||
}
|
||||
|
||||
static void PicoWrite16_32x_on_io_cd(u32 a, u32 d)
|
||||
{
|
||||
PicoWrite16_mcd_io(a, d);
|
||||
if (a == 0xa130f0)
|
||||
bank_switch_rom_68k(Pico32x.regs[4 / 2]);
|
||||
}
|
||||
|
||||
static void PicoWrite16_32x_on_io_ssf2(u32 a, u32 d)
|
||||
{
|
||||
PicoWrite16_io(a, d);
|
||||
if ((a & ~0x0f) == 0xa130f0) {
|
||||
carthw_ssf2_write8(a + 1, d);
|
||||
bank_switch_rom_68k(Pico32x.regs[4 / 2]);
|
||||
}
|
||||
}
|
||||
|
||||
// before ADEN
|
||||
u32 PicoRead8_32x(u32 a)
|
||||
{
|
||||
|
@ -1833,6 +1870,20 @@ void PicoMemSetup32x(void)
|
|||
cpu68k_map_set(m68k_write8_map, 0xa10000, 0xa1ffff, PicoWrite8_32x_on, 1);
|
||||
cpu68k_map_set(m68k_write16_map, 0xa10000, 0xa1ffff, PicoWrite16_32x_on, 1);
|
||||
|
||||
// TODO: cd + carthw
|
||||
if (PicoIn.AHW & PAHW_MCD) {
|
||||
m68k_write8_io = PicoWrite8_32x_on_io_cd;
|
||||
m68k_write16_io = PicoWrite16_32x_on_io_cd;
|
||||
}
|
||||
else if (carthw_ssf2_active) {
|
||||
m68k_write8_io = PicoWrite8_32x_on_io_ssf2;
|
||||
m68k_write16_io = PicoWrite16_32x_on_io_ssf2;
|
||||
}
|
||||
else {
|
||||
m68k_write8_io = PicoWrite8_32x_on_io;
|
||||
m68k_write16_io = PicoWrite16_32x_on_io;
|
||||
}
|
||||
|
||||
// SH2 maps: A31,A30,A29,CS1,CS0
|
||||
// all unmapped by default
|
||||
for (i = 0; i < ARRAY_SIZE(sh2_read8_map); i++) {
|
||||
|
|
|
@ -31,11 +31,11 @@ static carthw_state_chunk carthw_ssf2_state[] =
|
|||
{ 0, 0, NULL }
|
||||
};
|
||||
|
||||
static void carthw_ssf2_write8(u32 a, u32 d)
|
||||
void carthw_ssf2_write8(u32 a, u32 d)
|
||||
{
|
||||
u32 target, base;
|
||||
|
||||
if ((a & 0xfffff0) != 0xa130f0) {
|
||||
if ((a & ~0x0e) != 0xa130f1) {
|
||||
PicoWrite8_io(a, d);
|
||||
return;
|
||||
}
|
||||
|
@ -54,13 +54,19 @@ static void carthw_ssf2_write8(u32 a, u32 d)
|
|||
|
||||
cpu68k_map_set(m68k_read8_map, target, target + 0x80000 - 1, Pico.rom + base, 0);
|
||||
cpu68k_map_set(m68k_read16_map, target, target + 0x80000 - 1, Pico.rom + base, 0);
|
||||
if (PicoIn.AHW & PAHW_32X)
|
||||
p32x_update_banks();
|
||||
}
|
||||
|
||||
void carthw_ssf2_write16(u32 a, u32 d)
|
||||
{
|
||||
PicoWrite16_io(a, d);
|
||||
if ((a & ~0x0f) == 0xa130f0)
|
||||
carthw_ssf2_write8(a + 1, d);
|
||||
}
|
||||
|
||||
static void carthw_ssf2_mem_setup(void)
|
||||
{
|
||||
cpu68k_map_set(m68k_write8_map, 0xa10000, 0xa1ffff, carthw_ssf2_write8, 1);
|
||||
cpu68k_map_set(m68k_write8_map, 0xa10000, 0xa1ffff, carthw_ssf2_write8, 1);
|
||||
cpu68k_map_set(m68k_write16_map, 0xa10000, 0xa1ffff, carthw_ssf2_write16, 1);
|
||||
}
|
||||
|
||||
static void carthw_ssf2_statef(void)
|
||||
|
|
|
@ -18,6 +18,7 @@ void PicoSVPMemSetup(void);
|
|||
extern int carthw_ssf2_active;
|
||||
extern unsigned char carthw_ssf2_banks[8];
|
||||
void carthw_ssf2_startup(void);
|
||||
void carthw_ssf2_write8(unsigned int a, unsigned int d);
|
||||
|
||||
/* misc */
|
||||
void carthw_Xin1_startup(void);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue