e132x, looked at negs opcode, nw.

This commit is contained in:
mooglyguy 2017-11-13 19:02:42 +01:00
parent ecc2e403dc
commit a911249fbf
3 changed files with 101 additions and 77 deletions

View File

@ -1814,35 +1814,6 @@ void hyperstone_device::hyperstone_subs(regs_decode &decode)
} }
} }
void hyperstone_device::hyperstone_negs(regs_decode &decode)
{
if (SRC_IS_SR)
SREG = GET_C;
int64_t tmp = -(int64_t)((int32_t)(SREG));
CHECK_VSUB(SREG,0,tmp);
//#if SETCARRYS
// CHECK_C(tmp);
//#endif
int32_t res = -(int32_t)(SREG);
SET_DREG(res);
SET_Z(res == 0 ? 1 : 0);
SET_N(SIGN_BIT(res));
m_icount -= m_clock_cycles_1;
if (GET_V && !SRC_IS_SR) //trap doesn't occur when source is SR
{
uint32_t addr = get_trap_addr(TRAPNO_RANGE_ERROR);
execute_exception(addr);
}
}
void hyperstone_device::hyperstone_sardi() void hyperstone_device::hyperstone_sardi()
{ {
check_delay_PC(); check_delay_PC();
@ -2188,10 +2159,10 @@ void hyperstone_device::execute_run()
case 0x59: hyperstone_neg_global_local(); break; case 0x59: hyperstone_neg_global_local(); break;
case 0x5a: hyperstone_neg_local_global(); break; case 0x5a: hyperstone_neg_local_global(); break;
case 0x5b: hyperstone_neg_local_local(); break; case 0x5b: hyperstone_neg_local_local(); break;
case 0x5c: op5c(); break; case 0x5c: hyperstone_negs_global_global(); break;
case 0x5d: op5d(); break; case 0x5d: hyperstone_negs_global_local(); break;
case 0x5e: op5e(); break; case 0x5e: hyperstone_negs_local_global(); break;
case 0x5f: op5f(); break; case 0x5f: hyperstone_negs_local_local(); break;
case 0x60: hyperstone_cmpi_global_simm(); break; case 0x60: hyperstone_cmpi_global_simm(); break;
case 0x61: hyperstone_cmpi_global_limm(); break; case 0x61: hyperstone_cmpi_global_limm(); break;
case 0x62: hyperstone_cmpi_local_simm(); break; case 0x62: hyperstone_cmpi_local_simm(); break;

View File

@ -285,7 +285,10 @@ private:
void hyperstone_neg_global_local(); void hyperstone_neg_global_local();
void hyperstone_neg_local_global(); void hyperstone_neg_local_global();
void hyperstone_neg_local_local(); void hyperstone_neg_local_local();
void hyperstone_negs(regs_decode &decode); void hyperstone_negs_global_global();
void hyperstone_negs_global_local();
void hyperstone_negs_local_global();
void hyperstone_negs_local_local();
void hyperstone_and_global_global(); void hyperstone_and_global_global();
void hyperstone_and_global_local(); void hyperstone_and_global_local();
void hyperstone_and_local_global(); void hyperstone_and_local_global();
@ -462,7 +465,6 @@ private:
void op2c(); void op2d(); void op2e(); void op2f(); // addc void op2c(); void op2d(); void op2e(); void op2f(); // addc
void op40(); void op41(); void op42(); void op43(); // subc void op40(); void op41(); void op42(); void op43(); // subc
void op4c(); void op4d(); void op4e(); void op4f(); // subs void op4c(); void op4d(); void op4e(); void op4f(); // subs
void op5c(); void op5d(); void op5e(); void op5f(); // negs
#if 0 #if 0
void generate_op00(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc); void generate_op01(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc); void generate_op00(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc); void generate_op01(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc);

View File

@ -2365,72 +2365,123 @@ void hyperstone_device::hyperstone_neg_local_local()
m_icount -= m_clock_cycles_1; m_icount -= m_clock_cycles_1;
} }
void hyperstone_device::op5c() void hyperstone_device::hyperstone_negs_global_global()
{ {
regs_decode decode;
check_delay_PC(); check_delay_PC();
decode.src = SRC_CODE;
decode.dst = DST_CODE;
decode.src_is_local = 0; const uint32_t src_code = SRC_CODE;
SREG = m_global_regs[decode.src]; const int32_t sreg = (src_code == SR_REGISTER) ? (SR & C_MASK) : (int32_t)m_global_regs[src_code];
const int64_t tmp = -(int64_t)sreg;
decode.dst_is_local = 0; SR &= ~(V_MASK | Z_MASK | N_MASK);
DREG = m_global_regs[decode.dst];
hyperstone_negs(decode); if (tmp & sreg & 0x80000000)
printf("0x5c, negs global,global\n"); SR |= V_MASK;
//#if SETCARRYS
// CHECK_C(tmp);
//#endif
const int32_t res = -sreg;
set_global_register(DST_CODE, res);
if (res == 0)
SR |= Z_MASK;
SR |= SIGN_TO_N(res);
m_icount -= m_clock_cycles_1;
if (GET_V && src_code != SR_REGISTER) // trap doesn't occur when source is SR
execute_exception(get_trap_addr(TRAPNO_RANGE_ERROR));
} }
void hyperstone_device::op5d() void hyperstone_device::hyperstone_negs_global_local()
{ {
regs_decode decode;
check_delay_PC(); check_delay_PC();
decode.src = SRC_CODE;
decode.dst = DST_CODE;
decode.src_is_local = 1; const int32_t sreg = (int32_t)m_local_regs[(SRC_CODE + GET_FP) & 0x3f];
SREG = m_local_regs[(decode.src + GET_FP) & 0x3f]; const int64_t tmp = -(int64_t)sreg;
decode.dst_is_local = 0; SR &= ~(V_MASK | Z_MASK | N_MASK);
DREG = m_global_regs[decode.dst];
hyperstone_negs(decode); if (tmp & sreg & 0x80000000)
printf("0x5d, negs global,local\n"); SR |= V_MASK;
//#if SETCARRYS
// CHECK_C(tmp);
//#endif
const int32_t res = -sreg;
set_global_register(DST_CODE, res);
if (res == 0)
SR |= Z_MASK;
SR |= SIGN_TO_N(res);
m_icount -= m_clock_cycles_1;
if (GET_V)
execute_exception(get_trap_addr(TRAPNO_RANGE_ERROR));
} }
void hyperstone_device::op5e() void hyperstone_device::hyperstone_negs_local_global()
{ {
regs_decode decode;
check_delay_PC(); check_delay_PC();
decode.src = SRC_CODE;
decode.dst = DST_CODE;
decode.src_is_local = 0; const uint32_t src_code = SRC_CODE;
SREG = m_global_regs[decode.src]; const int32_t sreg = (src_code == SR_REGISTER) ? (SR & C_MASK) : (int32_t)m_global_regs[src_code];
const int64_t tmp = -(int64_t)sreg;
decode.dst_is_local = 1; SR &= ~(V_MASK | Z_MASK | N_MASK);
DREG = m_local_regs[(decode.dst + GET_FP) & 0x3f]; /* registers offset by frame pointer */
hyperstone_negs(decode); if (tmp & sreg & 0x80000000)
printf("0x5e, negs local,global"); SR |= V_MASK;
//#if SETCARRYS
// CHECK_C(tmp);
//#endif
const int32_t res = -sreg;
m_local_regs[(DST_CODE + GET_FP) & 0x3f] = res;
if (res == 0)
SR |= Z_MASK;
SR |= SIGN_TO_N(res);
m_icount -= m_clock_cycles_1;
if (GET_V && src_code != SR_REGISTER) // trap doesn't occur when source is SR
execute_exception(get_trap_addr(TRAPNO_RANGE_ERROR));
} }
void hyperstone_device::op5f() void hyperstone_device::hyperstone_negs_local_local()
{ {
regs_decode decode;
check_delay_PC(); check_delay_PC();
decode.src = SRC_CODE;
decode.dst = DST_CODE;
decode.src_is_local = 1; const uint32_t fp = GET_FP;
SREG = m_local_regs[(decode.src + GET_FP) & 0x3f]; const int32_t sreg = (int32_t)m_local_regs[(SRC_CODE + fp) & 0x3f];
const int64_t tmp = -(int64_t)sreg;
decode.dst_is_local = 1; SR &= ~(V_MASK | Z_MASK | N_MASK);
DREG = m_local_regs[(decode.dst + GET_FP) & 0x3f]; /* registers offset by frame pointer */
hyperstone_negs(decode); if (tmp & sreg & 0x80000000)
printf("0x5f, negs local,local\n"); SR |= V_MASK;
//#if SETCARRYS
// CHECK_C(tmp);
//#endif
const int32_t res = -sreg;
m_local_regs[(DST_CODE + fp) & 0x3f] = res;
if (res == 0)
SR |= Z_MASK;
SR |= SIGN_TO_N(res);
m_icount -= m_clock_cycles_1;
if (GET_V)
execute_exception(get_trap_addr(TRAPNO_RANGE_ERROR));
} }
@ -6301,7 +6352,7 @@ void hyperstone_device::hypesrtone_ldwp_local_local()
// post increment the destination register if it's different from the source one // post increment the destination register if it's different from the source one
// (needed by Hidden Catch) // (needed by Hidden Catch)
if (src_code != dst_code || (m_op & 0x100)) if (src_code != dst_code)
m_local_regs[dst_code] += 4; m_local_regs[dst_code] += 4;
m_icount -= m_clock_cycles_1; m_icount -= m_clock_cycles_1;
@ -6338,7 +6389,7 @@ void hyperstone_device::hyperstone_lddp_local_local()
// post increment the destination register if it's different from the source one // post increment the destination register if it's different from the source one
// and from the "next source" one // and from the "next source" one
if (!(src_code == dst_code && (m_op & 0x100)) && !same_srcf_dst) if (src_code != dst_code && !same_srcf_dst)
{ {
m_local_regs[dst_code] += 8; m_local_regs[dst_code] += 8;
} }