e132xs: templated simple load ops, nw

This commit is contained in:
mooglyguy 2017-11-15 20:52:15 +01:00
parent 6ae640877b
commit 4e35aa3fb7
3 changed files with 85 additions and 107 deletions

View File

@ -1839,14 +1839,14 @@ void hyperstone_device::execute_run()
case 0xcd: execute_software(); break; // fcvtd
case 0xce: hyperstone_extend(); break;
case 0xcf: hyperstone_do(); break;
case 0xd0: hyperstone_ldwr_global(); break;
case 0xd1: hyperstone_ldwr_local(); break;
case 0xd2: hyperstone_lddr_global(); break;
case 0xd3: hyperstone_lddr_local(); break;
case 0xd4: hypesrtone_ldwp_global(); break;
case 0xd5: hypesrtone_ldwp_local(); break;
case 0xd6: hyperstone_lddp_global(); break;
case 0xd7: hyperstone_lddp_local(); break;
case 0xd0: hyperstone_ldwr<GLOBAL>(); break;
case 0xd1: hyperstone_ldwr<LOCAL>(); break;
case 0xd2: hyperstone_lddr<GLOBAL>(); break;
case 0xd3: hyperstone_lddr<LOCAL>(); break;
case 0xd4: hypesrtone_ldwp<GLOBAL>(); break;
case 0xd5: hypesrtone_ldwp<LOCAL>(); break;
case 0xd6: hyperstone_lddp<GLOBAL>(); break;
case 0xd7: hyperstone_lddp<LOCAL>(); break;
case 0xd8: hyperstone_stwr_global(); break;
case 0xd9: hyperstone_stwr_local(); break;
case 0xda: hyperstone_stdr_global(); break;

View File

@ -289,14 +289,10 @@ private:
template <reg_bank DST_GLOBAL> void hyperstone_set();
void hyperstone_ldwr_global();
void hyperstone_ldwr_local();
void hyperstone_lddr_global();
void hyperstone_lddr_local();
void hypesrtone_ldwp_global();
void hypesrtone_ldwp_local();
void hyperstone_lddp_global();
void hyperstone_lddp_local();
template <reg_bank SRC_GLOBAL> void hyperstone_ldwr();
template <reg_bank SRC_GLOBAL> void hyperstone_lddr();
template <reg_bank SRC_GLOBAL> void hypesrtone_ldwp();
template <reg_bank SRC_GLOBAL> void hyperstone_lddp();
void hyperstone_stwr_global();
void hyperstone_stwr_local();

View File

