Previous 199869 Revisions Next

r32750 Tuesday 14th October, 2014 at 19:53:05 UTC by Fabio Priuli
(MESS) atari400.c: recovering some speed which got lost with conversion to
slot device in carts which enable and disable ROM continuously (e.g. Dropzone
and Jinks). nw.
[src/mess/drivers]atari400.c

trunk/src/mess/drivers/atari400.c
r32749r32750
270270   DECLARE_READ8_MEMBER(read_d5xx);   // at least one cart type can enable/disable roms when reading
271271   DECLARE_WRITE8_MEMBER(disable_cart);
272272
273   // these are needed to handle carts which can disable ROM without
274   // installing/disinstalling continuously RAM and ROM (with e.g. big
275   // preformance hit in Williams carts)
276   DECLARE_READ8_MEMBER(special_read_8000);
277   DECLARE_WRITE8_MEMBER(special_write_8000);
278   DECLARE_READ8_MEMBER(special_read_a000);
279   DECLARE_WRITE8_MEMBER(special_write_a000);
280
273281   DECLARE_READ8_MEMBER(a600xl_low_r);
274282   DECLARE_READ8_MEMBER(a1200xl_low_r);
275283   DECLARE_READ8_MEMBER(a800xl_low_r);
r32749r32750
299307   optional_device<a800_cart_slot_device> m_cart;
300308   optional_device<a800_cart_slot_device> m_cart2;
301309
302   int m_cart_disabled;
310   int m_cart_disabled, m_cart_helper;
303311   int m_last_offs;
304312   UINT8 m_mmu, m_ext_bank;
305313   
r32749r32750
17271735   }
17281736}
17291737
1738
1739// these handle cart enable/disable without calling setup_ram thousands of times
1740READ8_MEMBER(a400_state::special_read_8000)
1741{
1742   if (!m_cart_disabled)
1743      return m_cart->read_80xx(space, offset);
1744   else
1745   {
1746      offset += 0x8000;
1747      if (m_ram->size() < offset)
1748         return 0;     
1749      else
1750         return m_ram->pointer()[offset];
1751   }
1752}
1753
1754WRITE8_MEMBER(a400_state::special_write_8000)
1755{
1756   if (m_cart_disabled)
1757   {
1758      offset += 0x8000;
1759      if (m_ram->size() >= offset)
1760         m_ram->pointer()[offset] = data;
1761   }
1762}
1763
1764READ8_MEMBER(a400_state::special_read_a000)
1765{
1766   if (!m_cart_disabled)
1767      return m_cart->read_80xx(space, offset);
1768   else
1769   {
1770      offset += 0xa000;
1771      if (m_ram->size() < offset)
1772         return 0;     
1773      else
1774         return m_ram->pointer()[offset];
1775   }
1776}
1777
1778WRITE8_MEMBER(a400_state::special_write_a000)
1779{
1780   if (m_cart_disabled)
1781   {
1782      offset += 0xa000;
1783      if (m_ram->size() >= offset)
1784         m_ram->pointer()[offset] = data;
1785   }
1786}
1787
1788
17301789READ8_MEMBER(a400_state::read_d5xx)
17311790{
17321791   disable_cart(space, offset, 0);
r32749r32750
17421801         case A800_PHOENIX:
17431802         case A800_BLIZZARD:
17441803            if (!m_cart_disabled)
1745            {
17461804               m_cart_disabled = 1;
1747               setup_ram(2, m_ram->size());
1748            }
17491805            break;
17501806         case A800_OSS034M:
17511807         case A800_OSS043M:
r32749r32750
17551811            // use m_cart_disabled & m_last_offs to avoid continuous remapping of
17561812            // the memory space in some games (e.g. dropzone)
17571813            if (offset & 0x8 && !m_cart_disabled)
1758            {
17591814               m_cart_disabled = 1;
1760               setup_ram(2, m_ram->size());
1761            }
17621815            else if (!(offset & 0x8))
17631816            {
17641817               if (m_cart_disabled)
1765               {
17661818                  m_cart_disabled = 0;
1767                  m_maincpu->space(AS_PROGRAM).install_read_handler(0xa000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)m_cart));
1768                  m_maincpu->space(AS_PROGRAM).unmap_write(0xa000, 0xbfff);
1769               }
17701819               
17711820               if ((offset & 0x7) != m_last_offs)
17721821               {
r32749r32750
17791828         case A800_TURBO64:
17801829         case A800_TURBO128:
17811830            if (offset & 0x10 && !m_cart_disabled)
1782            {
17831831               m_cart_disabled = 1;
1784               setup_ram(2, m_ram->size());
1785            }
17861832            else if (!(offset & 0x10))
17871833            {
17881834               if (m_cart_disabled)
1789               {
17901835                  m_cart_disabled = 0;
1791                  m_maincpu->space(AS_PROGRAM).install_read_handler(0xa000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)m_cart));
1792                  m_maincpu->space(AS_PROGRAM).unmap_write(0xa000, 0xbfff);
1793               }
17941836               
17951837               if ((offset & 0x0f) != m_last_offs)
17961838               {
r32749r32750
18071849         case A800_OSSM091:
18081850         case A800_OSS8K:
18091851            if ((offset & 0x9) == 0x08)
1810               setup_ram(2, m_ram->size());
1852               m_cart_disabled = 1;
18111853            else
18121854            {
1813               m_maincpu->space(AS_PROGRAM).install_read_handler(0xa000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)m_cart));
1814               m_maincpu->space(AS_PROGRAM).unmap_write(0xa000, 0xbfff);
1855               m_cart_disabled = 0;
18151856               m_cart->write_d5xx(space, offset, data);
18161857            }
18171858            break;
18181859         case A800_MICROCALC:
1819            m_cart_disabled = (m_cart_disabled + 1) % 5;
1820            if (m_cart_disabled == 4)
1821               setup_ram(2, m_ram->size());
1860            m_cart_helper = (m_cart_helper + 1) % 5;
1861            if (m_cart_helper == 4)
1862               m_cart_disabled = 1;
18221863            else
18231864            {
1824               m_maincpu->space(AS_PROGRAM).install_read_handler(0xa000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)m_cart));
1825               m_maincpu->space(AS_PROGRAM).unmap_write(0xa000, 0xbfff);
1826               m_cart->write_d5xx(space, offset, m_cart_disabled);
1865               m_cart_disabled = 0;
1866               m_cart->write_d5xx(space, offset, m_cart_helper);
18271867            }
18281868            break;
18291869         default:
r32749r32750
18531893            m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot));
18541894            m_maincpu->space(AS_PROGRAM).unmap_write(0x8000, 0xbfff);
18551895            break;
1856         case A800_PHOENIX:
1857            m_maincpu->space(AS_PROGRAM).install_read_handler(0xa000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot));
1858            m_maincpu->space(AS_PROGRAM).unmap_write(0xa000, 0xbfff);
1859            m_maincpu->space(AS_PROGRAM).install_write_handler(0xd500, 0xd5ff, write8_delegate(FUNC(a400_state::disable_cart), this));
1860            break;
18611896         case A800_BBSB:
18621897            m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot));
18631898            m_maincpu->space(AS_PROGRAM).install_write_handler(0x8000, 0x9fff, write8_delegate(FUNC(a800_cart_slot_device::write_80xx),(a800_cart_slot_device*)slot));
r32749r32750
18691904         case A800_OSS8K:
18701905         case A800_TURBO64:
18711906         case A800_TURBO128:
1872            m_maincpu->space(AS_PROGRAM).install_read_handler(0xa000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot));
1873            m_maincpu->space(AS_PROGRAM).unmap_write(0xa000, 0xbfff);
1907         case A800_PHOENIX:
1908            m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa000, 0xbfff, read8_delegate(FUNC(a400_state::special_read_a000), this), write8_delegate(FUNC(a400_state::special_write_a000), this));
18741909            m_maincpu->space(AS_PROGRAM).install_write_handler(0xd500, 0xd5ff, write8_delegate(FUNC(a400_state::disable_cart), this));
18751910            break;
1876         case A800_MICROCALC:
1877            // this can also disable ROM when reading in 0xd500-0xd5ff
1878            m_maincpu->space(AS_PROGRAM).install_read_handler(0xa000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot));
1879            m_maincpu->space(AS_PROGRAM).unmap_write(0xa000, 0xbfff);
1880            m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xd500, 0xd5ff, read8_delegate(FUNC(a400_state::read_d5xx), this), write8_delegate(FUNC(a400_state::disable_cart), this));
1881            break;
18821911         case A800_EXPRESS:
1883            m_maincpu->space(AS_PROGRAM).install_read_handler(0xa000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot));
1884            m_maincpu->space(AS_PROGRAM).unmap_write(0xa000, 0xbfff);
1912            m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa000, 0xbfff, read8_delegate(FUNC(a400_state::special_read_a000), this), write8_delegate(FUNC(a400_state::special_write_a000), this));
18851913            m_maincpu->space(AS_PROGRAM).install_write_handler(0xd570, 0xd57f, write8_delegate(FUNC(a400_state::disable_cart), this));
18861914            break;
18871915         case A800_DIAMOND:
1888            m_maincpu->space(AS_PROGRAM).install_read_handler(0xa000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot));
1889            m_maincpu->space(AS_PROGRAM).unmap_write(0xa000, 0xbfff);
1916            m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa000, 0xbfff, read8_delegate(FUNC(a400_state::special_read_a000), this), write8_delegate(FUNC(a400_state::special_write_a000), this));
18901917            m_maincpu->space(AS_PROGRAM).install_write_handler(0xd5d0, 0xd5df, write8_delegate(FUNC(a400_state::disable_cart), this));
18911918            break;
18921919         case A800_WILLIAMS:
1893            m_maincpu->space(AS_PROGRAM).install_read_handler(0xa000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot));
1894            m_maincpu->space(AS_PROGRAM).unmap_write(0xa000, 0xbfff);
1920            m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa000, 0xbfff, read8_delegate(FUNC(a400_state::special_read_a000), this), write8_delegate(FUNC(a400_state::special_write_a000), this));
18951921            m_maincpu->space(AS_PROGRAM).install_write_handler(0xd500, 0xd50f, write8_delegate(FUNC(a400_state::disable_cart), this));
18961922            break;
18971923         case A800_SPARTADOS:
1898            m_maincpu->space(AS_PROGRAM).install_read_handler(0xa000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot));
1899            m_maincpu->space(AS_PROGRAM).unmap_write(0xa000, 0xbfff);
1924            m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa000, 0xbfff, read8_delegate(FUNC(a400_state::special_read_a000), this), write8_delegate(FUNC(a400_state::special_write_a000), this));
19001925            m_maincpu->space(AS_PROGRAM).install_write_handler(0xd5e0, 0xd5ef, write8_delegate(FUNC(a400_state::disable_cart), this));
19011926            break;
1927         case A800_BLIZZARD:
1928            m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x8000, 0xbfff, read8_delegate(FUNC(a400_state::special_read_8000), this), write8_delegate(FUNC(a400_state::special_write_8000), this));
1929            m_maincpu->space(AS_PROGRAM).install_write_handler(0xd500, 0xd5ff, write8_delegate(FUNC(a400_state::disable_cart), this));
1930            break;
1931         case A800_MICROCALC:
1932            // this can also disable ROM when reading in 0xd500-0xd5ff
1933            m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa000, 0xbfff, read8_delegate(FUNC(a400_state::special_read_a000), this), write8_delegate(FUNC(a400_state::special_write_a000), this));
1934            m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xd500, 0xd5ff, read8_delegate(FUNC(a400_state::read_d5xx), this), write8_delegate(FUNC(a400_state::disable_cart), this));
1935            break;
19021936         case A800_TELELINK2:
19031937            m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot));
19041938            m_maincpu->space(AS_PROGRAM).install_write_handler(0x9000, 0x90ff, write8_delegate(FUNC(a800_cart_slot_device::write_80xx),(a800_cart_slot_device*)slot));
r32749r32750
19061940            m_maincpu->space(AS_PROGRAM).install_read_handler(0xd501, 0xd501, read8_delegate(FUNC(a800_cart_slot_device::read_d5xx),(a800_cart_slot_device*)slot));
19071941            m_maincpu->space(AS_PROGRAM).install_write_handler(0xd502, 0xd502, write8_delegate(FUNC(a800_cart_slot_device::write_d5xx),(a800_cart_slot_device*)slot));
19081942            break;
1909         case A800_BLIZZARD:
1910            m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot));
1911            m_maincpu->space(AS_PROGRAM).unmap_write(0x8000, 0xbfff);
1912            m_maincpu->space(AS_PROGRAM).install_write_handler(0xd500, 0xd5ff, write8_delegate(FUNC(a400_state::disable_cart), this));
1913            break;
19141943         case A800_XEGS:
19151944            m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot));
19161945            m_maincpu->space(AS_PROGRAM).unmap_write(0x8000, 0xbfff);
r32749r32750
19641993   setup_cart(m_cart);
19651994
19661995   save_item(NAME(m_cart_disabled));
1996   save_item(NAME(m_cart_helper));
19671997   save_item(NAME(m_last_offs));
19681998}
19691999
r32749r32750
19772007   setup_cart(m_cart2);
19782008
19792009   save_item(NAME(m_cart_disabled));
2010   save_item(NAME(m_cart_helper));
19802011   save_item(NAME(m_last_offs));
19812012}
19822013
r32749r32750
19872018   setup_cart(m_cart);
19882019
19892020   save_item(NAME(m_cart_disabled));
2021   save_item(NAME(m_cart_helper));
19902022   save_item(NAME(m_last_offs));
19912023   save_item(NAME(m_mmu));
19922024   save_item(NAME(m_ext_bank));
r32749r32750
19982030   setup_cart(m_cart);
19992031
20002032   save_item(NAME(m_cart_disabled));
2033   save_item(NAME(m_cart_helper));
20012034   save_item(NAME(m_last_offs));
20022035}
20032036

Previous 199869 Revisions Next


© 1997-2024 The MAME Team