trunk/src/mame/machine/snes.c
| r21582 | r21583 | |
| 410 | 410 | return superfx_mmio_read(state->m_superfx, offset); |
| 411 | 411 | } |
| 412 | 412 | } |
| 413 | | else if (state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC) |
| 414 | | { |
| 415 | | UINT16 limit = (state->m_has_addon_chip == HAS_SPC7110_RTC) ? 0x4842 : 0x483f; |
| 416 | | if (offset >= 0x4800 && offset <= limit) |
| 417 | | { |
| 418 | | return spc7110_mmio_read(space, offset); |
| 419 | | } |
| 420 | | } |
| 421 | 413 | |
| 422 | 414 | if (offset >= DMAP0 && offset < 0x4380) |
| 423 | 415 | { |
| r21582 | r21583 | |
| 529 | 521 | return; |
| 530 | 522 | } |
| 531 | 523 | } |
| 532 | | else if (state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC) |
| 533 | | { |
| 534 | | UINT16 limit = (state->m_has_addon_chip == HAS_SPC7110_RTC) ? 0x4842 : 0x483f; |
| 535 | | if (offset >= 0x4800 && offset <= limit) |
| 536 | | { |
| 537 | | spc7110_mmio_write(space.machine(), (UINT32)offset, data); |
| 538 | | return; |
| 539 | | } |
| 540 | | } |
| 541 | 524 | |
| 542 | 525 | if (offset >= DMAP0 && offset < 0x4380) |
| 543 | 526 | { |
| r21582 | r21583 | |
| 755 | 738 | else |
| 756 | 739 | value = snes_open_bus_r(space, 0); |
| 757 | 740 | } |
| 758 | | else if (state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC) |
| 759 | | { |
| 760 | | if (offset < 0x10000) |
| 761 | | value = snes_ram[0x306000 + (offset & 0x1fff)]; |
| 762 | | } |
| 763 | 741 | else |
| 764 | 742 | { |
| 765 | 743 | logerror("(PC=%06x) snes_r_bank1: Unmapped external chip read: %04x\n",space.device().safe_pc(),address); |
| r21582 | r21583 | |
| 797 | 775 | else |
| 798 | 776 | value = snes_open_bus_r(space, 0); |
| 799 | 777 | } |
| 800 | | else if (state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC) |
| 801 | | { |
| 802 | | if (offset < 0x10000) |
| 803 | | value = snes_ram[0x306000 + (offset & 0x1fff)]; |
| 804 | | } |
| 805 | 778 | else if ((state->m_cart[0].mode == SNES_MODE_21) && (state->m_cart[0].sram > 0)) |
| 806 | 779 | { |
| 807 | 780 | /* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */ |
| r21582 | r21583 | |
| 841 | 814 | return sfx_data[offset & 0x0f]; |
| 842 | 815 | } |
| 843 | 816 | } |
| 844 | | else if ((state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC)) |
| 845 | | { |
| 846 | | if (offset >= 0x100000 && offset < 0x110000) |
| 847 | | value = spc7110_mmio_read(space, 0x4800); |
| 848 | | } |
| 849 | 817 | else if ((state->m_cart[0].mode & 5) && !(state->m_has_addon_chip == HAS_SUPERFX)) /* Mode 20 & 22 */ |
| 850 | 818 | { |
| 851 | 819 | if ((address < 0x8000) && (state->m_cart[0].mode == SNES_MODE_20)) |
| r21582 | r21583 | |
| 995 | 963 | value = snes_open_bus_r(space, 0); |
| 996 | 964 | } |
| 997 | 965 | } |
| 998 | | else if ((state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC) && offset >= 0x100000) |
| 999 | | value = spc7110_bank7_read(space, offset); |
| 1000 | 966 | else if ((state->m_cart[0].mode & 5) && !(state->m_has_addon_chip == HAS_SUPERFX)) /* Mode 20 & 22 */ |
| 1001 | 967 | { |
| 1002 | 968 | if (address < 0x8000) |
| r21582 | r21583 | |
| 1030 | 996 | { |
| 1031 | 997 | if (state->m_has_addon_chip == HAS_SUPERFX) |
| 1032 | 998 | snes_ram[0xf00000 + (offset & 0x1fff)] = data; // here it should be 0xe00000 but there are mirroring issues |
| 1033 | | else if (state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC) |
| 1034 | | { |
| 1035 | | if (offset < 0x10000) |
| 1036 | | snes_ram[0x306000 + (offset & 0x1fff)] = data; |
| 1037 | | } |
| 1038 | 999 | else |
| 1039 | 1000 | logerror("snes_w_bank1: Attempt to write to reserved address: %x = %02x\n", offset, data); |
| 1040 | 1001 | } |
| r21582 | r21583 | |
| 1061 | 1022 | { |
| 1062 | 1023 | if (state->m_has_addon_chip == HAS_SUPERFX) |
| 1063 | 1024 | snes_ram[0xf00000 + (offset & 0x1fff)] = data; // here it should be 0xe00000 but there are mirroring issues |
| 1064 | | else if (state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC) |
| 1065 | | { |
| 1066 | | if (offset < 0x10000) |
| 1067 | | snes_ram[0x306000 + (offset & 0x1fff)] = data; |
| 1068 | | } |
| 1069 | 1025 | else if ((state->m_cart[0].mode == SNES_MODE_21) && (state->m_cart[0].sram > 0)) |
| 1070 | 1026 | { |
| 1071 | 1027 | /* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */ |
trunk/src/mame/machine/snes7110.c
| r21582 | r21583 | |
| 758 | 758 | + m_morton32[2][(data >> 16) & 255] + m_morton32[3][(data >> 24) & 255]; |
| 759 | 759 | } |
| 760 | 760 | |
| 761 | | static void spc7110_mmio_write(running_machine &machine, UINT32 addr, UINT8 data); |
| 762 | | static UINT8 spc7110_mmio_read(address_space &space, UINT32 addr); |
| 763 | 761 | static void spc7110_update_time(running_machine &machine, UINT8 offset); |
| 764 | 762 | |
| 765 | 763 | enum RTC_State |
| r21582 | r21583 | |
| 1058 | 1056 | } |
| 1059 | 1057 | } |
| 1060 | 1058 | |
| 1061 | | static UINT8 spc7110_mmio_read(address_space &space, UINT32 addr) |
| 1059 | UINT8 spc7110_mmio_read(address_space &space, UINT32 addr) |
| 1062 | 1060 | { |
| 1063 | 1061 | running_machine &machine = space.machine(); |
| 1064 | 1062 | UINT8 *ROM = machine.root_device().memregion("cart")->base(); |
| r21582 | r21583 | |
| 1245 | 1243 | return snes_open_bus_r(space, 0); |
| 1246 | 1244 | } |
| 1247 | 1245 | |
| 1248 | | static void spc7110_mmio_write(running_machine &machine, UINT32 addr, UINT8 data) |
| 1246 | void spc7110_mmio_write(running_machine &machine, UINT32 addr, UINT8 data) |
| 1249 | 1247 | { |
| 1250 | 1248 | UINT8 *ROM = machine.root_device().memregion("cart")->base(); |
| 1251 | 1249 | |
| r21582 | r21583 | |
| 1631 | 1629 | } |
| 1632 | 1630 | } |
| 1633 | 1631 | |
| 1634 | | static UINT8 spc7110_bank7_read(address_space &space, UINT32 offset) |
| 1632 | UINT8 spc7110_bank7_read(address_space &space, UINT32 offset) |
| 1635 | 1633 | { |
| 1636 | 1634 | UINT8 *ROM = space.machine().root_device().memregion("cart")->base(); |
| 1637 | 1635 | UINT32 addr = offset & 0x0fffff; |
trunk/src/mess/drivers/snes.c
| r21582 | r21583 | |
| 144 | 144 | if (state->m_has_addon_chip == HAS_SDD1 |
| 145 | 145 | && (offset < 0x400000 && (offset & 0xffff) >= 0x4800 && (offset & 0xffff) < 0x4808)) |
| 146 | 146 | return sdd1_mmio_read(space, (UINT32)(offset & 0xffff)); |
| 147 | if ((state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC) |
| 148 | && offset < 0x400000) |
| 149 | { |
| 150 | UINT16 limit = (state->m_has_addon_chip == HAS_SPC7110_RTC) ? 0x4842 : 0x483f; |
| 151 | if ((offset & 0xffff) >= 0x4800 && (offset & 0xffff) <= limit) |
| 152 | return spc7110_mmio_read(space, (UINT32)(offset & 0xffff)); |
| 153 | if (offset < 0x10000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000) |
| 154 | return snes_ram[0x306000 + (offset & 0x1fff)]; |
| 155 | if (offset >= 0x300000 && offset < 0x310000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000) |
| 156 | return snes_ram[0x306000 + (offset & 0x1fff)]; |
| 157 | } |
| 158 | if ((state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC) |
| 159 | && offset >= 0x500000 && offset < 0x510000) |
| 160 | return spc7110_mmio_read(space, 0x4800); |
| 147 | 161 | |
| 148 | 162 | // base cart access |
| 149 | 163 | if (offset < 0x300000) |
| r21582 | r21583 | |
| 198 | 212 | && (offset < 0x400000 && (offset & 0xffff) >= 0x4800 && (offset & 0xffff) < 0x4808)) |
| 199 | 213 | return sdd1_mmio_read(space, (UINT32)(offset & 0xffff)); |
| 200 | 214 | if (state->m_has_addon_chip == HAS_SDD1 && offset >= 0x400000) |
| 201 | | return sdd1_read(space.machine(), offset - 0x400000);; |
| 215 | return sdd1_read(space.machine(), offset - 0x400000); |
| 216 | if ((state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC) |
| 217 | && offset < 0x400000) |
| 218 | { |
| 219 | UINT16 limit = (state->m_has_addon_chip == HAS_SPC7110_RTC) ? 0x4842 : 0x483f; |
| 220 | if ((offset & 0xffff) >= 0x4800 && (offset & 0xffff) <= limit) |
| 221 | return spc7110_mmio_read(space, (UINT32)(offset & 0xffff)); |
| 222 | if (offset < 0x10000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000) |
| 223 | return snes_ram[0x306000 + (offset & 0x1fff)]; |
| 224 | if (offset >= 0x300000 && offset < 0x310000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000) |
| 225 | return snes_ram[0x306000 + (offset & 0x1fff)]; |
| 226 | } |
| 227 | if ((state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC) |
| 228 | && offset >= 0x500000) |
| 229 | return spc7110_bank7_read(space, offset - 0x400000); |
| 202 | 230 | |
| 203 | 231 | // base cart access |
| 204 | 232 | if (offset < 0x400000) |
| r21582 | r21583 | |
| 276 | 304 | // here we don't return, but we let the w_io happen... |
| 277 | 305 | } |
| 278 | 306 | } |
| 307 | if ((state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC) && offset < 0x400000) |
| 308 | { |
| 309 | UINT16 limit = (state->m_has_addon_chip == HAS_SPC7110_RTC) ? 0x4842 : 0x483f; |
| 310 | if ((offset & 0xffff) >= 0x4800 && (offset & 0xffff) <= limit) |
| 311 | { spc7110_mmio_write(space.machine(), (UINT32)(offset & 0xffff), data); return; } |
| 312 | if (offset < 0x10000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000) |
| 313 | { snes_ram[0x306000 + (offset & 0x1fff)] = data; return; } |
| 314 | if (offset >= 0x300000 && offset < 0x310000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000) |
| 315 | { snes_ram[0x306000 + (offset & 0x1fff)] = data; return; } |
| 316 | } |
| 279 | 317 | |
| 280 | 318 | // base cart access |
| 281 | 319 | if (offset < 0x300000) |
| r21582 | r21583 | |
| 359 | 397 | // here we don't return, but we let the w_io happen... |
| 360 | 398 | } |
| 361 | 399 | } |
| 400 | if ((state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC) && offset < 0x400000) |
| 401 | { |
| 402 | UINT16 limit = (state->m_has_addon_chip == HAS_SPC7110_RTC) ? 0x4842 : 0x483f; |
| 403 | if ((offset & 0xffff) >= 0x4800 && (offset & 0xffff) <= limit) |
| 404 | { spc7110_mmio_write(space.machine(), (UINT32)(offset & 0xffff), data); return; } |
| 405 | if (offset < 0x10000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000) |
| 406 | { snes_ram[0x306000 + (offset & 0x1fff)] = data; return; } |
| 407 | if (offset >= 0x300000 && offset < 0x310000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000) |
| 408 | { snes_ram[0x306000 + (offset & 0x1fff)] = data; return; } |
| 409 | } |
| 362 | 410 | |
| 363 | 411 | // base cart access |
| 364 | 412 | if (offset < 0x400000) |