mirror of
https://git.k-space.ee/arti/vt1200.git
synced 2026-10-30 12:03:54 +02:00
patches: capture the MAME local edits as a 50-line patch (the MAME remote rejects shallow updates, so a mirror would cost GBs for a 50-line diff)
This commit is contained in:
1 parent
264d5330ad
commit
1561e34967
2 files changed
+208
No files matched your search
@@ -0,0 +1,53 @@
|
||||
# MAME local edits
|
||||
|
||||
`mame-local-edits.patch` is the complete set of changes this project makes to
|
||||
upstream MAME. It is **50 lines across four files**, and it is the whole reason a
|
||||
MAME tree is needed at all:
|
||||
|
||||
| file | change |
|
||||
|---|---|
|
||||
| `src/devices/cpu/tms34010/tms34010.cpp` | `REG_REFCNT` advances per cycle — required for the level-1 VIDEO MEMORY test |
|
||||
| `src/devices/machine/mc68681.cpp` / `.h` | the overrun error is latched on the **start bit** of the overrunning character, per the SCN2681 datasheet |
|
||||
| `src/mame/mame.lst` | adds the `vt1200` driver entry |
|
||||
|
||||
Each change carries an **inline revert note at the site**, and the rationale for
|
||||
each is in `harness/mame/DUART_REPORT.md`. One further proposed edit (TxRDY
|
||||
assertion timing) was **refuted** by the fitted part's datasheet and is not here.
|
||||
|
||||
## Applying it
|
||||
|
||||
```sh
|
||||
git clone --depth 1 --branch mame0289 \
|
||||
https://github.com/mamedev/mame.git /home/arti/code/k-space/mame0289
|
||||
git -C /home/arti/code/k-space/mame0289 am \
|
||||
/home/arti/code/k-space/vt1200/patches/mame-local-edits.patch
|
||||
harness/mame/build.sh # symlinks the driver in and builds
|
||||
```
|
||||
|
||||
`git am` preserves the commit message and author. If it does not apply cleanly
|
||||
because upstream moved, `git apply -3` will fall back to a three-way merge.
|
||||
|
||||
**Note the clone is at a _tag_, not a branch.** `--branch mame0289` where
|
||||
`mame0289` is a tag leaves a **detached HEAD**, so commit before you check
|
||||
anything else out — otherwise edits are discarded.
|
||||
|
||||
## Why a patch and not a mirror
|
||||
|
||||
The MAME tree is not pushed as a repository. Its remote **rejects shallow
|
||||
updates** (`receive.shallowUpdate` is off), and this is a `--depth 1` clone
|
||||
pinned at a tag, so no push from it is accepted:
|
||||
|
||||
```
|
||||
! [remote rejected] vt1200-local -> vt1200-local (shallow update not allowed)
|
||||
```
|
||||
|
||||
Making it pushable means `git fetch --unshallow`, which downloads MAME's **full
|
||||
history** — several GB and tens of minutes — to transmit a 50-line difference.
|
||||
This patch carries the same information in 155 lines and is reviewable in a diff.
|
||||
|
||||
If a real fork is wanted anyway, unshallow first:
|
||||
|
||||
```sh
|
||||
git -C /home/arti/code/k-space/mame0289 fetch --unshallow upstream
|
||||
git -C /home/arti/code/k-space/mame0289 push -u origin vt1200-local
|
||||
```
|
||||
@@ -0,0 +1,155 @@
|
||||
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
|
||||
|
||||
Reference in new issue
Block a user