mirror of
https://github.com/holub/mame
synced 2025-07-04 17:38:08 +03:00
m68k chk2cmp2: fix oversight on prev commit for unsigned compare (nw)
This commit is contained in:
parent
2b8ab63d08
commit
6525cd6c42
@ -3589,15 +3589,21 @@ M68KMAKE_OP(chk2cmp2, 8, ., pcdi)
|
||||
{
|
||||
uint32_t word2 = OPER_I_16();
|
||||
int32_t compare = REG_DA()[(word2 >> 12) & 15] & 0xff;
|
||||
uint32_t ea = EA_PCDI_8();
|
||||
int32_t lower_bound = m68ki_read_pcrel_8(ea);
|
||||
int32_t upper_bound = m68ki_read_pcrel_8(ea + 1);
|
||||
|
||||
if (lower_bound > upper_bound)
|
||||
{
|
||||
lower_bound = (int32_t)(int8_t)lower_bound;
|
||||
upper_bound = (int32_t)(int8_t)upper_bound;
|
||||
|
||||
if(!BIT_F(word2))
|
||||
compare = (int32_t)(int8_t)compare;
|
||||
}
|
||||
|
||||
uint32_t ea = EA_PCDI_8();
|
||||
int32_t lower_bound = (int32_t)(int8_t)m68ki_read_pcrel_8(ea);
|
||||
int32_t upper_bound = (int32_t)(int8_t)m68ki_read_pcrel_8(ea + 1);
|
||||
|
||||
m_not_z_flag = !((upper_bound==compare) | (lower_bound==compare));
|
||||
m_c_flag = (compare >= lower_bound && compare <= upper_bound) ? CFLAG_CLEAR : CFLAG_SET;
|
||||
m_not_z_flag = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
|
||||
|
||||
if(COND_CS() && BIT_B(word2))
|
||||
m68ki_exception_trap(EXCEPTION_CHK);
|
||||
@ -3613,15 +3619,21 @@ M68KMAKE_OP(chk2cmp2, 8, ., pcix)
|
||||
{
|
||||
uint32_t word2 = OPER_I_16();
|
||||
int32_t compare = REG_DA()[(word2 >> 12) & 15] & 0xff;
|
||||
uint32_t ea = EA_PCIX_8();
|
||||
int32_t lower_bound = m68ki_read_pcrel_8(ea);
|
||||
int32_t upper_bound = m68ki_read_pcrel_8(ea + 1);
|
||||
|
||||
if (lower_bound > upper_bound)
|
||||
{
|
||||
lower_bound = (int32_t)(int8_t)lower_bound;
|
||||
upper_bound = (int32_t)(int8_t)upper_bound;
|
||||
|
||||
if(!BIT_F(word2))
|
||||
compare = (int32_t)(int8_t)compare;
|
||||
}
|
||||
|
||||
uint32_t ea = EA_PCIX_8();
|
||||
int32_t lower_bound = (int32_t)(int8_t)m68ki_read_pcrel_8(ea);
|
||||
int32_t upper_bound = (int32_t)(int8_t)m68ki_read_pcrel_8(ea + 1);
|
||||
|
||||
m_not_z_flag = !((upper_bound==compare) | (lower_bound==compare));
|
||||
m_c_flag = (compare >= lower_bound && compare <= upper_bound) ? CFLAG_CLEAR : CFLAG_SET;
|
||||
m_not_z_flag = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
|
||||
|
||||
if(COND_CS() && BIT_B(word2))
|
||||
m68ki_exception_trap(EXCEPTION_CHK);
|
||||
@ -3637,15 +3649,21 @@ M68KMAKE_OP(chk2cmp2, 8, ., .)
|
||||
{
|
||||
uint32_t word2 = OPER_I_16();
|
||||
int32_t compare = REG_DA()[(word2 >> 12) & 15] & 0xff;
|
||||
uint32_t ea = M68KMAKE_GET_EA_AY_8;
|
||||
int32_t lower_bound = m68ki_read_8(ea);
|
||||
int32_t upper_bound = m68ki_read_8(ea + 1);
|
||||
|
||||
if (lower_bound > upper_bound)
|
||||
{
|
||||
lower_bound = (int32_t)(int8_t)lower_bound;
|
||||
upper_bound = (int32_t)(int8_t)upper_bound;
|
||||
|
||||
if(!BIT_F(word2))
|
||||
compare = (int32_t)(int8_t)compare;
|
||||
}
|
||||
|
||||
uint32_t ea = M68KMAKE_GET_EA_AY_8;
|
||||
int32_t lower_bound = (int32_t)(int8_t)m68ki_read_8(ea);
|
||||
int32_t upper_bound = (int32_t)(int8_t)m68ki_read_8(ea + 1);
|
||||
|
||||
m_not_z_flag = !((upper_bound==compare) | (lower_bound==compare));
|
||||
m_c_flag = (compare >= lower_bound && compare <= upper_bound) ? CFLAG_CLEAR : CFLAG_SET;
|
||||
m_not_z_flag = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
|
||||
|
||||
if(COND_CS() && BIT_B(word2))
|
||||
m68ki_exception_trap(EXCEPTION_CHK);
|
||||
@ -3661,15 +3679,21 @@ M68KMAKE_OP(chk2cmp2, 16, ., pcdi)
|
||||
{
|
||||
uint32_t word2 = OPER_I_16();
|
||||
int32_t compare = REG_DA()[(word2 >> 12) & 15] & 0xffff;
|
||||
uint32_t ea = EA_PCDI_16();
|
||||
int32_t lower_bound = m68ki_read_pcrel_16(ea);
|
||||
int32_t upper_bound = m68ki_read_pcrel_16(ea + 2);
|
||||
|
||||
if (lower_bound > upper_bound)
|
||||
{
|
||||
lower_bound = (int32_t)(int16_t)lower_bound;
|
||||
upper_bound = (int32_t)(int16_t)upper_bound;
|
||||
|
||||
if(!BIT_F(word2))
|
||||
compare = (int32_t)(int16_t)compare;
|
||||
}
|
||||
|
||||
uint32_t ea = EA_PCDI_16();
|
||||
int32_t lower_bound = (int32_t)(int16_t)m68ki_read_pcrel_16(ea);
|
||||
int32_t upper_bound = (int32_t)(int16_t)m68ki_read_pcrel_16(ea + 2);
|
||||
|
||||
m_not_z_flag = !((upper_bound==compare) | (lower_bound==compare));
|
||||
m_c_flag = (compare >= lower_bound && compare <= upper_bound) ? CFLAG_CLEAR : CFLAG_SET;
|
||||
m_not_z_flag = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
|
||||
|
||||
if(COND_CS() && BIT_B(word2))
|
||||
m68ki_exception_trap(EXCEPTION_CHK);
|
||||
@ -3685,15 +3709,21 @@ M68KMAKE_OP(chk2cmp2, 16, ., pcix)
|
||||
{
|
||||
uint32_t word2 = OPER_I_16();
|
||||
int32_t compare = REG_DA()[(word2 >> 12) & 15] & 0xffff;
|
||||
uint32_t ea = EA_PCIX_16();
|
||||
int32_t lower_bound = m68ki_read_pcrel_16(ea);
|
||||
int32_t upper_bound = m68ki_read_pcrel_16(ea + 2);
|
||||
|
||||
if (lower_bound > upper_bound)
|
||||
{
|
||||
lower_bound = (int32_t)(int16_t)lower_bound;
|
||||
upper_bound = (int32_t)(int16_t)upper_bound;
|
||||
|
||||
if(!BIT_F(word2))
|
||||
compare = (int32_t)(int16_t)compare;
|
||||
}
|
||||
|
||||
uint32_t ea = EA_PCIX_16();
|
||||
int32_t lower_bound = (int32_t)(int16_t)m68ki_read_pcrel_16(ea);
|
||||
int32_t upper_bound = (int32_t)(int16_t)m68ki_read_pcrel_16(ea + 2);
|
||||
|
||||
m_not_z_flag = !((upper_bound==compare) | (lower_bound==compare));
|
||||
m_c_flag = (compare >= lower_bound && compare <= upper_bound) ? CFLAG_CLEAR : CFLAG_SET;
|
||||
m_not_z_flag = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
|
||||
|
||||
if(COND_CS() && BIT_B(word2))
|
||||
m68ki_exception_trap(EXCEPTION_CHK);
|
||||
@ -3709,15 +3739,21 @@ M68KMAKE_OP(chk2cmp2, 16, ., .)
|
||||
{
|
||||
uint32_t word2 = OPER_I_16();
|
||||
int32_t compare = REG_DA()[(word2 >> 12) & 15] & 0xffff;
|
||||
uint32_t ea = M68KMAKE_GET_EA_AY_16;
|
||||
int32_t lower_bound = m68ki_read_16(ea);
|
||||
int32_t upper_bound = m68ki_read_16(ea + 2);
|
||||
|
||||
if (lower_bound > upper_bound)
|
||||
{
|
||||
lower_bound = (int32_t)(int16_t)lower_bound;
|
||||
upper_bound = (int32_t)(int16_t)upper_bound;
|
||||
|
||||
if(!BIT_F(word2))
|
||||
compare = (int32_t)(int16_t)compare;
|
||||
}
|
||||
|
||||
uint32_t ea = M68KMAKE_GET_EA_AY_16;
|
||||
int32_t lower_bound = (int32_t)(int16_t)m68ki_read_16(ea);
|
||||
int32_t upper_bound = (int32_t)(int16_t)m68ki_read_16(ea + 2);
|
||||
|
||||
m_not_z_flag = !((upper_bound==compare) | (lower_bound==compare));
|
||||
m_c_flag = (compare >= lower_bound && compare <= upper_bound) ? CFLAG_CLEAR : CFLAG_SET;
|
||||
m_not_z_flag = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
|
||||
|
||||
if(COND_CS() && BIT_B(word2))
|
||||
m68ki_exception_trap(EXCEPTION_CHK);
|
||||
@ -3732,14 +3768,20 @@ M68KMAKE_OP(chk2cmp2, 32, ., pcdi)
|
||||
if(CPU_TYPE_IS_EC020_PLUS())
|
||||
{
|
||||
uint32_t word2 = OPER_I_16();
|
||||
int32_t compare = (int32_t)REG_DA()[(word2 >> 12) & 15];
|
||||
|
||||
int64_t compare = REG_DA()[(word2 >> 12) & 15];
|
||||
uint32_t ea = EA_PCDI_32();
|
||||
int32_t lower_bound = (int32_t)m68ki_read_pcrel_32(ea);
|
||||
int32_t upper_bound = (int32_t)m68ki_read_pcrel_32(ea + 4);
|
||||
int64_t lower_bound = m68ki_read_pcrel_32(ea);
|
||||
int64_t upper_bound = m68ki_read_pcrel_32(ea + 4);
|
||||
|
||||
if (lower_bound > upper_bound)
|
||||
{
|
||||
lower_bound = (int64_t)(int32_t)lower_bound;
|
||||
upper_bound = (int64_t)(int32_t)upper_bound;
|
||||
compare = (int64_t)(int32_t)compare;
|
||||
}
|
||||
|
||||
m_not_z_flag = !((upper_bound==compare) | (lower_bound==compare));
|
||||
m_c_flag = (compare >= lower_bound && compare <= upper_bound) ? CFLAG_CLEAR : CFLAG_SET;
|
||||
m_not_z_flag = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
|
||||
|
||||
if(COND_CS() && BIT_B(word2))
|
||||
m68ki_exception_trap(EXCEPTION_CHK);
|
||||
@ -3754,14 +3796,20 @@ M68KMAKE_OP(chk2cmp2, 32, ., pcix)
|
||||
if(CPU_TYPE_IS_EC020_PLUS())
|
||||
{
|
||||
uint32_t word2 = OPER_I_16();
|
||||
int32_t compare = (int32_t)REG_DA()[(word2 >> 12) & 15];
|
||||
|
||||
int64_t compare = REG_DA()[(word2 >> 12) & 15];
|
||||
uint32_t ea = EA_PCIX_32();
|
||||
int32_t lower_bound = (int32_t)m68ki_read_pcrel_32(ea);
|
||||
int32_t upper_bound = (int32_t)m68ki_read_pcrel_32(ea + 4);
|
||||
int64_t lower_bound = m68ki_read_pcrel_32(ea);
|
||||
int64_t upper_bound = m68ki_read_pcrel_32(ea + 4);
|
||||
|
||||
if (lower_bound > upper_bound)
|
||||
{
|
||||
lower_bound = (int64_t)(int32_t)lower_bound;
|
||||
upper_bound = (int64_t)(int32_t)upper_bound;
|
||||
compare = (int64_t)(int32_t)compare;
|
||||
}
|
||||
|
||||
m_not_z_flag = !((upper_bound==compare) | (lower_bound==compare));
|
||||
m_c_flag = (compare >= lower_bound && compare <= upper_bound) ? CFLAG_CLEAR : CFLAG_SET;
|
||||
m_not_z_flag = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
|
||||
|
||||
if(COND_CS() && BIT_B(word2))
|
||||
m68ki_exception_trap(EXCEPTION_CHK);
|
||||
@ -3776,14 +3824,20 @@ M68KMAKE_OP(chk2cmp2, 32, ., .)
|
||||
if(CPU_TYPE_IS_EC020_PLUS())
|
||||
{
|
||||
uint32_t word2 = OPER_I_16();
|
||||
int32_t compare = (int32_t)REG_DA()[(word2 >> 12) & 15];
|
||||
|
||||
int64_t compare = REG_DA()[(word2 >> 12) & 15];
|
||||
uint32_t ea = M68KMAKE_GET_EA_AY_32;
|
||||
int32_t lower_bound = (int32_t)m68ki_read_32(ea);
|
||||
int32_t upper_bound = (int32_t)m68ki_read_32(ea + 4);
|
||||
int64_t lower_bound = m68ki_read_32(ea);
|
||||
int64_t upper_bound = m68ki_read_32(ea + 4);
|
||||
|
||||
if (lower_bound > upper_bound)
|
||||
{
|
||||
lower_bound = (int64_t)(int32_t)lower_bound;
|
||||
upper_bound = (int64_t)(int32_t)upper_bound;
|
||||
compare = (int64_t)(int32_t)compare;
|
||||
}
|
||||
|
||||
m_not_z_flag = !((upper_bound==compare) | (lower_bound==compare));
|
||||
m_c_flag = (compare >= lower_bound && compare <= upper_bound) ? CFLAG_CLEAR : CFLAG_SET;
|
||||
m_not_z_flag = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
|
||||
|
||||
if(COND_CS() && BIT_B(word2))
|
||||
m68ki_exception_trap(EXCEPTION_CHK);
|
||||
|
Loading…
Reference in New Issue
Block a user