Files
vt1200/patches/mame-local-edits.patch

156 lines
6.2 KiB
Diff

From f0cbd6294c3931889ab073c8cd46b245013f4317 Mon Sep 17 00:00:00 2001
From: SDD <sdd@local>
Date: Fri, 16 Oct 2026 17:41:02 +0300
Subject: [PATCH] Local device edits for the VT1200 harness (upstream is
unmodified apart from these)
Two documented corrections, each with an inline revert note at the site:
* src/devices/cpu/tms34010/tms34010.cpp -- REG_REFCNT advances per cycle,
required for the level-1 VIDEO MEMORY test to pass.
* src/devices/machine/mc68681.cpp / .h -- the overrun error is latched on the
START BIT of the overrunning character, per the SCN2681 datasheet, rather
than when that character completes. Verified against the fitted part's
datasheet by an independent reader; a second proposed edit (TxRDY timing)
was REFUTED by the same process and reverted.
src/mame/mame.lst gains the vt1200 driver entry.
NOTE: the driver itself (src/mame/dec/vt1200.cpp and the board model) is NOT
committed here. It lives in the vt1200 repository and harness/mame/build.sh
symlinks it in; committing the symlinks would bake in machine-specific
absolute paths.
---
src/devices/cpu/tms34010/tms34010.cpp | 10 ++++++++-
src/devices/machine/mc68681.cpp | 32 ++++++++++++++++++++++++++-
src/devices/machine/mc68681.h | 10 +++++++--
src/mame/mame.lst | 2 ++
4 files changed, 50 insertions(+), 4 deletions(-)
diff --git a/src/devices/cpu/tms34010/tms34010.cpp b/src/devices/cpu/tms34010/tms34010.cpp
index 921b4ac6f421..e95f62cdba58 100644
--- a/src/devices/cpu/tms34010/tms34010.cpp
+++ b/src/devices/cpu/tms34010/tms34010.cpp
@@ -1571,7 +1571,15 @@ u16 tms34010_device::io_register_r(offs_t offset)
return result;
case REG_REFCNT:
- return (total_cycles() / 16) & 0xfffc;
+ // VT1200 NOTE (local change, not upstream): the firmware's level-1
+ // video-memory test reads REFCNT twice a few instructions apart and
+ // treats an unchanged value as a failure ("REFCNT check",
+ // bit 0x3F201ED0). MAME's /16 and &0xfffc means the value only
+ // changes every 64 cycles, so two nearby reads match and the test
+ // fails. Advance it every cycle instead, which is the behaviour the
+ // firmware is probing for. Revert by restoring the line below:
+ // return (total_cycles() / 16) & 0xfffc;
+ return total_cycles() & 0xffff;
case REG_INTPEND:
result = IOREG(offset);
diff --git a/src/devices/machine/mc68681.cpp b/src/devices/machine/mc68681.cpp
index 70d3cfd0bb30..0d254d564be8 100644
--- a/src/devices/machine/mc68681.cpp
+++ b/src/devices/machine/mc68681.cpp
@@ -1326,6 +1326,7 @@ duart_channel::duart_channel(const machine_config &mconfig, const char *tag, dev
, SR(0)
, rx_enabled(0)
, rx_fifo_num(0)
+ , m_rx_line(true)
, m_tx_data_in_buffer(false)
, m_tx_break(false)
, m_bits_transmitted(255)
@@ -1357,6 +1358,26 @@ void duart_channel::device_start()
save_item(NAME(m_tx_break));
save_item(NAME(m_bits_transmitted));
save_item(NAME(m_tx_enabled));
+ save_item(NAME(m_rx_line));
+}
+
+// VT1200 NOTE (local change, not upstream): the datasheet latches the overrun
+// error "upon receipt of the start bit of the new (overrunning) character",
+// i.e. while the FIFO is full and the previous character is still held in the
+// receive shift register. MAME's rx_fifo_push() latches it only when that
+// character is fully received, a whole character late. Watching the RxD line
+// here reproduces the earlier latch time. Revert: delete this override, delete
+// the m_rx_line member, and restore the device_serial_interface::rx_w calls in
+// mc68681.h's rx_a_w/rx_b_w/rx_c_w/rx_d_w.
+void duart_channel::rx_w(int state)
+{
+ if (state == 0 && m_rx_line && (rx_fifo_num == MC68681_RX_FIFO_SIZE + 1))
+ {
+ SR |= STATUS_OVERRUN_ERROR;
+ update_interrupts();
+ }
+ m_rx_line = (state != 0);
+ device_serial_interface::rx_w(state);
}
void duart_channel::device_reset()
@@ -1485,7 +1506,16 @@ void duart_channel::tra_callback()
rx_w(transmit_register_get_data_bit());
}
- // TxRDY is not set until the end of start bit time
+ // TxRDY is not set until the end of start bit time.
+ //
+ // VT1200 NOTE: verified faithful to the fitted part (Signetics SCN2681
+ // product specification, p.22 "Transmitter Disable Note": "TxRDY sets at
+ // the end of the 'start bit' time. It is during the start bit that the
+ // data in the transmit holding register is transferred to the transmit
+ // shift register."). An earlier local VT1200 edit asserted TxRDY at
+ // tra_complete() instead; that edit was REFUTED by this sentence (the
+ // citation it used, p.7, describes the THR->TSR transfer but says nothing
+ // about when TxRDY is set) and has been reverted. Do not re-apply it.
if (++m_bits_transmitted > 1 && !m_tx_data_in_buffer && m_tx_enabled)
{
SR |= STATUS_TRANSMITTER_READY;
diff --git a/src/devices/machine/mc68681.h b/src/devices/machine/mc68681.h
index d5476e822c2f..c1e09db44d94 100644
--- a/src/devices/machine/mc68681.h
+++ b/src/devices/machine/mc68681.h
@@ -31,6 +31,11 @@ public:
void write_chan_reg(int reg, uint8_t data);
void update_interrupts();
+ // VT1200 NOTE (local change, not upstream): saw the RxD line so the overrun
+ // error can be latched on the start bit of the overrunning character (the
+ // datasheet's timing), rather than at its completion in rx_fifo_push().
+ void rx_w(int state);
+
void rx_fifo_push(uint8_t data, uint8_t errors);
uint8_t read_rx_fifo();
@@ -67,6 +72,7 @@ private:
int rx_fifo_read_ptr;
int rx_fifo_write_ptr;
int rx_fifo_num;
+ bool m_rx_line; // VT1200 NOTE (local): previous RxD line state
int m_ch;
@@ -108,8 +114,8 @@ public:
virtual uint8_t read(offs_t offset);
virtual void write(offs_t offset, uint8_t data);
- void rx_a_w(int state) { m_chanA->device_serial_interface::rx_w((uint8_t)state); }
- void rx_b_w(int state) { m_chanB->device_serial_interface::rx_w((uint8_t)state); }
+ void rx_a_w(int state) { m_chanA->rx_w((uint8_t)state); }
+ void rx_b_w(int state) { m_chanB->rx_w((uint8_t)state); }
auto irq_cb() { return write_irq.bind(); }
auto a_tx_cb() { return write_a_tx.bind(); }
diff --git a/src/mame/mame.lst b/src/mame/mame.lst
index c0e618fe3bf9..37e4232f5d58 100644
--- a/src/mame/mame.lst
+++ b/src/mame/mame.lst
@@ -49758,3 +49758,5 @@ iq151
@source:zvt/pp01.cpp
pp01
+@source:dec/vt1200.cpp
+vt1200
--
2.56.0