mirror of
https://github.com/holub/mame
synced 2025-04-23 08:49:55 +03:00
e132xs checkpoint, nw.
This commit is contained in:
parent
0cbfba5a51
commit
688885c9e4
@ -2422,79 +2422,6 @@ void hyperstone_device::hyperstone_testlz()
|
||||
m_icount -= m_clock_cycles_2;
|
||||
}
|
||||
|
||||
void hyperstone_device::hyperstone_ldxx2(regs_decode &decode)
|
||||
{
|
||||
if (DST_IS_PC || DST_IS_SR)
|
||||
{
|
||||
DEBUG_PRINTF(("Denoted PC or SR in hyperstone_ldxx2. PC = %08X\n", PC));
|
||||
}
|
||||
else
|
||||
{
|
||||
switch( decode.sub_type )
|
||||
{
|
||||
case 0: // LDBS.N
|
||||
SET_SREG((int32_t)(int8_t)READ_B(DREG));
|
||||
|
||||
if (!decode.same_src_dst)
|
||||
SET_DREG(DREG + EXTRA_S);
|
||||
break;
|
||||
|
||||
case 1: // LDBU.N
|
||||
SET_SREG(READ_B(DREG));
|
||||
|
||||
if(!decode.same_src_dst)
|
||||
SET_DREG(DREG + EXTRA_S);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (EXTRA_S & 1) // LDHS.N
|
||||
SET_SREG((int32_t)(int16_t)READ_HW(DREG));
|
||||
else // LDHU.N
|
||||
SET_SREG(READ_HW(DREG));
|
||||
|
||||
if(!decode.same_src_dst)
|
||||
SET_DREG(DREG + (EXTRA_S & ~1));
|
||||
break;
|
||||
|
||||
case 3:
|
||||
switch (EXTRA_S & 3)
|
||||
{
|
||||
case 0: // LDW.N
|
||||
SET_SREG(READ_W(DREG));
|
||||
if(!decode.same_src_dst)
|
||||
SET_DREG(DREG + (EXTRA_S & ~1));
|
||||
break;
|
||||
case 1: // LDD.N
|
||||
SET_SREG(READ_W(DREG));
|
||||
SET_SREGF(READ_W(DREG + 4));
|
||||
|
||||
if (!decode.same_src_dst && !decode.same_srcf_dst)
|
||||
SET_DREG(DREG + (EXTRA_S & ~1));
|
||||
|
||||
m_icount -= m_clock_cycles_1; // extra cycle
|
||||
break;
|
||||
case 2: // Reserved
|
||||
DEBUG_PRINTF(("Executed Reserved instruction in hyperstone_ldxx2. PC = %08X\n", PC));
|
||||
break;
|
||||
case 3: // LDW.S
|
||||
if (DREG < SP)
|
||||
SET_SREG(READ_W(DREG));
|
||||
else
|
||||
SET_SREG(m_local_regs[(DREG & 0xfc) >> 2]);
|
||||
|
||||
if (!decode.same_src_dst)
|
||||
SET_DREG(DREG + (EXTRA_S & ~3));
|
||||
|
||||
m_icount -= m_clock_cycles_2; // extra cycles
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_icount -= m_clock_cycles_1;
|
||||
}
|
||||
|
||||
void hyperstone_device::hyperstone_stxx2(regs_decode &decode)
|
||||
{
|
||||
if( SRC_IS_SR )
|
||||
@ -2991,7 +2918,7 @@ void hyperstone_device::execute_run()
|
||||
case 0x47: hyperstone_not_local_local(); break;
|
||||
case 0x48: op48(); break;
|
||||
case 0x49: op49(); break;
|
||||
case 0x4a: op4a(); break;
|
||||
case 0x4a: hyperstone_sub_local_global(); break;
|
||||
case 0x4b: hyperstone_sub_local_local(); break;
|
||||
case 0x4c: op4c(); break;
|
||||
case 0x4d: op4d(); break;
|
||||
@ -3067,7 +2994,7 @@ void hyperstone_device::execute_run()
|
||||
case 0x93: hyperstone_ldxx1_local_local(); break;
|
||||
case 0x94: hyperstone_ldxx2_global_global(); break;
|
||||
case 0x95: hyperstone_ldxx2_global_local(); break;
|
||||
case 0x96: op96(); break;
|
||||
case 0x96: hyperstone_ldxx2_local_global(); break;
|
||||
case 0x97: hyperstone_ldxx2_local_local(); break;
|
||||
case 0x98: hyperstone_stxx1_global_global(); break;
|
||||
case 0x99: hyperstone_stxx1_global_local(); break;
|
||||
|
@ -262,6 +262,7 @@ private:
|
||||
void hyperstone_cmpb_local_local();
|
||||
void hyperstone_subc(regs_decode &decode);
|
||||
void hyperstone_sub(regs_decode &decode);
|
||||
void hyperstone_sub_local_global();
|
||||
void hyperstone_sub_local_local();
|
||||
void hyperstone_subs(regs_decode &decode);
|
||||
void hyperstone_addc(regs_decode &decode);
|
||||
@ -338,9 +339,9 @@ private:
|
||||
void hyperstone_ldxx1_global_local();
|
||||
void hyperstone_ldxx1_local_global();
|
||||
void hyperstone_ldxx1_local_local();
|
||||
void hyperstone_ldxx2(regs_decode &decode);
|
||||
void hyperstone_ldxx2_global_global();
|
||||
void hyperstone_ldxx2_global_local();
|
||||
void hyperstone_ldxx2_local_global();
|
||||
void hyperstone_ldxx2_local_local();
|
||||
void hyperstone_stxx1_global_global();
|
||||
void hyperstone_stxx1_global_local();
|
||||
@ -444,7 +445,7 @@ private:
|
||||
|
||||
|
||||
void op40(); void op41(); void op42(); void op43();
|
||||
void op48(); void op49(); void op4a(); void op4c(); void op4d(); void op4e(); void op4f();
|
||||
void op48(); void op49(); void op4c(); void op4d(); void op4e(); void op4f();
|
||||
void op50(); void op51();
|
||||
void op58(); void op59(); void op5a(); void op5c(); void op5d(); void op5e(); void op5f();
|
||||
|
||||
@ -453,7 +454,7 @@ private:
|
||||
void op7c(); void op7d(); void op7e(); void op7f();
|
||||
void op87();
|
||||
|
||||
void op96();
|
||||
|
||||
void op9d();
|
||||
void opa0(); void opa1(); void opa4(); void opa5();
|
||||
|
||||
|
@ -1528,6 +1528,7 @@ void hyperstone_device::op43()
|
||||
decode.same_src_dst = (SRC_CODE == DST_CODE);
|
||||
decode.same_src_dstf = (SRC_CODE == ((DST_CODE + 1) & 0x3f));
|
||||
decode.same_srcf_dst = (((SRC_CODE + 1) & 0x3f) == DST_CODE);
|
||||
|
||||
hyperstone_subc(decode);
|
||||
}
|
||||
|
||||
@ -1625,20 +1626,32 @@ void hyperstone_device::op49()
|
||||
hyperstone_sub(decode);
|
||||
}
|
||||
|
||||
void hyperstone_device::op4a()
|
||||
void hyperstone_device::hyperstone_sub_local_global()
|
||||
{
|
||||
regs_decode decode;
|
||||
check_delay_PC();
|
||||
decode.src = SRC_CODE;
|
||||
decode.dst = DST_CODE;
|
||||
|
||||
decode.src_is_local = 0;
|
||||
SREG = m_global_regs[decode.src];
|
||||
const uint32_t src_code = SRC_CODE;
|
||||
const uint32_t sreg = (src_code == SR_REGISTER) ? (SR & C_MASK) : m_global_regs[src_code];
|
||||
const uint32_t dst_code = (DST_CODE + GET_FP) & 0x3f;
|
||||
uint32_t dreg = m_local_regs[dst_code];
|
||||
|
||||
decode.dst_is_local = 1;
|
||||
DREG = m_local_regs[(decode.dst + GET_FP) & 0x3f]; /* registers offset by frame pointer */
|
||||
const uint64_t tmp = (uint64_t)dreg - (uint64_t)sreg;
|
||||
|
||||
hyperstone_sub(decode);
|
||||
SR &= ~(C_MASK | V_MASK | Z_MASK | N_MASK);
|
||||
|
||||
SR |= (tmp & 0x100000000L) >> 32;
|
||||
|
||||
if ((tmp ^ dreg) & (dreg ^ sreg) & 0x80000000)
|
||||
SR |= V_MASK;
|
||||
|
||||
dreg -= sreg;
|
||||
m_local_regs[dst_code] = dreg;
|
||||
|
||||
if (dreg == 0)
|
||||
SR |= Z_MASK;
|
||||
SR |= SIGN_TO_N(dreg);
|
||||
|
||||
m_icount -= m_clock_cycles_1;
|
||||
}
|
||||
|
||||
void hyperstone_device::hyperstone_sub_local_local()
|
||||
@ -3700,26 +3713,90 @@ void hyperstone_device::hyperstone_ldxx2_global_local()
|
||||
m_icount -= m_clock_cycles_1;
|
||||
}
|
||||
|
||||
void hyperstone_device::op96()
|
||||
void hyperstone_device::hyperstone_ldxx2_local_global()
|
||||
{
|
||||
regs_decode decode;
|
||||
decode_dis(decode);
|
||||
uint16_t next_1 = READ_OP(PC);
|
||||
PC += 2;
|
||||
|
||||
const uint16_t sub_type = next_1 & 0x3000;
|
||||
|
||||
uint32_t extra_s;
|
||||
if (next_1 & 0x8000)
|
||||
{
|
||||
const uint16_t next_2 = READ_OP(PC);
|
||||
PC += 2;
|
||||
m_instruction_length = (3<<19);
|
||||
|
||||
extra_s = next_2;
|
||||
extra_s |= ((next_1 & 0xfff) << 16);
|
||||
|
||||
if (next_1 & 0x4000)
|
||||
extra_s |= 0xf0000000;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_instruction_length = (2<<19);
|
||||
extra_s = next_1 & 0xfff;
|
||||
|
||||
if (next_1 & 0x4000)
|
||||
extra_s |= 0xfffff000;
|
||||
}
|
||||
|
||||
check_delay_PC();
|
||||
decode.src = SRC_CODE;
|
||||
decode.dst = DST_CODE;
|
||||
decode.src_is_local = 0;
|
||||
|
||||
SREG = m_global_regs[decode.src];
|
||||
SREGF = m_global_regs[decode.src + 1];
|
||||
const uint32_t src_code = SRC_CODE;
|
||||
const uint32_t dst_code = (DST_CODE + GET_FP) & 0x3f;
|
||||
const uint32_t dreg = m_local_regs[dst_code];
|
||||
|
||||
decode.dst_is_local = 1;
|
||||
DREG = m_local_regs[(decode.dst + GET_FP) & 0x3f]; /* registers offset by frame pointer */
|
||||
DREGF = m_local_regs[(decode.dst + 1 + GET_FP) & 0x3f];
|
||||
switch (sub_type)
|
||||
{
|
||||
case 0x0000: // LDBS.N
|
||||
set_global_register(src_code, (int32_t)(int8_t)READ_B(dreg));
|
||||
m_local_regs[dst_code] += extra_s;
|
||||
break;
|
||||
|
||||
decode.same_src_dst = 0;
|
||||
decode.same_src_dstf = 0;
|
||||
decode.same_srcf_dst = 0;
|
||||
hyperstone_ldxx2(decode);
|
||||
case 0x1000: // LDBU.N
|
||||
set_global_register(src_code, READ_B(dreg));
|
||||
m_local_regs[dst_code] += extra_s;
|
||||
break;
|
||||
|
||||
case 0x2000:
|
||||
if (extra_s & 1) // LDHS.N
|
||||
set_global_register(src_code, (int32_t)(int16_t)READ_HW(dreg));
|
||||
else // LDHU.N
|
||||
set_global_register(src_code, READ_HW(dreg));
|
||||
m_local_regs[dst_code] += extra_s & ~1;
|
||||
break;
|
||||
|
||||
case 0x3000:
|
||||
switch (extra_s & 3)
|
||||
{
|
||||
case 0: // LDW.N
|
||||
set_global_register(src_code, READ_W(dreg));
|
||||
m_local_regs[dst_code] += extra_s & ~1;
|
||||
break;
|
||||
case 1: // LDD.N
|
||||
set_global_register(src_code, READ_W(dreg));
|
||||
set_global_register(src_code + 1, READ_W(dreg + 4));
|
||||
m_local_regs[dst_code] += extra_s & ~1;
|
||||
m_icount -= m_clock_cycles_1; // extra cycle
|
||||
break;
|
||||
case 2: // Reserved
|
||||
DEBUG_PRINTF(("Executed Reserved instruction in hyperstone_ldxx2. PC = %08X\n", PC));
|
||||
break;
|
||||
case 3: // LDW.S
|
||||
if (dreg < SP)
|
||||
set_global_register(src_code, READ_W(dreg));
|
||||
else
|
||||
set_global_register(src_code, m_local_regs[(dreg & 0xfc) >> 2]);
|
||||
m_local_regs[dst_code] += extra_s & ~3;
|
||||
m_icount -= m_clock_cycles_2; // extra cycles
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
m_icount -= m_clock_cycles_1;
|
||||
}
|
||||
|
||||
void hyperstone_device::hyperstone_ldxx2_local_local()
|
||||
|
Loading…
Reference in New Issue
Block a user