trunk/src/mame/machine/smpc.c
| r20920 | r20921 | |
| 864 | 864 | const char *const padnames[] = { "JOY1", "JOY2" }; |
| 865 | 865 | UINT8 res = 0; |
| 866 | 866 | |
| 867 | | th = (pad_n == 0) ? ((m_smpc.PDR1>>6) & 1) : ((m_smpc.PDR2>>6) & 1); |
| 867 | th = (pad_n == 0) ? ((m_smpc.PDR1>>5) & 3) : ((m_smpc.PDR2>>6) & 3); |
| 868 | 868 | |
| 869 | 869 | if (LOG_SMPC) printf("SMPC: SH-2 TH control mode, returning pad data %d for phase %d\n",pad_n+1, th); |
| 870 | 870 | |
| 871 | 871 | switch(th) |
| 872 | 872 | { |
| 873 | | case 1: |
| 874 | | res = th<<7; |
| 873 | /* TODO: 3D Lemmings bogusly enables TH Control mode, wants this to return the ID, needs HW tests. */ |
| 874 | case 3: |
| 875 | res = th<<6; |
| 876 | res |= 0x14; |
| 877 | res |= machine().root_device().ioport(padnames[pad_n])->read() & 8; // L |
| 878 | break; |
| 879 | case 2: |
| 880 | res = th<<6; |
| 875 | 881 | // 1 C B Right Left Down Up |
| 876 | 882 | res|= (((machine().root_device().ioport(padnames[pad_n])->read()>>4)) & 0x30); // C & B |
| 877 | 883 | res|= (((machine().root_device().ioport(padnames[pad_n])->read()>>12)) & 0xf); |
| 878 | 884 | break; |
| 885 | case 1: |
| 886 | res = th<<6; |
| 887 | res |= 0x10; |
| 888 | res |= (machine().root_device().ioport(padnames[pad_n])->read()>>4) & 0xf; // R, X, Y, Z |
| 889 | break; |
| 879 | 890 | case 0: |
| 880 | | res = th<<7; |
| 891 | res = th<<6; |
| 881 | 892 | // 0 Start A 0 0 Down Up |
| 882 | 893 | res|= (((machine().root_device().ioport(padnames[pad_n])->read()>>6)) & 0x30); // Start & A |
| 883 | 894 | res|= (((machine().root_device().ioport(padnames[pad_n])->read()>>12)) & 0x3); |
| r20920 | r20921 | |
| 997 | 1008 | m_smpc.SF = data & 1; // hand-shake flag |
| 998 | 1009 | |
| 999 | 1010 | if(offset == 0x75) // PDR1 |
| 1000 | | m_smpc.PDR1 = (data & m_smpc.DDR1); |
| 1011 | m_smpc.PDR1 = data & 0x7f; |
| 1001 | 1012 | |
| 1002 | 1013 | if(offset == 0x77) // PDR2 |
| 1003 | | m_smpc.PDR2 = (data & m_smpc.DDR2); |
| 1014 | m_smpc.PDR2 = data & 0x7f; |
| 1004 | 1015 | |
| 1005 | 1016 | if(offset == 0x79) |
| 1006 | 1017 | m_smpc.DDR1 = data & 0x7f; |