experimental merging of snes memory handlers. please test your favorite SNES games against previous code

(or against latest release) and report regressions.
This commit is contained in:
Fabio Priuli 2013-03-06 16:15:08 +00:00
parent 75f1fe0c71
commit ebf4e8eae4
6 changed files with 170 additions and 315 deletions

View File

@ -345,14 +345,9 @@ UINT32 nss_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, co
static ADDRESS_MAP_START( snes_map, AS_PROGRAM, 8, nss_state )
AM_RANGE(0x000000, 0x2fffff) AM_READWRITE_LEGACY(snes_r_bank1, snes_w_bank1) /* I/O and ROM (repeats for each bank) */
AM_RANGE(0x300000, 0x3fffff) AM_READWRITE_LEGACY(snes_r_bank2, snes_w_bank2) /* I/O and ROM (repeats for each bank) */
AM_RANGE(0x400000, 0x5fffff) AM_READ_LEGACY(snes_r_bank3) /* ROM (and reserved in Mode 20) */
AM_RANGE(0x600000, 0x6fffff) AM_READWRITE_LEGACY(snes_r_bank4, snes_w_bank4) /* used by Mode 20 DSP-1 */
AM_RANGE(0x700000, 0x7dffff) AM_READWRITE_LEGACY(snes_r_bank5, snes_w_bank5)
AM_RANGE(0x000000, 0x7dffff) AM_READWRITE_LEGACY(snes_r_bank1, snes_w_bank1)
AM_RANGE(0x7e0000, 0x7fffff) AM_RAM /* 8KB Low RAM, 24KB High RAM, 96KB Expanded RAM */
AM_RANGE(0x800000, 0xbfffff) AM_READWRITE_LEGACY(snes_r_bank6, snes_w_bank6) /* Mirror and ROM */
AM_RANGE(0xc00000, 0xffffff) AM_READWRITE_LEGACY(snes_r_bank7, snes_w_bank7) /* Mirror and ROM */
AM_RANGE(0x800000, 0xffffff) AM_READWRITE_LEGACY(snes_r_bank2, snes_w_bank2) /* Mirror and ROM */
ADDRESS_MAP_END
READ8_MEMBER(nss_state::spc_ram_100_r)

View File

@ -161,14 +161,9 @@ UINT32 sfcbox_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap,
}
static ADDRESS_MAP_START( snes_map, AS_PROGRAM, 8, sfcbox_state )
AM_RANGE(0x000000, 0x2fffff) AM_READWRITE_LEGACY(snes_r_bank1, snes_w_bank1) /* I/O and ROM (repeats for each bank) */
AM_RANGE(0x300000, 0x3fffff) AM_READWRITE_LEGACY(snes_r_bank2, snes_w_bank2) /* I/O and ROM (repeats for each bank) */
AM_RANGE(0x400000, 0x5fffff) AM_READ_LEGACY(snes_r_bank3) /* ROM (and reserved in Mode 20) */
AM_RANGE(0x600000, 0x6fffff) AM_READWRITE_LEGACY(snes_r_bank4, snes_w_bank4) /* used by Mode 20 DSP-1 */
AM_RANGE(0x700000, 0x7dffff) AM_READWRITE_LEGACY(snes_r_bank5, snes_w_bank5)
AM_RANGE(0x000000, 0x7dffff) AM_READWRITE_LEGACY(snes_r_bank1, snes_w_bank1)
AM_RANGE(0x7e0000, 0x7fffff) AM_RAM /* 8KB Low RAM, 24KB High RAM, 96KB Expanded RAM */
AM_RANGE(0x800000, 0xbfffff) AM_READWRITE_LEGACY(snes_r_bank6, snes_w_bank6) /* Mirror and ROM */
AM_RANGE(0xc00000, 0xffffff) AM_READWRITE_LEGACY(snes_r_bank7, snes_w_bank7) /* Mirror and ROM */
AM_RANGE(0x800000, 0xffffff) AM_READWRITE_LEGACY(snes_r_bank2, snes_w_bank2) /* Mirror and ROM */
ADDRESS_MAP_END
READ8_MEMBER(sfcbox_state::spc_ram_100_r)

