summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/pps4/pps4.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/pps4/pps4.cpp')
-rw-r--r--src/devices/cpu/pps4/pps4.cpp70
1 files changed, 33 insertions, 37 deletions
diff --git a/src/devices/cpu/pps4/pps4.cpp b/src/devices/cpu/pps4/pps4.cpp
index 6603d96db02..aaf83860407 100644
--- a/src/devices/cpu/pps4/pps4.cpp
+++ b/src/devices/cpu/pps4/pps4.cpp
@@ -78,7 +78,6 @@
#include "emu.h"
#include "pps4.h"
#include "pps4dasm.h"
-#include "debugger.h"
#define VERBOSE 0 //!< set to 1 to log certain instruction conditions
@@ -92,9 +91,11 @@ pps4_device::pps4_device(const machine_config &mconfig, device_type type, const
, m_program_config("program", ENDIANNESS_LITTLE, 8, 12)
, m_data_config("data", ENDIANNESS_LITTLE, 8, 12) // 4bit RAM
, m_io_config("io", ENDIANNESS_LITTLE, 8, 8) // 4bit IO
- , m_dia_cb(*this)
- , m_dib_cb(*this)
+ , m_dia_cb(*this, 0)
+ , m_dib_cb(*this, 0)
, m_do_cb(*this)
+ , m_wasldi(0)
+ , m_waslbl(0)
{
}
@@ -154,7 +155,6 @@ std::unique_ptr<util::disasm_interface> pps4_device::create_disassembler()
inline u8 pps4_device::ROP()
{
const u8 op = m_cache.read_byte(m_P & 0xFFF);
- m_Ip = m_I1; // save previous opcode
m_P = (m_P + 1) & 0xFFF;
m_icount -= 1;
return op;
@@ -614,12 +614,10 @@ void pps4_device::iEXD()
*/
void pps4_device::iLDI()
{
- // previous LDI instruction?
- if (0x70 == (m_Ip & 0xf0)) {
- LOG("%s: skip prev:%02x op:%02x\n", __FUNCTION__, m_Ip, m_I1);
- return;
- }
- m_A = ~m_I1 & 15;
+ if (!m_wasldi)
+ m_A = ~m_I1 & 15;
+
+ m_wasldi = 2;
}
/**
@@ -817,8 +815,8 @@ void pps4_device::iXS()
*/
void pps4_device::iCYS()
{
- const u16 sa = (m_SA >> 4) | (m_A << 8);
- m_A = m_SA & 15;
+ const u16 sa = (m_SA >> 4) | ((m_A^15) << 8);
+ m_A = ~m_SA & 15;
m_SA = sa;
}
@@ -857,18 +855,17 @@ void pps4_device::iCYS()
*/
void pps4_device::iLB()
{
- // previous LB or LBL instruction?
- if (0xc0 == (m_Ip & 0xf0) || 0x00 == m_Ip) {
- LOG("%s: skip prev:%02x op:%02x\n", __FUNCTION__, m_Ip, m_I1);
- return;
+ if (!m_waslbl)
+ {
+ m_SB = m_SA;
+ m_SA = (m_P + 1) & 0xFFF;
+ m_P = (3 << 6) | (m_I1 & 15);
+ m_B = ~ARG() & 255;
+ m_P = m_SA;
+ // swap SA and SB
+ std::swap(m_SA, m_SB);
}
- m_SB = m_SA;
- m_SA = (m_P + 1) & 0xFFF;
- m_P = (3 << 6) | (m_I1 & 15);
- m_B = ~ARG() & 255;
- m_P = m_SA;
- // swap SA and SB
- std::swap(m_SA, m_SB);
+ m_waslbl = 2;
}
/**
@@ -897,12 +894,10 @@ void pps4_device::iLB()
void pps4_device::iLBL()
{
m_I2 = ARG();
- // previous LB or LBL instruction?
- if (0xc0 == (m_Ip & 0xf0) || 0x00 == m_Ip) {
- LOG("%s: skip prev:%02x op:%02x\n", __FUNCTION__, m_Ip, m_I1);
- return;
- }
- m_B = ~m_I2 & 255; // Note: immediate is 1's complement
+ if (!m_waslbl)
+ m_B = ~m_I2 & 255; // Note: immediate is 1's complement
+
+ m_waslbl = 2;
}
/**
@@ -983,7 +978,7 @@ void pps4_device::iT()
* @brief pps4_device::iTM Transfer and mark indirect
* HEX BINARY CYCLES MNEMONIC
* ----------------------------------
- * 0xc0+ 11xx xxxx 2 TM x
+ * 0xd0+ 11x1 xxxx 2 TM x
* yyyy yyyy from page 3
*
* Symbolic equation
@@ -1327,6 +1322,10 @@ void pps4_device::iSAG()
void pps4_device::execute_one()
{
m_I1 = ROP();
+ if (m_wasldi)
+ m_wasldi--;
+ if (m_waslbl)
+ m_waslbl--;
if (m_Skip) {
m_Skip = 0;
LOG("%s: skip op:%02x\n", __FUNCTION__, m_I1);
@@ -1573,7 +1572,8 @@ void pps4_device::device_start()
save_item(NAME(m_FF2));
save_item(NAME(m_I1));
save_item(NAME(m_I2));
- save_item(NAME(m_Ip));
+ save_item(NAME(m_wasldi));
+ save_item(NAME(m_waslbl));
state_add( PPS4_PC, "PC", m_P ).mask(0xFFF).formatstr("%03X");
state_add( PPS4_A, "A", m_A ).formatstr("%01X");
@@ -1585,16 +1585,11 @@ void pps4_device::device_start()
state_add( PPS4_B, "B", m_B ).formatstr("%03X");
state_add( PPS4_I1, "I1", m_I1 ).formatstr("%02X").noshow();
state_add( PPS4_I2, "I2", m_I2 ).formatstr("%02X").noshow();
- state_add( PPS4_Ip, "Ip", m_Ip ).formatstr("%02X").noshow();
state_add( STATE_GENPC, "GENPC", m_P ).noshow();
state_add( STATE_GENPCBASE,"CURPC", m_P ).noshow();
state_add( STATE_GENFLAGS, "GENFLAGS", m_C).formatstr("%3s").noshow();
set_icountptr(m_icount);
-
- m_dia_cb.resolve_safe(0);
- m_dib_cb.resolve_safe(0);
- m_do_cb.resolve_safe();
}
void pps4_2_device::device_start()
@@ -1634,7 +1629,8 @@ void pps4_device::device_reset()
m_FF2 = 0; // Flip-flop 2
m_I1 = 0; // Most recent instruction I(8:1)
m_I2 = 0; // Most recent parameter I2(8:1)
- m_Ip = 0; // Previous instruction I(8:1)
+ m_wasldi = 0; // was last instruction LDI?
+ m_waslbl = 0; // was last instruction LB/LBL?
}
void pps4_2_device::device_reset()