From 91e217332f87039f8ffff90c0d98011ee74c1585 Mon Sep 17 00:00:00 2001 From: Michael Zapf Date: Tue, 7 Jun 2022 01:41:58 +0200 Subject: ti99/geneve: TIPI: Fixed crash on empty queue access and network instabilities. --- src/devices/bus/ti99/peb/tipi.cpp | 9 ++++++--- src/devices/bus/ti99/peb/tipi.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/devices/bus/ti99/peb/tipi.cpp b/src/devices/bus/ti99/peb/tipi.cpp index 1dc8b1d3c3d..313bc02cc03 100644 --- a/src/devices/bus/ti99/peb/tipi.cpp +++ b/src/devices/bus/ti99/peb/tipi.cpp @@ -105,6 +105,7 @@ tipi_card_device::tipi_card_device(const machine_config &mconfig, const char *ta m_waitinit(false), m_rpiconn(false), m_tc(0), + m_rd(0), m_lasttc(0) { } @@ -155,9 +156,8 @@ void tipi_card_device::readz(offs_t offset, uint8_t *value) int val = 0; if (m_address & 2) { - val = m_indqueue.front(); - m_indqueue.pop(); - LOGMASKED(LOG_PORTS, "RDIN -> %02x\n", val); + LOGMASKED(LOG_PORTS, "RDIN -> %02x\n", m_rd); + val = m_rd; } else { @@ -393,6 +393,9 @@ void tipi_card_device::process_message() { m_rc = m_tc; // Auto-acknowledge m_lasttc = m_tc; + + m_rd = m_indqueue.front(); + m_indqueue.pop(); } } } diff --git a/src/devices/bus/ti99/peb/tipi.h b/src/devices/bus/ti99/peb/tipi.h index f0fb6753758..abd2808daf9 100644 --- a/src/devices/bus/ti99/peb/tipi.h +++ b/src/devices/bus/ti99/peb/tipi.h @@ -88,6 +88,7 @@ private: u8 m_tc; u8 m_td; u8 m_rc; + u8 m_rd; u8 m_lasttc; }; -- cgit v1.2.3