re-srcclean'd. nw.

This commit is contained in:
Fabio Priuli 2013-03-05 13:15:46 +00:00
parent ede318287f
commit 2b4177249e

View File

@ -194,7 +194,7 @@ READ8_MEMBER( snes_console_state::snes_lo_r )
{
if (address >= 0x3000 && address < 0x3300)
return superfx_mmio_read(m_superfx, address);
if (address >= 0x6000 && address < 0x8000) // here it should be snes_ram[0xe00000+...] but there are mirroring issues
if (address >= 0x6000 && address < 0x8000) // here it should be snes_ram[0xe00000+...] but there are mirroring issues
return superfx_access_ram(m_superfx) ? snes_ram[0xf00000 + (offset & 0x1fff)] : snes_open_bus_r(space, 0);
}
if (m_has_addon_chip == HAS_SUPERFX && m_superfx != NULL
@ -285,7 +285,7 @@ READ8_MEMBER( snes_console_state::snes_hi_r )
&& offset >= 0x500000)
return spc7110_bank7_read(space, offset - 0x400000);
if (m_has_addon_chip == HAS_SUPERFX && m_superfx != NULL)
return space.read_byte(offset); // [80-ff] same as [00-7f]
return space.read_byte(offset); // [80-ff] same as [00-7f]
// base cart access
if (offset < 0x400000)
@ -301,47 +301,47 @@ WRITE8_MEMBER( snes_console_state::snes_lo_w )
// take care of add-on chip access
if (m_has_addon_chip == HAS_OBC1
&& (offset < 0x400000 && address >= 0x6000 && address < 0x8000))
{ obc1_write(space, offset, data, mem_mask); return; }
{ obc1_write(space, offset, data, mem_mask); return; }
if (m_has_addon_chip == HAS_CX4
&& (offset < 0x400000 && address >= 0x6000 && address < 0x8000))
{ CX4_write(space.machine(), address - 0x6000, data); return; }
{ CX4_write(space.machine(), address - 0x6000, data); return; }
if (m_has_addon_chip == HAS_RTC
&& (offset < 0x400000 && (address == 0x2800 || address == 0x2801)))
{ srtc_write(space.machine(), offset, data); return; }
{ srtc_write(space.machine(), offset, data); return; }
if (m_has_addon_chip == HAS_ST010 || m_has_addon_chip == HAS_ST011)
{
if (offset >= 0x680000 && offset < 0x700000 && address < 0x1000)
{ st010_write_ram(address, data); return; }
{ st010_write_ram(address, data); return; }
if (offset == 0x600000)
{ st010_set_dr(data); return; }
{ st010_set_dr(data); return; }
if (offset == 0x600001)
{ st010_set_sr(data); return; }
{ st010_set_sr(data); return; }
}
if (m_cart[0].mode == SNES_MODE_21 && m_has_addon_chip == HAS_DSP1
&& (offset < 0x200000 && address >= 0x6000 && address < 0x8000))
{ dsp_set_dr(data); return; }
{ dsp_set_dr(data); return; }
if (m_cart[0].mode == SNES_MODE_20 && m_has_addon_chip == HAS_DSP1)
{
if (offset >= 0x200000 && offset < 0x400000 && (offset & 0x8000) == 0x8000)
{ dsp_set_dr(data); return; }
{ dsp_set_dr(data); return; }
if (offset >= 0x600000 && offset < 0x700000 && (offset & 0x8000) == 0x0000)
{ dsp_set_dr(data); return; }
{ dsp_set_dr(data); return; }
}
if ((m_has_addon_chip == HAS_DSP2 || m_has_addon_chip == HAS_DSP3)
&& (offset >= 0x200000 && offset < 0x400000 && (offset & 0x8000) == 0x8000))
{
if (address < 0xc000)
{ dsp_set_dr(data); return; }
{ dsp_set_dr(data); return; }
else
{ dsp_set_sr(data); return; }
{ dsp_set_sr(data); return; }
}
if (m_has_addon_chip == HAS_DSP4
&& (offset >= 0x300000 && offset < 0x400000 && (offset & 0x8000) == 0x8000))
{
if (address < 0xc000)
{ dsp_set_dr(data); return; }
{ dsp_set_dr(data); return; }
else
{ dsp_set_sr(data); return; }
{ dsp_set_sr(data); return; }
}
if (m_has_addon_chip == HAS_SDD1 && offset < 0x400000)
{
@ -355,23 +355,23 @@ WRITE8_MEMBER( snes_console_state::snes_lo_w )
{
UINT16 limit = (m_has_addon_chip == HAS_SPC7110_RTC) ? 0x4842 : 0x483f;
if (address >= 0x4800 && address <= limit)
{ spc7110_mmio_write(space.machine(), (UINT32)address, data); return; }
{ spc7110_mmio_write(space.machine(), (UINT32)address, data); return; }
if (offset < 0x10000 && address >= 0x6000 && address < 0x8000)
{ snes_ram[0x306000 + (address & 0x1fff)] = data; return; }
{ snes_ram[0x306000 + (address & 0x1fff)] = data; return; }
if (offset >= 0x300000 && offset < 0x310000 && address >= 0x6000 && address < 0x8000)
{ snes_ram[0x306000 + (address & 0x1fff)] = data; return; }
{ snes_ram[0x306000 + (address & 0x1fff)] = data; return; }
}
if (m_has_addon_chip == HAS_SUPERFX && m_superfx != NULL
&& offset < 0x400000)
&& offset < 0x400000)
{
if (address >= 0x3000 && address < 0x3300)
{ superfx_mmio_write(m_superfx, address, data); return; }
if (address >= 0x6000 && address < 0x8000) // here it should be snes_ram[0xe00000+...] but there are mirroring issues
{ snes_ram[0xf00000 + (offset & 0x1fff)] = data; return; }
{ superfx_mmio_write(m_superfx, address, data); return; }
if (address >= 0x6000 && address < 0x8000) // here it should be snes_ram[0xe00000+...] but there are mirroring issues
{ snes_ram[0xf00000 + (offset & 0x1fff)] = data; return; }
}
if (m_has_addon_chip == HAS_SUPERFX && m_superfx != NULL
&& offset >= 0x600000)
{ snes_ram[0x800000 + offset] = data; return; }
{ snes_ram[0x800000 + offset] = data; return; }
// base cart access
if (offset < 0x300000)
@ -393,47 +393,47 @@ WRITE8_MEMBER( snes_console_state::snes_hi_w )
// take care of add-on chip access
if (m_has_addon_chip == HAS_OBC1
&& (offset < 0x400000 && address >= 0x6000 && address < 0x8000))
{ obc1_write(space, offset, data, mem_mask); return; }
{ obc1_write(space, offset, data, mem_mask); return; }
if (m_has_addon_chip == HAS_CX4
&& (offset < 0x400000 && address >= 0x6000 && address < 0x8000))
{ CX4_write(space.machine(), address - 0x6000, data); return; }
{ CX4_write(space.machine(), address - 0x6000, data); return; }
if (m_has_addon_chip == HAS_RTC
&& (offset < 0x400000 && (address == 0x2800 || address == 0x2801)))
{ srtc_write(space.machine(), offset, data); return; }
{ srtc_write(space.machine(), offset, data); return; }
if (m_has_addon_chip == HAS_ST010 || m_has_addon_chip == HAS_ST011)
{
if (offset >= 0x680000 && offset < 0x700000 && address < 0x1000)
{ st010_write_ram(address, data); return; }
{ st010_write_ram(address, data); return; }
if (offset == 0x600000)
{ st010_set_dr(data); return; }
{ st010_set_dr(data); return; }
if (offset == 0x600001)
{ st010_set_sr(data); return; }
{ st010_set_sr(data); return; }
}
if (m_cart[0].mode == SNES_MODE_21 && m_has_addon_chip == HAS_DSP1
&& (offset < 0x200000 && address >= 0x6000 && address < 0x8000))
{ dsp_set_dr(data); return; }
{ dsp_set_dr(data); return; }
if (m_cart[0].mode == SNES_MODE_20 && m_has_addon_chip == HAS_DSP1)
{
if (offset >= 0x200000 && offset < 0x400000 && (offset & 0x8000) == 0x8000)
{ dsp_set_dr(data); return; }
{ dsp_set_dr(data); return; }
if (offset >= 0x600000 && offset < 0x700000 && (offset & 0x8000) == 0x0000)
{ dsp_set_dr(data); return; }
{ dsp_set_dr(data); return; }
}
if ((m_has_addon_chip == HAS_DSP2 || m_has_addon_chip == HAS_DSP3)
&& (offset >= 0x200000 && offset < 0x400000 && (offset & 0x8000) == 0x8000))
{
if (address < 0xc000)
{ dsp_set_dr(data); return; }
{ dsp_set_dr(data); return; }
else
{ dsp_set_sr(data); return; }
{ dsp_set_sr(data); return; }
}
if (m_has_addon_chip == HAS_DSP4
&& (offset >= 0x300000 && offset < 0x400000 && (offset & 0x8000) == 0x8000))
{
if (address < 0xc000)
{ dsp_set_dr(data); return; }
{ dsp_set_dr(data); return; }
else
{ dsp_set_sr(data); return; }
{ dsp_set_sr(data); return; }
}
if (m_has_addon_chip == HAS_SDD1 && offset < 0x400000)
{
@ -447,14 +447,14 @@ WRITE8_MEMBER( snes_console_state::snes_hi_w )
{
UINT16 limit = (m_has_addon_chip == HAS_SPC7110_RTC) ? 0x4842 : 0x483f;
if (address >= 0x4800 && address <= limit)
{ spc7110_mmio_write(space.machine(), (UINT32)address, data); return; }
{ spc7110_mmio_write(space.machine(), (UINT32)address, data); return; }
if (offset < 0x10000 && address >= 0x6000 && address < 0x8000)
{ snes_ram[0x306000 + (address & 0x1fff)] = data; return; }
{ snes_ram[0x306000 + (address & 0x1fff)] = data; return; }
if (offset >= 0x300000 && offset < 0x310000 && address >= 0x6000 && address < 0x8000)
{ snes_ram[0x306000 + (address & 0x1fff)] = data; return; }
{ snes_ram[0x306000 + (address & 0x1fff)] = data; return; }
}
if (m_has_addon_chip == HAS_SUPERFX && m_superfx != NULL)
{ space.write_byte(offset, data); return; } // [80-ff] same as [00-7f]
{ space.write_byte(offset, data); return; } // [80-ff] same as [00-7f]
// base cart access
if (offset < 0x400000)
@ -1568,7 +1568,7 @@ WRITE8_MEMBER( snsnew_state::snes20_hi_w )
if (address >= 0x2000 && address < 0x6000)
snes_w_io(space, address, data);
}
else if (offset >= 0x700000) // NVRAM access
else if (offset >= 0x700000) // NVRAM access
{
m_slotcart->m_cart->write_h(space, offset, data);
}
@ -1656,7 +1656,7 @@ WRITE8_MEMBER( snsnew_state::snes21_lo_w )
}
}
}
else if (offset >= 0x700000) // NVRAM access
else if (offset >= 0x700000) // NVRAM access
m_slotcart->m_cart->write_l(space, offset, data);
}
@ -1707,7 +1707,7 @@ WRITE8_MEMBER( snsnew_state::snes21_hi_w )
}
}
}
else if (offset >= 0x700000) // NVRAM access
else if (offset >= 0x700000) // NVRAM access
m_slotcart->m_cart->write_h(space, offset, data);
}
@ -1730,15 +1730,15 @@ READ8_MEMBER( snsnew_state::snesfx_hi_r )
}
if (address >= 0x6000 && address < 0x8000)
{
return m_slotcart->m_cart->read_h(space, offset); //RAM
return m_slotcart->m_cart->read_h(space, offset); //RAM
}
if (address >= 0x8000)
return m_slotcart->m_cart->read_h(space, offset); //ROM
return m_slotcart->m_cart->read_h(space, offset); //ROM
}
else if (offset < 0x600000)
return m_slotcart->m_cart->read_h(space, offset); //ROM
return m_slotcart->m_cart->read_h(space, offset); //ROM
return m_slotcart->m_cart->read_h(space, offset); //RAM
return m_slotcart->m_cart->read_h(space, offset); //RAM
}
READ8_MEMBER( snsnew_state::snesfx_lo_r )
@ -1758,15 +1758,15 @@ READ8_MEMBER( snsnew_state::snesfx_lo_r )
}
if (address >= 0x6000 && address < 0x8000)
{
return m_slotcart->m_cart->read_l(space, offset); //RAM
return m_slotcart->m_cart->read_l(space, offset); //RAM
}
if (address >= 0x8000)
return m_slotcart->m_cart->read_l(space, offset); //ROM
return m_slotcart->m_cart->read_l(space, offset); //ROM
}
else if (offset < 0x600000)
return m_slotcart->m_cart->read_l(space, offset); //ROM
return m_slotcart->m_cart->read_l(space, offset); //ROM
return m_slotcart->m_cart->read_l(space, offset); //RAM
return m_slotcart->m_cart->read_l(space, offset); //RAM
}
WRITE8_MEMBER( snsnew_state::snesfx_hi_w )
@ -2088,6 +2088,9 @@ READ8_MEMBER( snsnew_state::snesnew_lo_r )
else if ((m_slotcart->get_type() == SNES_ST010 || m_slotcart->get_type() == SNES_ST011)
&& (offset >= 0x680000 && offset < 0x700000 && (offset & 0xffff) < 0x1000))
return m_slotcart->m_cart->chip_read(space, offset);
else if ((m_slotcart->get_type() == SNES_ST010 /*|| m_slotcart->get_type() == SNES_ST011*/) // why does this freeze moritash?
&& (offset == 0x600000 || offset == 0x600001))
return m_slotcart->m_cart->chip_read(space, offset);
else if (m_slotcart->get_type() == SNES_SRTC
&& (offset < 0x400000 && (offset & 0xffff) == 0x2800))
return m_slotcart->m_cart->chip_read(space, offset & 0xffff);
@ -2150,7 +2153,7 @@ READ8_MEMBER( snsnew_state::snesnew_hi_r )
&& (offset >= 0x680000 && offset < 0x700000 && (offset & 0xffff) < 0x1000))
return m_slotcart->m_cart->chip_read(space, offset);
else if ((m_slotcart->get_type() == SNES_ST010 || m_slotcart->get_type() == SNES_ST011)
&& (offset == 0x600000 || offset == 0x600001))
&& (offset == 0x600000 || offset == 0x600001))
return m_slotcart->m_cart->chip_read(space, offset);
else if (m_slotcart->get_type() == SNES_SRTC
&& (offset < 0x400000 && (offset & 0xffff) == 0x2800))
@ -2158,7 +2161,7 @@ READ8_MEMBER( snsnew_state::snesnew_hi_r )
else if ((m_slotcart->get_type() == SNES_POKEMON || m_slotcart->get_type() == SNES_BANANA)
&& (offset & 0x70000) == 0x0000)
{
// printf("hi read %x\n", offset);
// printf("hi read %x\n", offset);
return m_slotcart->m_cart->chip_read(space, offset);
}
else
@ -2220,7 +2223,7 @@ WRITE8_MEMBER( snsnew_state::snesnew_lo_w )
&& (offset >= 0x680000 && offset < 0x700000 && (offset & 0xffff) < 0x1000))
m_slotcart->m_cart->chip_write(space, offset, data);
else if ((m_slotcart->get_type() == SNES_ST010 || m_slotcart->get_type() == SNES_ST011)
&& (offset == 0x600000 || offset == 0x600001))
&& (offset == 0x600000 || offset == 0x600001))
m_slotcart->m_cart->chip_write(space, offset, data);
else if (m_slotcart->get_type() == SNES_SRTC
&& (offset < 0x400000 && (offset & 0xffff) == 0x2801))
@ -2295,7 +2298,7 @@ WRITE8_MEMBER( snsnew_state::snesnew_hi_w )
&& (offset >= 0x680000 && offset < 0x700000 && (offset & 0xffff) < 0x1000))
m_slotcart->m_cart->chip_write(space, offset, data);
else if ((m_slotcart->get_type() == SNES_ST010 || m_slotcart->get_type() == SNES_ST011)
&& (offset == 0x600000 || offset == 0x600001))
&& (offset == 0x600000 || offset == 0x600001))
m_slotcart->m_cart->chip_write(space, offset, data);
else if (m_slotcart->get_type() == SNES_SRTC
&& (offset < 0x400000 && (offset & 0xffff) == 0x2801))
@ -2360,26 +2363,26 @@ ADDRESS_MAP_END
static SLOT_INTERFACE_START(snes_cart)
SLOT_INTERFACE_INTERNAL("lorom", SNS_LOROM)
SLOT_INTERFACE_INTERNAL("lorom_bsx", SNS_LOROM_BSX) // LoROM + BS-X slot - unsupported
SLOT_INTERFACE_INTERNAL("lorom_cx4", SNS_LOROM) // Cart + CX4 - unsupported
SLOT_INTERFACE_INTERNAL("lorom_bsx", SNS_LOROM_BSX) // LoROM + BS-X slot - unsupported
SLOT_INTERFACE_INTERNAL("lorom_cx4", SNS_LOROM) // Cart + CX4 - unsupported
SLOT_INTERFACE_INTERNAL("lorom_dsp", SNS_LOROM_NECDSP)
SLOT_INTERFACE_INTERNAL("lorom_dsp4", SNS_LOROM_NECDSP)
SLOT_INTERFACE_INTERNAL("lorom_obc1", SNS_LOROM_OBC1)
SLOT_INTERFACE_INTERNAL("lorom_sa1", SNS_LOROM) // Cart + SA1 - unsupported
SLOT_INTERFACE_INTERNAL("lorom_sa1", SNS_LOROM) // Cart + SA1 - unsupported
SLOT_INTERFACE_INTERNAL("lorom_sdd1", SNS_LOROM_SDD1)
SLOT_INTERFACE_INTERNAL("lorom_sfx", SNS_LOROM_SUPERFX)
SLOT_INTERFACE_INTERNAL("lorom_sgb", SNS_LOROM) // SuperGB base cart - unsupported
SLOT_INTERFACE_INTERNAL("lorom_sgb", SNS_LOROM) // SuperGB base cart - unsupported
SLOT_INTERFACE_INTERNAL("lorom_st010", SNS_LOROM_SETA10)
SLOT_INTERFACE_INTERNAL("lorom_st011", SNS_LOROM_SETA11)
SLOT_INTERFACE_INTERNAL("lorom_st018", SNS_LOROM) // Cart + ST018 - unsupported
SLOT_INTERFACE_INTERNAL("lorom_sufami", SNS_LOROM_SUFAMI) // Sufami Turbo base cart
SLOT_INTERFACE_INTERNAL("lorom_st018", SNS_LOROM) // Cart + ST018 - unsupported
SLOT_INTERFACE_INTERNAL("lorom_sufami", SNS_LOROM_SUFAMI) // Sufami Turbo base cart
SLOT_INTERFACE_INTERNAL("hirom", SNS_HIROM)
SLOT_INTERFACE_INTERNAL("hirom_bsx", SNS_HIROM_BSX) // HiROM + BS-X slot - unsupported
SLOT_INTERFACE_INTERNAL("hirom_bsx", SNS_HIROM_BSX) // HiROM + BS-X slot - unsupported
SLOT_INTERFACE_INTERNAL("hirom_dsp", SNS_HIROM_NECDSP)
SLOT_INTERFACE_INTERNAL("hirom_spc7110", SNS_HIROM_SPC7110)
SLOT_INTERFACE_INTERNAL("hirom_spcrtc", SNS_HIROM_SPC7110_RTC)
SLOT_INTERFACE_INTERNAL("hirom_srtc", SNS_HIROM_SRTC)
SLOT_INTERFACE_INTERNAL("bsxrom", SNS_ROM_BSX) // BS-X base cart - partial support only
SLOT_INTERFACE_INTERNAL("bsxrom", SNS_ROM_BSX) // BS-X base cart - partial support only
// pirate carts
SLOT_INTERFACE_INTERNAL("lorom_poke", SNS_LOROM_POKEMON)
SLOT_INTERFACE_END
@ -2402,18 +2405,18 @@ static MACHINE_START( snesnew )
set_5a22_map(*state->m_maincpu);
break;
case SNES_DSP_MODE21:
// machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x000000, 0x7dffff, FUNC(snes21_lo_r), FUNC(snes21_lo_w));
// machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x800000, 0xffffff, FUNC(snes21_hi_r), FUNC(snes21_hi_w));
// 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, 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);
break;
case SNES_SRTC:
// machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x000000, 0x7dffff, FUNC(snes21_lo_r), FUNC(snes21_lo_w));
// machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x800000, 0xffffff, FUNC(snes21_hi_r), FUNC(snes21_hi_w));
// 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, 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);
break;
}
}