Files
courier-emu/docs/asic-port-map.md
T
Cryan209andClaude Opus 5 2582f0dabf The lamps were already mapped, and the RS-232 lines are the next claim
Correcting this file: it offered ports 0a, 0c and 0e as "LED candidates" from
the shape of three idle bytes, when dsp-rom-probe.md has had the bit-by-bit
lamp map for some time - measured by driving single bits on a unit and watching
the panel - and panel.py models the latch driver and the nine-lamp list. The
guess is gone. What the trace actually contributes is which part the latches
are in, which no document had said.

The owner's second proposal, that the ASIC also drives the RS-232 signals, is
recorded as near-deduction rather than hypothesis, because the firmware side
has been implying it without anyone joining it up. Port 0x10 bit 0 is already
the CD line to the DTE and port 0x12 bit 0x40 already reads the DTE's DTR, so
two interface signals live in ASIC ports already. And RD, SD, TR and RS have no
latch bit at all while still lighting, which dsp-rom-probe.md already explains
as the lamps being wired to the UART and control lines in hardware - so
whatever holds the panel holds those signals.

It also lands on an open item. board-verified-403.md records the board moving
CS, RD and AA after self test where the emulator makes no panel writes, and
concludes the fix is to model the panel as following the serial signals. If
those lines are ASIC inputs, that is the mechanism.

What to trace is written down, with the caution that the signals are at the
EIA-232 transceiver's logic side and not at the DB-25 - and that transceiver is
not in board-parts.md, because the photograph never covered that end.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 01:43:00 +12:00

8.6 KiB

Modelling the 20.16 MHz ASIC through the serial monitor

The NEC gate array is the part the harness models as a black box (see board-parts.md). It is also the only thing on the 80186's I/O bus: the CPU's own peripheral block is in memory at 0xff00-0xffff, and flash and SRAM are memory too, so whatever answers an IN is the ASIC.

The ID_SDL monitor can read those ports on a running board. courier_emu.asic_probe does that, in three states, writing nothing:

.venv/bin/python -m courier_emu.asic_probe \
  --device /dev/cu.usbserial-21210 --baud 115200 \
  --output artifacts/asic-ports-01

It sweeps 0x00-0xff four times idle, four times during AT&T8, and four times after. AT&T8 is what makes an active state observable: &T1 loops the DTE through the modem so the serial port stops taking commands, while &T8 runs the same analogue loopback against the modem's own pattern generator and leaves the DTE in command mode. It needs no phone line and never goes off hook.

The shape of the space

finding evidence
Only even addresses are decoded all 64 odd ports in 0x00-0x7f read 0x00
The decode stops at 0x7f above it, all 64 even ports read back their own address and all 64 odd ports read 0x00
The idle default is 0x00 96 of the 128 ports below 0x80 read zero

The ASIC presents 16-bit registers; the monitor reads a byte, so the odd half is a high byte nothing drives.

A candidate explanation, from a different board. On the 25 MHz Courier 2806, AD8-AD15 do not reach the ASIC at all - they go to the CPU's SRAMs and appear nowhere on the package (asic-pinout.md). If this board is wired the same way, the odd ports read 0x00 because nothing is there, and the 16-bit-register reading above is simply wrong.

That is not established. This sweep was taken on the 20.16 MHz board, the CPU-side interface is the half that does not transfer between the two - their supervisors differ and their DSP payloads do not - and this board's own AD8-AD15 have never been traced. Tracing them settles it in one reading. Above 0x7f there is no device at all - what comes back is the bus holding the last address, which is why a sweep there looks like a ramp.

The third row is a discrepancy with the harness. machine.py returns mask - 0xff for a byte - from any port it does not model:

value = self.port_values.get(port, bridged if bridged is not None else mask)

The board's answer is 0x00 for three quarters of its decoded space. The measured map is in courier_emu.asic_ports, and asic_ports.seed() produces it in the form port_values takes.

What is there

Thirty-two ports carry a non-zero idle value, all even, all below 0x80:

ports idle what they are
0a 0c 0e f7 60 07 0e is a panel latch driver; 0a and 0c unattributed
10 12 14 86 8a 7e the board latches: hook relay, NVRAM strobe, carrier-detect pair
18 1a 1c 1e ff ff fd ff the four that move under load
42 46 4a 4e 52 56 ff the DSP download window, written in thousands and never read
58 5c 60 20 0e 4b mailbox tag, data, stream window
64-7e 78 09 8f a7 e8 aa b6 97 51 51 06 4f b3 looks like fixed configuration

