summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/pps41/pps41base.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/pps41/pps41base.cpp')
-rw-r--r--src/devices/cpu/pps41/pps41base.cpp75
1 files changed, 41 insertions, 34 deletions
diff --git a/src/devices/cpu/pps41/pps41base.cpp b/src/devices/cpu/pps41/pps41base.cpp
index 4c824022b39..e03443da73e 100644
--- a/src/devices/cpu/pps41/pps41base.cpp
+++ b/src/devices/cpu/pps41/pps41base.cpp
@@ -25,7 +25,7 @@ Part numbers:
Internal clock is 4-phase (4 subcycles per 1-byte opcode), and when running
from an external oscillator, it is divided by 2 first. It also has an internal
-oscillator which can be enabled up with a resistor to VC.
+oscillator which can be enabled with a resistor wired to VC.
References:
- Series MM76 Product Description
@@ -40,9 +40,7 @@ TODO:
explain what would happen. Scrabble Sensor does it, so it's probably ok.
- documentation discourages use of some extended opcodes when in subroutine pages,
but again does not explain why
-- documentation is conflicting whether or not MM76/MM75 can (re)set interrupt flip-
- flops with SOS/ROS opcodes
-- allowed opcodes after TAB should be limited
+- allowed opcode after TAB should be limited
- add MCU mask options, there's one for inverting interrupts
- add MM78LA
@@ -66,6 +64,7 @@ pps41_base_device::pps41_base_device(const machine_config &mconfig, device_type
m_write_d(*this),
m_read_r(*this),
m_write_r(*this),
+ m_read_sdi(*this),
m_write_sdo(*this),
m_write_ssc(*this)
{ }
@@ -88,6 +87,7 @@ void pps41_base_device::device_start()
m_write_d.resolve_safe();
m_read_r.resolve_safe(0xff);
m_write_r.resolve_safe();
+ m_read_sdi.resolve_safe(1);
m_write_sdo.resolve_safe();
m_write_ssc.resolve_safe();
@@ -120,10 +120,8 @@ void pps41_base_device::device_start()
m_skip_count = 0;
m_s = 0;
- m_sdi = 0;
- m_sclock_in = 1;
+ m_sclock_in = 0;
m_sclock_count = 0;
- m_ss_pending = false;
m_d_pins = 10;
m_d_mask = (1 << m_d_pins) - 1;
@@ -157,10 +155,8 @@ void pps41_base_device::device_start()
save_item(NAME(m_skip_count));
save_item(NAME(m_s));
- save_item(NAME(m_sdi));
save_item(NAME(m_sclock_in));
save_item(NAME(m_sclock_count));
- save_item(NAME(m_ss_pending));
save_item(NAME(m_d_output));
save_item(NAME(m_r_output));
@@ -213,7 +209,7 @@ void pps41_base_device::device_reset()
//-------------------------------------------------
-// inputline handling
+// interrupt handling
//-------------------------------------------------
void pps41_base_device::execute_set_input(int line, int state)
@@ -236,17 +232,6 @@ void pps41_base_device::execute_set_input(int line, int state)
m_int_line[1] = state;
break;
- case PPS41_INPUT_LINE_SDI:
- m_sdi = state;
- break;
-
- case PPS41_INPUT_LINE_SSC:
- // serial shift pending on falling edge
- if (!state && m_sclock_in)
- m_ss_pending = true;
- m_sclock_in = state;
- break;
-
default:
break;
}
@@ -254,27 +239,49 @@ void pps41_base_device::execute_set_input(int line, int state)
//-------------------------------------------------
+// serial i/o
+//-------------------------------------------------
+
+void pps41_base_device::ssc_w(int state)
+{
+ state = (state) ? 1 : 0;
+
+ // serial shift on falling edge
+ if (!state && m_sclock_in)
+ serial_shift(m_read_sdi());
+ m_sclock_in = state;
+}
+
+void pps41_base_device::serial_shift(int state)
+{
+ state = (state) ? 1 : 0;
+ m_s = (m_s << 1 | state) & 0xf;
+ m_write_sdo(BIT(m_s, 3));
+}
+
+void pps41_base_device::serial_clock()
+{
+ // internal serial clock cycle
+ int i = m_read_sdi();
+ m_sclock_count--;
+ m_write_ssc(m_sclock_count & 1);
+
+ if (~m_sclock_count & 1 && m_sclock_count < 8)
+ serial_shift(i);
+}
+
+
+//-------------------------------------------------
// execute
//-------------------------------------------------
void pps41_base_device::cycle()
{
- m_icount -= 4;
+ m_icount--;
// clock serial i/o
- m_ss_pending = m_ss_pending || bool(m_sclock_count & 1);
-
if (m_sclock_count)
- {
- m_sclock_count--;
- m_write_ssc(m_sclock_count & 1);
- }
- if (m_ss_pending)
- {
- m_ss_pending = false;
- m_s = (m_s << 1 | m_sdi) & 0xf;
- m_write_sdo(BIT(m_s, 3));
- }
+ serial_clock();
}
void pps41_base_device::increment_pc()