Previous 199869 Revisions Next

r21853 Thursday 14th March, 2013 at 13:20:52 UTC by Fabio Priuli
reduced direct accesses to cart devices (systems should eventually only interact with the cart slot devices). nw.
[src/mess/drivers]gb.c megadriv.c snes.c
[src/mess/machine]gb_slot.h md_sk.c md_slot.h sns_bsx.c sns_slot.h sns_sufami.c

trunk/src/mess/drivers/megadriv.c
r21852r21853
282282      svp_init(machine);
283283   else
284284   {
285      machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7fffff, read16_delegate(FUNC(device_md_cart_interface::read),state->m_slotcart->m_cart), write16_delegate(FUNC(device_md_cart_interface::write),state->m_slotcart->m_cart));
286      machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa13000, 0xa130ff, read16_delegate(FUNC(device_md_cart_interface::read_a13),state->m_slotcart->m_cart), write16_delegate(FUNC(device_md_cart_interface::write_a13),state->m_slotcart->m_cart));
287      machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15000, 0xa150ff, read16_delegate(FUNC(device_md_cart_interface::read_a15),state->m_slotcart->m_cart), write16_delegate(FUNC(device_md_cart_interface::write_a15),state->m_slotcart->m_cart));
288      machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xa14000, 0xa14003, write16_delegate(FUNC(device_md_cart_interface::write_tmss_bank),state->m_slotcart->m_cart));
285      machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7fffff, read16_delegate(FUNC(base_md_cart_slot_device::read),(base_md_cart_slot_device*)state->m_slotcart), write16_delegate(FUNC(base_md_cart_slot_device::write),(base_md_cart_slot_device*)state->m_slotcart));
286      machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa13000, 0xa130ff, read16_delegate(FUNC(base_md_cart_slot_device::read_a13),(base_md_cart_slot_device*)state->m_slotcart), write16_delegate(FUNC(base_md_cart_slot_device::write_a13),(base_md_cart_slot_device*)state->m_slotcart));
287      machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15000, 0xa150ff, read16_delegate(FUNC(base_md_cart_slot_device::read_a15),(base_md_cart_slot_device*)state->m_slotcart), write16_delegate(FUNC(base_md_cart_slot_device::write_a15),(base_md_cart_slot_device*)state->m_slotcart));
288      machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xa14000, 0xa14003, write16_delegate(FUNC(base_md_cart_slot_device::write_tmss_bank),(base_md_cart_slot_device*)state->m_slotcart));
289289   }
290290}
291291
r21852r21853
10501050static MACHINE_START(pico)
10511051{
10521052   pico_state *state = machine.driver_data<pico_state>();
1053   machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7fffff, read16_delegate(FUNC(device_md_cart_interface::read),state->m_picocart->m_cart), write16_delegate(FUNC(device_md_cart_interface::write),state->m_picocart->m_cart));
1054   machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa13000, 0xa130ff, read16_delegate(FUNC(device_md_cart_interface::read_a13),state->m_picocart->m_cart), write16_delegate(FUNC(device_md_cart_interface::write_a13),state->m_picocart->m_cart));
1055   machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15000, 0xa150ff, read16_delegate(FUNC(device_md_cart_interface::read_a15),state->m_picocart->m_cart), write16_delegate(FUNC(device_md_cart_interface::write_a15),state->m_picocart->m_cart));
1056   machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xa14000, 0xa14003, write16_delegate(FUNC(device_md_cart_interface::write_tmss_bank),state->m_picocart->m_cart));
1053   machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7fffff, read16_delegate(FUNC(base_md_cart_slot_device::read),(base_md_cart_slot_device*)state->m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write),(base_md_cart_slot_device*)state->m_picocart));
1054   machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa13000, 0xa130ff, read16_delegate(FUNC(base_md_cart_slot_device::read_a13),(base_md_cart_slot_device*)state->m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write_a13),(base_md_cart_slot_device*)state->m_picocart));
1055   machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15000, 0xa150ff, read16_delegate(FUNC(base_md_cart_slot_device::read_a15),(base_md_cart_slot_device*)state->m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write_a15),(base_md_cart_slot_device*)state->m_picocart));
1056   machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xa14000, 0xa14003, write16_delegate(FUNC(base_md_cart_slot_device::write_tmss_bank),(base_md_cart_slot_device*)state->m_picocart));
10571057}
10581058
10591059static MACHINE_CONFIG_START( pico, pico_state )
trunk/src/mess/drivers/gb.c
r21852r21853
459459
460460READ8_MEMBER(gb_state::gb_cart_r)
461461{
462   if (m_bios_disable && m_cartslot->m_cart)
463      return m_cartslot->m_cart->read_rom(space, offset);
462   if (m_bios_disable && m_cartslot)
463      return m_cartslot->read_rom(space, offset);
464464   else
465465   {
466466      if (offset < 0x100)
r21852r21853
468468         UINT8 *ROM = m_region_maincpu->base();
469469         return ROM[offset];
470470      }
471      else if (m_cartslot->m_cart)
471      else if (m_cartslot)
472472      {
473         return m_cartslot->m_cart->read_rom(space, offset);
473         return m_cartslot->read_rom(space, offset);
474474      }
475475      else
476476         return 0xff;
r21852r21853
479479
480480READ8_MEMBER(gb_state::gbc_cart_r)
481481{
482   if (m_bios_disable && m_cartslot->m_cart)
483      return m_cartslot->m_cart->read_rom(space, offset);
482   if (m_bios_disable && m_cartslot)
483      return m_cartslot->read_rom(space, offset);
484484   else
485485   {
486486      if (offset < 0x100)
r21852r21853
493493         UINT8 *ROM = m_region_maincpu->base();
494494         return ROM[offset - 0x100];
495495      }
496      else if (m_cartslot->m_cart)
496      else if (m_cartslot)
497497      {
498         return m_cartslot->m_cart->read_rom(space, offset);
498         return m_cartslot->read_rom(space, offset);
499499      }
500500      else
501501         return 0xff;
r21852r21853
504504
505505WRITE8_MEMBER(gb_state::gb_bank_w)
506506{
507   if (m_cartslot->m_cart)
508      m_cartslot->m_cart->write_bank(space, offset, data);
507   if (m_cartslot)
508      m_cartslot->write_bank(space, offset, data);
509509}
510510
511511READ8_MEMBER(gb_state::gb_ram_r)
512512{
513   if (m_cartslot->m_cart)
514      return m_cartslot->m_cart->read_ram(space, offset);
513   if (m_cartslot)
514      return m_cartslot->read_ram(space, offset);
515515   else
516516      return 0xff;
517517}
518518
519519WRITE8_MEMBER(gb_state::gb_ram_w)
520520{
521   if (m_cartslot->m_cart)
522      m_cartslot->m_cart->write_ram(space, offset, data);
521   if (m_cartslot)
522      m_cartslot->write_ram(space, offset, data);
523523}
524524
525525READ8_MEMBER(gb_state::gb_echo_r)
r21852r21853
534534
535535READ8_MEMBER(megaduck_state::cart_r)
536536{
537   if (m_cartslot && m_cartslot->m_cart)
538      return m_cartslot->m_cart->read_rom(space, offset);
537   if (m_cartslot)
538      return m_cartslot->read_rom(space, offset);
539539   else
540540      return 0xff;
541541}
542542
543543WRITE8_MEMBER(megaduck_state::bank1_w)
544544{
545   if (m_cartslot->m_cart)
546      m_cartslot->m_cart->write_bank(space, offset, data);
545   if (m_cartslot)
546      m_cartslot->write_bank(space, offset, data);
547547}
548548
549549WRITE8_MEMBER(megaduck_state::bank2_w)
550550{
551   if (m_cartslot->m_cart)
552      m_cartslot->m_cart->write_ram(space, offset, data); /* used for bankswitch, but we re-use GB name */
551   if (m_cartslot)
552      m_cartslot->write_ram(space, offset, data); /* used for bankswitch, but we re-use GB name */
553553}
554554
555555
r21852r21853
662662   SLOT_INTERFACE_INTERNAL("rom_digimon",  GB_ROM_DIGIMON)
663663   SLOT_INTERFACE_INTERNAL("rom_rock8",  GB_ROM_ROCKMAN8)
664664   SLOT_INTERFACE_INTERNAL("rom_sm3sp",  GB_ROM_SM3SP)
665//   SLOT_INTERFACE_INTERNAL("rom_dkong5",  GB_ROM_DKONG5)
666//   SLOT_INTERFACE_INTERNAL("rom_unk01",  GB_ROM_UNK01)
665667SLOT_INTERFACE_END
666668
667669static SLOT_INTERFACE_START(megaduck_cart)
trunk/src/mess/drivers/snes.c
r21852r21853
16091609   // take care of add-on IO
16101610   if ((m_slotcart->get_type() == SNES_ST010 || m_slotcart->get_type() == SNES_ST011)
16111611         && (offset >= 0x600000 && offset < 0x680000 && (offset & 0xffff) < 0x4000))
1612      return m_slotcart->m_cart->chip_read(space, offset);
1612      return m_slotcart->chip_read(space, offset);
16131613   else if ((m_slotcart->get_type() == SNES_ST010 || m_slotcart->get_type() == SNES_ST011)
16141614         && (offset >= 0x680000 && offset < 0x700000 && (offset & 0xffff) < 0x8000))
1615      return m_slotcart->m_cart->chip_read(space, offset);
1615      return m_slotcart->chip_read(space, offset);
16161616   else if (m_slotcart->get_type() == SNES_CX4
16171617         && (offset < 0x400000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000))    // hack until we emulate the real CPU
16181618      return CX4_read((offset & 0xffff) - 0x6000);
r21852r21853
16261626      else if (address < 0x8000)
16271627         return snes_open_bus_r(space, 0);
16281628      else
1629         return m_slotcart->m_cart->read_h(space, offset);
1629         return m_slotcart->read_h(space, offset);
16301630   }
16311631   else if (offset < 0x700000)
16321632   {
16331633      if (address < 0x8000)
16341634         return snes_open_bus_r(space, 0);
16351635      else
1636         return m_slotcart->m_cart->read_h(space, offset);
1636         return m_slotcart->read_h(space, offset);
16371637   }
16381638   else
16391639   {
16401640      if (m_type == SNES_SUFAMITURBO && address >= 0x8000 && offset < 0x740000)
1641         return m_slotcart->m_cart->read_h(space, offset);
1641         return m_slotcart->read_h(space, offset);
16421642
16431643      // here usually there is SRAM mirrored in the whole range, but if ROM is very large then arrives here too (see tokimeki and wizardg4)
16441644      if (m_slotcart->m_cart->get_rom_size() > 0x200000 && address >= 0x8000)
1645         return m_slotcart->m_cart->read_h(space, offset);
1645         return m_slotcart->read_h(space, offset);
16461646      else
16471647      {
16481648         if (m_slotcart->m_cart->get_nvram_size() > 0x8000)
16491649         {
16501650            // In this case, SRAM is mapped in 0x8000 chunks at diff offsets: 0x700000-0x707fff, 0x710000-0x717fff, etc.
16511651            offset = ((offset - 0x700000) / 0x10000) * 0x8000 + (offset & 0x7fff);
1652            return m_slotcart->m_cart->read_ram(space, offset);
1652            return m_slotcart->read_ram(space, offset);
16531653         }
16541654         else if (m_slotcart->m_cart->get_nvram_size() > 0)
1655            return m_slotcart->m_cart->read_ram(space, offset);
1655            return m_slotcart->read_ram(space, offset);
16561656         else
16571657            return snes_open_bus_r(space, 0);
16581658      }
r21852r21853
16661666   // take care of add-on IO
16671667   if ((m_slotcart->get_type() == SNES_ST010 || m_slotcart->get_type() == SNES_ST011)
16681668         && (offset >= 0x600000 && offset < 0x680000 && (offset & 0xffff) < 0x4000))
1669   { m_slotcart->m_cart->chip_write(space, offset, data); return; }
1669   { m_slotcart->chip_write(space, offset, data); return; }
16701670   else if ((m_slotcart->get_type() == SNES_ST010 || m_slotcart->get_type() == SNES_ST011)
16711671         && (offset >= 0x680000 && offset < 0x700000 && (offset & 0xffff) < 0x8000))
1672   { m_slotcart->m_cart->chip_write(space, offset, data); return; }
1672   { m_slotcart->chip_write(space, offset, data); return; }
16731673   else if (m_slotcart->get_type() == SNES_CX4
16741674         && (offset < 0x400000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000))    // hack until we emulate the real CPU
16751675   { CX4_write(space.machine(), (offset & 0xffff) - 0x6000, data); return; }
16761676   else if (m_type == SNES_SUFAMITURBO
16771677         && address >= 0x8000 && ((offset >= 0x600000 && offset < 0x640000) || (offset >= 0x700000 && offset < 0x740000)))
1678   { m_slotcart->m_cart->write_h(space, offset, data); return; }
1678   { m_slotcart->write_h(space, offset, data); return; }
16791679
16801680   if (offset < 0x400000)
16811681   {
r21852r21853
16901690      {
16911691         // In this case, SRAM is mapped in 0x8000 chunks at diff offsets: 0x700000-0x707fff, 0x710000-0x717fff, etc.
16921692         offset = ((offset - 0x700000) / 0x10000) * 0x8000 + (offset & 0x7fff);
1693         m_slotcart->m_cart->write_ram(space, offset, data);
1693         m_slotcart->write_ram(space, offset, data);
16941694      }
16951695      else if (m_slotcart->m_cart->get_nvram_size() > 0)
1696         m_slotcart->m_cart->write_ram(space, offset, data);
1696         m_slotcart->write_ram(space, offset, data);
16971697   }
16981698}
16991699
r21852r21853
17041704   // take care of add-on IO
17051705   if ((m_slotcart->get_type() == SNES_ST010 /*|| m_slotcart->get_type() == SNES_ST011*/) // why does this break moritash?
17061706         && (offset >= 0x600000 && offset < 0x680000 && (offset & 0xffff) < 0x4000))
1707      return m_slotcart->m_cart->chip_read(space, offset);
1707      return m_slotcart->chip_read(space, offset);
17081708   else if ((m_slotcart->get_type() == SNES_ST010 || m_slotcart->get_type() == SNES_ST011)
17091709         && (offset >= 0x680000 && offset < 0x700000 && (offset & 0xffff) < 0x8000))
1710      return m_slotcart->m_cart->chip_read(space, offset);
1710      return m_slotcart->chip_read(space, offset);
17111711   else if (m_slotcart->get_type() == SNES_CX4
17121712         && (offset < 0x400000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000))    // hack until we emulate the real CPU
17131713      return CX4_read((offset & 0xffff) - 0x6000);
r21852r21853
17211721      else if (address < 0x8000)
17221722         return snes_open_bus_r(space, 0);
17231723      else
1724         return m_slotcart->m_cart->read_l(space, offset);
1724         return m_slotcart->read_l(space, offset);
17251725   }
17261726   else if (offset < 0x700000)
17271727   {
17281728      if (address < 0x8000)
17291729         return snes_open_bus_r(space, 0);
17301730      else
1731         return m_slotcart->m_cart->read_l(space, offset);
1731         return m_slotcart->read_l(space, offset);
17321732   }
17331733   else
17341734   {
17351735      if (m_type == SNES_SUFAMITURBO && address >= 0x8000 && offset < 0x740000)
1736         return m_slotcart->m_cart->read_l(space, offset);
1736         return m_slotcart->read_l(space, offset);
17371737
17381738      // here usually there is SRAM mirrored in the whole range, but if ROM is very large then arrives here too (see tokimeki and wizardg4)
17391739      if (m_slotcart->m_cart->get_rom_size() > 0x200000 && address >= 0x8000)
1740         return m_slotcart->m_cart->read_l(space, offset);
1740         return m_slotcart->read_l(space, offset);
17411741      else
17421742      {
17431743         if (m_slotcart->m_cart->get_nvram_size() > 0x8000)
17441744         {
17451745            // In this case, SRAM is mapped in 0x8000 chunks at diff offsets: 0x700000-0x707fff, 0x710000-0x717fff, etc.
17461746            offset = ((offset - 0x700000) / 0x10000) * 0x8000 + (offset & 0x7fff);
1747            return m_slotcart->m_cart->read_ram(space, offset);
1747            return m_slotcart->read_ram(space, offset);
17481748         }
17491749         else if (m_slotcart->m_cart->get_nvram_size() > 0)
1750            return m_slotcart->m_cart->read_ram(space, offset);
1750            return m_slotcart->read_ram(space, offset);
17511751         else
17521752            return snes_open_bus_r(space, 0);
17531753      }
r21852r21853
17581758{
17591759   if (m_type == SNES_SUFAMITURBO
17601760            && (offset & 0xffff) >= 0x8000 && ((offset >= 0x600000 && offset < 0x640000) || (offset >= 0x700000 && offset < 0x740000)))
1761   { m_slotcart->m_cart->write_l(space, offset, data); return; }
1761   { m_slotcart->write_l(space, offset, data); return; }
17621762
17631763   // other add-on writes matches the hi handler
17641764   snes20_hi_w(space, offset, data, 0xff);
r21852r21853
17841784         if (m_type == SNES_BSXHI && m_slotcart->m_cart->get_nvram_size() && offset >= 0x200000)
17851785         {
17861786            int mask = (m_slotcart->m_cart->get_nvram_size() - 1) & 0x7fff;
1787            return m_slotcart->m_cart->read_ram(space, (offset - 0x6000) & mask);
1787            return m_slotcart->read_ram(space, (offset - 0x6000) & mask);
17881788         }
17891789
17901790         if (m_slotcart->m_cart->get_nvram_size() && offset >= 0x300000)
r21852r21853
17921792            /* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */
17931793            /* OTOH Secret of Mana does not work properly if sram is not mirrored on later banks */
17941794            int mask = (m_slotcart->m_cart->get_nvram_size() - 1) & 0x7fff; /* Limit SRAM size to what's actually present */
1795            return m_slotcart->m_cart->read_ram(space, (offset - 0x6000) & mask);
1795            return m_slotcart->read_ram(space, (offset - 0x6000) & mask);
17961796         }
17971797         else
17981798            return snes_open_bus_r(space, 0);
r21852r21853
18001800   }
18011801
18021802   // ROM access
1803   return m_slotcart->m_cart->read_l(space, offset);
1803   return m_slotcart->read_l(space, offset);
18041804}
18051805
18061806WRITE8_MEMBER( snsnew_state::snes21_lo_w )
r21852r21853
18171817         if (m_type == SNES_BSXHI && m_slotcart->m_cart->get_nvram_size() && offset >= 0x200000)
18181818         {
18191819            int mask = (m_slotcart->m_cart->get_nvram_size() - 1) & 0x7fff;
1820            m_slotcart->m_cart->write_ram(space, (offset - 0x6000) & mask, data);
1820            m_slotcart->write_ram(space, (offset - 0x6000) & mask, data);
18211821            return;
18221822         }
18231823         if (m_slotcart->m_cart->get_nvram_size() && offset >= 0x300000)
r21852r21853
18251825            /* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */
18261826            /* OTOH Secret of Mana does not work properly if sram is not mirrored on later banks */
18271827            int mask = (m_slotcart->m_cart->get_nvram_size() - 1) & 0x7fff; /* Limit SRAM size to what's actually present */
1828            m_slotcart->m_cart->write_ram(space, (offset - 0x6000) & mask, data);
1828            m_slotcart->write_ram(space, (offset - 0x6000) & mask, data);
18291829         }
18301830      }
18311831   }
r21852r21853
18461846         if (m_type == SNES_BSXHI && m_slotcart->m_cart->get_nvram_size() && offset >= 0x200000)
18471847         {
18481848            int mask = (m_slotcart->m_cart->get_nvram_size() - 1) & 0x7fff;
1849            return m_slotcart->m_cart->read_ram(space, (offset - 0x6000) & mask);
1849            return m_slotcart->read_ram(space, (offset - 0x6000) & mask);
18501850         }
18511851
18521852         if (m_slotcart->m_cart->get_nvram_size() && offset >= 0x300000)
r21852r21853
18541854            /* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */
18551855            /* OTOH Secret of Mana does not work properly if sram is not mirrored on later banks */
18561856            int mask = (m_slotcart->m_cart->get_nvram_size() - 1) & 0x7fff; /* Limit SRAM size to what's actually present */
1857            return m_slotcart->m_cart->read_ram(space, (offset - 0x6000) & mask);
1857            return m_slotcart->read_ram(space, (offset - 0x6000) & mask);
18581858         }
18591859         else
18601860            return snes_open_bus_r(space, 0);
r21852r21853
18621862   }
18631863
18641864   // ROM access
1865   return m_slotcart->m_cart->read_h(space, offset);
1865   return m_slotcart->read_h(space, offset);
18661866}
18671867
18681868WRITE8_MEMBER( snsnew_state::snes21_hi_w )
r21852r21853
18791879         if (m_type == SNES_BSXHI && m_slotcart->m_cart->get_nvram_size() && offset >= 0x200000)
18801880         {
18811881            int mask = (m_slotcart->m_cart->get_nvram_size() - 1) & 0x7fff;
1882            m_slotcart->m_cart->write_ram(space, (offset - 0x6000) & mask, data);
1882            m_slotcart->write_ram(space, (offset - 0x6000) & mask, data);
18831883            return;
18841884         }
18851885         if (m_slotcart->m_cart->get_nvram_size() && offset >= 0x300000)
r21852r21853
18871887            /* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */
18881888            /* OTOH Secret of Mana does not work properly if sram is not mirrored on later banks */
18891889            int mask = (m_slotcart->m_cart->get_nvram_size() - 1) & 0x7fff; /* Limit SRAM size to what's actually present */
1890            m_slotcart->m_cart->write_ram(space, (offset - 0x6000) & mask, data);
1890            m_slotcart->write_ram(space, (offset - 0x6000) & mask, data);
18911891         }
18921892      }
18931893   }
r21852r21853
19081908      else if (address < 0x6000)
19091909      {
19101910         if (address >= 0x3000 && address < 0x3300)
1911            return m_slotcart->m_cart->chip_read(space, offset);
1911            return m_slotcart->chip_read(space, offset);
19121912         else
19131913            return snes_r_io(space, address);
19141914      }
19151915      else if (address < 0x8000)
1916         return m_slotcart->m_cart->read_ram(space, offset & 0x1fff);
1916         return m_slotcart->read_ram(space, offset & 0x1fff);
19171917      else
1918         return m_slotcart->m_cart->read_h(space, offset);
1918         return m_slotcart->read_h(space, offset);
19191919   }
19201920   else if (offset < 0x600000)
1921      return m_slotcart->m_cart->read_h(space, offset);
1921      return m_slotcart->read_h(space, offset);
19221922   else
1923      return m_slotcart->m_cart->read_ram(space, offset);
1923      return m_slotcart->read_ram(space, offset);
19241924}
19251925
19261926READ8_MEMBER( snsnew_state::snessfx_lo_r )
r21852r21853
19341934      else if (address < 0x6000)
19351935      {
19361936         if (address >= 0x3000 && address < 0x3300)
1937            return m_slotcart->m_cart->chip_read(space, offset);
1937            return m_slotcart->chip_read(space, offset);
19381938         else
19391939            return snes_r_io(space, address);
19401940      }
19411941      else if (address < 0x8000)
1942         return m_slotcart->m_cart->read_ram(space, offset & 0x1fff);
1942         return m_slotcart->read_ram(space, offset & 0x1fff);
19431943      else
1944         return m_slotcart->m_cart->read_l(space, offset);
1944         return m_slotcart->read_l(space, offset);
19451945   }
19461946   else if (offset < 0x600000)
1947      return m_slotcart->m_cart->read_l(space, offset);
1947      return m_slotcart->read_l(space, offset);
19481948   else
1949      return m_slotcart->m_cart->read_ram(space, offset);
1949      return m_slotcart->read_ram(space, offset);
19501950}
19511951
19521952WRITE8_MEMBER( snsnew_state::snessfx_hi_w )
r21852r21853
19591959      else if (address < 0x6000)
19601960      {
19611961         if (address >= 0x3000 && address < 0x3300)
1962            m_slotcart->m_cart->chip_write(space, offset, data);
1962            m_slotcart->chip_write(space, offset, data);
19631963         else
19641964            snes_w_io(space, address, data);
19651965      }
19661966      else if (address < 0x8000)
1967         m_slotcart->m_cart->write_ram(space, offset & 0x1fff, data);
1967         m_slotcart->write_ram(space, offset & 0x1fff, data);
19681968   }
19691969   else if (offset >= 0x600000)
1970      m_slotcart->m_cart->write_ram(space, offset, data);
1970      m_slotcart->write_ram(space, offset, data);
19711971}
19721972
19731973WRITE8_MEMBER( snsnew_state::snessfx_lo_w )
r21852r21853
19911991      {
19921992         UINT16 limit = (m_slotcart->get_type() == SNES_SPC7110_RTC) ? 0x4843 : 0x4840;
19931993         if (address >= 0x4800 && address < limit)
1994            return m_slotcart->m_cart->chip_read(space, address);
1994            return m_slotcart->chip_read(space, address);
19951995
19961996         return snes_r_io(space, address);
19971997      }
19981998      else if (address < 0x8000)
19991999      {
20002000         if (offset < 0x10000)
2001            return m_slotcart->m_cart->read_ram(space, offset);
2001            return m_slotcart->read_ram(space, offset);
20022002         if (offset >= 0x300000 && offset < 0x310000)
2003            return m_slotcart->m_cart->read_ram(space, offset);
2003            return m_slotcart->read_ram(space, offset);
20042004      }
20052005      else
2006         return m_slotcart->m_cart->read_h(space, offset);
2006         return m_slotcart->read_h(space, offset);
20072007   }
2008   return m_slotcart->m_cart->read_h(space, offset);
2008   return m_slotcart->read_h(space, offset);
20092009}
20102010
20112011READ8_MEMBER( snsnew_state::snes7110_lo_r )
r21852r21853
20202020      {
20212021         UINT16 limit = (m_slotcart->get_type() == SNES_SPC7110_RTC) ? 0x4843 : 0x4840;
20222022         if (address >= 0x4800 && address < limit)
2023            return m_slotcart->m_cart->chip_read(space, address);
2023            return m_slotcart->chip_read(space, address);
20242024
20252025         return snes_r_io(space, address);
20262026      }
20272027      else if (address < 0x8000)
20282028      {
20292029         if (offset < 0x10000)
2030            return m_slotcart->m_cart->read_ram(space, offset);
2030            return m_slotcart->read_ram(space, offset);
20312031         if (offset >= 0x300000 && offset < 0x310000)
2032            return m_slotcart->m_cart->read_ram(space, offset);
2032            return m_slotcart->read_ram(space, offset);
20332033      }
20342034      else
2035         return m_slotcart->m_cart->read_l(space, offset);
2035         return m_slotcart->read_l(space, offset);
20362036   }
20372037   if (offset >= 0x500000 && offset < 0x510000)
2038      return m_slotcart->m_cart->chip_read(space, 0x4800);
2038      return m_slotcart->chip_read(space, 0x4800);
20392039
20402040   return snes_open_bus_r(space, 0);
20412041}
r21852r21853
20572057         UINT16 limit = (m_slotcart->get_type() == SNES_SPC7110_RTC) ? 0x4843 : 0x4840;
20582058         if (address >= 0x4800 && address < limit)
20592059         {
2060            m_slotcart->m_cart->chip_write(space, address, data);
2060            m_slotcart->chip_write(space, address, data);
20612061            return;
20622062         }
20632063         snes_w_io(space, address, data);
r21852r21853
20652065      else if (address < 0x8000)
20662066      {
20672067         if (offset < 0x10000)
2068            m_slotcart->m_cart->write_ram(space, offset, data);
2068            m_slotcart->write_ram(space, offset, data);
20692069         if (offset >= 0x300000 && offset < 0x310000)
2070            m_slotcart->m_cart->write_ram(space, offset, data);
2070            m_slotcart->write_ram(space, offset, data);
20712071      }
20722072   }
20732073}
r21852r21853
20882088      else if (address < 0x6000)
20892089      {
20902090         if (address >= 0x4800 && address < 0x4808)
2091            return m_slotcart->m_cart->chip_read(space, address);
2091            return m_slotcart->chip_read(space, address);
20922092
20932093         return snes_r_io(space, address);
20942094      }
20952095      else if (address < 0x8000)
20962096         return snes_open_bus_r(space, 0);
20972097      else
2098         return m_slotcart->m_cart->read_l(space, offset);
2098         return m_slotcart->read_l(space, offset);
20992099   }
21002100   else if (offset >= 0x700000 && address < 0x8000 && m_slotcart->m_cart->get_nvram_size())    // NVRAM access
2101      return m_slotcart->m_cart->read_ram(space, offset);
2101      return m_slotcart->read_ram(space, offset);
21022102   else    // ROM access
2103      return m_slotcart->m_cart->read_l(space, offset);
2103      return m_slotcart->read_l(space, offset);
21042104}
21052105
21062106READ8_MEMBER( snsnew_state::snessdd1_hi_r )
21072107{
21082108   if (offset >= 0x400000)
2109      return m_slotcart->m_cart->read_h(space, offset);
2109      return m_slotcart->read_h(space, offset);
21102110   else
21112111      return snessdd1_lo_r(space, offset, 0xff);
21122112}
r21852r21853
21272127      {
21282128         if (address >= 0x4300 && address < 0x4380)
21292129         {
2130            m_slotcart->m_cart->chip_write(space, address, data);
2130            m_slotcart->chip_write(space, address, data);
21312131            // here we don't return, but we let the w_io happen...
21322132         }
21332133         if (address >= 0x4800 && address < 0x4808)
21342134         {
2135            m_slotcart->m_cart->chip_write(space, address, data);
2135            m_slotcart->chip_write(space, address, data);
21362136            return;
21372137         }
21382138         snes_w_io(space, address, data);
21392139      }
21402140   }
21412141   if (offset >= 0x700000 && address < 0x8000 && m_slotcart->m_cart->get_nvram_size())
2142      return m_slotcart->m_cart->write_ram(space, offset, data);
2142      return m_slotcart->write_ram(space, offset, data);
21432143}
21442144
21452145
r21852r21853
21582158      else if (address < 0x6000)
21592159      {
21602160         if (address >= 0x2188 && address < 0x21a0)
2161            return m_slotcart->m_cart->chip_read(space, offset);
2161            return m_slotcart->chip_read(space, offset);
21622162         if (address >= 0x5000)
2163            return m_slotcart->m_cart->chip_read(space, offset);
2163            return m_slotcart->chip_read(space, offset);
21642164         return snes_r_io(space, address);
21652165      }
21662166      else if (address < 0x8000)
21672167      {
21682168         if (offset >= 0x200000)
2169            return m_slotcart->m_cart->read_h(space, offset);
2169            return m_slotcart->read_h(space, offset);
21702170         else
21712171            return snes_open_bus_r(space, 0);
21722172      }
21732173      else
2174         return m_slotcart->m_cart->read_h(space, offset);
2174         return m_slotcart->read_h(space, offset);
21752175   }
2176   return m_slotcart->m_cart->read_h(space, offset);
2176   return m_slotcart->read_h(space, offset);
21772177}
21782178
21792179WRITE8_MEMBER( snsnew_state::snesbsx_hi_w )
r21852r21853
21872187      {
21882188         if (address >= 0x2188 && address < 0x21a0)
21892189         {
2190            m_slotcart->m_cart->chip_write(space, offset, data);
2190            m_slotcart->chip_write(space, offset, data);
21912191            return;
21922192         }
21932193         if (address >= 0x5000)
21942194         {
2195            m_slotcart->m_cart->chip_write(space, offset, data);
2195            m_slotcart->chip_write(space, offset, data);
21962196            return;
21972197         }
21982198         snes_w_io(space, address, data);
r21852r21853
22002200      else if (address < 0x8000)
22012201      {
22022202         if (offset >= 0x200000)
2203            return m_slotcart->m_cart->write_l(space, offset, data);
2203            return m_slotcart->write_l(space, offset, data);
22042204      }
22052205      else
2206         return m_slotcart->m_cart->write_l(space, offset, data);
2206         return m_slotcart->write_l(space, offset, data);
22072207   }
2208   return m_slotcart->m_cart->write_l(space, offset, data);
2208   return m_slotcart->write_l(space, offset, data);
22092209}
22102210
22112211READ8_MEMBER( snsnew_state::snesbsx_lo_r )
r21852r21853
22192219      else if (address < 0x6000)
22202220      {
22212221         if (address >= 0x2188 && address < 0x21a0)
2222            return m_slotcart->m_cart->chip_read(space, offset);
2222            return m_slotcart->chip_read(space, offset);
22232223         if (address >= 0x5000)
2224            return m_slotcart->m_cart->chip_read(space, offset);
2224            return m_slotcart->chip_read(space, offset);
22252225         return snes_r_io(space, address);
22262226      }
22272227      else if (address < 0x8000)
22282228      {
22292229         if (offset >= 0x200000)
2230            return m_slotcart->m_cart->read_l(space, offset);
2230            return m_slotcart->read_l(space, offset);
22312231         else
22322232            return snes_open_bus_r(space, 0);
22332233      }
22342234      else
2235         return m_slotcart->m_cart->read_l(space, offset);
2235         return m_slotcart->read_l(space, offset);
22362236   }
2237   return m_slotcart->m_cart->read_l(space, offset);
2237   return m_slotcart->read_l(space, offset);
22382238}
22392239
22402240WRITE8_MEMBER( snsnew_state::snesbsx_lo_w )
r21852r21853
23032303      case SNES_ST011:    // this requires two diff kinds of chip access, so we handle it in snes20_lo/hi_r/w
23042304         break;
23052305      case SNES_DSP:
2306         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x208000, 0x20ffff, 0, 0x9f0000, read8_delegate(FUNC(device_sns_cart_interface::chip_read),state->m_slotcart->m_cart));
2307         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x208000, 0x20ffff, 0, 0x9f0000, write8_delegate(FUNC(device_sns_cart_interface::chip_write),state->m_slotcart->m_cart));
2306         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x208000, 0x20ffff, 0, 0x9f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)state->m_slotcart));
2307         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x208000, 0x20ffff, 0, 0x9f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)state->m_slotcart));
23082308         break;
23092309      case SNES_DSP_2MB:
2310         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x600000, 0x607fff, 0, 0x8f0000, read8_delegate(FUNC(device_sns_cart_interface::chip_read),state->m_slotcart->m_cart));
2311         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x600000, 0x607fff, 0, 0x8f0000, write8_delegate(FUNC(device_sns_cart_interface::chip_write),state->m_slotcart->m_cart));
2310         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x600000, 0x607fff, 0, 0x8f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)state->m_slotcart));
2311         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x600000, 0x607fff, 0, 0x8f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)state->m_slotcart));
23122312         break;
23132313      case SNES_DSP4:
2314         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x308000, 0x30ffff, 0, 0x8f0000, read8_delegate(FUNC(device_sns_cart_interface::chip_read),state->m_slotcart->m_cart));
2315         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x308000, 0x30ffff, 0, 0x8f0000, write8_delegate(FUNC(device_sns_cart_interface::chip_write),state->m_slotcart->m_cart));
2314         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x308000, 0x30ffff, 0, 0x8f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)state->m_slotcart));
2315         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x308000, 0x30ffff, 0, 0x8f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)state->m_slotcart));
23162316         break;
23172317      case SNES_OBC1:
2318         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x006000, 0x007fff, 0, 0xbf0000, read8_delegate(FUNC(device_sns_cart_interface::chip_read),state->m_slotcart->m_cart));
2319         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x006000, 0x007fff, 0, 0xbf0000, write8_delegate(FUNC(device_sns_cart_interface::chip_write),state->m_slotcart->m_cart));
2318         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x006000, 0x007fff, 0, 0xbf0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)state->m_slotcart));
2319         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x006000, 0x007fff, 0, 0xbf0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)state->m_slotcart));
23202320         break;
23212321      case SNES_SFX:
23222322         machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snsnew_state::snessfx_lo_r),state), write8_delegate(FUNC(snsnew_state::snessfx_lo_w),state));
r21852r21853
23432343      case SNES_DSP_MODE21:
23442344         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));
23452345         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));
2346         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));
2347         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));
2346         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x006000, 0x007fff, 0, 0x9f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)state->m_slotcart));
2347         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x006000, 0x007fff, 0, 0x9f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)state->m_slotcart));
23482348         set_5a22_map(*state->m_maincpu);
23492349         break;
23502350      case SNES_SRTC:
23512351         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));
23522352         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));
2353         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));
2354         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));
2353         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x002800, 0x002800, 0, 0xbf0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)state->m_slotcart));
2354         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x002801, 0x002801, 0, 0xbf0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)state->m_slotcart));
23552355         set_5a22_map(*state->m_maincpu);
23562356         break;
23572357      case SNES_SPC7110:
r21852r21853
23622362         break;
23632363      // pirate 'mappers'
23642364      case SNES_POKEMON:
2365         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x800000, 0x80ffff, 0, 0x780000, read8_delegate(FUNC(device_sns_cart_interface::chip_read),state->m_slotcart->m_cart));
2366         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x800000, 0x80ffff, 0, 0x780000, write8_delegate(FUNC(device_sns_cart_interface::chip_write),state->m_slotcart->m_cart));
2365         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x800000, 0x80ffff, 0, 0x780000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)state->m_slotcart));
2366         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x800000, 0x80ffff, 0, 0x780000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)state->m_slotcart));
23672367         break;
23682368      case SNES_TEKKEN2:
2369         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x808000, 0x8087ff, 0, 0x3f0000, read8_delegate(FUNC(device_sns_cart_interface::chip_read),state->m_slotcart->m_cart));
2370         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x808000, 0x8087ff, 0, 0x3f0000, write8_delegate(FUNC(device_sns_cart_interface::chip_write),state->m_slotcart->m_cart));
2369         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x808000, 0x8087ff, 0, 0x3f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)state->m_slotcart));
2370         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x808000, 0x8087ff, 0, 0x3f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)state->m_slotcart));
23712371         break;
23722372      case SNES_MCPIR1:
23732373      case SNES_MCPIR2:
2374         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xffff00, 0xffffff, write8_delegate(FUNC(device_sns_cart_interface::chip_write),state->m_slotcart->m_cart));
2374         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xffff00, 0xffffff, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)state->m_slotcart));
23752375         break;
23762376      case SNES_20COL:
23772377         // why is this not working? investigate...
2378         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x008000, 0x008fff, write8_delegate(FUNC(device_sns_cart_interface::chip_write),state->m_slotcart->m_cart));
2378         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x008000, 0x008fff, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)state->m_slotcart));
23792379         break;
23802380      case SNES_SOULBLAD:
23812381         // reads from xxx0-xxx3in range [80-bf] return a fixed sequence of 4bits; reads in range [c0-ff] return open bus
2382         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x808000, 0x808003, 0, 0x3f7ff0, read8_delegate(FUNC(device_sns_cart_interface::chip_read),state->m_slotcart->m_cart));
2382         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x808000, 0x808003, 0, 0x3f7ff0, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)state->m_slotcart));
23832383         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xc00000, 0xffffff, FUNC(snes_open_bus_r));
23842384         break;
23852385      case SNES_BUGS:
23862386      case SNES_BANANA:
2387//          machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x808000, 0x80ffff, 0, 0x780000, read8_delegate(FUNC(device_sns_cart_interface::chip_read),state->m_slotcart->m_cart));
2388//          machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x808000, 0x80ffff, 0, 0x780000, write8_delegate(FUNC(device_sns_cart_interface::chip_write),state->m_slotcart->m_cart));
2387//          machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x808000, 0x80ffff, 0, 0x780000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)state->m_slotcart));
2388//          machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x808000, 0x80ffff, 0, 0x780000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)state->m_slotcart));
23892389//          set_5a22_map(*state->m_maincpu);
23902390         break;
23912391   }
trunk/src/mess/machine/sns_slot.h
r21852r21853
152152   virtual DECLARE_READ8_MEMBER(chip_read);
153153   virtual DECLARE_WRITE8_MEMBER(chip_write);
154154
155// FIXME:
156// this should be private, but then there is some problem installing delegates in the driver...
155// m_cart cannot be made private yet, because we need to check nvram_size from the driver...
156// more work needed
157157//private:
158158
159   device_sns_cart_interface*      m_cart;
160
161159   int m_type;
160   device_sns_cart_interface*      m_cart;
162161};
163162
164163// ======================> sns_cart_slot_device
trunk/src/mess/machine/sns_bsx.c
r21852r21853
285285   if (offset < 0x200000 && access_00_1f)
286286   {
287287      // 0x00-0x1f:0x8000-0xffff -> CART
288      if (m_slot->m_cart && m_slot->m_cart->get_rom_size())
289         return m_slot->m_cart->read_l(space, offset);
288      return m_slot->read_l(space, offset);
290289   }
291290   if (offset >= 0x200000 && offset < 0x400000)
292291   {
r21852r21853
335334   if (offset < 0x200000 && access_80_9f)
336335   {
337336      // 0x80-0x9f:0x8000-0xffff -> CART
338      if (m_slot->m_cart && m_slot->m_cart->get_rom_size())
339         return m_slot->m_cart->read_l(space, offset);
337      return m_slot->read_l(space, offset);
340338   }
341339
342340   // if not in any of the cases above...
r21852r21853
475473   }
476474   else if (offset < 0x700000)
477475   {
478      if (m_slot->m_cart && m_slot->m_cart->get_rom_size())
479         return m_slot->m_cart->read_h(space, offset);
476      return m_slot->read_h(space, offset);
480477   }
481478   // RAM [70-7f]
482479   return 0x00;
r21852r21853
499496   }
500497   if (offset >= 0x200000 && offset < 0x400000)
501498   {
502      if ((offset & 0xffff) >= 0x8000 && m_slot->m_cart && m_slot->m_cart->get_rom_size())
503         return m_slot->m_cart->read_h(space, offset);
499      if ((offset & 0xffff) >= 0x8000)
500         return m_slot->read_h(space, offset);
504501   }
505502   if (offset >= 0x400000 && offset < 0x600000)
506503   {
r21852r21853
509506      return m_rom[rom_bank_map[bank] * 0x8000 + (offset & 0x7fff)];
510507   }
511508   if (offset >= 0x600000)
512   {
513      if (m_slot->m_cart && m_slot->m_cart->get_rom_size())
514         return m_slot->m_cart->read_h(space, offset);
515   }
509      return m_slot->read_h(space, offset);
516510   return 0xff;
517511}
518512
trunk/src/mess/machine/md_sk.c
r21852r21853
5050
5151READ16_MEMBER(md_rom_sk_device::read)
5252{
53   if (m_exp->m_cart != NULL && m_exp->m_cart->get_rom_base() != NULL && offset >= 0x200000/2 && offset < (0x200000 + m_exp->m_cart->get_rom_size())/2)
54      return m_exp->m_cart->m_rom[offset - 0x200000/2];
53   if (offset >= 0x200000/2 && offset < 0x400000/2)
54      return m_exp->read(space, offset - 0x200000/2);
5555   if (offset < 0x400000/2)
5656      return m_rom[MD_ADDR(offset)];
5757   else
trunk/src/mess/machine/md_slot.h
r21852r21853
176176   virtual DECLARE_WRITE16_MEMBER(write_a13);
177177   virtual DECLARE_READ16_MEMBER(read_a15);
178178   virtual DECLARE_WRITE16_MEMBER(write_a15);
179   virtual DECLARE_WRITE16_MEMBER(write_tmss_bank) { if (m_cart) m_cart->write_tmss_bank(space, offset, data); };
179180
180// FIXME:
181// this should be private, but then there is some problem installing delegates in the driver...
181// TODO: this only needs to be public because megasvp copies rom into memory region, so we need to rework that code...
182182//private:
183
184   device_md_cart_interface*       m_cart;
185
183   
186184   int m_type;
185   device_md_cart_interface*       m_cart;
187186};
188187
189188// ======================> md_cart_slot_device
trunk/src/mess/machine/gb_slot.h
r21852r21853
145145   virtual DECLARE_READ8_MEMBER(read_ram);
146146   virtual DECLARE_WRITE8_MEMBER(write_ram);
147147
148// FIXME:
149// this should be private, but then there is some problem installing delegates in the driver...
148// TODO: check how to implement m_sgb_hack without accessing m_cart->m_rom
150149//private:
151
152   device_gb_cart_interface*       m_cart;
153
150   
154151   int m_type;
152   device_gb_cart_interface*       m_cart;
155153};
156154
157155// ======================> gb_cart_slot_device
trunk/src/mess/machine/sns_sufami.c
r21852r21853
9090   }
9191   if (offset >= 0x200000 && offset < 0x400000)    // SLOT1 STROM
9292   {
93      if (m_slot1->m_cart)
94         return m_slot1->m_cart->read_l(space, offset - 0x200000);
93      return m_slot1->read_l(space, offset - 0x200000);
9594   }
9695   if (offset >= 0x400000 && offset < 0x600000)    // SLOT2 STROM
9796   {
98      if (m_slot2->m_cart)
99         return m_slot2->m_cart->read_l(space, offset - 0x400000);
97      return m_slot2->read_l(space, offset - 0x400000);
10098   }
10199   if (offset >= 0x600000 && offset < 0x640000)    // SLOT1 RAM
102100   {
103      if (m_slot1->m_cart && (offset & 0xffff) >= 0x8000)
101      if ((offset & 0xffff) >= 0x8000)
104102      {
105103         offset -= 0x600000;
106104         bank = offset / 0x10000;
107         return m_slot1->m_cart->read_ram(space, bank * 0x8000 + (offset & 0x7fff));
105         return m_slot1->read_ram(space, bank * 0x8000 + (offset & 0x7fff));
108106      }
109107   }
110108   if (offset >= 0x700000 && offset < 0x740000)    // SLOT2 RAM
111109   {
112      if (m_slot2->m_cart && (offset & 0xffff) >= 0x8000)
110      if ((offset & 0xffff) >= 0x8000)
113111      {
114112         offset -= 0x700000;
115113         bank = offset / 0x10000;
116         return m_slot2->m_cart->read_ram(space, bank * 0x8000 + (offset & 0x7fff));
114         return m_slot2->read_ram(space, bank * 0x8000 + (offset & 0x7fff));
117115      }
118116   }
119117
r21852r21853
130128   int bank;
131129   if (offset >= 0x600000 && offset < 0x640000)    // SLOT1 RAM
132130   {
133      if (m_slot1->m_cart && (offset & 0xffff) >= 0x8000)
131      if ((offset & 0xffff) >= 0x8000)
134132      {
135133         offset -= 0x600000;
136134         bank = offset / 0x10000;
137         m_slot1->m_cart->write_ram(space, bank * 0x8000 + (offset & 0x7fff), data);
135         m_slot1->write_ram(space, bank * 0x8000 + (offset & 0x7fff), data);
138136      }
139137   }
140138
141139   if (offset >= 0x700000 && offset < 0x740000)    // SLOT2 RAM
142140   {
143      if (m_slot2->m_cart && (offset & 0xffff) >= 0x8000)
141      if ((offset & 0xffff) >= 0x8000)
144142      {
145143         offset -= 0x700000;
146144         bank = offset / 0x10000;
147         m_slot2->m_cart->write_ram(space, bank * 0x8000 + (offset & 0x7fff), data);
145         m_slot2->write_ram(space, bank * 0x8000 + (offset & 0x7fff), data);
148146      }
149147   }
150148

Previous 199869 Revisions Next


© 1997-2024 The MAME Team