Skip to content

Commit a47e3a2

Browse files
codefrog2002Daniel Filner
andauthored
TMS32031: ABSF was mistakenly using ~man instead of -man, causing problems for MK4 which checks whether |A|+|B| == |A + B|. (#14440)
Fixed this problem: walking both players toward each other would result in no collision. The relevant block of mk4 code: 01f3ad:07020000: ldf R0,R2 01f3ae:07030001: ldf R1,R3 01f3af:00020002: absf R2,R2 01f3b0:00030003: absf R3,R3 01f3b1:01830002: addf R2,R3 01f3b2:01810000: addf R0,R1 01f3b3:00010001: absf R1,R1 01f3b4:04010003: cmpf R3,R1 01f3b5:42e40000: ldfeq #1,R4 01f3b6:43e4f800: ldflt #-1,R4 Co-authored-by: Daniel Filner <[email protected]>
1 parent a7a0a9e commit a47e3a2

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

src/devices/cpu/tms32031/32031ops.hxx

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,16 +1409,36 @@ uint32_t tms3203x_device::modillegal_def(uint32_t op, uint8_t ar, uint32_t *&def
14091409

14101410
#define ABSF(dreg, sreg) \
14111411
{ \
1412-
int32_t man = FREGMAN(sreg); \
1412+
int32_t man = FREGMAN(sreg); \
1413+
int8_t fexp = FREGEXP(sreg); \
14131414
CLR_NZVUF(); \
1414-
m_r[dreg] = m_r[sreg]; \
1415+
m_r[dreg] = m_r[sreg]; \
1416+
if (fexp == -128) \
1417+
{ /* if sreg was misformed, it should come out 80:00000000 */ \
1418+
m_r[dreg].set_mantissa(0); \
1419+
} \
1420+
else \
14151421
if (man < 0) \
14161422
{ \
1417-
m_r[dreg].set_mantissa(~man); \
1418-
if (man == (int32_t)0x80000000 && FREGEXP(sreg) == 127) \
1419-
IREG(TMR_ST) |= VFLAG | LVFLAG; \
1423+
if (man == (int32_t)0x80000000) \
1424+
{ \
1425+
if (fexp == 127) \
1426+
{ /* total overflow result: 7F:7FFFFFFFF */ \
1427+
IREG(TMR_ST) |= VFLAG | LVFLAG; \
1428+
m_r[dreg].set_mantissa(0x7fffffff); \
1429+
} \
1430+
else \
1431+
{ /* man overflow -80000000 to +80000000 : increment exp */ \
1432+
m_r[dreg].set_exponent(fexp + 1); \
1433+
m_r[dreg].set_mantissa(0); \
1434+
} \
1435+
} \
1436+
else \
1437+
{ /* normal case */ \
1438+
m_r[dreg].set_mantissa(-man); /* aka (~man)+1 */ \
1439+
} \
14201440
} \
1421-
OR_NZF(m_r[dreg]); \
1441+
OR_NZF(m_r[dreg]); \
14221442
}
14231443

14241444
void tms3203x_device::absf_reg(uint32_t op)

0 commit comments

Comments
 (0)