mirror of
https://github.com/holub/mame
synced 2025-04-25 17:56:43 +03:00
e132xs: templatized call opcode, nw
This commit is contained in:
parent
843cf2982e
commit
f89e9af986
@ -1818,8 +1818,8 @@ void hyperstone_device::execute_run()
|
||||
case 0xeb: hyperstone_db<COND_NZ, IS_CLEAR>(); break;
|
||||
case 0xec: hyperstone_dbr(); break;
|
||||
case 0xed: hyperstone_frame(); break;
|
||||
case 0xee: hyperstone_call_global(); break;
|
||||
case 0xef: hyperstone_call_local(); break;
|
||||
case 0xee: hyperstone_call<GLOBAL>(); break;
|
||||
case 0xef: hyperstone_call<LOCAL>(); break;
|
||||
case 0xf0: hyperstone_b<COND_V, IS_SET>(); break;
|
||||
case 0xf1: hyperstone_b<COND_V, IS_CLEAR>(); break;
|
||||
case 0xf2: hyperstone_b<COND_Z, IS_SET>(); break;
|
||||
|
@ -363,8 +363,7 @@ private:
|
||||
void hyperstone_dbr();
|
||||
|
||||
void hyperstone_frame();
|
||||
void hyperstone_call_global();
|
||||
void hyperstone_call_local();
|
||||
template <hyperstone_device::reg_bank SRC_GLOBAL> void hyperstone_call();
|
||||
|
||||
void hyperstone_trap();
|
||||
void hyperstone_extend();
|
||||
|
@ -2756,7 +2756,8 @@ void hyperstone_device::hyperstone_frame()
|
||||
m_icount -= m_clock_cycles_1;
|
||||
}
|
||||
|
||||
void hyperstone_device::hyperstone_call_global()
|
||||
template <hyperstone_device::reg_bank SRC_GLOBAL>
|
||||
void hyperstone_device::hyperstone_call()
|
||||
{
|
||||
uint16_t imm_1 = READ_OP(PC);
|
||||
PC += 2;
|
||||
@ -2791,10 +2792,7 @@ void hyperstone_device::hyperstone_call_global()
|
||||
uint32_t src_code = SRC_CODE;
|
||||
uint32_t dst_code = DST_CODE;
|
||||
|
||||
uint32_t sreg = m_global_regs[src_code];
|
||||
|
||||
if (src_code == SR_REGISTER)
|
||||
sreg = 0;
|
||||
uint32_t sreg = (SRC_GLOBAL && src_code == SR_REGISTER) ? 0 : (SRC_GLOBAL ? m_global_regs : m_local_regs)[src_code];
|
||||
|
||||
if (!DST_CODE)
|
||||
dst_code = 16;
|
||||
@ -2818,65 +2816,6 @@ void hyperstone_device::hyperstone_call_global()
|
||||
m_icount -= m_clock_cycles_1;
|
||||
}
|
||||
|
||||
void hyperstone_device::hyperstone_call_local()
|
||||
{
|
||||
uint16_t imm_1 = READ_OP(PC);
|
||||
PC += 2;
|
||||
|
||||
int32_t extra_s = 0;
|
||||
|
||||
if (imm_1 & 0x8000)
|
||||
{
|
||||
uint16_t imm_2 = READ_OP(PC);
|
||||
|
||||
PC += 2;
|
||||
SET_ILC(3<<19);
|
||||
|
||||
extra_s = imm_2;
|
||||
extra_s |= ((imm_1 & 0x3fff) << 16);
|
||||
|
||||
if (imm_1 & 0x4000)
|
||||
extra_s |= 0xc0000000;
|
||||
}
|
||||
else
|
||||
{
|
||||
extra_s = imm_1 & 0x3fff;
|
||||
|
||||
SET_ILC(2<<19);
|
||||
|
||||
if (imm_1 & 0x4000)
|
||||
extra_s |= 0xffffc000;
|
||||
}
|
||||
|
||||
check_delay_PC();
|
||||
|
||||
uint32_t src_code = SRC_CODE;
|
||||
uint32_t dst_code = DST_CODE;
|
||||
|
||||
if (!DST_CODE)
|
||||
dst_code = 16;
|
||||
|
||||
uint32_t fp = GET_FP;
|
||||
extra_s = (extra_s & ~1) + m_local_regs[(src_code + fp) & 0x3f];
|
||||
|
||||
uint32_t dreg_index = dst_code + fp;
|
||||
m_local_regs[dreg_index & 0x3f] = (PC & ~1) | GET_S;
|
||||
m_local_regs[(dreg_index + 1) & 0x3f] = SR;
|
||||
|
||||
SET_FP(fp + dst_code);
|
||||
SET_FL(6); //default value for call
|
||||
SR &= ~M_MASK;
|
||||
|
||||
PC = extra_s;
|
||||
|
||||
m_intblock = 2;
|
||||
|
||||
//TODO: add interrupt locks, errors, ....
|
||||
|
||||
//TODO: no 1!
|
||||
m_icount -= m_clock_cycles_1;
|
||||
}
|
||||
|
||||
template <hyperstone_device::branch_condition CONDITION, hyperstone_device::condition_set COND_SET>
|
||||
void hyperstone_device::hyperstone_b()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user