summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/pps4
diff options
context:
space:
mode:
author Robbbert <Robbbert@users.noreply.github.com>2022-05-25 12:17:05 +1000
committer Robbbert <Robbbert@users.noreply.github.com>2022-05-25 12:17:05 +1000
commitf383ae926d3efff1af7e7ddff0cee28b9e18149b (patch)
treefadbb44c2d16240a700da95d5db4e72be9d4a7d6 /src/devices/cpu/pps4
parent5a36d6f35858fc5f9546090bc108ce26da19ea1f (diff)
pps4: fixed bug with lb/lbl commands.
Diffstat (limited to 'src/devices/cpu/pps4')
-rw-r--r--src/devices/cpu/pps4/pps4.cpp36
-rw-r--r--src/devices/cpu/pps4/pps4.h1
2 files changed, 20 insertions, 17 deletions
diff --git a/src/devices/cpu/pps4/pps4.cpp b/src/devices/cpu/pps4/pps4.cpp
index 2e21cf07357..6b3c3c7ea20 100644
--- a/src/devices/cpu/pps4/pps4.cpp
+++ b/src/devices/cpu/pps4/pps4.cpp
@@ -95,6 +95,7 @@ pps4_device::pps4_device(const machine_config &mconfig, device_type type, const
, m_dib_cb(*this)
, m_do_cb(*this)
, m_wasldi(0)
+ , m_waslbl(0)
{
}
@@ -855,18 +856,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;
}
/**
@@ -895,12 +895,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;
}
/**
@@ -1327,6 +1325,8 @@ 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);
@@ -1635,6 +1635,8 @@ void pps4_device::device_reset()
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;
+ m_waslbl = 0;
}
void pps4_2_device::device_reset()
diff --git a/src/devices/cpu/pps4/pps4.h b/src/devices/cpu/pps4/pps4.h
index 023e80a1fcd..6cdc7799343 100644
--- a/src/devices/cpu/pps4/pps4.h
+++ b/src/devices/cpu/pps4/pps4.h
@@ -85,6 +85,7 @@ protected:
memory_access< 8, 0, 0, ENDIANNESS_LITTLE>::specific m_io;
int m_icount;
int m_wasldi;
+ int m_waslbl;
u8 m_A; //!< Accumulator A(4:1)
u8 m_X; //!< X register X(4:1)