From 60b10988ba1eb52993695095834f5b3e11f467b3 Mon Sep 17 00:00:00 2001 From: mooglyguy Date: Wed, 15 Nov 2017 21:09:09 +0100 Subject: e132xs: templated simple store ops, nw --- src/devices/cpu/e132xs/e132xs.cpp | 16 +++--- src/devices/cpu/e132xs/e132xs.h | 12 ++--- src/devices/cpu/e132xs/e132xsop.hxx | 102 ++++++++++-------------------------- 3 files changed, 39 insertions(+), 91 deletions(-) diff --git a/src/devices/cpu/e132xs/e132xs.cpp b/src/devices/cpu/e132xs/e132xs.cpp index 0e3c58626a2..92893c3777e 100644 --- a/src/devices/cpu/e132xs/e132xs.cpp +++ b/src/devices/cpu/e132xs/e132xs.cpp @@ -1847,14 +1847,14 @@ void hyperstone_device::execute_run() case 0xd5: hypesrtone_ldwp(); break; case 0xd6: hyperstone_lddp(); break; case 0xd7: hyperstone_lddp(); break; - case 0xd8: hyperstone_stwr_global(); break; - case 0xd9: hyperstone_stwr_local(); break; - case 0xda: hyperstone_stdr_global(); break; - case 0xdb: hyperstone_stdr_local(); break; - case 0xdc: hyperstone_stwp_global(); break; - case 0xdd: hyperstone_stwp_local(); break; - case 0xde: hyperstone_stdp_global(); break; - case 0xdf: hyperstone_stdp_local(); break; + case 0xd8: hyperstone_stwr(); break; + case 0xd9: hyperstone_stwr(); break; + case 0xda: hyperstone_stdr(); break; + case 0xdb: hyperstone_stdr(); break; + case 0xdc: hyperstone_stwp(); break; + case 0xdd: hyperstone_stwp(); break; + case 0xde: hyperstone_stdp(); break; + case 0xdf: hyperstone_stdp(); break; case 0xe0: hyperstone_dbv(); break; case 0xe1: hyperstone_dbnv(); break; case 0xe2: hyperstone_dbe(); break; diff --git a/src/devices/cpu/e132xs/e132xs.h b/src/devices/cpu/e132xs/e132xs.h index 6ad97ea56a2..f7f424e9beb 100644 --- a/src/devices/cpu/e132xs/e132xs.h +++ b/src/devices/cpu/e132xs/e132xs.h @@ -294,14 +294,10 @@ private: template void hypesrtone_ldwp(); template void hyperstone_lddp(); - void hyperstone_stwr_global(); - void hyperstone_stwr_local(); - void hyperstone_stdr_global(); - void hyperstone_stdr_local(); - void hyperstone_stwp_global(); - void hyperstone_stwp_local(); - void hyperstone_stdp_global(); - void hyperstone_stdp_local(); + template void hyperstone_stwr(); + template void hyperstone_stdr(); + template void hyperstone_stwp(); + template void hyperstone_stdp(); void hyperstone_dbv(); void hyperstone_dbnv(); diff --git a/src/devices/cpu/e132xs/e132xsop.hxx b/src/devices/cpu/e132xs/e132xsop.hxx index 00b230aedd3..0b078527bf2 100644 --- a/src/devices/cpu/e132xs/e132xsop.hxx +++ b/src/devices/cpu/e132xs/e132xsop.hxx @@ -4193,35 +4193,30 @@ void hyperstone_device::hyperstone_lddp() m_icount -= m_clock_cycles_2; } -void hyperstone_device::hyperstone_stwr_global() +template +void hyperstone_device::hyperstone_stwr() { check_delay_PC(); - const uint32_t src_code = SRC_CODE; - const uint32_t sreg = ((src_code == SR_REGISTER) ? 0 : m_global_regs[src_code]); - WRITE_W(m_local_regs[(DST_CODE + GET_FP) & 0x3f], sreg); + const uint32_t fp = GET_FP; + const uint32_t src_code = SRC_GLOBAL ? SRC_CODE : ((SRC_CODE + fp) & 0x3f); + const uint32_t sreg = (SRC_GLOBAL && src_code == SR_REGISTER) ? 0 : (SRC_GLOBAL ? m_global_regs : m_local_regs)[src_code]; + WRITE_W(m_local_regs[(DST_CODE + fp) & 0x3f], sreg); m_icount -= m_clock_cycles_1; } -void hyperstone_device::hyperstone_stwr_local() +template +void hyperstone_device::hyperstone_stdr() { check_delay_PC(); const uint32_t fp = GET_FP; - WRITE_W(m_local_regs[(DST_CODE + fp) & 0x3f], m_local_regs[(SRC_CODE + fp) & 0x3f]); - - m_icount -= m_clock_cycles_1; -} - -void hyperstone_device::hyperstone_stdr_global() -{ - check_delay_PC(); + const uint32_t src_code = SRC_GLOBAL ? SRC_CODE : ((SRC_CODE + fp) & 0x3f); + const uint32_t srcf_code = SRC_GLOBAL ? (SRC_CODE + 1) : ((src_code + 1) & 0x3f); + const uint32_t sreg = (SRC_GLOBAL && src_code == SR_REGISTER) ? 0 : (SRC_GLOBAL ? m_global_regs : m_local_regs)[src_code]; + const uint32_t sregf = (SRC_GLOBAL && src_code == SR_REGISTER) ? 0 : (SRC_GLOBAL ? m_global_regs : m_local_regs)[srcf_code]; - const uint32_t src_code = SRC_CODE; - const bool src_is_sr = (src_code == SR_REGISTER); - const uint32_t sreg = src_is_sr ? 0 : m_global_regs[src_code]; - const uint32_t sregf = src_is_sr ? 0 : m_global_regs[src_code + 1]; const uint32_t dreg = m_local_regs[(DST_CODE + GET_FP) & 0x3f]; WRITE_W(dreg, sreg); @@ -4230,28 +4225,16 @@ void hyperstone_device::hyperstone_stdr_global() m_icount -= m_clock_cycles_2; } -void hyperstone_device::hyperstone_stdr_local() +template +void hyperstone_device::hyperstone_stwp() { check_delay_PC(); const uint32_t fp = GET_FP; - const uint32_t src_code = (SRC_CODE + fp) & 0x3f; - const uint32_t dreg = m_local_regs[(DST_CODE + fp) & 0x3f]; - - WRITE_W(dreg, m_local_regs[src_code]); - WRITE_W(dreg + 4, m_local_regs[(src_code + 1) & 0x3f]); - - m_icount -= m_clock_cycles_2; -} - -void hyperstone_device::hyperstone_stwp_global() -{ - check_delay_PC(); - - const uint32_t src_code = SRC_CODE; - const uint32_t sreg = ((src_code == SR_REGISTER) ? 0 : m_global_regs[src_code]); + const uint32_t src_code = SRC_GLOBAL ? SRC_CODE : ((SRC_CODE + fp) & 0x3f); + const uint32_t sreg = (SRC_GLOBAL && src_code == SR_REGISTER) ? 0 : (SRC_GLOBAL ? m_global_regs : m_local_regs)[src_code]; - const uint32_t dst_code = (DST_CODE + GET_FP) & 0x3f; + const uint32_t dst_code = (DST_CODE + fp) & 0x3f; const uint32_t dreg = m_local_regs[dst_code]; WRITE_W(dreg, sreg); @@ -4260,63 +4243,32 @@ void hyperstone_device::hyperstone_stwp_global() m_icount -= m_clock_cycles_1; } -void hyperstone_device::hyperstone_stwp_local() +template +void hyperstone_device::hyperstone_stdp() { check_delay_PC(); const uint32_t fp = GET_FP; - const uint32_t dst_code = (DST_CODE + fp) & 0x3f; - WRITE_W(m_local_regs[dst_code], m_local_regs[(SRC_CODE + fp) & 0x3f]); - m_local_regs[dst_code] += 4; - - m_icount -= m_clock_cycles_1; -} - -void hyperstone_device::hyperstone_stdp_global() -{ - check_delay_PC(); - - const uint32_t src_code = SRC_CODE; - const uint32_t sreg = (src_code == SR_REGISTER) ? 0 : m_global_regs[src_code]; - const uint32_t sregf = (src_code == SR_REGISTER) ? 0 : m_global_regs[src_code + 1]; + const uint32_t src_code = SRC_GLOBAL ? SRC_CODE : ((SRC_CODE + fp) & 0x3f); + const uint32_t srcf_code = SRC_GLOBAL ? (src_code + 1) : ((src_code + 1) & 0x3f); + const uint32_t sreg = (SRC_GLOBAL && src_code == SR_REGISTER) ? 0 : (SRC_GLOBAL ? m_global_regs : m_local_regs)[src_code]; + const uint32_t sregf = (SRC_GLOBAL && src_code == SR_REGISTER) ? 0 : (SRC_GLOBAL ? m_global_regs : m_local_regs)[srcf_code]; - const uint32_t dst_code = (DST_CODE + GET_FP) & 0x3f; + const uint32_t dst_code = (DST_CODE + fp) & 0x3f; const uint32_t dreg = m_local_regs[dst_code]; WRITE_W(dreg, sreg); - WRITE_W(dreg + 4, sregf); - m_local_regs[dst_code] += 8; - - m_icount -= m_clock_cycles_2; -} -void hyperstone_device::hyperstone_stdp_local() -{ - check_delay_PC(); - const uint32_t fp = GET_FP; - const uint32_t src_code = SRC_CODE + fp; - const uint32_t srcf_code = (SRC_CODE + fp + 1) & 0x3f; - const uint32_t dst_code = (DST_CODE + fp) & 0x3f; - - const uint32_t sreg = m_local_regs[src_code & 0x3f]; - const uint32_t sregf = m_local_regs[srcf_code]; - const uint32_t dreg = m_local_regs[dst_code]; /* registers offset by frame pointer */ - - bool same_srcf_dst = (srcf_code == dst_code); - - WRITE_W(dreg, sreg); m_local_regs[dst_code] += 8; - if (same_srcf_dst) - WRITE_W(dreg + 4, sregf + 8); // because DREG == SREGF and DREG has been incremented - else + if (SRC_GLOBAL || srcf_code != dst_code) WRITE_W(dreg + 4, sregf); + else + WRITE_W(dreg + 4, sregf + 8); // because DREG == SREGF and DREG has been incremented m_icount -= m_clock_cycles_2; } - - void hyperstone_device::hyperstone_dbv() { if (SR & V_MASK) -- cgit v1.2.3