summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Michael Zapf <github@mizapf.de>2020-01-05 17:40:24 +0100
committer Michael Zapf <github@mizapf.de>2020-01-05 17:40:24 +0100
commit2edee35ac323af4e248b6b034ff0915648f5e5de (patch)
tree147ff8dd57a41a565bb3b0ff2c7d131c49c16238
parent7ad87969bdb8ceb80ec514c730c87ac4c7543693 (diff)
ti99_2: Removed instability in Load/save to Hexbus floppy.
-rw-r--r--src/devices/bus/hexbus/hexbus.cpp9
-rw-r--r--src/devices/bus/hexbus/hexbus.h3
-rw-r--r--src/devices/bus/ti99/internal/992board.cpp19
-rw-r--r--src/devices/bus/ti99/internal/992board.h5
4 files changed, 28 insertions, 8 deletions
diff --git a/src/devices/bus/hexbus/hexbus.cpp b/src/devices/bus/hexbus/hexbus.cpp
index 5fec624ab39..0b8d7821cb6 100644
--- a/src/devices/bus/hexbus/hexbus.cpp
+++ b/src/devices/bus/hexbus/hexbus.cpp
@@ -415,6 +415,15 @@ uint8_t hexbus_chained_device::to_line_state(uint8_t data, bool bav, bool hsk)
return lines;
}
+/*
+ Convenience function to get a data bit.
+*/
+int hexbus_chained_device::data_bit(int n)
+{
+ const uint8_t testbit[4] = { 0x01, 0x02, 0x40, 0x80 };
+ return (m_current_bus_value & testbit[n&3])? 1:0;
+}
+
// ------------------------------------------------------------------------
} } // end namespace bus::hexbus
diff --git a/src/devices/bus/hexbus/hexbus.h b/src/devices/bus/hexbus/hexbus.h
index 7ff730e94a7..76092c0f16f 100644
--- a/src/devices/bus/hexbus/hexbus.h
+++ b/src/devices/bus/hexbus/hexbus.h
@@ -127,6 +127,9 @@ protected:
// Data lines
static int data_lines(uint8_t lines) { return (((lines & 0xc0) >> 4) | (lines & 0x03)); }
+
+ // Return the selected data bit (0-3)
+ int data_bit(int n);
};
// ------------------------------------------------------------------------
diff --git a/src/devices/bus/ti99/internal/992board.cpp b/src/devices/bus/ti99/internal/992board.cpp
index ba5aa9c2f58..fcb5d904a68 100644
--- a/src/devices/bus/ti99/internal/992board.cpp
+++ b/src/devices/bus/ti99/internal/992board.cpp
@@ -355,7 +355,8 @@ io992_device::io992_device(const machine_config &mconfig, device_type type, cons
m_videoctrl(*this, "^" TI992_VDC_TAG),
m_keyboard(*this, "LINE%u", 0U),
m_set_rom_bank(*this),
- m_key_row(0)
+ m_key_row(0),
+ m_hsk_released(true)
{
}
@@ -473,14 +474,16 @@ uint8_t io992_device::cruread(offs_t offset)
case 0xe802:
case 0xe804:
case 0xe806:
+ return data_bit(offset&3);
case 0xe808:
+ return (bus_hsk_level()==ASSERT_LINE)? 0:1;
case 0xe80a:
- return ((m_current_bus_value & m_hexbval[offset&7])==0)? 0:1;
+ return (bus_bav_level()==ASSERT_LINE)? 0:1;
case 0xe80c:
// e80c (bit 6) seems to indicate that the HSK* line has been released
- // own HSK*=1 and HSK*=0 on the bus
- return ((own_hsk_level()==CLEAR_LINE) && (bus_hsk_level()==ASSERT_LINE))? 0:1;
+ // and is now asserted again
+ return (m_hsk_released && (bus_hsk_level()==ASSERT_LINE))? 1:0;
case 0xe80e:
inp = m_cassette->input();
@@ -499,8 +502,6 @@ void io992_device::cruwrite(offs_t offset, uint8_t data)
LOGMASKED(LOG_CRU, "CRU %04x <- %1x\n", address, data);
-// uint8_t olddata = m_latch_out;
-
switch (address)
{
// Select the current keyboard row. Also, bit 0 is used to switch the
@@ -544,6 +545,7 @@ void io992_device::cruwrite(offs_t offset, uint8_t data)
case 0xe808: // HSK
set_hsk_line(data!=0? CLEAR_LINE : ASSERT_LINE);
+ m_hsk_released = (bus_hsk_level()==CLEAR_LINE);
break;
case 0xe80c:
@@ -581,6 +583,11 @@ void io992_device::hexbus_value_changed(uint8_t data)
LOGMASKED(LOG_HEXBUS, "Latching HSK*; got data %01x\n", (data>>4)|(data&3));
latch_hsk();
}
+ else
+ {
+ LOGMASKED(LOG_HEXBUS, "HSK* released\n");
+ m_hsk_released = true;
+ }
}
else
LOGMASKED(LOG_HEXBUS, "Ignoring Hexbus change (to %02x), BAV*=%d\n", data, (own_bav_level()==ASSERT_LINE)? 0:1);
diff --git a/src/devices/bus/ti99/internal/992board.h b/src/devices/bus/ti99/internal/992board.h
index 49649bed3e3..3b27462b323 100644
--- a/src/devices/bus/ti99/internal/992board.h
+++ b/src/devices/bus/ti99/internal/992board.h
@@ -116,8 +116,6 @@ protected:
void hexbus_value_changed(uint8_t data) override;
private:
- const uint8_t m_hexbval[6] = { 0x01, 0x02, 0x40, 0x80, 0x10, 0x04 };
-
required_device<hexbus::hexbus_device> m_hexbus;
required_device<cassette_image_device> m_cassette;
required_device<video992_device> m_videoctrl;
@@ -128,6 +126,9 @@ private:
// Keyboard row
int m_key_row;
+
+ // HSK* released flag. This is queried as CRU bit 6 (with the current HSK* level).
+ bool m_hsk_released;
};