mirror of
https://github.com/holub/mame
synced 2025-05-12 09:08:53 +03:00
3d0m2_te: alu_calc ALU mode (result < 0) was not possible, and simplify Boolean mode (nw)
This commit is contained in:
parent
3226360252
commit
cf5044123b
@ -3010,10 +3010,8 @@ uint8_t m2_te_device::color_blend(uint8_t ct, uint8_t cti, uint8_t cs, uint8_t c
|
|||||||
|
|
||||||
uint8_t m2_te_device::alu_calc(uint16_t a, uint16_t b)
|
uint8_t m2_te_device::alu_calc(uint16_t a, uint16_t b)
|
||||||
{
|
{
|
||||||
uint16_t cinv;
|
int32_t result = 0;
|
||||||
uint16_t c = 0;
|
|
||||||
uint32_t blendout;
|
uint32_t blendout;
|
||||||
uint32_t result;
|
|
||||||
uint32_t carry = 0;
|
uint32_t carry = 0;
|
||||||
uint32_t borrow = 0;
|
uint32_t borrow = 0;
|
||||||
uint32_t cntl = (m_db.alu_ctrl & DBALUCNTL_ALUOP_MASK) >> DBALUCNTL_ALUOP_SHIFT;
|
uint32_t cntl = (m_db.alu_ctrl & DBALUCNTL_ALUOP_MASK) >> DBALUCNTL_ALUOP_SHIFT;
|
||||||
@ -3021,7 +3019,7 @@ uint8_t m2_te_device::alu_calc(uint16_t a, uint16_t b)
|
|||||||
// p271
|
// p271
|
||||||
|
|
||||||
/* ALU */
|
/* ALU */
|
||||||
if ((cntl & 8) == 0)
|
if ((cntl & 8) == 0)
|
||||||
{
|
{
|
||||||
if (!(cntl & 4))
|
if (!(cntl & 4))
|
||||||
{
|
{
|
||||||
@ -3043,36 +3041,18 @@ uint8_t m2_te_device::alu_calc(uint16_t a, uint16_t b)
|
|||||||
/* Boolean */
|
/* Boolean */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cinv = 0;
|
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
for (i = 0; i < 8; ++i)
|
for (i = 0; i < 8; ++i)
|
||||||
{
|
{
|
||||||
j = (a & 1) *2 + (b & 1);
|
j = (a & 1) *2 + (b & 1);
|
||||||
|
|
||||||
switch (j)
|
result >>= 1;
|
||||||
{
|
result |= (cntl >> j & 1) ? 0x80 : 0;
|
||||||
case 0: cinv |= (cntl & 1); break;
|
|
||||||
case 1: cinv |= ((cntl & 2) != 0); break;
|
|
||||||
case 2: cinv |= ((cntl & 4) != 0); break;
|
|
||||||
case 3: cinv |= ((cntl & 8) != 0); break;
|
|
||||||
}
|
|
||||||
|
|
||||||
cinv <<= 1;
|
|
||||||
a >>= 1;
|
a >>= 1;
|
||||||
b >>= 1;
|
b >>= 1;
|
||||||
}
|
}
|
||||||
cinv >>= 1;
|
|
||||||
|
|
||||||
for (i = 0; i < 8; ++i)
|
|
||||||
{
|
|
||||||
c |= cinv & 1;
|
|
||||||
c <<= 1;
|
|
||||||
cinv >>= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
c >>= 1;
|
|
||||||
result = (int)c;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result &= 0x1ff;
|
result &= 0x1ff;
|
||||||
@ -3102,7 +3082,7 @@ uint8_t m2_te_device::alu_calc(uint16_t a, uint16_t b)
|
|||||||
alugel = 4;
|
alugel = 4;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((cntl & 8) == 0)
|
if ((cntl & 8) == 0)
|
||||||
{
|
{
|
||||||
/* Clamp? */
|
/* Clamp? */
|
||||||
if (!(cntl & 1))
|
if (!(cntl & 1))
|
||||||
|
Loading…
Reference in New Issue
Block a user