trunk/src/mame/drivers/sfcbox.c
r17563 | r17564 | |
12 | 12 | |
13 | 13 | The "To Do" list: |
14 | 14 | ----------------- |
| 15 | -Main CPU banks cartridges via ports $c0/$c1 |
15 | 16 | -Consider moving the 3 cartridges of the slot 2 in a sotwware list since they are interchangable |
16 | 17 | -Hook the z180 clone, the DSP 1A/1B and the Super FX |
17 | 18 | -Add the missing GROM4-1 |
r17563 | r17564 | |
117 | 118 | #include "cpu/spc700/spc700.h" |
118 | 119 | #include "cpu/g65816/g65816.h" |
119 | 120 | #include "cpu/z180/z180.h" |
| 121 | #include "machine/s3520cf.h" |
120 | 122 | #include "video/mb90092.h" |
121 | 123 | #include "includes/snes.h" |
122 | 124 | #include "audio/snes_snd.h" |
r17563 | r17564 | |
128 | 130 | sfcbox_state(const machine_config &mconfig, device_type type, const char *tag) |
129 | 131 | : snes_state(mconfig, type, tag), |
130 | 132 | m_bios(*this, "bios"), |
131 | | m_mb90092(*this,"mb90092") |
| 133 | m_mb90092(*this,"mb90092"), |
| 134 | m_s3520cf(*this, "s3520cf") |
132 | 135 | { } |
133 | 136 | |
134 | | required_device <cpu_device> m_bios; |
135 | | required_device <mb90092_device> m_mb90092; |
| 137 | required_device<cpu_device> m_bios; |
| 138 | required_device<mb90092_device> m_mb90092; |
| 139 | required_device<s3520cf_device> m_s3520cf; |
136 | 140 | |
137 | 141 | UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
138 | 142 | |
| 143 | DECLARE_READ8_MEMBER( port_81_r ); |
| 144 | DECLARE_READ8_MEMBER( port_83_r ); |
| 145 | DECLARE_WRITE8_MEMBER( port_80_w ); |
139 | 146 | DECLARE_WRITE8_MEMBER( port_81_w ); |
| 147 | DECLARE_WRITE8_MEMBER( port_83_w ); |
| 148 | DECLARE_WRITE8_MEMBER( snes_map_0_w ); |
| 149 | DECLARE_WRITE8_MEMBER( snes_map_1_w ); |
140 | 150 | }; |
141 | 151 | |
142 | 152 | UINT32 sfcbox_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect ) |
r17563 | r17564 | |
177 | 187 | static ADDRESS_MAP_START( sfcbox_map, AS_PROGRAM, 8, sfcbox_state ) |
178 | 188 | AM_RANGE(0x00000, 0x0ffff) AM_ROM AM_REGION("krom", 0) |
179 | 189 | AM_RANGE(0x20000, 0x27fff) AM_RAM |
180 | | AM_RANGE(0x40000, 0x47fff) AM_ROM AM_REGION("grom", 0) |
181 | | AM_RANGE(0x60000, 0x67fff) AM_NOP // grom slot 1 |
| 190 | AM_RANGE(0x40000, 0x47fff) AM_ROM AM_REGION("grom1", 0) |
| 191 | AM_RANGE(0x60000, 0x67fff) AM_ROM AM_REGION("grom2", 0) |
182 | 192 | ADDRESS_MAP_END |
183 | 193 | |
| 194 | |
| 195 | WRITE8_MEMBER( sfcbox_state::port_80_w ) |
| 196 | { |
| 197 | /* |
| 198 | x--- ---- (often same as bit5) |
| 199 | -x-- ---- Unknown/unused |
| 200 | --x- ---- ?? PLENTY used (often same as bit7) |
| 201 | ---x ---- ?? pulsed while [C094] is nonzero (0370h timer0 steps) |
| 202 | ---- x--- Unknown/unused |
| 203 | ---- -x-- SNES Transfer DATA to SNES (Bit1 of WRIO/RDIO on SNES side) |
| 204 | ---- --x- SNES Transfer CLOCK to SNES (Bit5 of WRIO/RDIO on SNES side) |
| 205 | ---- ---x SNES Transfer STAT to SNES (Bit2 of WRIO/RDIO on SNES side) |
| 206 | */ |
| 207 | snes_ram[WRIO] = ((data & 4) >> 1) | (snes_ram[WRIO] & ~0x02); // DATA |
| 208 | snes_ram[WRIO] = ((data & 2) << 4) | (snes_ram[WRIO] & ~0x20); // CLOCK |
| 209 | snes_ram[WRIO] = ((data & 1) << 2) | (snes_ram[WRIO] & ~0x04); // STAT |
| 210 | } |
| 211 | |
| 212 | |
| 213 | READ8_MEMBER( sfcbox_state::port_81_r ) |
| 214 | { |
| 215 | /* |
| 216 | x--- ---- Vblank, Vsync, or Whatever flag (must toggle on/off at whatever speed) |
| 217 | -x-- ---- Int1 Request (Joypad is/was accessed by SNES or so?) (0=IRQ, 1=No) |
| 218 | --x- ---- Unknown/unused ;/(for "joy2/slot1" or so, use [A0].4-5) |
| 219 | ---x ---- Unknown/unused ;\joy1/slot0 or so, used by an UNUSED function (08A0h) |
| 220 | ---- x--- Boot mode or so (maybe a jumper, or watchdog-flag, or Bit0 of WRIO/RDIO?) |
| 221 | ---- -x-- SNES Transfer DATA from SNES (Bit4 of WRIO/RDIO on SNES side) |
| 222 | ---- --x- SNES Transfer ACK from SNES (Bit3 of WRIO/RDIO on SNES side) |
| 223 | ---- ---x Int0 Request (Coin-Input, Low for 44ms..80ms) (0=IRQ, 1=No) |
| 224 | */ |
| 225 | UINT8 res; |
| 226 | |
| 227 | res = (machine().primary_screen->vblank() & 1) << 7; |
| 228 | res = 1 << 6; |
| 229 | res = 0 << 5; |
| 230 | res = 0 << 4; |
| 231 | res = 0 << 3; |
| 232 | res |= ((snes_ram[WRIO] & 0x10) >> 4) << 2; // DATA to main |
| 233 | res |= ((snes_ram[WRIO] & 0x08) >> 3) << 1; // ACK to main |
| 234 | res = 1 << 0; |
| 235 | |
| 236 | return res; |
| 237 | } |
| 238 | |
184 | 239 | WRITE8_MEMBER( sfcbox_state::port_81_w ) |
185 | 240 | { |
186 | 241 | device_set_input_line(m_maincpu, INPUT_LINE_RESET, (data & 1) ? CLEAR_LINE : ASSERT_LINE); |
r17563 | r17564 | |
189 | 244 | ioport("OSD_CS")->write(data, 0xff); |
190 | 245 | } |
191 | 246 | |
| 247 | READ8_MEMBER( sfcbox_state::port_83_r ) |
| 248 | { |
| 249 | return 0xff; |
| 250 | } |
| 251 | |
| 252 | WRITE8_MEMBER( sfcbox_state::port_83_w ) |
| 253 | { |
| 254 | |
| 255 | } |
| 256 | |
| 257 | WRITE8_MEMBER( sfcbox_state::snes_map_0_w ) |
| 258 | { |
| 259 | const char *const rom_socket[4] = { "ROM5", "ROM1/7/12", "ROM3/9", "IC23" }; |
| 260 | |
| 261 | printf("%s ROM Socket\n",rom_socket[data & 3]); |
| 262 | printf("%02x ROM Slot\n",(data & 4) >> 2); |
| 263 | printf("%02x SRAM Enable\n",(data & 8) >> 3); |
| 264 | printf("%02x SRAM Slot\n",(data & 0x10) >> 4); |
| 265 | printf("%02x DSP Enable\n",(data & 0x20) >> 5); |
| 266 | printf("%02x DSP Slot\n",(data & 0x40) >> 6); |
| 267 | printf("%s ROM / DSP / SRAM maps\n",(data & 0x80) ? "HiROM" : "LoROM"); |
| 268 | } |
| 269 | |
| 270 | WRITE8_MEMBER( sfcbox_state::snes_map_1_w ) |
| 271 | { |
| 272 | /* Reserved for ROM DSP SRAM probably means bank ATROM */ |
| 273 | const char *const rom_dsp_sram[4] = { "Reserved?", "GSU", "LoROM", "HiROM" }; |
| 274 | const char *const sram_size[4] = { "2K", "8K", "Reserved?", "32K" }; |
| 275 | |
| 276 | printf("%s ROM / DSP SRAM map 2\n",rom_dsp_sram[data & 3]); |
| 277 | printf("%08x SRAM base\n",((data & 0xc) >> 2)*0x8000); |
| 278 | printf("%02x GSU Slot\n",((data & 0x10) >> 4)); |
| 279 | printf("%s SRAM Size\n",sram_size[((data & 0xc0) >> 6)]); |
| 280 | } |
| 281 | |
192 | 282 | static ADDRESS_MAP_START( sfcbox_io, AS_IO, 8, sfcbox_state ) |
193 | 283 | AM_RANGE(0x0b, 0x0b) AM_DEVWRITE("mb90092",mb90092_device,write) |
194 | 284 | AM_RANGE(0x00, 0x3f) AM_RAM // internal i/o |
195 | | // AM_RANGE(0x80, 0x80) // Keyswitch and Button Inputs / SNES Transfer and Misc Output |
196 | | AM_RANGE(0x81, 0x81) AM_WRITE(port_81_w) // SNES Transfer and Misc Input / Misc Output |
| 285 | AM_RANGE(0x80, 0x80) AM_READ_PORT("KEY") AM_WRITE(port_80_w) // Keyswitch and Button Inputs / SNES Transfer and Misc Output |
| 286 | AM_RANGE(0x81, 0x81) AM_READWRITE(port_81_r,port_81_w) // SNES Transfer and Misc Input / Misc Output |
197 | 287 | // AM_RANGE(0x82, 0x82) // Unknown/unused |
198 | | // AM_RANGE(0x83, 0x83) // Joypad Input/Status / Joypad Output/Control |
| 288 | AM_RANGE(0x83, 0x83) AM_READWRITE(port_83_r,port_83_w) // Joypad Input/Status / Joypad Output/Control |
199 | 289 | // AM_RANGE(0x84, 0x84) // Joypad 1, MSB (1st 8 bits) (eg. Bit7=ButtonB, 0=Low=Pressed) |
200 | 290 | // AM_RANGE(0x85, 0x85) // Joypad 1, LSB (2nd 8 bits) (eg. Bit0=LSB of ID, 0=Low=One) |
201 | 291 | // AM_RANGE(0x86, 0x86) // Joypad 2, MSB (1st 8 bits) (eg. Bit7=ButtonB, 0=Low=Pressed) |
202 | 292 | // AM_RANGE(0x87, 0x87) // Joypad 2, LSB (2nd 8 bits) (eg. Bit0=LSB of ID, 0=Low=One) |
203 | | // AM_RANGE(0xa0, 0xa0) // Real Time Clock |
204 | | // AM_RANGE(0xc0, 0xc0) // SNES Mapping Register 0 |
205 | | // AM_RANGE(0xc1, 0xc1) // SNES Mapping Register 1 |
| 293 | AM_RANGE(0xa0, 0xa0) AM_READ_PORT("RTC_R") AM_WRITE_PORT("RTC_W") // Real Time Clock |
| 294 | AM_RANGE(0xc0, 0xc0) AM_WRITE(snes_map_0_w) // SNES Mapping Register 0 |
| 295 | AM_RANGE(0xc1, 0xc1) AM_WRITE(snes_map_1_w) // SNES Mapping Register 1 |
206 | 296 | ADDRESS_MAP_END |
207 | 297 | |
208 | 298 | |
209 | 299 | static INPUT_PORTS_START( snes ) |
| 300 | PORT_START("RTC_R") |
| 301 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("s3520cf", s3520cf_device, read_bit) |
| 302 | |
| 303 | PORT_START("RTC_W") |
| 304 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("s3520cf", s3520cf_device, set_clock_line) |
| 305 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("s3520cf", s3520cf_device, write_bit) |
| 306 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("s3520cf", s3520cf_device, set_dir_line) |
| 307 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("s3520cf", s3520cf_device, set_cs_line) |
| 308 | |
| 309 | /* TODO: verify these */ |
| 310 | PORT_START("KEY") |
| 311 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON14 ) PORT_NAME("Reset Button") |
| 312 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON13 ) PORT_NAME("TV/GAME Button") |
| 313 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON12 ) PORT_NAME("Relay Off Button") |
| 314 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Options Button") |
| 315 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON11 ) PORT_NAME("Self-Test Button") |
| 316 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_NAME("Play Mode 3 Button") |
| 317 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME("Play Mode 2 Button") |
| 318 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("Play Mode 1 Button") |
| 319 | |
210 | 320 | PORT_START("OSD_CS") |
211 | 321 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("mb90092", mb90092_device, set_cs_line) |
212 | 322 | |
r17563 | r17564 | |
333 | 443 | MCFG_CPU_ADD("soundcpu", SPC700, 2048000/2) /* 2.048 Mhz, but internal divider */ |
334 | 444 | MCFG_CPU_PROGRAM_MAP(spc_mem) |
335 | 445 | |
336 | | MCFG_QUANTUM_TIME(attotime::from_hz(24000)) |
| 446 | MCFG_QUANTUM_PERFECT_CPU("maincpu") |
337 | 447 | |
338 | 448 | MCFG_MACHINE_START( snes ) |
339 | 449 | MCFG_MACHINE_RESET( snes ) |
r17563 | r17564 | |
380 | 490 | MCFG_CPU_IO_MAP(sfcbox_io) |
381 | 491 | |
382 | 492 | MCFG_MB90092_ADD("mb90092",XTAL_12MHz / 2) /* TODO: correct clock */ |
| 493 | MCFG_S3520CF_ADD("s3520cf") /* RTC */ |
383 | 494 | |
384 | 495 | MCFG_MACHINE_START( sfcbox ) |
385 | 496 | MCFG_MACHINE_RESET( sfcbox ) |
r17563 | r17564 | |
416 | 527 | ROM_START( sfcbox ) |
417 | 528 | SFCBOX_BIOS |
418 | 529 | |
419 | | ROM_REGION( 0x8000, "grom", ROMREGION_ERASEFF ) |
| 530 | ROM_REGION( 0x8000, "grom1", ROMREGION_ERASEFF ) |
| 531 | |
| 532 | ROM_REGION( 0x8000, "grom2", ROMREGION_ERASEFF ) |
420 | 533 | ROM_END |
421 | 534 | |
422 | 535 | ROM_START( pss61 ) |
423 | 536 | SFCBOX_BIOS |
424 | 537 | |
425 | | ROM_REGION( 0x8000, "grom", 0 ) |
| 538 | ROM_REGION( 0x8000, "grom1", 0 ) |
426 | 539 | ROM_LOAD( "grom1-1.ic1", 0x0000, 0x8000, CRC(333bf9a7) SHA1(5d0cd9ca29e5580c3eebe9f136839987c879f979) ) |
427 | 540 | |
| 541 | ROM_REGION( 0x8000, "grom2", ROMREGION_ERASEFF ) |
| 542 | |
428 | 543 | ROM_REGION( 0x380000, "game", 0 ) |
429 | 544 | ROM_LOAD( "shvc-mk-0.rom6", 0x000000, 0x080000, CRC(c8002453) SHA1(cbb853bf911255c1d8eb27cd34fc7855a0dda218) ) |
430 | 545 | ROM_LOAD( "shvc-4m-1.rom3", 0x080000, 0x200000, CRC(91b28d56) SHA1(b83dd73d3d6049450bb8092d73c3af879804f58c) ) |
431 | | ROM_LOAD( "shvc-fo-1.ic20", 0x280000, 0x100000, CRC(ad668a41) SHA1(39ff7354a7fa02295c899b7a7ec3556998ac2636) ) /* Super FX hook needed for Star Fox */ |
| 546 | ROM_LOAD( "shvc-fo-1.ic20", 0x280000, 0x100000, CRC(ad668a41) SHA1(39ff7354a7fa02295c899b7a7ec3556998ac2636) ) /* TODO: Super FX hook needed for Star Fox */ |
432 | 547 | ROM_END |
433 | 548 | |
434 | 549 | ROM_START( pss62 ) |
435 | 550 | SFCBOX_BIOS |
436 | 551 | |
437 | | ROM_REGION( 0x8000, "grom", 0 ) |
| 552 | ROM_REGION( 0x8000, "grom1", 0 ) |
438 | 553 | ROM_LOAD( "grom2-1.ic1", 0x0000, 0x8000, CRC(bcfc5642) SHA1(a96e52685bd3dcdf09d1b7acd6e1c1ab7726a640) ) |
439 | 554 | |
| 555 | ROM_REGION( 0x8000, "grom2", ROMREGION_ERASEFF ) |
| 556 | |
440 | 557 | ROM_REGION( 0x180000, "game", 0 ) |
441 | 558 | ROM_LOAD( "shvc-gc-0.rom1", 0x000000, 0x100000, CRC(b4fd7aff) SHA1(eb553b77418dedba25fc4d5dddcb04f424b0f6a9) ) |
442 | 559 | ROM_LOAD( "shvc-2a-1.rom3", 0x100000, 0x080000, CRC(6b23e2e4) SHA1(684123a12ca1e31115bd6221d96f82461066877f) ) |
r17563 | r17564 | |
445 | 562 | ROM_START( pss63 ) |
446 | 563 | SFCBOX_BIOS |
447 | 564 | |
448 | | ROM_REGION( 0x8000, "grom", 0 ) |
| 565 | ROM_REGION( 0x8000, "grom1", 0 ) |
449 | 566 | ROM_LOAD( "grom3-1.ic1", 0x0000, 0x8000, CRC(ebec4c1c) SHA1(d638ef1486b4c0b3d4d5b666929ca7947e16efad) ) |
450 | 567 | |
| 568 | ROM_REGION( 0x8000, "grom2", ROMREGION_ERASEFF ) |
| 569 | |
451 | 570 | ROM_REGION( 0x500000, "game", 0 ) |
452 | 571 | ROM_LOAD( "shvc-t2-1.rom3", 0x000000, 0x100000, CRC(4ae93c10) SHA1(5fa25d027940907b769578d7bf85a9d5ba94911a) ) |
453 | 572 | ROM_LOAD( "shvc-8x-1.rom1", 0x100000, 0x400000, CRC(3adef543) SHA1(df02860e691fbee453e345dd343c08b6da08d4ea) ) |
r17563 | r17564 | |
456 | 575 | ROM_START( pss64 ) |
457 | 576 | SFCBOX_BIOS |
458 | 577 | |
459 | | ROM_REGION( 0x8000, "grom", 0 ) |
| 578 | ROM_REGION( 0x8000, "grom1", ROMREGION_ERASEFF ) |
460 | 579 | ROM_LOAD( "grom4-1.ic1", 0x0000, 0x8000, NO_DUMP ) |
461 | 580 | |
| 581 | ROM_REGION( 0x8000, "grom2", ROMREGION_ERASEFF ) |
| 582 | |
462 | 583 | ROM_REGION( 0x500000, "game", 0 ) |
463 | 584 | ROM_LOAD( "shvc-m4-0.rom3", 0x000000, 0x100000, CRC(fb259f4f) SHA1(8faeb56f80e82dd042bdc84d19c526a979c6de8f) ) |
464 | 585 | ROM_LOAD( "shvc-8x-1.rom1", 0x100000, 0x400000, CRC(3adef543) SHA1(df02860e691fbee453e345dd343c08b6da08d4ea) ) |