View File

@ -237,14 +237,9 @@ READ8_MEMBER(snesb_state::snesb_coin_r)
static ADDRESS_MAP_START( snesb_map, AS_PROGRAM, 8, snesb_state )
AM_RANGE(0x000000, 0x2fffff) AM_READWRITE_LEGACY(snes_r_bank1, snes_w_bank1) /* I/O and ROM (repeats for each bank) */
AM_RANGE(0x300000, 0x3fffff) AM_READWRITE_LEGACY(snes_r_bank2, snes_w_bank2) /* I/O and ROM (repeats for each bank) */
AM_RANGE(0x400000, 0x5fffff) AM_READ_LEGACY(snes_r_bank3) /* ROM (and reserved in Mode 20) */
AM_RANGE(0x600000, 0x6fffff) AM_READWRITE_LEGACY(snes_r_bank4, snes_w_bank4) /* used by Mode 20 DSP-1 */
AM_RANGE(0x700000, 0x7dffff) AM_READWRITE_LEGACY(snes_r_bank5, snes_w_bank5)
AM_RANGE(0x7e0000, 0x7fffff) AM_RAM /* 8KB Low RAM, 24KB High RAM, 96KB Expanded RAM */
AM_RANGE(0x800000, 0xbfffff) AM_READWRITE_LEGACY(snes_r_bank6, snes_w_bank6) /* Mirror and ROM */
AM_RANGE(0xc00000, 0xffffff) AM_READWRITE_LEGACY(snes_r_bank7, snes_w_bank7) /* Mirror and ROM */
AM_RANGE(0x000000, 0x7dffff) AM_READWRITE_LEGACY(snes_r_bank1, snes_w_bank1)
AM_RANGE(0x7e0000, 0x7fffff) AM_RAM /* 8KB Low RAM, 24KB High RAM, 96KB Expanded RAM */
AM_RANGE(0x800000, 0xffffff) AM_READWRITE_LEGACY(snes_r_bank2, snes_w_bank2) /* Mirror and ROM */
ADDRESS_MAP_END
READ8_MEMBER(snesb_state::spc_ram_100_r)

View File

@ -757,17 +757,8 @@ DECLARE_READ8_HANDLER( snes_open_bus_r );
extern DECLARE_READ8_HANDLER( snes_r_bank1 );
extern DECLARE_READ8_HANDLER( snes_r_bank2 );
extern DECLARE_READ8_HANDLER( snes_r_bank3 );
extern DECLARE_READ8_HANDLER( snes_r_bank4 );
extern DECLARE_READ8_HANDLER( snes_r_bank5 );
extern DECLARE_READ8_HANDLER( snes_r_bank6 );
extern DECLARE_READ8_HANDLER( snes_r_bank7 );
extern DECLARE_WRITE8_HANDLER( snes_w_bank1 );
extern DECLARE_WRITE8_HANDLER( snes_w_bank2 );
extern DECLARE_WRITE8_HANDLER( snes_w_bank4 );
extern DECLARE_WRITE8_HANDLER( snes_w_bank5 );
extern DECLARE_WRITE8_HANDLER( snes_w_bank6 );
extern DECLARE_WRITE8_HANDLER( snes_w_bank7 );
extern UINT8 *snes_ram; /* Main memory */

View File

