trunk/src/mame/drivers/saturn.c
| r20649 | r20650 | |
| 23 | 23 | - IC13 games on the dev bios doesn't even load the cartridge / crashes the emulation at start-up, |
| 24 | 24 | rom rearrange needed? |
| 25 | 25 | - SCU DSP still has its fair share of issues, it also needs to be converted to CPU structure; |
| 26 | | - Add the RS232c interface (serial port),needed by fhboxers. |
| 26 | - Add the RS232c interface (serial port), needed by fhboxers. |
| 27 | 27 | - Video emulation bugs: check stvvdp2.c file. |
| 28 | 28 | - Reimplement the idle skip if possible. |
| 29 | 29 | - Properly emulate the protection chips, used by several games (check stvprot.c for more info) |
| r20649 | r20650 | |
| 386 | 386 | case 0xa4/4: /* IRQ control */ |
| 387 | 387 | if(LOG_SCU) logerror("PC=%08x IRQ status reg set:%08x %08x\n",space.device().safe_pc(),m_scu_regs[41],mem_mask); |
| 388 | 388 | m_scu.ist &= m_scu_regs[offset]; |
| 389 | | //scu_test_pending_irq(); |
| 389 | scu_test_pending_irq(); |
| 390 | 390 | break; |
| 391 | 391 | case 0xa8/4: if(LOG_SCU) logerror("A-Bus IRQ ACK %08x\n",m_scu_regs[42]); break; |
| 392 | 392 | case 0xc4/4: if(LOG_SCU) logerror("SCU SDRAM set: %02x\n",m_scu_regs[49]); break; |
| r20649 | r20650 | |
| 639 | 639 | sh2_set_frt_input(m_maincpu, PULSE_LINE); |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | /* |
| 643 | TODO: |
| 644 | Some games seems to not like either MAME's interleave system and/or SH-2 DRC, causing an hard crash. |
| 645 | Reported games are: |
| 646 | Blast Wind (before FMV) |
| 647 | Choro Q Park (car selection) |
| 648 | 060311E4: MOV.L R14,@-SP ;R14 = 0x60ffba0 / R15 = 0x60ffba0 |
| 649 | 060311E6: MOV SP,R14 ;R14 = 0x60ffba0 / R15 = 0x60ffb9c / [0x60ffb9c] <- 0x60ffba0 |
| 650 | 060311E8: MOV.L @SP+,R14 ;R14 = 0x60ffb9c / R15 = 0x60ffb9c / [0x60ffb9c] -> R14 |
| 651 | 060311EA: RTS ;R14 = 0x60ffba0 / R15 = 0x60ffba0 |
| 652 | 060311EC: NOP |
| 653 | 06031734: MULS.W R9, R8 ;R14 = 0x60ffba0 / R15 = 0x60ffba0 / EA = 0x60311E4 |
| 654 | on DRC this becomes: |
| 655 | R14 0x6031b78 (cause of the crash later on), R15 = 0x60ffba4 and EA = 0 |
| 656 | |
| 657 | Shinrei Jusatsushi Taromaru (options menu) |
| 658 | |
| 659 | */ |
| 660 | |
| 661 | WRITE32_MEMBER(saturn_state::saturn_minit_w) |
| 662 | { |
| 663 | //logerror("cpu %s (PC=%08X) MINIT write = %08x\n", space.device().tag(), space.device().safe_pc(),data); |
| 664 | if(m_fake_comms->read() & 1) |
| 665 | machine().scheduler().synchronize(); // force resync |
| 666 | else |
| 667 | { |
| 668 | machine().scheduler().boost_interleave(m_minit_boost_timeslice, attotime::from_usec(m_minit_boost)); |
| 669 | machine().scheduler().trigger(1000); |
| 670 | } |
| 671 | |
| 672 | sh2_set_frt_input(m_slave, PULSE_LINE); |
| 673 | } |
| 674 | |
| 675 | WRITE32_MEMBER(saturn_state::saturn_sinit_w) |
| 676 | { |
| 677 | //logerror("cpu %s (PC=%08X) SINIT write = %08x\n", space.device().tag(), space.device().safe_pc(),data); |
| 678 | if(m_fake_comms->read() & 1) |
| 679 | machine().scheduler().synchronize(); // force resync |
| 680 | else |
| 681 | machine().scheduler().boost_interleave(m_sinit_boost_timeslice, attotime::from_usec(m_sinit_boost)); |
| 682 | |
| 683 | sh2_set_frt_input(m_maincpu, PULSE_LINE); |
| 684 | } |
| 685 | |
| 686 | |
| 642 | 687 | READ8_MEMBER(saturn_state::saturn_backupram_r) |
| 643 | 688 | { |
| 644 | 689 | if(!(offset & 1)) |
| r20649 | r20650 | |
| 730 | 775 | AM_RANGE(0x00100000, 0x0010007f) AM_READWRITE8(saturn_SMPC_r, saturn_SMPC_w,0xffffffff) |
| 731 | 776 | AM_RANGE(0x00180000, 0x0018ffff) AM_READWRITE8(saturn_backupram_r, saturn_backupram_w,0xffffffff) AM_SHARE("share1") |
| 732 | 777 | AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_MIRROR(0x20100000) AM_SHARE("workram_l") |
| 733 | | AM_RANGE(0x01000000, 0x017fffff) AM_WRITE(minit_w) |
| 734 | | AM_RANGE(0x01800000, 0x01ffffff) AM_WRITE(sinit_w) |
| 778 | AM_RANGE(0x01000000, 0x017fffff) AM_WRITE(saturn_minit_w) |
| 779 | AM_RANGE(0x01800000, 0x01ffffff) AM_WRITE(saturn_sinit_w) |
| 735 | 780 | AM_RANGE(0x02000000, 0x023fffff) AM_ROM AM_SHARE("share7") AM_REGION("maincpu", 0x80000) // cartridge space |
| 736 | 781 | // AM_RANGE(0x02400000, 0x027fffff) AM_RAM //cart RAM area, dynamically allocated |
| 737 | 782 | // AM_RANGE(0x04000000, 0x047fffff) AM_RAM //backup RAM area, dynamically allocated |
| r20649 | r20650 | |
| 1187 | 1232 | PORT_CONFSETTING(0x90,"<unconnected>") |
| 1188 | 1233 | |
| 1189 | 1234 | PORT_START("fake") |
| 1190 | | PORT_CONFNAME(0x01,0x00,"Master-Slave Comms Hack") |
| 1191 | | PORT_CONFSETTING(0x00,"No") |
| 1192 | | PORT_CONFSETTING(0x01,"Yes") |
| 1235 | PORT_CONFNAME(0x01,0x00,"Master-Slave Comms") |
| 1236 | PORT_CONFSETTING(0x00,"Normal (400 cycles)") |
| 1237 | PORT_CONFSETTING(0x01,"One Shot (Hack)") |
| 1193 | 1238 | INPUT_PORTS_END |
| 1194 | 1239 | |
| 1195 | 1240 | #define STV_PLAYER_INPUTS(_n_, _b1_, _b2_, _b3_,_b4_) \ |
| r20649 | r20650 | |
| 2364 | 2409 | MACHINE_CONFIG_END |
| 2365 | 2410 | |
| 2366 | 2411 | |
| 2367 | | /* we use a clever hack here. Basically 0x60ffc13 is used for master slave comms, synching there should avoid crashes in several spots. */ |
| 2368 | | READ32_MEMBER(saturn_state::workram_h_comms_r) |
| 2369 | | { |
| 2370 | | if(m_fake_comms->read() & 1) |
| 2371 | | machine().scheduler().synchronize(); // force resync |
| 2372 | 2412 | |
| 2373 | | return m_workram_h[0x0ffc10/4]; |
| 2374 | | } |
| 2375 | | |
| 2376 | | WRITE32_MEMBER(saturn_state::workram_h_comms_w) |
| 2377 | | { |
| 2378 | | if(m_fake_comms->read() & 1) |
| 2379 | | machine().scheduler().synchronize(); // force resync |
| 2380 | | |
| 2381 | | COMBINE_DATA(&m_workram_h[0x0ffc10/4]); |
| 2382 | | } |
| 2383 | | |
| 2384 | | |
| 2385 | 2413 | void saturn_state::saturn_init_driver(int rgn) |
| 2386 | 2414 | { |
| 2387 | 2415 | m_saturn_region = rgn; |
| r20649 | r20650 | |
| 2391 | 2419 | sh2drc_set_options(machine().device("maincpu"), SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL); |
| 2392 | 2420 | sh2drc_set_options(machine().device("slave"), SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL); |
| 2393 | 2421 | |
| 2394 | | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x060ffc10, 0x060ffc13, read32_delegate(FUNC(saturn_state::workram_h_comms_r),this)); |
| 2395 | | machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x060ffc10, 0x060ffc13, write32_delegate(FUNC(saturn_state::workram_h_comms_w),this)); |
| 2396 | | machine().device("slave")->memory().space(AS_PROGRAM).install_read_handler(0x060ffc10, 0x060ffc13, read32_delegate(FUNC(saturn_state::workram_h_comms_r),this)); |
| 2397 | | machine().device("slave")->memory().space(AS_PROGRAM).install_write_handler(0x060ffc10, 0x060ffc13, write32_delegate(FUNC(saturn_state::workram_h_comms_w),this)); |
| 2398 | | |
| 2399 | 2422 | /* amount of time to boost interleave for on MINIT / SINIT, needed for communication to work */ |
| 2400 | 2423 | m_minit_boost = 400; |
| 2401 | 2424 | m_sinit_boost = 400; |