src/mess/drivers/psx.c
| r3612 | r3613 | |
| 20 | 20 | #include "sound/psx.h" |
| 21 | 21 | #include "debugger.h" |
| 22 | 22 | |
| 23 | // RB: there is no longer an opbase handler so the quickload won't work as designed. |
| 24 | #if 0 |
| 23 | 25 | static struct |
| 24 | 26 | { |
| 25 | 27 | UINT8 id[ 8 ]; |
| r3612 | r3613 | |
| 148 | 150 | memory_set_opbase_handler( 0, psx_setopbase ); |
| 149 | 151 | return INIT_PASS; |
| 150 | 152 | } |
| 153 | #endif |
| 151 | 154 | |
| 152 | 155 | #define PAD_STATE_IDLE ( 0 ) |
| 153 | 156 | #define PAD_STATE_LISTEN ( 1 ) |
| r3612 | r3613 | |
| 549 | 552 | |
| 550 | 553 | if( mem_mask == 0xffffff00 ) |
| 551 | 554 | { |
| 552 | | logerror( "%08x cd0 read\n", activecpu_get_pc() ); |
| 555 | logerror( "%08x cd0 read\n", cpu_get_pc(space->cpu) ); |
| 553 | 556 | |
| 554 | 557 | if (cd_result_ready && cd_result_c) |
| 555 | 558 | cd_io_status |= 0x20; |
| r3612 | r3613 | |
| 566 | 569 | } |
| 567 | 570 | else if( mem_mask == 0xffff00ff ) |
| 568 | 571 | { |
| 569 | | logerror( "%08x cd1 read\n", activecpu_get_pc() ); |
| 572 | logerror( "%08x cd1 read\n", cpu_get_pc(space->cpu) ); |
| 570 | 573 | |
| 571 | 574 | if (cd_result_ready && cd_result_c) |
| 572 | 575 | result = ((UINT32) cd_result[cd_result_p]) << 8; |
| r3612 | r3613 | |
| 580 | 583 | } |
| 581 | 584 | else if( mem_mask == 0xff00ffff ) |
| 582 | 585 | { |
| 583 | | logerror( "%08x cd2 read\n", activecpu_get_pc() ); |
| 586 | logerror( "%08x cd2 read\n", cpu_get_pc(space->cpu) ); |
| 584 | 587 | } |
| 585 | 588 | else if( mem_mask == 0x00ffffff ) |
| 586 | 589 | { |
| 587 | | logerror( "%08x cd3 read\n", activecpu_get_pc() ); |
| 590 | logerror( "%08x cd3 read\n", cpu_get_pc(space->cpu) ); |
| 588 | 591 | |
| 589 | 592 | result = ((UINT32) cd_stat) << 24; |
| 590 | 593 | } |
| 591 | 594 | else |
| 592 | 595 | { |
| 593 | | logerror( "%08x cd_r( %08x, %08x ) unsupported transfer\n", activecpu_get_pc(), offset, mem_mask ); |
| 596 | logerror( "%08x cd_r( %08x, %08x ) unsupported transfer\n", cpu_get_pc(space->cpu), offset, mem_mask ); |
| 594 | 597 | } |
| 595 | 598 | return result; |
| 596 | 599 | } |
| r3612 | r3613 | |
| 603 | 606 | { |
| 604 | 607 | /* write to CD register 0 */ |
| 605 | 608 | data = (data >> 0) & 0xff; |
| 606 | | logerror( "%08x cd0 write %02x\n", activecpu_get_pc(), data & 0xff ); |
| 609 | logerror( "%08x cd0 write %02x\n", cpu_get_pc(space->cpu), data & 0xff ); |
| 607 | 610 | |
| 608 | 611 | cd_param_p = 0; |
| 609 | 612 | if (data == 0x00) |
| r3612 | r3613 | |
| 622 | 625 | { |
| 623 | 626 | /* write to CD register 1 */ |
| 624 | 627 | data = (data >> 8) & 0xff; |
| 625 | | logerror( "%08x cd1 write %02x\n", activecpu_get_pc(), data ); |
| 628 | logerror( "%08x cd1 write %02x\n", cpu_get_pc(space->cpu), data ); |
| 626 | 629 | |
| 627 | 630 | if (data <= sizeof(psx_cdcmds) / sizeof(psx_cdcmds[0])) |
| 628 | 631 | psx_cdcmd = psx_cdcmds[data]; |
| r3612 | r3613 | |
| 632 | 635 | if (psx_cdcmd) |
| 633 | 636 | psx_cdcmd(); |
| 634 | 637 | |
| 635 | | psx_irq_set(machine, 0x0004); |
| 638 | psx_irq_set(space->machine, 0x0004); |
| 636 | 639 | } |
| 637 | 640 | else if( mem_mask == 0xff00ffff ) |
| 638 | 641 | { |
| 639 | 642 | /* write to CD register 2 */ |
| 640 | 643 | data = (data >> 16) & 0xff; |
| 641 | | logerror( "%08x cd2 write %02x\n", activecpu_get_pc(), data & 0xff ); |
| 644 | logerror( "%08x cd2 write %02x\n", cpu_get_pc(space->cpu), data & 0xff ); |
| 642 | 645 | |
| 643 | 646 | if ((cd_reset == 2) && (data == 0x07)) |
| 644 | 647 | { |
| r3612 | r3613 | |
| 666 | 669 | { |
| 667 | 670 | /* write to CD register 3 */ |
| 668 | 671 | data = (data >> 24) & 0xff; |
| 669 | | logerror( "%08x cd3 write %02x\n", activecpu_get_pc(), data & 0xff ); |
| 672 | logerror( "%08x cd3 write %02x\n", cpu_get_pc(space->cpu), data & 0xff ); |
| 670 | 673 | |
| 671 | 674 | if ((data == 0x07) && (cd_reset == 1)) |
| 672 | 675 | { |
| r3612 | r3613 | |
| 680 | 683 | } |
| 681 | 684 | else |
| 682 | 685 | { |
| 683 | | logerror( "%08x cd_w( %08x, %08x, %08x ) unsupported transfer\n", activecpu_get_pc(), offset, data, mem_mask ); |
| 686 | logerror( "%08x cd_w( %08x, %08x, %08x ) unsupported transfer\n", cpu_get_pc(space->cpu), offset, data, mem_mask ); |
| 684 | 687 | } |
| 685 | 688 | } |
| 686 | 689 | |
| r3612 | r3613 | |
| 803 | 806 | MDRV_SOUND_ROUTE( 1, "right", 1.00 ) |
| 804 | 807 | |
| 805 | 808 | /* quickload */ |
| 806 | | MDRV_QUICKLOAD_ADD(psx_exe_load, "exe,psx", 0) |
| 809 | // MDRV_QUICKLOAD_ADD(psx_exe_load, "exe,psx", 0) |
| 807 | 810 | MACHINE_DRIVER_END |
| 808 | 811 | |
| 809 | 812 | static MACHINE_DRIVER_START( psxpal ) |
| r3612 | r3613 | |
| 836 | 839 | MDRV_SOUND_ROUTE( 1, "right", 1.00 ) |
| 837 | 840 | |
| 838 | 841 | /* quickload */ |
| 839 | | MDRV_QUICKLOAD_ADD(psx_exe_load, "exe,psx", 0) |
| 842 | // MDRV_QUICKLOAD_ADD(psx_exe_load, "exe,psx", 0) |
| 840 | 843 | MACHINE_DRIVER_END |
| 841 | 844 | |
| 842 | 845 | ROM_START( psj ) |