From c056522aabda6256f7ab24cc40a41ec134064acc Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Thu, 2 Feb 2023 16:36:23 -0500 Subject: Fix upd7810 serial input failing to detect the start bit of the next byte if there are zero serial idle state bits sent between the serial bytes to the upd7810 receive line. [Lord Nightmare] --- src/devices/cpu/upd7810/upd7810.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/devices/cpu/upd7810/upd7810.cpp b/src/devices/cpu/upd7810/upd7810.cpp index 929070e61fc..1f899b0b547 100644 --- a/src/devices/cpu/upd7810/upd7810.cpp +++ b/src/devices/cpu/upd7810/upd7810.cpp @@ -1113,6 +1113,7 @@ void upd7810_device::upd7810_sio_input() case 0x48: /* 7bits, no parity, 1 stop bit */ case 0x68: /* 7bits, no parity, 1 stop bit (parity select = 1 but parity is off) */ m_rxs >>= 16 - 9; + m_rxs |= ~0 << 9; RXB = (m_rxs >> 1) & 0x7f; if ((1 << 8) != (m_rxs & (1 | (1 << 8)))) IRR |= INTER; /* framing error */ @@ -1120,12 +1121,14 @@ void upd7810_device::upd7810_sio_input() case 0x4c: /* 8bits, no parity, 1 stop bit */ case 0x6c: /* 8bits, no parity, 1 stop bit (parity select = 1 but parity is off) */ m_rxs >>= 16 - 10; + m_rxs |= ~0 << 10; RXB = (m_rxs >> 1) & 0xff; if ((1 << 9) != (m_rxs & (1 | (1 << 9)))) IRR |= INTER; /* framing error */ break; case 0x58: /* 7bits, odd parity, 1 stop bit */ m_rxs >>= 16 - 10; + m_rxs |= ~0 << 10; RXB = (m_rxs >> 1) & 0x7f; if ((1 << 9) != (m_rxs & (1 | (1 << 9)))) IRR |= INTER; /* framing error */ @@ -1134,6 +1137,7 @@ void upd7810_device::upd7810_sio_input() break; case 0x5c: /* 8bits, odd parity, 1 stop bit */ m_rxs >>= 16 - 11; + m_rxs |= ~0 << 11; RXB = (m_rxs >> 1) & 0xff; if ((1 << 10) != (m_rxs & (1 | (1 << 10)))) IRR |= INTER; /* framing error */ @@ -1142,6 +1146,7 @@ void upd7810_device::upd7810_sio_input() break; case 0x78: /* 7bits, even parity, 1 stop bit */ m_rxs >>= 16 - 10; + m_rxs |= ~0 << 10; RXB = (m_rxs >> 1) & 0x7f; if ((1 << 9) != (m_rxs & (1 | (1 << 9)))) IRR |= INTER; /* framing error */ @@ -1150,6 +1155,7 @@ void upd7810_device::upd7810_sio_input() break; case 0x7c: /* 8bits, even parity, 1 stop bit */ m_rxs >>= 16 - 11; + m_rxs |= ~0 << 11; RXB = (m_rxs >> 1) & 0xff; if ((1 << 10) != (m_rxs & (1 | (1 << 10)))) IRR |= INTER; /* framing error */ @@ -1159,6 +1165,7 @@ void upd7810_device::upd7810_sio_input() case 0xc8: /* 7bits, no parity, 2 stop bits */ case 0xe8: /* 7bits, no parity, 2 stop bits (parity select = 1 but parity is off) */ m_rxs >>= 16 - 10; + m_rxs |= ~0 << 10; RXB = (m_rxs >> 1) & 0x7f; if ((3 << 9) != (m_rxs & (1 | (3 << 9)))) IRR |= INTER; /* framing error */ @@ -1168,6 +1175,7 @@ void upd7810_device::upd7810_sio_input() case 0xcc: /* 8bits, no parity, 2 stop bits */ case 0xec: /* 8bits, no parity, 2 stop bits (parity select = 1 but parity is off) */ m_rxs >>= 16 - 11; + m_rxs |= ~0 << 11; RXB = (m_rxs >> 1) & 0xff; if ((3 << 10) != (m_rxs & (1 | (3 << 10)))) IRR |= INTER; /* framing error */ @@ -1176,6 +1184,7 @@ void upd7810_device::upd7810_sio_input() break; case 0xd8: /* 7bits, odd parity, 2 stop bits */ m_rxs >>= 16 - 11; + m_rxs |= ~0 << 11; RXB = (m_rxs >> 1) & 0x7f; if ((3 << 10) != (m_rxs & (1 | (3 << 10)))) IRR |= INTER; /* framing error */ @@ -1184,6 +1193,7 @@ void upd7810_device::upd7810_sio_input() break; case 0xdc: /* 8bits, odd parity, 2 stop bits */ m_rxs >>= 16 - 12; + m_rxs |= ~0 << 12; RXB = (m_rxs >> 1) & 0xff; if ((3 << 11) != (m_rxs & (1 | (3 << 11)))) IRR |= INTER; /* framing error */ @@ -1192,6 +1202,7 @@ void upd7810_device::upd7810_sio_input() break; case 0xf8: /* 7bits, even parity, 2 stop bits */ m_rxs >>= 16 - 11; + m_rxs |= ~0 << 11; RXB = (m_rxs >> 1) & 0x7f; if ((3 << 10) != (m_rxs & (1 | (3 << 10)))) IRR |= INTER; /* framing error */ @@ -1200,6 +1211,7 @@ void upd7810_device::upd7810_sio_input() break; case 0xfc: /* 8bits, even parity, 2 stop bits */ m_rxs >>= 16 - 12; + m_rxs |= ~0 << 12; RXB = (m_rxs >> 1) & 0xff; if ((3 << 11) != (m_rxs & (1 | (3 << 11)))) IRR |= INTER; /* framing error */ @@ -1211,6 +1223,7 @@ void upd7810_device::upd7810_sio_input() else { m_rxs >>= 16 - 8; + m_rxs |= ~0 << 8; RXB = m_rxs; // m_rxcnt = 8; } @@ -1870,7 +1883,7 @@ void upd7810_device::device_reset() m_int2 = 1; // physical (inverted) INT2 line state m_txs = 0; - m_rxs = 0; + m_rxs = ~0; m_txcnt = 0; m_rxcnt = 0; m_txbuf = 0; -- cgit v1.2.3