That last block is the interesting one. Ten of its thirteen values - 64 66 6c 72 74 76 78 7a 7c 7e - are identical to the sweep in artifacts/io-port-map/hardware-2016mhz/atglk2b.txt, taken from this unit when it ran stock 7.3.14 rather than ID_SDL 4.03. Same values across two firmware versions and two sessions is what identity or strapping looks like. The other three (68 6a 70, and also 58 and 60) differ between the captures, so they are state.

The panel rows here are thinner than the ones already recorded

The "board latches" row above predates dsp-rom-probe.md, which maps these ports bit by bit from driving single bits on a physical unit and watching the front of the modem: 0x14 is active-low and carries CD, CS, AA, ARQ, HS and SYN; 0x12 bit 1 is MR; 0x10 bit 0 is OH and the relay; 0x0e is a panel latch driver. courier_emu/panel.py models the whole latch driver and holds the lamp list. Read that pair rather than this table's one-line summary.

What this file adds is where those latches physically live: asic-pinout.md measures the ASIC as the part driving the panel, which no document had attributed before.

What moves

Only four ports differ between idle and active audio:

port idle &T8 bits
18 ff c0, c6, c7 3f
1a ff c0 3f
1c fd f9 04
1e ff fb 04

1c and 1e are the mailbox status pair and both move on bit 2 - the bit the supervisor's mailbox interrupt acknowledges. 18 also varied within the active state, so it carries live signal rather than a settled level.

This is the main limit of the run: with the loop on hook and no call, most of the ASIC never does anything. Four ports out of thirty-two is what &T8 reaches.

The reset sweep: a clean negative

--reset sweeps either side of an ATZ instead of either side of a loopback, on the theory that a restart would strobe the DSP download window at 0x40-0x56.

.venv/bin/python -m courier_emu.asic_probe \
  --device /dev/cu.usbserial-21210 --baud 115200 \
  --reset --output artifacts/asic-reset-01

It does not work, and the reason is structural rather than a matter of sampling faster: the monitor is firmware. The board stops answering the moment it restarts and is readable again only once the supervisor is back at its command loop, by which point anything a reset did to the download window is over.

The probe still races it rather than waiting for ATZ's own OK, which would guarantee missing the event. It writes the command without waiting and then hammers one port with a 0.45 s timeout:

t=0.000  port 40 -> (no answer)
t=0.375  port 40 -> 00
t=0.540  port 40 -> 00        ... steady thereafter

So the outage is under 375 ms and the board answers immediately after. The resolution floor is the modem's own ~165 ms reply latency, so a shorter timeout would not buy much.

The result across the reset:

ports differing before vs after 0 of 256
non-zero ports, before vs after all 32 identical
watched ports still moving while settling none
ATZ round trip 0.375 s

The download window reads 00/FF in the same alternating pattern either side. Nothing in the port space records that a reset happened.

That is a real limit on this approach rather than a tuning problem. Moving the download window needs a transition the monitor can survive, and there are only two: power-on, which is unobservable through the firmware's own monitor, and a call setup, which bridge.py notes re-enters the download routine - and that needs the loop off hook.

What this does not settle

Seeding the measured map into the ROM harness does not fix the outstanding bug where a board ROM accepts input and transmits nothing (commit 229ef5b). Running the captured 7.3.14 ROM with ATI\r for 60M instructions:

transmitted received ticks
harness default (0xff) 0 4 2,732
measured map 0 4 2,730

The tick count moves, so the map does reach execution; the transmit path does not depend on it. That bug is elsewhere. (Those two tests are pytest-style functions, so make test, which runs unittest, does not collect them - they fail when run under pytest directly.)

The map is therefore published and not wired in by default. Two reasons: it is the idle, on-hook state, so holding those values static through a run that goes off hook could be worse than the current 0xff; and it is the 20.16 MHz board's ASIC, where the harness's usual image main211.xmf is a different generation entirely.

Two things not attempted, both deliberate:

No port writes. Write-response is what separates a latch from a read-only status register and it is the obvious next experiment, but an unknown ASIC register is not a safe write target - three ports on this board drive the hook relay, the NVRAM strobe and the carrier-detect pair. That needs its own decision, not a characterization sweep.

Reads are not always free. The mailbox data registers at 0x5c/0x5e are how the supervisor collects a reply, and 0x1c carries status its interrupt acknowledges, so sampling them may consume something the firmware wanted. --skip-mailbox leaves that group alone; a result that matters should be taken both ways.