summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/machine/im6402.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/machine/im6402.c')
-rw-r--r--src/emu/machine/im6402.c47
1 files changed, 30 insertions, 17 deletions
diff --git a/src/emu/machine/im6402.c b/src/emu/machine/im6402.c
index 420cdca9e0e..87a2a0da72c 100644
--- a/src/emu/machine/im6402.c
+++ b/src/emu/machine/im6402.c
@@ -23,7 +23,7 @@ const device_type IM6402 = &device_creator<im6402_device>;
// MACROS / CONSTANTS
//**************************************************************************
-#define LOG 1
+#define LOG 0
@@ -68,25 +68,14 @@ inline void im6402_device::set_tre(int state)
//-------------------------------------------------
-// receive -
+// receive_bit -
//-------------------------------------------------
-inline void im6402_device::receive()
+inline void im6402_device::receive_bit(int state)
{
- int bit = 1;
-
- if (m_in_rri_func.isnull())
- {
- bit = get_in_data_bit();
- }
- else
- {
- bit = m_in_rri_func();
- }
-
-// if (LOG) logerror("IM6402 '%s' Receive Bit %u\n", tag(), bit);
+ if (LOG) logerror("IM6402 '%s' Receive Bit %u\n", tag(), state);
- receive_register_update_bit(bit);
+ receive_register_update_bit(state);
if (is_receive_register_full())
{
@@ -101,7 +90,28 @@ inline void im6402_device::receive()
}
set_dr(ASSERT_LINE);
+ }
+}
+
+
+//-------------------------------------------------
+// receive -
+//-------------------------------------------------
+
+inline void im6402_device::receive()
+{
+ int bit = 1;
+
+ if (m_in_rri_func.isnull())
+ {
+ bit = get_in_data_bit();
+ }
+ else
+ {
+ bit = m_in_rri_func();
}
+
+ receive_bit(bit);
}
@@ -272,6 +282,9 @@ void im6402_device::device_timer(emu_timer &timer, device_timer_id id, int param
void im6402_device::input_callback(UINT8 state)
{
+ int bit = (state & SERIAL_STATE_RX_DATA) ? 1 : 0;
+
+ receive_bit(bit);
}
@@ -452,7 +465,7 @@ WRITE_LINE_MEMBER( im6402_device::crl_w )
if (LOG) logerror("IM6402 '%s' Control Register Load\n", tag());
int word_length = 5 + ((m_cls2 << 1) | m_cls1);
- int stop_bits = 1 + (m_sbs ? ((word_length == 5) ? 0.5 : 1) : 0);
+ float stop_bits = 1 + (m_sbs ? ((word_length == 5) ? 0.5 : 1) : 0);
int parity_code;
if (m_pi) parity_code = SERIAL_PARITY_NONE;