summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/asap/asap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/asap/asap.cpp')
-rw-r--r--src/devices/cpu/asap/asap.cpp95
1 files changed, 44 insertions, 51 deletions
diff --git a/src/devices/cpu/asap/asap.cpp b/src/devices/cpu/asap/asap.cpp
index 8edc3734b08..53f66aa1900 100644
--- a/src/devices/cpu/asap/asap.cpp
+++ b/src/devices/cpu/asap/asap.cpp
@@ -14,7 +14,6 @@
#include "emu.h"
#include "asap.h"
#include "asapdasm.h"
-#include "debugger.h"
//**************************************************************************
@@ -456,8 +455,8 @@ inline void asap_device::check_irqs()
{
if (m_irq_state && m_iflag)
{
+ standard_irq_callback(ASAP_IRQ0, m_pc);
generate_exception(EXCEPTION_INTERRUPT);
- standard_irq_callback(ASAP_IRQ0);
}
}
@@ -613,9 +612,9 @@ void asap_device::bsp()
{
if ((int32_t)m_znflag > 0)
{
- m_nextpc = m_ppc + ((int32_t)(m_op << 10) >> 8);
+ m_nextpc = m_ppc + util::sext(m_op << 2, 24);
- fetch_instruction();
+ fetch_instruction_debug();
m_pc = m_nextpc;
m_nextpc = ~0;
@@ -628,9 +627,9 @@ void asap_device::bmz()
{
if ((int32_t)m_znflag <= 0)
{
- m_nextpc = m_ppc + ((int32_t)(m_op << 10) >> 8);
+ m_nextpc = m_ppc + util::sext(m_op << 2, 24);
- fetch_instruction();
+ fetch_instruction_debug();
m_pc = m_nextpc;
m_nextpc = ~0;
@@ -643,9 +642,9 @@ void asap_device::bgt()
{
if (m_znflag != 0 && (int32_t)(m_znflag ^ m_vflag) >= 0)
{
- m_nextpc = m_ppc + ((int32_t)(m_op << 10) >> 8);
+ m_nextpc = m_ppc + util::sext(m_op << 2, 24);
- fetch_instruction();
+ fetch_instruction_debug();
m_pc = m_nextpc;
m_nextpc = ~0;
@@ -658,9 +657,9 @@ void asap_device::ble()
{
if (m_znflag == 0 || (int32_t)(m_znflag ^ m_vflag) < 0)
{
- m_nextpc = m_ppc + ((int32_t)(m_op << 10) >> 8);
+ m_nextpc = m_ppc + util::sext(m_op << 2, 24);
- fetch_instruction();
+ fetch_instruction_debug();
m_pc = m_nextpc;
m_nextpc = ~0;
@@ -673,9 +672,9 @@ void asap_device::bge()
{
if ((int32_t)(m_znflag ^ m_vflag) >= 0)
{
- m_nextpc = m_ppc + ((int32_t)(m_op << 10) >> 8);
+ m_nextpc = m_ppc + util::sext(m_op << 2, 24);
- fetch_instruction();
+ fetch_instruction_debug();
m_pc = m_nextpc;
m_nextpc = ~0;
@@ -688,9 +687,9 @@ void asap_device::blt()
{
if ((int32_t)(m_znflag ^ m_vflag) < 0)
{
- m_nextpc = m_ppc + ((int32_t)(m_op << 10) >> 8);
+ m_nextpc = m_ppc + util::sext(m_op << 2, 24);
- fetch_instruction();
+ fetch_instruction_debug();
m_pc = m_nextpc;
m_nextpc = ~0;
@@ -703,9 +702,9 @@ void asap_device::bhi()
{
if (m_znflag != 0 && m_cflag)
{
- m_nextpc = m_ppc + ((int32_t)(m_op << 10) >> 8);
+ m_nextpc = m_ppc + util::sext(m_op << 2, 24);
- fetch_instruction();
+ fetch_instruction_debug();
m_pc = m_nextpc;
m_nextpc = ~0;
@@ -718,9 +717,9 @@ void asap_device::bls()
{
if (m_znflag == 0 || !m_cflag)
{
- m_nextpc = m_ppc + ((int32_t)(m_op << 10) >> 8);
+ m_nextpc = m_ppc + util::sext(m_op << 2, 24);
- fetch_instruction();
+ fetch_instruction_debug();
m_pc = m_nextpc;
m_nextpc = ~0;
@@ -733,9 +732,9 @@ void asap_device::bcc()
{
if (!m_cflag)
{
- m_nextpc = m_ppc + ((int32_t)(m_op << 10) >> 8);
+ m_nextpc = m_ppc + util::sext(m_op << 2, 24);
- fetch_instruction();
+ fetch_instruction_debug();
m_pc = m_nextpc;
m_nextpc = ~0;
@@ -748,9 +747,9 @@ void asap_device::bcs()
{
if (m_cflag)
{
- m_nextpc = m_ppc + ((int32_t)(m_op << 10) >> 8);
+ m_nextpc = m_ppc + util::sext(m_op << 2, 24);
- fetch_instruction();
+ fetch_instruction_debug();
m_pc = m_nextpc;
m_nextpc = ~0;
@@ -763,9 +762,9 @@ void asap_device::bpl()
{
if ((int32_t)m_znflag >= 0)
{
- m_nextpc = m_ppc + ((int32_t)(m_op << 10) >> 8);
+ m_nextpc = m_ppc + util::sext(m_op << 2, 24);
- fetch_instruction();
+ fetch_instruction_debug();
m_pc = m_nextpc;
m_nextpc = ~0;
@@ -778,9 +777,9 @@ void asap_device::bmi()
{
if ((int32_t)m_znflag < 0)
{
- m_nextpc = m_ppc + ((int32_t)(m_op << 10) >> 8);
+ m_nextpc = m_ppc + util::sext(m_op << 2, 24);
- fetch_instruction();
+ fetch_instruction_debug();
m_pc = m_nextpc;
m_nextpc = ~0;
@@ -793,9 +792,9 @@ void asap_device::bne()
{
if (m_znflag != 0)
{
- m_nextpc = m_ppc + ((int32_t)(m_op << 10) >> 8);
+ m_nextpc = m_ppc + util::sext(m_op << 2, 24);
- fetch_instruction();
+ fetch_instruction_debug();
m_pc = m_nextpc;
m_nextpc = ~0;
@@ -808,9 +807,9 @@ void asap_device::beq()
{
if (m_znflag == 0)
{
- m_nextpc = m_ppc + ((int32_t)(m_op << 10) >> 8);
+ m_nextpc = m_ppc + util::sext(m_op << 2, 24);
- fetch_instruction();
+ fetch_instruction_debug();
m_pc = m_nextpc;
m_nextpc = ~0;
@@ -823,9 +822,9 @@ void asap_device::bvc()
{
if ((int32_t)m_vflag >= 0)
{
- m_nextpc = m_ppc + ((int32_t)(m_op << 10) >> 8);
+ m_nextpc = m_ppc + util::sext(m_op << 2, 24);
- fetch_instruction();
+ fetch_instruction_debug();
m_pc = m_nextpc;
m_nextpc = ~0;
@@ -838,9 +837,9 @@ void asap_device::bvs()
{
if ((int32_t)m_vflag < 0)
{
- m_nextpc = m_ppc + ((int32_t)(m_op << 10) >> 8);
+ m_nextpc = m_ppc + util::sext(m_op << 2, 24);
- fetch_instruction();
+ fetch_instruction_debug();
m_pc = m_nextpc;
m_nextpc = ~0;
@@ -854,9 +853,9 @@ void asap_device::bvs()
void asap_device::bsr()
{
DSTVAL = m_pc + 4;
- m_nextpc = m_ppc + ((int32_t)(m_op << 10) >> 8);
+ m_nextpc = m_ppc + util::sext(m_op << 2, 24);
- fetch_instruction();
+ fetch_instruction_debug();
m_pc = m_nextpc;
m_nextpc = ~0;
@@ -866,9 +865,9 @@ void asap_device::bsr()
void asap_device::bsr_0()
{
- m_nextpc = m_ppc + ((int32_t)(m_op << 10) >> 8);
+ m_nextpc = m_ppc + util::sext(m_op << 2, 24);
- fetch_instruction();
+ fetch_instruction_debug();
m_pc = m_nextpc;
m_nextpc = ~0;
@@ -1558,25 +1557,19 @@ void asap_device::ashl_c0()
void asap_device::rotl()
{
- uint32_t src1 = SRC1VAL;
- uint32_t src2 = SRC2VAL & 31;
- DSTVAL = (src1 << src2) | (src1 >> (32 - src2));
+ DSTVAL = rotl_32(SRC1VAL, SRC2VAL);
}
void asap_device::rotl_c()
{
- uint32_t src1 = SRC1VAL;
- uint32_t src2 = SRC2VAL & 31;
- uint32_t dst = (src1 << src2) | (src1 >> (32 - src2));
+ uint32_t dst = rotl_32(SRC1VAL, SRC2VAL);
SET_ZN(dst);
DSTVAL = dst;
}
void asap_device::rotl_c0()
{
- uint32_t src1 = SRC1VAL;
- uint32_t src2 = SRC2VAL & 31;
- uint32_t dst = (src1 << src2) | (src1 >> (32 - src2));
+ uint32_t dst = rotl_32(SRC1VAL, SRC2VAL);
SET_ZN(dst);
}
@@ -1603,7 +1596,7 @@ void asap_device::jsr()
DSTVAL = m_pc + 4;
m_nextpc = SRC1VAL + (SRC2VAL << 2);
- fetch_instruction();
+ fetch_instruction_debug();
m_pc = m_nextpc;
m_nextpc = ~0;
@@ -1615,7 +1608,7 @@ void asap_device::jsr_0()
{
m_nextpc = SRC1VAL + (SRC2VAL << 2);
- fetch_instruction();
+ fetch_instruction_debug();
m_pc = m_nextpc;
m_nextpc = ~0;
@@ -1629,7 +1622,7 @@ void asap_device::jsr_c()
m_nextpc = SRC1VAL + (SRC2VAL << 2);
m_iflag = m_pflag;
- fetch_instruction();
+ fetch_instruction_debug();
m_pc = m_nextpc;
m_nextpc = ~0;
@@ -1643,7 +1636,7 @@ void asap_device::jsr_c0()
m_nextpc = SRC1VAL + (SRC2VAL << 2);
m_iflag = m_pflag;
- fetch_instruction();
+ fetch_instruction_debug();
m_pc = m_nextpc;
m_nextpc = ~0;