@ -676,161 +676,44 @@ address | | | | | | |
*/
/* 0x000000 - 0x2fffff */
/* 0x000000 - 0x7dffff */
READ8_HANDLER( snes_r_bank1 )
{
snes_state *state = space.machine().driver_data<snes_state>();
UINT8 value = 0xff;
UINT16 address = offset & 0xffff;
if (address < 0x2000) /* Mirror of Low RAM */
value = space.read_byte(0x7e0000 + address);
else if (address < 0x6000) /* I/O */
value = state->snes_r_io(space, address);
else if (address < 0x8000)
if (offset < 0x400000)
{
logerror("(PC=%06x) snes_r_bank1: Unmapped external chip read: %04x\n", space.device().safe_pc(), address);
value = snes_open_bus_r(space, 0); /* Reserved */
}
else
value = snes_ram[offset]; //ROM
return value;
}
/* 0x300000 - 0x3fffff */
READ8_HANDLER( snes_r_bank2 )
{
snes_state *state = space.machine().driver_data<snes_state>();
UINT8 value = 0xff;
UINT16 address = offset & 0xffff;
if (address < 0x2000) /* Mirror of Low RAM */
value = space.read_byte(0x7e0000 + address);
else if (address < 0x6000) /* I/O */
value = state->snes_r_io(space, address);
else if (address < 0x8000) /* SRAM for mode_21, Reserved othewise */
{
if (state->m_cart[0].mode == SNES_MODE_21 && state->m_cart[0].m_nvram_size > 0)
if (address < 0x2000) /* Mirror of Low RAM */
value = space.read_byte(0x7e0000 + address);
else if (address < 0x6000) /* I/O */
value = state->snes_r_io(space, address);
else if (address < 0x8000)
{
/* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */
/* OTOH Secret of Mana does not work properly if sram is not mirrored on later banks */
int mask = (state->m_cart[0].m_nvram_size - 1) & 0x7fff; /* Limit SRAM size to what's actually present */
value = state->m_cart[0].m_nvram[(offset - 0x6000) & mask];
if (offset >= 0x300000 && state->m_cart[0].mode == SNES_MODE_21 && state->m_cart[0].m_nvram_size > 0)
{
/* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */
/* OTOH Secret of Mana does not work properly if sram is not mirrored on later banks */
int mask = (state->m_cart[0].m_nvram_size - 1) & 0x7fff; /* Limit SRAM size to what's actually present */
value = state->m_cart[0].m_nvram[(offset - 0x6000) & mask];
}
else
value = snes_open_bus_r(space, 0); /* Reserved */
}
else
{
logerror("(PC=%06x) snes_r_bank2: Unmapped external chip read: %04x\n", space.device().safe_pc(), address );
value = snes_ram[offset]; //ROM
}
else if (offset < 0x700000)
{
if (state->m_cart[0].mode & 5 && address < 0x8000) /* Mode 20 & 22 in 0x0000-0x7fff */
value = snes_open_bus_r(space, 0);
}
else
value = snes_ram[offset]; //ROM
}
else
value = snes_ram[0x300000 + offset]; //ROM
return value;
}
/* 0x400000 - 0x5fffff */
READ8_HANDLER( snes_r_bank3 )
{
snes_state *state = space.machine().driver_data<snes_state>();
UINT8 value = 0xff;
UINT16 address = offset & 0xffff;
if (state->m_cart[0].mode & 5) /* Mode 20 & 22 */
{
if (address < 0x8000 && state->m_cart[0].mode == SNES_MODE_20)
value = snes_open_bus_r(space, 0); /* Reserved */
else
value = snes_ram[0x400000 + offset]; //ROM
}
else /* Mode 21 & 25 */
value = snes_ram[0x400000 + offset]; //ROM
return value;
}
/* 0x600000 - 0x6fffff */
READ8_HANDLER( snes_r_bank4 )
{
snes_state *state = space.machine().driver_data<snes_state>();
UINT8 value = 0xff;
UINT16 address = offset & 0xffff;
if (state->m_cart[0].mode & 5) /* Mode 20 & 22 */
{
if (address >= 0x8000)
value = snes_ram[0x600000 + offset]; //ROM
else
{
logerror("(PC=%06x) snes_r_bank4: Unmapped external chip read: %04x\n", space.device().safe_pc(), address);
value = snes_open_bus_r(space, 0); /* Reserved */
}
}
else if (state->m_cart[0].mode & 0x0a) /* Mode 21 & 25 */
value = snes_ram[0x600000 + offset]; //ROM
return value;
}
/* 0x700000 - 0x7dffff */
READ8_HANDLER( snes_r_bank5 )
{
snes_state *state = space.machine().driver_data<snes_state>();
UINT8 value;
UINT16 address = offset & 0xffff;
if (state->m_cart[0].mode & 5 && address < 0x8000) /* Mode 20 & 22 */
{
if (state->m_cart[0].m_nvram_size > 0x8000)
{
// In this case, SRAM is mapped in 0x8000 chunks at diff offsets: 0x700000-0x707fff, 0x710000-0x717fff, etc.
int mask = state->m_cart[0].m_nvram_size - 1;
offset = (offset / 0x10000) * 0x8000 + (offset & 0x7fff);
value = state->m_cart[0].m_nvram[offset & mask];
}
else if (state->m_cart[0].m_nvram_size > 0)
{
int mask = state->m_cart[0].m_nvram_size - 1; /* Limit SRAM size to what's actually present */
value = state->m_cart[0].m_nvram[offset & mask];
}
else
{
logerror("(PC=%06x) snes_r_bank5: Unmapped external chip read: %04x\n", space.device().safe_pc(), address);
value = snes_open_bus_r(space, 0); /* Reserved */
}
}
else
value = snes_ram[0x700000 + offset]; //ROM
return value;
}
/* 0x800000 - 0xbfffff */
READ8_HANDLER( snes_r_bank6 )
{
UINT8 value = 0;
if ((offset & 0xffff) < 0x8000)
value = space.read_byte(offset);
else
value = snes_ram[0x800000 + offset]; //ROM
return value;
}
/* 0xc00000 - 0xffffff */
READ8_HANDLER( snes_r_bank7 )
{
snes_state *state = space.machine().driver_data<snes_state>();
UINT8 value = 0;
UINT16 address = offset & 0xffff;
if (state->m_cart[0].mode & 5 && address < 0x8000) /* Mode 20 & 22 in 0x0000-0x7fff */
{
if (offset < 0x300000)
value = space.read_byte(0x400000 + offset);
else
if (state->m_cart[0].mode & 5 && address < 0x8000) /* Mode 20 & 22 */
{
if (state->m_cart[0].m_nvram_size > 0x8000)
{
@ -846,124 +729,104 @@ READ8_HANDLER( snes_r_bank7 )
}
else
{
logerror("(PC=%06x) snes_r_bank7: Unmapped external chip read: %04x\n", space.device().safe_pc(), address);
logerror("(PC=%06x) snes_r_bank1: Unmapped external chip read: %X\n", space.device().safe_pc(), offset);
value = snes_open_bus_r(space, 0); /* Reserved */
}
}
else
value = snes_ram[offset]; //ROM
}
else
value = snes_ram[0xc00000 + offset]; //ROM
return value;
}
/* 0x000000 - 0x2fffff */
/* 0x800000 - 0xffffff */
READ8_HANDLER( snes_r_bank2 )
{
snes_state *state = space.machine().driver_data<snes_state>();
UINT8 value = 0;
UINT16 address = offset & 0xffff;
if (offset < 0x400000)
{
if (address < 0x8000)
value = space.read_byte(offset);
else
value = snes_ram[0x800000 + offset]; //ROM
}
else
{
if (state->m_cart[0].mode & 5 && address < 0x8000) /* Mode 20 & 22 in 0x0000-0x7fff */
{
if (offset < 0x700000)
value = space.read_byte(offset);
else
{
if (state->m_cart[0].m_nvram_size > 0x8000)
{
// In this case, SRAM is mapped in 0x8000 chunks at diff offsets: 0x700000-0x707fff, 0x710000-0x717fff, etc.
int mask = state->m_cart[0].m_nvram_size - 1;
offset = (offset / 0x10000) * 0x8000 + (offset & 0x7fff);
value = state->m_cart[0].m_nvram[offset & mask];
}
else if (state->m_cart[0].m_nvram_size > 0)
{
int mask = state->m_cart[0].m_nvram_size - 1; /* Limit SRAM size to what's actually present */
value = state->m_cart[0].m_nvram[offset & mask];
}
else
{
logerror("(PC=%06x) snes_r_bank2: Unmapped external chip read: %X\n", space.device().safe_pc(), offset);
value = snes_open_bus_r(space, 0); /* Reserved */
}
}
}
else
value = snes_ram[0x800000 + offset]; //ROM
}
return value;
}
/* 0x000000 - 0x7dffff */
WRITE8_HANDLER( snes_w_bank1 )
{
snes_state *state = space.machine().driver_data<snes_state>();
UINT16 address = offset & 0xffff;
if (address < 0x2000) /* Mirror of Low RAM */
space.write_byte(0x7e0000 + address, data);
else if (address < 0x6000) /* I/O */
state->snes_w_io(space, address, data);
else if (address < 0x8000)
logerror("(PC=%06x) snes_w_bank1: Attempt to write to reserved address: %x = %02x\n", space.device().safe_pc(), offset, data);
else
logerror("(PC=%06x) Attempt to write to ROM address: %X\n", space.device().safe_pc(), offset);
}
/* 0x300000 - 0x3fffff */
WRITE8_HANDLER( snes_w_bank2 )
{
snes_state *state = space.machine().driver_data<snes_state>();
UINT16 address = offset & 0xffff;
if (address < 0x2000) /* Mirror of Low RAM */
space.write_byte(0x7e0000 + address, data);
else if (address < 0x6000) /* I/O */
state->snes_w_io(space, address, data);
else if (address < 0x8000) /* SRAM for mode_21, Reserved othewise */
if (offset < 0x400000)
{
if (state->m_cart[0].mode == SNES_MODE_21 && state->m_cart[0].m_nvram_size > 0)
if (address < 0x2000) /* Mirror of Low RAM */
space.write_byte(0x7e0000 + address, data);
else if (address < 0x6000) /* I/O */
state->snes_w_io(space, address, data);
else if (address < 0x8000)
{
/* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */
/* OTOH Secret of Mana does not work properly if sram is not mirrored on later banks */
int mask = (state->m_cart[0].m_nvram_size - 1) & 0x7fff; /* Limit SRAM size to what's actually present */
state->m_cart[0].m_nvram[(offset - 0x6000) & mask] = data;
}
if (offset >= 0x300000 && state->m_cart[0].mode == SNES_MODE_21 && state->m_cart[0].m_nvram_size > 0)
{
/* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */
/* OTOH Secret of Mana does not work properly if sram is not mirrored on later banks */
int mask = (state->m_cart[0].m_nvram_size - 1) & 0x7fff; /* Limit SRAM size to what's actually present */
state->m_cart[0].m_nvram[(offset - 0x6000) & mask] = data;
}
else
logerror("(PC=%06x) snes_w_bank1: Attempt to write to reserved address: %X = %02X\n", space.device().safe_pc(), offset, data);
}
else
logerror("(PC=%06x) snes_w_bank2: Attempt to write to reserved address: %X = %02x\n", space.device().safe_pc(), offset + 0x300000, data);
logerror("(PC=%06x) Attempt to write to ROM address: %X\n", space.device().safe_pc(), offset);
}
else
logerror("(PC=%06x) Attempt to write to ROM address: %X\n", space.device().safe_pc(), offset + 0x300000);
}
/* 0x600000 - 0x6fffff */
WRITE8_HANDLER( snes_w_bank4 )
{
snes_state *state = space.machine().driver_data<snes_state>();
UINT16 address = offset & 0xffff;
if (state->m_cart[0].mode & 5) /* Mode 20 & 22 */
else if (offset >= 0x600000 && offset < 0x700000)
{
if (address >= 0x8000)
logerror("(PC=%06x) Attempt to write to ROM address: %X\n", space.device().safe_pc(), offset + 0x600000);
if (state->m_cart[0].mode & 5 && address < 0x8000) /* Mode 20 & 22 */
logerror("(PC=%06x) snes_w_bank1: Attempt to write to reserved address: %X = %02X\n", space.device().safe_pc(), offset, data);
else
logerror("(PC=%06x) snes_w_bank4: Attempt to write to reserved address: %X = %02x\n", space.device().safe_pc(), offset + 0x600000, data);
logerror("(PC=%06x) Attempt to write to ROM address: %X\n", space.device().safe_pc(), offset);
}
else if (state->m_cart[0].mode & 0x0a)
logerror("(PC=%06x) Attempt to write to ROM address: %X\n", space.device().safe_pc(), offset + 0x600000);
}
/* 0x700000 - 0x7dffff */
WRITE8_HANDLER( snes_w_bank5 )
{
snes_state *state = space.machine().driver_data<snes_state>();
UINT16 address = offset & 0xffff;
if (state->m_cart[0].mode & 5 && address < 0x8000) /* Mode 20 & 22 */
else if (offset >= 0x700000)
{
if (state->m_cart[0].m_nvram_size > 0x8000)
{
// In this case, SRAM is mapped in 0x8000 chunks at diff offsets: 0x700000-0x707fff, 0x710000-0x717fff, etc.
int mask = state->m_cart[0].m_nvram_size - 1;
offset = (offset / 0x10000) * 0x8000 + (offset & 0x7fff);
state->m_cart[0].m_nvram[offset & mask] = data;
}
else if (state->m_cart[0].m_nvram_size > 0)
{
int mask = state->m_cart[0].m_nvram_size - 1; /* Limit SRAM size to what's actually present */
state->m_cart[0].m_nvram[offset & mask] = data;
}
else
logerror("(PC=%06x) snes_w_bank5: Attempt to write to reserved address: %X = %02x\n", space.device().safe_pc(), offset + 0x700000, data);
}
else
logerror("(PC=%06x) Attempt to write to ROM address: %X\n", space.device().safe_pc(), offset + 0x700000);
}
/* 0x800000 - 0xbfffff */
WRITE8_HANDLER( snes_w_bank6 )
{
if ((offset & 0xffff) < 0x8000)
space.write_byte(offset, data);
else
logerror("(PC=%06x) Attempt to write to ROM address: %X\n", space.device().safe_pc(), offset + 0x800000);
}
/* 0xc00000 - 0xffffff */
WRITE8_HANDLER( snes_w_bank7 )
{
snes_state *state = space.machine().driver_data<snes_state>();
UINT16 address = offset & 0xffff;
if (state->m_cart[0].mode & 5 && address < 0x8000) /* Mode 20 & 22 in 0x0000-0x7fff */
{
if (offset >= 0x300000)
if (state->m_cart[0].mode & 5 && address < 0x8000) /* Mode 20 & 22 */
{
if (state->m_cart[0].m_nvram_size > 0x8000)
{
@ -971,20 +834,60 @@ WRITE8_HANDLER( snes_w_bank7 )
int mask = state->m_cart[0].m_nvram_size - 1;
offset = (offset / 0x10000) * 0x8000 + (offset & 0x7fff);
state->m_cart[0].m_nvram[offset & mask] = data;
return;
}
else if (state->m_cart[0].m_nvram_size > 0)
{
int mask = state->m_cart[0].m_nvram_size - 1; /* Limit SRAM size to what's actually present */
state->m_cart[0].m_nvram[offset & mask] = data;
return;
}
else
logerror("(PC=%06x) snes_w_bank1: Attempt to write to reserved address: %X = %02X\n", space.device().safe_pc(), offset, data);
}
else
logerror("(PC=%06x) Attempt to write to ROM address: %X\n", space.device().safe_pc(), offset);
}
}
/* 0x800000 - 0xffffff */
WRITE8_HANDLER( snes_w_bank2 )
{
snes_state *state = space.machine().driver_data<snes_state>();
UINT16 address = offset & 0xffff;
if (offset < 0x400000)
{
if (address < 0x8000)
space.write_byte(offset, data);
else
logerror("(PC=%06x) Attempt to write to ROM address: %X\n", space.device().safe_pc(), offset + 0x800000);
}
else
{
if (state->m_cart[0].mode & 5 && address < 0x8000) /* Mode 20 & 22 in 0x0000-0x7fff */
{
if (offset < 0x700000)
space.write_byte(offset, data);
else
{
if (state->m_cart[0].m_nvram_size > 0x8000)
{
// In this case, SRAM is mapped in 0x8000 chunks at diff offsets: 0x700000-0x707fff, 0x710000-0x717fff, etc.
int mask = state->m_cart[0].m_nvram_size - 1;
offset = (offset / 0x10000) * 0x8000 + (offset & 0x7fff);
state->m_cart[0].m_nvram[offset & mask] = data;
}
else if (state->m_cart[0].m_nvram_size > 0)
{
int mask = state->m_cart[0].m_nvram_size - 1; /* Limit SRAM size to what's actually present */
state->m_cart[0].m_nvram[offset & mask] = data;
}
else
logerror("(PC=%06x) snes_w_bank2: Attempt to write to reserved address: %X = %02X\n", space.device().safe_pc(), offset, data);
}
}
else
logerror("(PC=%06x) snes_w_bank7: Attempt to write to ROM address: %X = %02x\n", space.device().safe_pc(), offset + 0xc00000, data);
logerror("(PC=%06x) Attempt to write to ROM address: %X\n", space.device().safe_pc(), offset);
}
else if (state->m_cart[0].mode & 0x0a)
logerror("(PC=%06x) Attempt to write to ROM address: %X\n", space.device().safe_pc(), offset + 0xc00000);
}

