Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRRRR4BV2CBsQMqfrT6 Signed-off-by: Claude <noreply@anthropic.com>
12 KiB
The chassis side: SDL in NM040103.NAC
Bring-up update (2026-09-10): refer to Quad blockers. The local RS-232 AT operation is documented. It is not proved that an NMC handshake is necessary first. The original probe showed spurious receive interrupts and missing channel-selected memory. The verification section below records the later corrected interrupt-driven receive and CRC test.
docs/x2/NM040103.NAC is the image of the Total Control Network Management Card. It
is the other end of the download handshake that the Quad x2 Modem NAC waits for. Thus,
it is the correct place to recover that protocol from. We do not need to guess it from
the card that only listens. Refer to
quad-x2-modem-nac.md for the card side.
Container
The file uses the same 32-byte header as the I-modem and Quad NACs: the magic
01 02 03, then a little-endian payload length at offset 3 that is equal to the
file size minus 34. But its body is not a binary Intel-HEX record stream.
It is a flat image that starts with eb 46 (a short jump), followed by the USR
copyright. courier nac-info correctly rejects it.
The base address of the body is 0x1fff. The string addresses that the code pushes are equal to the file
offset plus 0x1fff. We verified this across eleven separate strings, and we confirmed it when we
disassembled the referencing sites as coherent 32-bit code.
The header fields, named by the image itself
The NMC contains its own header dumper at +0x3b011, which names each field:
%s, .SDL File Header: %s, .NAC File Header:
file size: %d card type: %d
sw type: %d file type: %d
sw version: %d.%d.%d group ID: %d
file prefix: %c%c card list: %d, %d, ...
This is the mapping onto the headers in this tree:
| File | Payload len (LE32 @3) | Version @8..0a | @0b..0e | Prefix @0f..10 | Card list @11.. |
|---|---|---|---|---|---|
Ie030002.nac |
0x0cd187 |
3.0.2 | 00 02 01 01 |
IE |
28 |
Ie030002.sdl |
0x000eda |
3.0.2 | 02 01 01 01 |
IE |
28 |
QF060003.NAC |
0x07776c |
6.0.3 | 00 02 01 01 |
QF |
0d 0e 0f |
QR060103.NAC |
0x0725e4 |
6.1.3 | 00 02 01 01 |
QR |
22 23 24 |
QF030200.SDL |
0x000aca |
3.2.0 | 02 01 01 01 |
qf |
0d 0e 0f |
QR030300.SDL |
0x000daa |
3.3.0 | 02 01 01 01 |
QR |
22 23 24 |
NM040103.NAC |
0x132033 |
4.1.3 | 00 01 01 02 |
nm |
06 15 |
The version triple confirms VERSION_OFFSET = 8 of nac.py against seven files,
and it agrees with each filename. Two observations are certain. First, byte 0x0b is 0x00 in
each .NAC and 0x02 in each .SDL. Thus, it is the file type. Second, the
prefix at 0x0f..0x10 is two characters, not the three characters that nac.py now
reads, and the card list starts at 0x11. Each Quad release lists three
consecutive card IDs. The I-modem lists one, and the NMC lists two. We did not yet find the exact
assignment of card type, sw type and group ID among the bytes 0x07,
0x0c, 0x0d, 0x0e. The print sequence of the dumper
is not necessarily the struct sequence, and seven samples do not separate them.
Backplane message framing
A second dumper at +0xa0540 names the wire header:
msg_head.dest_adr: %x msg_head.src_adr: %x
msg_head.length: %u msg_head.message: %*s
msg_head.crc1: %x msg_head.crc2: %x
The receive state machine logs rx start → rx: alloc_buffed →
rx: have rbuf → rx: len_ok → rx crc ok. On failure, it logs
rxp state=%d /event=%d error.
The CRC is shared with the card
All three images have the same 256-entry CRC-16/X.25 table (reflected
polynomial 0x8408, stored little-endian), and the tables are byte-identical:
| Image | Table offset |
|---|---|
QF060003 flattened |
0x1cae |
QR060103 flattened |
0x1bd0 |
NM040103 body |
0x20d0 |
This is the crc1/crc2 algorithm of the framing above. It also
seals the operational image of the Quad: with init 0xffff and final XOR 0xffff
over 0x80000..0xfbfee, it reproduces the stored word at 0xfbfee exactly for
the two Quad releases. The chassis framing and the verification of the card image use one CRC.
The SDL module
Function names are in the image near +0xe0567:
nmc_sdl_prep nmc_sdl_dnload_h2b_file nmc_sdl_clac_crc
nmc_sdl_task snd_rcv_nmc_sdl sdl_kill_other_tasks
sdl_break_at_rec_boundary sdl_wrt_to_ws sdl_erase_flash
ReadSlot WriteSlot ValidSlotData
nmc_sdl_dnload_h2b_file (host-to-board download, +0x34840) reads a 32-bit
command code from the start of the received message and dispatches on it:
| Code | Behaviour at +0x348aa onwards |
|---|---|
5 |
goes to the transfer step |
4 |
posts, then returns 0 — end of transfer |
3 |
sets the completion flag, then goes to the transfer step |
| other | logs Bad SDL command code (code= %d) |
The NMC-side entry checks its own message in the same way. It accepts only 1.
For other values, it logs Bad NMC SDL command code (cmd_code= %d).
ReadSlot/WriteSlot protect the backplane slot access with VRTX event flags
(FCLEAR/FAPEND) on a 1 << (slot - 1) mask. They report Read Slot Collision!, Write Slot Collision!, Write Slot Timeout! and
Read Write NVRAM conflict.
The error reports of the card side name the remaining parts of the transfer state machine:
NAC Bulk trnsfr aborted (slot= %d), Slot %d detects NAC data timeout,
Slot %d rcvd data while x'ed off, Slot %d rcvd invalid xfr frame,
Slot %d discard timer message, and
rcvd unexpected msg map=%d fc=%h sdl code=%d.
What this does and does not give the emulator
It gives the message layer: the framing, the CRC, the command codes, the slot arbitration, and the failure modes of the transfer state machine.
It does not give the byte-level register protocol at 0x0226 of the Quad itself.
That port belongs to the local host-interface device of the card, which
the NMC never touches directly. The NMC gets to slots through the backplane,
not through the local ports of a NAC. Thus, to write the host interface of the Quad, it is still necessary to
identify the device from the card side. The initialization writes
0x0224 = 0x10,0x20,0x30,0x40,0x50, then 0x0220 = 0x93, 0x17,
0x0222 = 0xff, 0x0228 = 0x60, 0x022a = 0x03, 0x0224 = 0x80, 0x01. It writes these on a
byte-wide device that is mapped to even addresses only (a 16-bit bus with A0 not
connected, thus register n is at 0x220 + 2n; the poll reads register 3).
The board latch bank is already recovered. The accessor at QF+0x808db
indexes a four-entry port table at cs:0x931 (0x0000, 0x0200, 0x0260,
0x0280), with an output shadow at [0x216..0x21d]. Those are exactly the
ports that the execution run touches.
The card side of the handshake, recovered
This is the protocol that the Quad engine waits for, read from QF060003.
Transport
The external USART block, byte-wide on even addresses:
| Port | Role |
|---|---|
0x220 |
mode — written two times at init (0x93, 0x17) |
0x222 |
status — bit 0 RxRdy, bit 2 TxRdy |
0x224 |
command — 0x10,0x20,0x30,0x40,0x50 reset sequence, then 0x80, 0x01 |
0x226 |
data |
The receive entry
0x819e6 reads one byte and dispatches through a state vector:
push dx
mov dx, 0x226
in al, dx
pop dx
mov byte [0x467], 0x64 ; a countdown, reloaded on every byte
call word [0x45c] ; the current state
retf
The state machine
[0x45c] holds the next state as a near offset. These are the states:
| State | Expects | On match | On mismatch |
|---|---|---|---|
0x19f6 |
0x32 '2' |
→ 0x1a01 |
stay |
0x1a01 |
0x32 '2' |
→ 0x1a19 |
→ 0x19f6, clear [0x467] |
0x1a19 |
0x02 STX |
→ 0x1a44, and initialize the frame |
→ 0x19f6 |
0x1a44 |
any | collect the byte | — |
Thus, the attention sequence is '2' '2' STX, and each incorrect byte resets the machine to the
start. On STX, the frame state is initialized: buffer pointer [0x44c] = 0x44e,
byte count [0x448] = 0, and CRC accumulator [0x1533] = 0xffff.
The frame CRC
The collector at 0x1a44 stores each byte and adds it into the accumulator:
mov di, [0x44c] ; stosb ; mov [0x44c], di ; append
mov dx, [0x1533] ; running CRC
xor ah, ah ; xor al, dl ; shl ax, 1 ; index = (byte ^ crc_low) * 2
mov bx, ax ; mov ax, cs:[bx + 0x1cae] ; table lookup
mov dl, dh ; xor dh, dh ; crc >>= 8
xor dx, ax ; mov [0x1533], dx ; crc = (crc >> 8) ^ entry
That is the standard table-driven byte CRC with init 0xffff. The table at
cs:0x1cae is the same CRC-16/X.25 table that seals the flash image at
0xfbfee (quad-x2-modem-nac.md), and that
msg_head.crc1/crc2 of the NMC uses. One CRC is used across the card image, the chassis framing
and this link.
Verification status — measured 2026-09-10
The unmodified QF060003 controller now enters and completes this receive path through the modelled DUART interrupt. To reproduce, run these commands from the repository root:
PYTHONPATH=. .venv/bin/python tools/probe_quad_receive.py
.venv/bin/python -m pytest -q tests/test_quad.py tests/test_quad_receive.py tests/test_timers.py
The probe boots docs/x2/Qf060003.zip at 8000:0000 with QuadBoard(identity=0),
and it runs eight million instructions. It does not patch code, seed parser RAM,
call the handler directly or supply a periodic Courier interrupt. The results are
saved in artifacts/quad-receive-20260910/results.json.
The DUART drives INT0/type 0x0c. The firmware vector of that interrupt is 8000:19ac.
The Quad uses the interrupt mask layout of the 80C186EB: INT0 is IMASK bit 4.
Thus, the startup value 0x00cc enables it. The delivery needs CPU IF, the
controller mask, and an enabled DUART event that IMR selects. The ISR starts
with STI. Thus, the emulator keeps INT0 in service until the firmware
writes EOI (0x8000 to 0xff02). This prevents recursive receive interrupts.
The periodic Courier INT0 events are disabled for this board profile.
This was the complete valid wire input:
32 32 02 00 00 00 00 04 00 00 00 41 42 7c 4d
attention eight-byte header body CRC (low byte first)
Header bytes 4–5 specify four trailing bytes, which include the two CRC bytes.
Byte 7 has bit 7 clear. This selects the short control-frame path. The CRC covers
the eight-byte header and 41 42. It does not cover the attention. With init ffff, reflected
polynomial 8408 and a final complement, the result is 4d7c. When the appended CRC is added into the accumulator,
the result is the expected residue of the firmware, f0b8. This is a framing test.
It does not give a higher-level command meaning to the synthetic body.
| Measurement | Valid frame | Final CRC byte changed from 4d to 4c |
|---|---|---|
Receive entry 0x819e6 |
15 | 15 |
Header collector 0x81a44 |
8 | 8 |
Body/CRC collector 0x81afc |
4 | 4 |
CRC-success branch 0x81b2c |
1 | 0 |
Control-completion branch 0x81b7e |
1 | 0 |
| Final CRC accumulator | f0b8 |
e131 |
| Empty data reads | 0 | 0 |
The two runs write the parser vector sequence
19f6 → 1a01 → 1a19 → 1a44 → 1afc → 19f6. They consume exactly the 15 queued bytes,
and finish with an empty FIFO, an empty sender queue and no pending DUART IRQ.
The valid frame gets to the instruction that sets the control-complete flag.
The bad CRC returns to attention and does not get to that instruction. The firmware
reads ISR 0x22a once for each received byte, and it never needs to poll SR 0x222.
This replaces the old claim that the receive entry was never reached, and the later spurious-zero result in the original blocker probe. It establishes the interrupt-driven framing and the CRC acceptance in QF060003. It does not establish an NMC SDL session, the QR firmware validation, the local AT readiness or the physical serial timing. The sender sends one byte for each service step of the emulator into a three-byte FIFO. The serial baud timing, the overrun, channel B and the full interrupt priority arbitration are outside this model.