trunk/src/mame/machine/smpc.c
| r20413 | r20414 | |
| 225 | 225 | state->m_slave->set_input_line(INPUT_LINE_RESET, param ? ASSERT_LINE : CLEAR_LINE); |
| 226 | 226 | state->m_smpc.OREG[31] = param + 0x02; //read-back for last command issued |
| 227 | 227 | state->m_smpc.SF = 0x00; //clear hand-shake flag |
| 228 | state->m_smpc.slave_on = param; |
| 229 | // printf("%d %d\n",machine.primary_screen->hpos(),machine.primary_screen->vpos()); |
| 228 | 230 | } |
| 229 | 231 | |
| 230 | 232 | static TIMER_CALLBACK( smpc_sound_enable ) |
| r20413 | r20414 | |
| 612 | 614 | state->m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| 613 | 615 | } |
| 614 | 616 | |
| 615 | | static void smpc_nmi_set(running_machine &machine,UINT8 cmd) |
| 617 | static TIMER_CALLBACK( smpc_nmi_set ) |
| 616 | 618 | { |
| 617 | 619 | saturn_state *state = machine.driver_data<saturn_state>(); |
| 618 | 620 | |
| 619 | | state->m_NMI_reset = cmd; |
| 621 | // printf("%d %d\n",machine.primary_screen->hpos(),machine.primary_screen->vpos()); |
| 622 | state->m_NMI_reset = param; |
| 623 | /* put issued command in OREG31 */ |
| 624 | state->m_smpc.OREG[31] = 0x19 + param; |
| 625 | /* clear hand-shake flag */ |
| 626 | state->m_smpc.SF = 0x00; |
| 627 | |
| 620 | 628 | //state->m_smpc.OREG[0] = (0x80) | ((state->m_NMI_reset & 1) << 6); |
| 621 | 629 | } |
| 622 | 630 | |
| r20413 | r20414 | |
| 640 | 648 | //case 0x01: Master OFF? |
| 641 | 649 | case 0x02: |
| 642 | 650 | case 0x03: |
| 643 | | if(LOG_SMPC) printf ("SMPC: Slave %s\n",(data & 1) ? "off" : "on"); |
| 644 | | space.machine().scheduler().timer_set(attotime::from_usec(100), FUNC(smpc_slave_enable),data & 1); |
| 651 | if(LOG_SMPC) printf ("SMPC: Slave %s %d %d\n",(data & 1) ? "off" : "on",space.machine().primary_screen->hpos(),space.machine().primary_screen->vpos()); |
| 652 | if((data & 1) != (state->m_smpc.slave_on & 1)) |
| 653 | space.machine().scheduler().timer_set(attotime::from_usec(100), FUNC(smpc_slave_enable),data & 1); |
| 654 | else /* guess: if Slave state is equal to the previous one, just execute less code. ask Greatest Nine '97. Unless SMPC is really so fast ... */ |
| 655 | space.machine().scheduler().timer_set(attotime::from_usec(5), FUNC(smpc_slave_enable),data & 1); |
| 645 | 656 | break; |
| 646 | 657 | case 0x06: |
| 647 | 658 | case 0x07: |
| r20413 | r20414 | |
| 712 | 723 | break; |
| 713 | 724 | case 0x19: |
| 714 | 725 | case 0x1a: |
| 715 | | if(LOG_SMPC) printf ("SMPC: NMI %sable\n",data & 1 ? "Dis" : "En"); |
| 716 | | smpc_nmi_set(space.machine(),data & 1); |
| 726 | if(LOG_SMPC) printf ("SMPC: NMI %sable %d %d\n",data & 1 ? "Dis" : "En",space.machine().primary_screen->hpos(),space.machine().primary_screen->vpos()); |
| 727 | space.machine().scheduler().timer_set(attotime::from_usec(100), FUNC(smpc_nmi_set),data & 1); |
| 717 | 728 | break; |
| 718 | 729 | default: |
| 719 | 730 | printf ("cpu '%s' (PC=%08X) SMPC: undocumented Command %02x\n", space.device().tag(), space.device().safe_pc(), data); |
| r20413 | r20414 | |
| 769 | 780 | smpc_comreg_exec(space,data,1); |
| 770 | 781 | |
| 771 | 782 | // we've processed the command, clear status flag |
| 772 | | if(data != 0x10 && data != 0x02 && data != 0x03 && data != 0xe && data != 0xf) |
| 783 | if(data != 0x10 && data != 0x02 && data != 0x03 && data != 0xe && data != 0xf && data != 0x19 && data != 0x1a) |
| 773 | 784 | { |
| 774 | 785 | state->m_smpc.OREG[31] = data; //read-back command |
| 775 | 786 | state->m_smpc.SF = 0x00; |
| r20413 | r20414 | |
| 856 | 867 | return_data = state->m_smpc.SR; |
| 857 | 868 | |
| 858 | 869 | if (offset == 0x63) |
| 870 | { |
| 871 | //printf("SF %d %d\n",space.machine().primary_screen->hpos(),space.machine().primary_screen->vpos()); |
| 859 | 872 | return_data = state->m_smpc.SF; |
| 873 | } |
| 860 | 874 | |
| 861 | 875 | if (offset == 0x75 || offset == 0x77)//PDR1/2 read |
| 862 | 876 | { |
| r20413 | r20414 | |
| 926 | 940 | smpc_comreg_exec(space,data,0); |
| 927 | 941 | |
| 928 | 942 | // we've processed the command, clear status flag |
| 929 | | if(data != 0x10 && data != 2 && data != 3 && data != 6 && data != 7 && data != 0x0e && data != 0x0f) |
| 943 | if(data != 0x10 && data != 2 && data != 3 && data != 6 && data != 7 && data != 0x0e && data != 0x0f && data != 0x19 && data != 0x1a) |
| 930 | 944 | { |
| 931 | 945 | state->m_smpc.OREG[31] = data; //read-back for last command issued |
| 932 | 946 | state->m_smpc.SF = 0x00; //clear hand-shake flag |