View File

@ -195,16 +195,7 @@ READ8_MEMBER( snes_console_state::snes_lo_r )
return space.read_byte(offset + 0x800000); // [00-7f] same as [80-ff]
// base cart access
if (offset < 0x300000)
return snes_r_bank1(space, offset, 0xff);
else if (offset < 0x400000)
return snes_r_bank2(space, offset - 0x300000, 0xff);
else if (offset < 0x600000)
return snes_r_bank3(space, offset - 0x400000, 0xff);
else if (offset < 0x700000)
return snes_r_bank4(space, offset - 0x600000, 0xff);
else
return snes_r_bank5(space, offset - 0x700000, 0xff);
return snes_r_bank1(space, offset, 0xff);
}
READ8_MEMBER( snes_console_state::snes_hi_r )
@ -290,10 +281,7 @@ READ8_MEMBER( snes_console_state::snes_hi_r )
return superfx_access_ram(m_superfx) ? m_sfx_ram[offset & 0xfffff] : snes_open_bus_r(space, 0);
// base cart access
if (offset < 0x400000)
return snes_r_bank6(space, offset, 0xff);
else
return snes_r_bank7(space, offset - 0x400000, 0xff);
return snes_r_bank2(space, offset, 0xff);
}
WRITE8_MEMBER( snes_console_state::snes_lo_w )
@ -367,16 +355,7 @@ WRITE8_MEMBER( snes_console_state::snes_lo_w )
{ space.write_byte(offset + 0x800000, data); return; } // [00-7f] same as [80-ff]
// base cart access
if (offset < 0x300000)
snes_w_bank1(space, offset, data, 0xff);
else if (offset < 0x400000)
snes_w_bank2(space, offset - 0x300000, data, 0xff);
else if (offset < 0x600000)
return;
else if (offset < 0x700000)
snes_w_bank4(space, offset - 0x600000, data, 0xff);
else
snes_w_bank5(space, offset - 0x700000, data, 0xff);
snes_w_bank1(space, offset, data, 0xff);
}
WRITE8_MEMBER( snes_console_state::snes_hi_w )
@ -459,10 +438,7 @@ WRITE8_MEMBER( snes_console_state::snes_hi_w )
{ m_sfx_ram[offset & 0xfffff] = data; return; }
// base cart access
if (offset < 0x400000)
snes_w_bank6(space, offset, data, 0xff);
else
snes_w_bank7(space, offset, data - 0x400000, 0xff);
snes_w_bank2(space, offset, data, 0xff);
}
READ8_MEMBER( snes_console_state::superfx_r_bank1 )
@ -2398,23 +2374,23 @@ static MACHINE_START( snesnew )
switch (state->m_type)
{
case SNES_MODE21:
machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snsnew_state::snes21_lo_r),state), write8_delegate(FUNC(snsnew_state::snes21_lo_w),state));
machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snsnew_state::snes21_hi_r),state), write8_delegate(FUNC(snsnew_state::snes21_hi_w),state));
set_5a22_map(*state->m_maincpu);
// machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snsnew_state::snes21_lo_r),state), write8_delegate(FUNC(snsnew_state::snes21_lo_w),state));
// machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snsnew_state::snes21_hi_r),state), write8_delegate(FUNC(snsnew_state::snes21_hi_w),state));
// set_5a22_map(*state->m_maincpu);
break;
case SNES_DSP_MODE21:
// machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snsnew_state::snes21_lo_r),state), write8_delegate(FUNC(snsnew_state::snes21_lo_w),state));
// machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snsnew_state::snes21_hi_r),state), write8_delegate(FUNC(snsnew_state::snes21_hi_w),state));
// machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x006000, 0x007fff, 0x9f0000, 0, read8_delegate(FUNC(device_sns_cart_interface::chip_read),state->m_slotcart->m_cart));
// machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x006000, 0x007fff, 0x9f0000, 0, write8_delegate(FUNC(device_sns_cart_interface::chip_write),state->m_slotcart->m_cart));
// set_5a22_map(*state->m_maincpu);
// machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snsnew_state::snes21_lo_r),state), write8_delegate(FUNC(snsnew_state::snes21_lo_w),state));
// machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snsnew_state::snes21_hi_r),state), write8_delegate(FUNC(snsnew_state::snes21_hi_w),state));
// machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x006000, 0x007fff, 0, 0x9f0000, read8_delegate(FUNC(device_sns_cart_interface::chip_read),state->m_slotcart->m_cart));
// machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x006000, 0x007fff, 0, 0x9f0000, write8_delegate(FUNC(device_sns_cart_interface::chip_write),state->m_slotcart->m_cart));
// set_5a22_map(*state->m_maincpu);
break;
case SNES_SRTC:
// machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snsnew_state::snes21_lo_r),state), write8_delegate(FUNC(snsnew_state::snes21_lo_w),state));
// machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snsnew_state::snes21_hi_r),state), write8_delegate(FUNC(snsnew_state::snes21_hi_w),state));
// machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x002800, 0x002800, 0xbf0000, 0, read8_delegate(FUNC(device_sns_cart_interface::chip_read),state->m_slotcart->m_cart));
// machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x002801, 0x002801, 0xbf0000, 0, write8_delegate(FUNC(device_sns_cart_interface::chip_write),state->m_slotcart->m_cart));
// set_5a22_map(*state->m_maincpu);
// machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snsnew_state::snes21_lo_r),state), write8_delegate(FUNC(snsnew_state::snes21_lo_w),state));
// machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snsnew_state::snes21_hi_r),state), write8_delegate(FUNC(snsnew_state::snes21_hi_w),state));
// machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x002800, 0x002800, 0, 0xbf0000, read8_delegate(FUNC(device_sns_cart_interface::chip_read),state->m_slotcart->m_cart));
// machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x002801, 0x002801, 0, 0xbf0000, write8_delegate(FUNC(device_sns_cart_interface::chip_write),state->m_slotcart->m_cart));
// set_5a22_map(*state->m_maincpu);
break;
}
}