@ -4101,112 +4101,94 @@ void hyperstone_device::hyperstone_extend()
}
void hyperstone_device::hyperstone_ldwr_global()
{
check_delay_PC();
set_global_register(SRC_CODE, READ_W(m_local_regs[(DST_CODE + GET_FP) & 0x3f]));
m_icount -= m_clock_cycles_1;
}
void hyperstone_device::hyperstone_ldwr_local() // ldwr local,local
template <hyperstone_device::reg_bank SRC_GLOBAL>
void hyperstone_device::hyperstone_ldwr()
{
check_delay_PC();
const uint32_t fp = GET_FP;
m_local_regs[(SRC_CODE + fp) & 0x3f] = READ_W(m_local_regs[(DST_CODE + fp) & 0x3f]);
if (SRC_GLOBAL)
set_global_register(SRC_CODE, READ_W(m_local_regs[(DST_CODE + fp) & 0x3f]));
else
m_local_regs[(SRC_CODE + fp) & 0x3f] = READ_W(m_local_regs[(DST_CODE + fp) & 0x3f]);
m_icount -= m_clock_cycles_1;
}
void hyperstone_device::hyperstone_lddr_global()
{
check_delay_PC();
const uint32_t src_code = SRC_CODE;
const uint32_t dreg = m_local_regs[(DST_CODE + GET_FP) & 0x3f];
set_global_register(src_code, READ_W(dreg));
set_global_register(src_code + 1, READ_W(dreg + 4));
m_icount -= m_clock_cycles_2;
}
void hyperstone_device::hyperstone_lddr_local()
template <hyperstone_device::reg_bank SRC_GLOBAL>
void hyperstone_device::hyperstone_lddr()
{
check_delay_PC();
const uint32_t fp = GET_FP;
const uint32_t src_code = SRC_CODE + fp;
const uint32_t src_code = SRC_GLOBAL ? SRC_CODE : ((SRC_CODE + fp) & 0x3f);
const uint32_t dreg = m_local_regs[(DST_CODE + fp) & 0x3f];
m_local_regs[src_code & 0x3f] = READ_W(dreg);
m_local_regs[(src_code + 1) & 0x3f] = READ_W(dreg + 4);
m_icount -= m_clock_cycles_2;
}
void hyperstone_device::hypesrtone_ldwp_global()
{
check_delay_PC();
const uint32_t dst_code = (DST_CODE + GET_FP) & 0x3f;
set_global_register(SRC_CODE, READ_W(m_local_regs[dst_code]));
m_local_regs[dst_code] += 4;
m_icount -= m_clock_cycles_1;
}
void hyperstone_device::hypesrtone_ldwp_local()
{
check_delay_PC();
const uint32_t fp = GET_FP;
const uint32_t src_code = (SRC_CODE + fp) & 0x3f;
const uint32_t dst_code = (DST_CODE + fp) & 0x3f;
m_local_regs[src_code] = READ_W(m_local_regs[dst_code]);
// post increment the destination register if it's different from the source one
// (needed by Hidden Catch)
if (src_code != dst_code)
m_local_regs[dst_code] += 4;
m_icount -= m_clock_cycles_1;
}
void hyperstone_device::hyperstone_lddp_global()
{
check_delay_PC();
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];
set_global_register(src_code, READ_W(dreg));
set_global_register(src_code + 1, READ_W(dreg + 4));
m_local_regs[dst_code] += 8;
m_icount -= m_clock_cycles_2;
}
void hyperstone_device::hyperstone_lddp_local()
{
check_delay_PC();
const uint32_t fp = GET_FP;
const uint32_t src_code = SRC_CODE + fp;
const uint32_t dst_code = (DST_CODE + fp) & 0x3f;
const uint32_t dreg = m_local_regs[dst_code];
const bool same_srcf_dst = (((src_code + 1) & 0x3f) == dst_code);
m_local_regs[src_code & 0x3f] = READ_W(dreg);
m_local_regs[(src_code + 1) & 0x3f] = READ_W(dreg + 4);
// post increment the destination register if it's different from the source one
// and from the "next source" one
if (src_code != dst_code && !same_srcf_dst)
if (SRC_GLOBAL)
{
set_global_register(src_code, READ_W(dreg));
set_global_register(src_code + 1, READ_W(dreg + 4));
}
else
{
m_local_regs[src_code] = READ_W(dreg);
m_local_regs[(src_code + 1) & 0x3f] = READ_W(dreg + 4);
}
m_icount -= m_clock_cycles_2;
}
template <hyperstone_device::reg_bank SRC_GLOBAL>
void hyperstone_device::hypesrtone_ldwp()
{
check_delay_PC();
const uint32_t fp = GET_FP;
const uint32_t dst_code = (DST_CODE + fp) & 0x3f;
if (SRC_GLOBAL)
{
set_global_register(SRC_CODE, READ_W(m_local_regs[dst_code]));
m_local_regs[dst_code] += 4;
}
else
{
const uint32_t src_code = (SRC_CODE + fp) & 0x3f;
m_local_regs[src_code] = READ_W(m_local_regs[dst_code]);
// post increment the destination register if it's different from the source one
// (needed by Hidden Catch)
if (src_code != dst_code)
m_local_regs[dst_code] += 4;
}
m_icount -= m_clock_cycles_1;
}
template <hyperstone_device::reg_bank SRC_GLOBAL>
void hyperstone_device::hyperstone_lddp()
{
check_delay_PC();
const uint32_t fp = GET_FP;
const uint32_t src_code = SRC_GLOBAL ? SRC_CODE : ((SRC_CODE + fp) & 0x3f);
const uint32_t dst_code = (DST_CODE + fp) & 0x3f;
const uint32_t dreg = m_local_regs[dst_code];
if (SRC_GLOBAL)
{
set_global_register(src_code, READ_W(dreg));
set_global_register(src_code + 1, READ_W(dreg + 4));
m_local_regs[dst_code] += 8;
}
else
{
const uint32_t srcf_code = (src_code + 1) & 0x3f;
m_local_regs[src_code] = READ_W(dreg);
m_local_regs[srcf_code] = READ_W(dreg + 4);
// post increment the destination register if it's different from the source one
// and from the "next source" one
if (src_code != dst_code && srcf_code != dst_code)
m_local_regs[dst_code] += 8;
}
m_icount -= m_clock_cycles_2;
}