summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar Angelo Salese <angelosa@users.noreply.github.com>2013-02-11 01:18:44 +0000
committerGravatarGravatar Angelo Salese <angelosa@users.noreply.github.com>2013-02-11 01:18:44 +0000
commit5d1bce6d3325c84905641c57e759e0b90424c15c (patch) (github)
tree9257d683a8ff64ebb18aed2e3659da04f1be2d52
parent3fa4ce2abb35f59fb40753d2776820b49a82d4fe (diff)
downloadmame-5d1bce6d3325c84905641c57e759e0b90424c15c.tar.bz2
mame-5d1bce6d3325c84905641c57e759e0b90424c15c.zip
Fixed TH Control Method when TR is active, fixes input detection in 3D Lemmings
-rw-r--r--src/mame/machine/scudsp.c4
-rw-r--r--src/mame/machine/smpc.c23
2 files changed, 21 insertions, 6 deletions
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;