From 5d1bce6d3325c84905641c57e759e0b90424c15c Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Mon, 11 Feb 2013 01:18:44 +0000 Subject: Fixed TH Control Method when TR is active, fixes input detection in 3D Lemmings --- src/mame/machine/scudsp.c | 4 ++++ src/mame/machine/smpc.c | 23 +++++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) (limited to 'src/mame') diff --git a/src/mame/machine/scudsp.c b/src/mame/machine/scudsp.c index 3f397c9d788..5aa197567ed 100644 --- a/src/mame/machine/scudsp.c +++ b/src/mame/machine/scudsp.c @@ -431,6 +431,10 @@ static void dsp_operation(address_space &space) case 0x2: /* OR */ i3 = dsp_reg.acl.si | dsp_reg.pl.si; dsp_reg.alu = (UINT64)(UINT32)i3; + /* TODO: Croc and some early Psygnosis games wants Z to be 1 when the result of this one is negative. + Needs HW tests ... */ + if(i3 < 0) + i3 = 0; SET_Z(i3 == 0); SET_C(0); SET_S(i3 < 0); diff --git a/src/mame/machine/smpc.c b/src/mame/machine/smpc.c index 8e6130689e7..c470aea7dda 100644 --- a/src/mame/machine/smpc.c +++ b/src/mame/machine/smpc.c @@ -864,20 +864,31 @@ UINT8 saturn_state::smpc_th_control_mode(UINT8 pad_n) const char *const padnames[] = { "JOY1", "JOY2" }; UINT8 res = 0; - th = (pad_n == 0) ? ((m_smpc.PDR1>>6) & 1) : ((m_smpc.PDR2>>6) & 1); + th = (pad_n == 0) ? ((m_smpc.PDR1>>5) & 3) : ((m_smpc.PDR2>>6) & 3); if (LOG_SMPC) printf("SMPC: SH-2 TH control mode, returning pad data %d for phase %d\n",pad_n+1, th); switch(th) { - case 1: - res = th<<7; + /* TODO: 3D Lemmings bogusly enables TH Control mode, wants this to return the ID, needs HW tests. */ + case 3: + res = th<<6; + res |= 0x14; + res |= machine().root_device().ioport(padnames[pad_n])->read() & 8; // L + break; + case 2: + res = th<<6; // 1 C B Right Left Down Up res|= (((machine().root_device().ioport(padnames[pad_n])->read()>>4)) & 0x30); // C & B res|= (((machine().root_device().ioport(padnames[pad_n])->read()>>12)) & 0xf); break; + case 1: + res = th<<6; + res |= 0x10; + res |= (machine().root_device().ioport(padnames[pad_n])->read()>>4) & 0xf; // R, X, Y, Z + break; case 0: - res = th<<7; + res = th<<6; // 0 Start A 0 0 Down Up res|= (((machine().root_device().ioport(padnames[pad_n])->read()>>6)) & 0x30); // Start & A res|= (((machine().root_device().ioport(padnames[pad_n])->read()>>12)) & 0x3); @@ -997,10 +1008,10 @@ WRITE8_MEMBER( saturn_state::saturn_SMPC_w ) m_smpc.SF = data & 1; // hand-shake flag if(offset == 0x75) // PDR1 - m_smpc.PDR1 = (data & m_smpc.DDR1); + m_smpc.PDR1 = data & 0x7f; if(offset == 0x77) // PDR2 - m_smpc.PDR2 = (data & m_smpc.DDR2); + m_smpc.PDR2 = data & 0x7f; if(offset == 0x79) m_smpc.DDR1 = data & 0x7f; -- cgit v1.2.3