summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2020-01-11 09:19:36 -0500
committer AJR <ajrhacker@users.noreply.github.com>2020-01-11 09:19:36 -0500
commit96eb2a56c5eb33c5cf832a45c8e251cf03c10cb6 (patch)
tree56868e5d6a025689516d861e6b9fe1c6f6bff641
parent107b9d422513e5becb76a172c710aacdcf08237c (diff)
ay31015: Better EOC timing with two stop bits; improve logging messages (nw)
-rw-r--r--src/devices/machine/ay31015.cpp34
1 files changed, 21 insertions, 13 deletions
diff --git a/src/devices/machine/ay31015.cpp b/src/devices/machine/ay31015.cpp
index 6ab1103b28a..e4dc2344e28 100644
--- a/src/devices/machine/ay31015.cpp
+++ b/src/devices/machine/ay31015.cpp
@@ -336,7 +336,9 @@ void ay31015_device::rx_process()
if (m_rx_pulses == 8) // sample input stream
{
- m_rx_parity ^= get_si(); // calculate cumulative parity
+ m_internal_sample = get_si();
+ m_rx_parity ^= m_internal_sample; // calculate cumulative parity
+ LOG("Receive parity bit: %d\n", m_internal_sample);
}
else
if (!m_rx_pulses) // end of a byte
@@ -350,7 +352,10 @@ void ay31015_device::rx_process()
if ((m_control_reg & CONTROL_EPS) && (!m_rx_parity))
m_rx_parity = 0; // even parity, ok
else
+ {
m_rx_parity = 1; // parity error
+ LOG("Parity error\n");
+ }
}
return;
@@ -478,7 +483,7 @@ void ay31015_device::tx_process()
}
else
set_so(0);
- LOG("Transmit data bit #%d: %d\n", 9 - (m_tx_pulses >> 4), m_tx_data & 1);
+ LOG("Transmit data bit #%d: %d\n", 1 + ((m_total_pulses - m_tx_pulses) >> 4), m_tx_data & 1);
m_tx_data >>= 1; // adjust the shift register
}
@@ -524,25 +529,26 @@ void ay31015_device::tx_process()
m_tx_pulses--;
if (!m_tx_pulses)
{
- m_status_reg |= STATUS_EOC; // character is completely sent
if (m_second_stop_bit)
{
m_tx_state = SECOND_STOP_BIT;
m_tx_pulses = m_second_stop_bit;
- LOG("Transmit second stop bit\n");
- }
- else
- if (m_status_reg & STATUS_TBMT)
- {
- m_tx_state = IDLE; // if nothing to send, go idle
- LOG("Transmitter idle\n");
}
else
{
- m_tx_pulses = 16;
- m_tx_state = START_BIT; // otherwise immediately start next byte
+ m_status_reg |= STATUS_EOC; // character is completely sent
+ if (m_status_reg & STATUS_TBMT)
+ {
+ m_tx_state = IDLE; // if nothing to send, go idle
+ LOG("Transmitter idle\n");
+ }
+ else
+ {
+ m_tx_pulses = 16;
+ m_tx_state = START_BIT; // otherwise immediately start next byte
+ }
+ update_status_pins();
}
- update_status_pins();
}
return;
@@ -552,6 +558,7 @@ void ay31015_device::tx_process()
m_tx_pulses--;
if (!m_tx_pulses)
{
+ m_status_reg |= STATUS_EOC; // character is completely sent
if (m_status_reg & STATUS_TBMT)
{
m_tx_state = IDLE; // if nothing to send, go idle
@@ -562,6 +569,7 @@ void ay31015_device::tx_process()
m_tx_pulses = 16;
m_tx_state = START_BIT; // otherwise immediately start next byte
}
+ update_status_pins();
}
return;