trunk/src/mess/drivers/snes.c
| r21798 | r21799 | |
| 1586 | 1586 | DECLARE_WRITE8_MEMBER( snesbsx_hi_w ); |
| 1587 | 1587 | DECLARE_READ8_MEMBER( snesbsx_lo_r ); |
| 1588 | 1588 | DECLARE_WRITE8_MEMBER( snesbsx_lo_w ); |
| 1589 | | DECLARE_READ8_MEMBER( snesnew_lo_r ); |
| 1590 | | DECLARE_READ8_MEMBER( snesnew_hi_r ); |
| 1591 | | DECLARE_WRITE8_MEMBER( snesnew_lo_w ); |
| 1592 | | DECLARE_WRITE8_MEMBER( snesnew_hi_w ); |
| 1593 | 1589 | |
| 1594 | 1590 | optional_device<sns_cart_slot_device> m_slotcart; |
| 1595 | 1591 | int m_type; |
| 1596 | 1592 | }; |
| 1597 | 1593 | |
| 1594 | //--------------------------------------------------------------------------------- |
| 1595 | // LoROM & LoROM + BSX slot & LoROM + some add-on chips |
| 1596 | //--------------------------------------------------------------------------------- |
| 1598 | 1597 | |
| 1599 | | // FIXME: merge these add-on specific maps into something more sane! |
| 1600 | | |
| 1601 | 1598 | // In general LoROM games have perfect mirror between 0x00-0x7d and 0x80-0xff |
| 1602 | 1599 | // But BSX+LoROM games use different read handlers (to access ROM beyond 2MB) |
| 1603 | 1600 | // so we use two different set of handlers... |
| 1604 | 1601 | |
| 1605 | | // LoROM |
| 1602 | // Also we have here LoROM + CX4, until the Hitachi CPU is emulated, |
| 1603 | // and the LoROM + Seta DSP, because their chip_read/chip_write need global offset |
| 1606 | 1604 | |
| 1607 | 1605 | READ8_MEMBER( snsnew_state::snes20_hi_r ) |
| 1608 | 1606 | { |
| 1609 | 1607 | UINT16 address = offset & 0xffff; |
| 1610 | 1608 | |
| 1609 | // take care of add-on IO |
| 1610 | if ((m_slotcart->get_type() == SNES_ST010 || m_slotcart->get_type() == SNES_ST011) |
| 1611 | && (offset >= 0x600000 && offset < 0x680000 && (offset & 0xffff) < 0x4000)) |
| 1612 | return m_slotcart->m_cart->chip_read(space, offset); |
| 1613 | else if ((m_slotcart->get_type() == SNES_ST010 || m_slotcart->get_type() == SNES_ST011) |
| 1614 | && (offset >= 0x680000 && offset < 0x700000 && (offset & 0xffff) < 0x8000)) |
| 1615 | return m_slotcart->m_cart->chip_read(space, offset); |
| 1616 | else if (m_slotcart->get_type() == SNES_CX4 |
| 1617 | && (offset < 0x400000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)) // hack until we emulate the real CPU |
| 1618 | return CX4_read((offset & 0xffff) - 0x6000); |
| 1619 | |
| 1611 | 1620 | if (offset < 0x400000) |
| 1612 | 1621 | { |
| 1613 | 1622 | if (address < 0x2000) |
| r21798 | r21799 | |
| 1654 | 1663 | { |
| 1655 | 1664 | UINT16 address = offset & 0xffff; |
| 1656 | 1665 | |
| 1657 | | if (m_type == SNES_SUFAMITURBO && address >= 0x8000 && ((offset >= 0x600000 && offset < 0x640000) || (offset >= 0x700000 && offset < 0x740000))) |
| 1666 | // take care of add-on IO |
| 1667 | if ((m_slotcart->get_type() == SNES_ST010 || m_slotcart->get_type() == SNES_ST011) |
| 1668 | && (offset >= 0x600000 && offset < 0x680000 && (offset & 0xffff) < 0x4000)) |
| 1669 | { m_slotcart->m_cart->chip_write(space, offset, data); return; } |
| 1670 | else if ((m_slotcart->get_type() == SNES_ST010 || m_slotcart->get_type() == SNES_ST011) |
| 1671 | && (offset >= 0x680000 && offset < 0x700000 && (offset & 0xffff) < 0x8000)) |
| 1672 | { m_slotcart->m_cart->chip_write(space, offset, data); return; } |
| 1673 | else if (m_slotcart->get_type() == SNES_CX4 |
| 1674 | && (offset < 0x400000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)) // hack until we emulate the real CPU |
| 1675 | { CX4_write(space.machine(), (offset & 0xffff) - 0x6000, data); return; } |
| 1676 | else if (m_type == SNES_SUFAMITURBO |
| 1677 | && address >= 0x8000 && ((offset >= 0x600000 && offset < 0x640000) || (offset >= 0x700000 && offset < 0x740000))) |
| 1658 | 1678 | { m_slotcart->m_cart->write_h(space, offset, data); return; } |
| 1659 | 1679 | |
| 1660 | 1680 | if (offset < 0x400000) |
| r21798 | r21799 | |
| 1681 | 1701 | { |
| 1682 | 1702 | UINT16 address = offset & 0xffff; |
| 1683 | 1703 | |
| 1704 | // take care of add-on IO |
| 1705 | if ((m_slotcart->get_type() == SNES_ST010 /*|| m_slotcart->get_type() == SNES_ST011*/) // why does this break moritash? |
| 1706 | && (offset >= 0x600000 && offset < 0x680000 && (offset & 0xffff) < 0x4000)) |
| 1707 | return m_slotcart->m_cart->chip_read(space, offset); |
| 1708 | else if ((m_slotcart->get_type() == SNES_ST010 || m_slotcart->get_type() == SNES_ST011) |
| 1709 | && (offset >= 0x680000 && offset < 0x700000 && (offset & 0xffff) < 0x8000)) |
| 1710 | return m_slotcart->m_cart->chip_read(space, offset); |
| 1711 | else if (m_slotcart->get_type() == SNES_CX4 |
| 1712 | && (offset < 0x400000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)) // hack until we emulate the real CPU |
| 1713 | return CX4_read((offset & 0xffff) - 0x6000); |
| 1714 | |
| 1684 | 1715 | if (offset < 0x400000) |
| 1685 | 1716 | { |
| 1686 | 1717 | if (address < 0x2000) |
| r21798 | r21799 | |
| 1725 | 1756 | |
| 1726 | 1757 | WRITE8_MEMBER( snsnew_state::snes20_lo_w ) |
| 1727 | 1758 | { |
| 1728 | | if (m_type == SNES_SUFAMITURBO && (offset & 0xffff) >= 0x8000 && ((offset >= 0x600000 && offset < 0x640000) || (offset >= 0x700000 && offset < 0x740000))) |
| 1759 | if (m_type == SNES_SUFAMITURBO |
| 1760 | && (offset & 0xffff) >= 0x8000 && ((offset >= 0x600000 && offset < 0x640000) || (offset >= 0x700000 && offset < 0x740000))) |
| 1729 | 1761 | { m_slotcart->m_cart->write_l(space, offset, data); return; } |
| 1762 | else if (m_slotcart->get_type() == SNES_BANANA |
| 1763 | && (offset & 0x78000) == 0x8000) |
| 1764 | { |
| 1765 | // printf("lo write %x\n", offset); |
| 1766 | m_slotcart->m_cart->chip_write(space, offset, data); |
| 1767 | return; |
| 1768 | } |
| 1730 | 1769 | |
| 1770 | // other add-on writes matches the hi handler |
| 1731 | 1771 | snes20_hi_w(space, offset, data, 0xff); |
| 1732 | 1772 | } |
| 1733 | 1773 | |
| 1734 | 1774 | |
| 1735 | | // HiROM |
| 1775 | //--------------------------------------------------------------------------------- |
| 1776 | // HiROM & HiROM + BSX slot |
| 1777 | //--------------------------------------------------------------------------------- |
| 1736 | 1778 | |
| 1737 | 1779 | READ8_MEMBER( snsnew_state::snes21_lo_r ) |
| 1738 | 1780 | { |
| r21798 | r21799 | |
| 1858 | 1900 | } |
| 1859 | 1901 | } |
| 1860 | 1902 | |
| 1861 | | // SuperFX / GSU |
| 1903 | //--------------------------------------------------------------------------------- |
| 1904 | // LoROM + SuperFX / GSU |
| 1905 | //--------------------------------------------------------------------------------- |
| 1862 | 1906 | |
| 1863 | 1907 | READ8_MEMBER( snsnew_state::snessfx_hi_r ) |
| 1864 | 1908 | { |
| r21798 | r21799 | |
| 1938 | 1982 | snessfx_hi_w(space, offset, data, 0xff); |
| 1939 | 1983 | } |
| 1940 | 1984 | |
| 1941 | | // SPC-7110 |
| 1985 | //--------------------------------------------------------------------------------- |
| 1986 | // HiROM + SPC-7110 |
| 1987 | //--------------------------------------------------------------------------------- |
| 1942 | 1988 | |
| 1943 | 1989 | READ8_MEMBER( snsnew_state::snes7110_hi_r ) |
| 1944 | 1990 | { |
| r21798 | r21799 | |
| 2034 | 2080 | } |
| 2035 | 2081 | |
| 2036 | 2082 | |
| 2037 | | // S-DD1 |
| 2083 | //--------------------------------------------------------------------------------- |
| 2084 | // LoROM + S-DD1 |
| 2085 | //--------------------------------------------------------------------------------- |
| 2038 | 2086 | |
| 2039 | 2087 | READ8_MEMBER( snsnew_state::snessdd1_lo_r ) |
| 2040 | 2088 | { |
| r21798 | r21799 | |
| 2102 | 2150 | } |
| 2103 | 2151 | |
| 2104 | 2152 | |
| 2105 | | // BS-X (Base unit) |
| 2153 | //--------------------------------------------------------------------------------- |
| 2154 | // LoROM + BS-X (Base unit) |
| 2155 | //--------------------------------------------------------------------------------- |
| 2106 | 2156 | |
| 2107 | 2157 | READ8_MEMBER( snsnew_state::snesbsx_hi_r ) |
| 2108 | 2158 | { |
| r21798 | r21799 | |
| 2200 | 2250 | } |
| 2201 | 2251 | |
| 2202 | 2252 | |
| 2203 | | READ8_MEMBER( snsnew_state::snesnew_lo_r ) |
| 2204 | | { |
| 2205 | | // take care of add-on IO |
| 2206 | | if (m_slotcart->get_type() == SNES_DSP |
| 2207 | | && (offset >= 0x200000 && offset < 0x400000 && (offset & 0x8000) == 0x8000)) |
| 2208 | | return m_slotcart->m_cart->chip_read(space, offset & 0x7fff); |
| 2209 | | else if (m_slotcart->get_type() == SNES_DSP_2MB |
| 2210 | | && (offset >= 0x600000 && offset < 0x700000 && (offset & 0x8000) == 0x0000)) |
| 2211 | | return m_slotcart->m_cart->chip_read(space, offset & 0x7fff); |
| 2212 | | else if (m_slotcart->get_type() == SNES_DSP_MODE21 |
| 2213 | | && (offset < 0x200000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)) |
| 2214 | | return m_slotcart->m_cart->chip_read(space, offset & 0x1fff); |
| 2215 | | else if (m_slotcart->get_type() == SNES_DSP4 |
| 2216 | | && (offset >= 0x300000 && offset < 0x400000 && (offset & 0x8000) == 0x8000)) |
| 2217 | | return m_slotcart->m_cart->chip_read(space, offset & 0x7fff); |
| 2218 | | else if (m_slotcart->get_type() == SNES_OBC1 |
| 2219 | | && (offset < 0x400000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)) |
| 2220 | | return m_slotcart->m_cart->chip_read(space, offset); |
| 2221 | | else if ((m_slotcart->get_type() == SNES_ST010 /*|| m_slotcart->get_type() == SNES_ST011*/) // why does this break moritash? |
| 2222 | | && (offset >= 0x600000 && offset < 0x680000 && (offset & 0xffff) < 0x4000)) |
| 2223 | | return m_slotcart->m_cart->chip_read(space, offset); |
| 2224 | | else if ((m_slotcart->get_type() == SNES_ST010 || m_slotcart->get_type() == SNES_ST011) |
| 2225 | | && (offset >= 0x680000 && offset < 0x700000 && (offset & 0xffff) < 0x8000)) |
| 2226 | | return m_slotcart->m_cart->chip_read(space, offset); |
| 2227 | | else if (m_slotcart->get_type() == SNES_SRTC |
| 2228 | | && (offset < 0x400000 && (offset & 0xffff) == 0x2800)) |
| 2229 | | return m_slotcart->m_cart->chip_read(space, offset & 0xffff); |
| 2230 | | else if (m_slotcart->get_type() == SNES_CX4 |
| 2231 | | && (offset < 0x400000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)) // hack until we emulate the real CPU |
| 2232 | | return CX4_read((offset & 0xffff) - 0x6000); |
| 2233 | | else |
| 2234 | | { |
| 2235 | | switch (m_type) |
| 2236 | | { |
| 2237 | | case SNES_MODE20: |
| 2238 | | case SNES_CX4: |
| 2239 | | case SNES_ST010: |
| 2240 | | case SNES_ST011: |
| 2241 | | case SNES_DSP: |
| 2242 | | case SNES_DSP_2MB: |
| 2243 | | case SNES_DSP4: |
| 2244 | | case SNES_OBC1: |
| 2245 | | case SNES_SUFAMITURBO: |
| 2246 | | case SNES_BSXLO: |
| 2247 | | case SNES_POKEMON: |
| 2248 | | case SNES_BANANA: |
| 2249 | | return snes20_lo_r(space, offset, 0xff); |
| 2250 | | |
| 2251 | | case SNES_MODE21: |
| 2252 | | case SNES_DSP_MODE21: |
| 2253 | | case SNES_SRTC: |
| 2254 | | case SNES_BSXHI: |
| 2255 | | return snes21_lo_r(space, offset, 0xff); |
| 2256 | | |
| 2257 | | case SNES_SFX: |
| 2258 | | return snessfx_lo_r(space, offset, 0xff); |
| 2259 | | |
| 2260 | | case SNES_SPC7110: |
| 2261 | | case SNES_SPC7110_RTC: |
| 2262 | | return snes7110_lo_r(space, offset, 0xff); |
| 2263 | | |
| 2264 | | case SNES_SDD1: |
| 2265 | | return snessdd1_lo_r(space, offset, 0xff); |
| 2266 | | |
| 2267 | | case SNES_BSX: |
| 2268 | | return snesbsx_lo_r(space, offset, 0xff); |
| 2269 | | } |
| 2270 | | } |
| 2271 | | return snes_open_bus_r(space, 0); |
| 2272 | | } |
| 2273 | | |
| 2274 | | READ8_MEMBER( snsnew_state::snesnew_hi_r ) |
| 2275 | | { |
| 2276 | | // take care of add-on IO |
| 2277 | | if (m_slotcart->get_type() == SNES_DSP |
| 2278 | | && (offset >= 0x200000 && offset < 0x400000 && (offset & 0x8000) == 0x8000)) |
| 2279 | | return m_slotcart->m_cart->chip_read(space, offset & 0x7fff); |
| 2280 | | else if (m_slotcart->get_type() == SNES_DSP_2MB |
| 2281 | | && (offset >= 0x600000 && offset < 0x700000 && (offset & 0x8000) == 0x0000)) |
| 2282 | | return m_slotcart->m_cart->chip_read(space, offset & 0x7fff); |
| 2283 | | else if (m_slotcart->get_type() == SNES_DSP_MODE21 |
| 2284 | | && (offset < 0x200000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)) |
| 2285 | | return m_slotcart->m_cart->chip_read(space, offset & 0x1fff); |
| 2286 | | else if (m_slotcart->get_type() == SNES_DSP4 |
| 2287 | | && (offset >= 0x300000 && offset < 0x400000 && (offset & 0x8000) == 0x8000)) |
| 2288 | | return m_slotcart->m_cart->chip_read(space, offset & 0x7fff); |
| 2289 | | else if (m_slotcart->get_type() == SNES_OBC1 |
| 2290 | | && (offset < 0x400000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)) |
| 2291 | | return m_slotcart->m_cart->chip_read(space, offset); |
| 2292 | | else if ((m_slotcart->get_type() == SNES_ST010 || m_slotcart->get_type() == SNES_ST011) |
| 2293 | | && (offset >= 0x600000 && offset < 0x680000 && (offset & 0xffff) < 0x4000)) |
| 2294 | | return m_slotcart->m_cart->chip_read(space, offset); |
| 2295 | | else if ((m_slotcart->get_type() == SNES_ST010 || m_slotcart->get_type() == SNES_ST011) |
| 2296 | | && (offset >= 0x680000 && offset < 0x700000 && (offset & 0xffff) < 0x8000)) |
| 2297 | | return m_slotcart->m_cart->chip_read(space, offset); |
| 2298 | | else if (m_slotcart->get_type() == SNES_SRTC |
| 2299 | | && (offset < 0x400000 && (offset & 0xffff) == 0x2800)) |
| 2300 | | return m_slotcart->m_cart->chip_read(space, offset & 0xffff); |
| 2301 | | else if (m_slotcart->get_type() == SNES_CX4 |
| 2302 | | && (offset < 0x400000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)) // hack until we emulate the real CPU |
| 2303 | | return CX4_read((offset & 0xffff) - 0x6000); |
| 2304 | | else if ((m_slotcart->get_type() == SNES_POKEMON || m_slotcart->get_type() == SNES_BANANA) |
| 2305 | | && (offset & 0x70000) == 0x0000) |
| 2306 | | { |
| 2307 | | // printf("hi read %x\n", offset); |
| 2308 | | return m_slotcart->m_cart->chip_read(space, offset); |
| 2309 | | } |
| 2310 | | else |
| 2311 | | { |
| 2312 | | switch (m_type) |
| 2313 | | { |
| 2314 | | case SNES_MODE20: |
| 2315 | | case SNES_CX4: |
| 2316 | | case SNES_ST010: |
| 2317 | | case SNES_ST011: |
| 2318 | | case SNES_DSP: |
| 2319 | | case SNES_DSP_2MB: |
| 2320 | | case SNES_DSP4: |
| 2321 | | case SNES_OBC1: |
| 2322 | | case SNES_SUFAMITURBO: |
| 2323 | | case SNES_BSXLO: |
| 2324 | | case SNES_POKEMON: |
| 2325 | | case SNES_BANANA: |
| 2326 | | return snes20_hi_r(space, offset, 0xff); |
| 2327 | | |
| 2328 | | case SNES_MODE21: |
| 2329 | | case SNES_DSP_MODE21: |
| 2330 | | case SNES_SRTC: |
| 2331 | | case SNES_BSXHI: |
| 2332 | | return snes21_hi_r(space, offset, 0xff); |
| 2333 | | |
| 2334 | | case SNES_SFX: |
| 2335 | | return snessfx_hi_r(space, offset, 0xff); |
| 2336 | | |
| 2337 | | case SNES_SPC7110: |
| 2338 | | case SNES_SPC7110_RTC: |
| 2339 | | return snes7110_hi_r(space, offset, 0xff); |
| 2340 | | |
| 2341 | | case SNES_SDD1: |
| 2342 | | return snessdd1_hi_r(space, offset, 0xff); |
| 2343 | | |
| 2344 | | case SNES_BSX: |
| 2345 | | return snesbsx_hi_r(space, offset, 0xff); |
| 2346 | | } |
| 2347 | | } |
| 2348 | | return snes_open_bus_r(space, 0); |
| 2349 | | } |
| 2350 | | |
| 2351 | | WRITE8_MEMBER( snsnew_state::snesnew_lo_w ) |
| 2352 | | { |
| 2353 | | // take care of add-on IO |
| 2354 | | if (m_slotcart->get_type() == SNES_DSP |
| 2355 | | && (offset >= 0x200000 && offset < 0x400000 && (offset & 0x8000) == 0x8000)) |
| 2356 | | m_slotcart->m_cart->chip_write(space, offset & 0x7fff, data); |
| 2357 | | else if (m_slotcart->get_type() == SNES_DSP_2MB |
| 2358 | | && (offset >= 0x600000 && offset < 0x700000 && (offset & 0x8000) == 0x0000)) |
| 2359 | | m_slotcart->m_cart->chip_write(space, offset & 0x7fff, data); |
| 2360 | | else if (m_slotcart->get_type() == SNES_DSP_MODE21 |
| 2361 | | && (offset < 0x200000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)) |
| 2362 | | m_slotcart->m_cart->chip_write(space, offset & 0x1fff, data); |
| 2363 | | else if (m_slotcart->get_type() == SNES_DSP4 |
| 2364 | | && (offset >= 0x300000 && offset < 0x400000 && (offset & 0x8000) == 0x8000)) |
| 2365 | | m_slotcart->m_cart->chip_write(space, offset & 0x7fff, data); |
| 2366 | | else if (m_slotcart->get_type() == SNES_OBC1 |
| 2367 | | && (offset < 0x400000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)) |
| 2368 | | m_slotcart->m_cart->chip_write(space, offset, data); |
| 2369 | | else if ((m_slotcart->get_type() == SNES_ST010 || m_slotcart->get_type() == SNES_ST011) |
| 2370 | | && (offset >= 0x600000 && offset < 0x680000 && (offset & 0xffff) < 0x4000)) |
| 2371 | | m_slotcart->m_cart->chip_write(space, offset, data); |
| 2372 | | else if ((m_slotcart->get_type() == SNES_ST010 || m_slotcart->get_type() == SNES_ST011) |
| 2373 | | && (offset >= 0x680000 && offset < 0x700000 && (offset & 0xffff) < 0x8000)) |
| 2374 | | m_slotcart->m_cart->chip_write(space, offset, data); |
| 2375 | | else if (m_slotcart->get_type() == SNES_SRTC |
| 2376 | | && (offset < 0x400000 && (offset & 0xffff) == 0x2801)) |
| 2377 | | m_slotcart->m_cart->chip_write(space, offset & 0xffff, data); |
| 2378 | | else if (m_slotcart->get_type() == SNES_CX4 |
| 2379 | | && (offset < 0x400000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)) // hack until we emulate the real CPU |
| 2380 | | CX4_write(space.machine(), (offset & 0xffff) - 0x6000, data); |
| 2381 | | else if (m_slotcart->get_type() == SNES_BANANA |
| 2382 | | && (offset & 0x78000) == 0x8000) |
| 2383 | | { |
| 2384 | | // printf("lo write %x\n", offset); |
| 2385 | | m_slotcart->m_cart->chip_write(space, offset, data); |
| 2386 | | } |
| 2387 | | else |
| 2388 | | { |
| 2389 | | switch (m_type) |
| 2390 | | { |
| 2391 | | case SNES_MODE20: |
| 2392 | | case SNES_CX4: |
| 2393 | | case SNES_ST010: |
| 2394 | | case SNES_ST011: |
| 2395 | | case SNES_DSP: |
| 2396 | | case SNES_DSP_2MB: |
| 2397 | | case SNES_DSP4: |
| 2398 | | case SNES_OBC1: |
| 2399 | | case SNES_SUFAMITURBO: |
| 2400 | | case SNES_BSXLO: |
| 2401 | | case SNES_POKEMON: |
| 2402 | | case SNES_BANANA: |
| 2403 | | snes20_lo_w(space, offset, data, 0xff); |
| 2404 | | break; |
| 2405 | | |
| 2406 | | case SNES_MODE21: |
| 2407 | | case SNES_DSP_MODE21: |
| 2408 | | case SNES_SRTC: |
| 2409 | | case SNES_BSXHI: |
| 2410 | | snes21_lo_w(space, offset, data, 0xff); |
| 2411 | | break; |
| 2412 | | |
| 2413 | | case SNES_SFX: |
| 2414 | | snessfx_lo_w(space, offset, data, 0xff); |
| 2415 | | break; |
| 2416 | | |
| 2417 | | case SNES_SPC7110: |
| 2418 | | case SNES_SPC7110_RTC: |
| 2419 | | snes7110_lo_w(space, offset, data, 0xff); |
| 2420 | | break; |
| 2421 | | |
| 2422 | | case SNES_SDD1: |
| 2423 | | snessdd1_lo_w(space, offset, data, 0xff); |
| 2424 | | break; |
| 2425 | | |
| 2426 | | case SNES_BSX: |
| 2427 | | snesbsx_lo_w(space, offset, data, 0xff); |
| 2428 | | break; |
| 2429 | | } |
| 2430 | | } |
| 2431 | | } |
| 2432 | | |
| 2433 | | WRITE8_MEMBER( snsnew_state::snesnew_hi_w ) |
| 2434 | | { |
| 2435 | | // take care of add-on IO |
| 2436 | | if (m_slotcart->get_type() == SNES_DSP |
| 2437 | | && (offset >= 0x200000 && offset < 0x400000 && (offset & 0x8000) == 0x8000)) |
| 2438 | | m_slotcart->m_cart->chip_write(space, offset & 0x7fff, data); |
| 2439 | | else if (m_slotcart->get_type() == SNES_DSP_2MB |
| 2440 | | && (offset >= 0x600000 && offset < 0x700000 && (offset & 0x8000) == 0x0000)) |
| 2441 | | m_slotcart->m_cart->chip_write(space, offset & 0x7fff, data); |
| 2442 | | else if (m_slotcart->get_type() == SNES_DSP_MODE21 |
| 2443 | | && (offset < 0x200000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)) |
| 2444 | | m_slotcart->m_cart->chip_write(space, offset & 0x1fff, data); |
| 2445 | | else if (m_slotcart->get_type() == SNES_DSP4 |
| 2446 | | && (offset >= 0x300000 && offset < 0x400000 && (offset & 0x8000) == 0x8000)) |
| 2447 | | m_slotcart->m_cart->chip_write(space, offset & 0x7fff, data); |
| 2448 | | else if (m_slotcart->get_type() == SNES_OBC1 |
| 2449 | | && (offset < 0x400000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)) |
| 2450 | | return m_slotcart->m_cart->chip_write(space, offset, data); |
| 2451 | | else if ((m_slotcart->get_type() == SNES_ST010 || m_slotcart->get_type() == SNES_ST011) |
| 2452 | | && (offset >= 0x600000 && offset < 0x680000 && (offset & 0xffff) < 0x4000)) |
| 2453 | | m_slotcart->m_cart->chip_write(space, offset, data); |
| 2454 | | else if ((m_slotcart->get_type() == SNES_ST010 || m_slotcart->get_type() == SNES_ST011) |
| 2455 | | && (offset >= 0x680000 && offset < 0x700000 && (offset & 0xffff) < 0x8000)) |
| 2456 | | m_slotcart->m_cart->chip_write(space, offset, data); |
| 2457 | | else if (m_slotcart->get_type() == SNES_SRTC |
| 2458 | | && (offset < 0x400000 && (offset & 0xffff) == 0x2801)) |
| 2459 | | m_slotcart->m_cart->chip_write(space, offset & 0xffff, data); |
| 2460 | | else if (m_slotcart->get_type() == SNES_CX4 |
| 2461 | | && (offset < 0x400000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)) // hack until we emulate the real CPU |
| 2462 | | CX4_write(space.machine(), (offset & 0xffff) - 0x6000, data); |
| 2463 | | else if ((m_slotcart->get_type() == SNES_POKEMON) |
| 2464 | | && (offset & 0x70000) == 0x0000) |
| 2465 | | { |
| 2466 | | // printf("hi write %x\n", offset); |
| 2467 | | m_slotcart->m_cart->chip_write(space, offset, data); |
| 2468 | | } |
| 2469 | | else |
| 2470 | | { |
| 2471 | | switch (m_type) |
| 2472 | | { |
| 2473 | | case SNES_MODE20: |
| 2474 | | case SNES_CX4: |
| 2475 | | case SNES_ST010: |
| 2476 | | case SNES_ST011: |
| 2477 | | case SNES_DSP: |
| 2478 | | case SNES_DSP_2MB: |
| 2479 | | case SNES_DSP4: |
| 2480 | | case SNES_OBC1: |
| 2481 | | case SNES_SUFAMITURBO: |
| 2482 | | case SNES_BSXLO: |
| 2483 | | case SNES_POKEMON: |
| 2484 | | case SNES_BANANA: |
| 2485 | | snes20_hi_w(space, offset, data, 0xff); |
| 2486 | | break; |
| 2487 | | |
| 2488 | | case SNES_MODE21: |
| 2489 | | case SNES_DSP_MODE21: |
| 2490 | | case SNES_SRTC: |
| 2491 | | case SNES_BSXHI: |
| 2492 | | snes21_hi_w(space, offset, data, 0xff); |
| 2493 | | break; |
| 2494 | | |
| 2495 | | case SNES_SFX: |
| 2496 | | snessfx_hi_w(space, offset, data, 0xff); |
| 2497 | | break; |
| 2498 | | |
| 2499 | | case SNES_SPC7110: |
| 2500 | | case SNES_SPC7110_RTC: |
| 2501 | | snes7110_hi_w(space, offset, data, 0xff); |
| 2502 | | break; |
| 2503 | | |
| 2504 | | case SNES_SDD1: |
| 2505 | | snessdd1_hi_w(space, offset, data, 0xff); |
| 2506 | | break; |
| 2507 | | |
| 2508 | | case SNES_BSX: |
| 2509 | | snesbsx_hi_w(space, offset, data, 0xff); |
| 2510 | | break; |
| 2511 | | } |
| 2512 | | } |
| 2513 | | } |
| 2514 | | |
| 2515 | | |
| 2516 | 2253 | static ADDRESS_MAP_START( snesnew_map, AS_PROGRAM, 8, snsnew_state ) |
| 2517 | | AM_RANGE(0x000000, 0x7dffff) AM_READWRITE(snesnew_lo_r, snesnew_lo_w) |
| 2254 | AM_RANGE(0x000000, 0x7dffff) AM_READWRITE(snes20_lo_r, snes20_lo_w) |
| 2518 | 2255 | AM_RANGE(0x7e0000, 0x7fffff) AM_RAM /* 8KB Low RAM, 24KB High RAM, 96KB Expanded RAM */ |
| 2519 | | AM_RANGE(0x800000, 0xffffff) AM_READWRITE(snesnew_hi_r, snesnew_hi_w) |
| 2256 | AM_RANGE(0x800000, 0xffffff) AM_READWRITE(snes20_hi_r, snes20_hi_w) |
| 2520 | 2257 | ADDRESS_MAP_END |
| 2521 | 2258 | |
| 2522 | 2259 | static SLOT_INTERFACE_START(snes_cart) |
| r21798 | r21799 | |
| 2555 | 2292 | MACHINE_START_CALL(snes_mess); |
| 2556 | 2293 | |
| 2557 | 2294 | // in progress... |
| 2558 | | #if 0 |
| 2559 | 2295 | switch (state->m_type) |
| 2560 | 2296 | { |
| 2561 | 2297 | case SNES_MODE20: |
| 2562 | 2298 | case SNES_BSXLO: |
| 2563 | 2299 | case SNES_SUFAMITURBO: |
| 2564 | | case SNES_POKEMON: |
| 2565 | 2300 | case SNES_BANANA: |
| 2566 | | case SNES_CX4: // this still uses the old simulation instead of emulating the CPU |
| 2567 | | case SNES_ST010: // this requires two diff kinds of chip access, so we handle it in snes20_lo/hi_r/w |
| 2568 | | case SNES_ST011: // this requires two diff kinds of chip access, so we handle it in snes20_lo/hi_r/w |
| 2569 | | break; |
| 2301 | case SNES_CX4: // this still uses the old simulation instead of emulating the CPU |
| 2302 | case SNES_ST010: // this requires two diff kinds of chip access, so we handle it in snes20_lo/hi_r/w |
| 2303 | case SNES_ST011: // this requires two diff kinds of chip access, so we handle it in snes20_lo/hi_r/w |
| 2304 | break; |
| 2305 | case SNES_POKEMON: |
| 2306 | 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)); |
| 2307 | 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)); |
| 2308 | // set_5a22_map(*state->m_maincpu); |
| 2309 | break; |
| 2570 | 2310 | case SNES_DSP: |
| 2571 | 2311 | 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)); |
| 2572 | 2312 | 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)); |
| 2573 | | break; |
| 2313 | break; |
| 2574 | 2314 | case SNES_DSP_2MB: |
| 2575 | 2315 | 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)); |
| 2576 | 2316 | 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)); |
| r21798 | r21799 | |
| 2607 | 2347 | 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)); |
| 2608 | 2348 | machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snsnew_state::snessfx_hi_r),state), write8_delegate(FUNC(snsnew_state::snessfx_hi_w),state)); |
| 2609 | 2349 | set_5a22_map(*state->m_maincpu); |
| 2610 | | break; |
| 2350 | break; |
| 2611 | 2351 | case SNES_SPC7110: |
| 2612 | 2352 | case SNES_SPC7110_RTC: |
| 2613 | 2353 | machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snsnew_state::snes7110_lo_r),state), write8_delegate(FUNC(snsnew_state::snes7110_lo_w),state)); |
| r21798 | r21799 | |
| 2625 | 2365 | set_5a22_map(*state->m_maincpu); |
| 2626 | 2366 | break; |
| 2627 | 2367 | } |
| 2628 | | #endif |
| 2629 | 2368 | } |
| 2630 | 2369 | |
| 2631 | 2370 | static MACHINE_CONFIG_START( snesnew, snsnew_state ) |