mirror of
https://github.com/D-Modem/courier-emu.git
synced 2026-11-28 20:38:07 -08:00
ATI7 on the Quad reported V32bis,Terbo,V.FC,V34+ with no HST, x2 or V90. That list was never read from anything: the options line is built from [0x8838] at 0xdf363, which the boot decode at 0xc0940 assembles from setting 2 of the six obfuscated settings records at RAM 0x86ee. With no EEPROM present every record reads back zero, the 3-of-3 majority vote at 0xceba7 fails, and the decoder returns its own XOR constant 0x1d as if it were data. 0x1d happens to carry bits 2 and 3, which is the whole of the reported feature list. The records are the same 93C66 part the 302 and 403 carry, at the same EEPROM word 94, reached over the same 186EB PIO lines machine.py already translates: DI ff5e bit 7, DO ff5a bit 7, CS ff56 0x20, CLK ff56 0x04. The frame builders are at 0xc16f7 (read, ah=6) and 0xc15e4 (write, ah=5), addressing words as (di - 0x8632) >> 1, which puts the record block at word 94 exactly. So the probe only ever needed a device handed to it, and now seeds one by default; pass --no-nvram for the old unprovisioned run. Seeded with IDSDL403_NVRAM the firmware reads the block over the wire and ATI7 reports HST,V32bis,Terbo,V.FC,V34+ plus the Fax options line. This also corrects docs/datapump-dispatch-gate.md, which held that the 403 part is not 7.3.14's shape because the six records show no majority. That decode was taken at 7.3.14's RAM address. 7.3.14 caches only words 94..102 at 0x0752; 7.4.16 copies the whole part to 0x058e..0x078d, putting the same words at 0x064a. At 0x0752 the 403 part gives no majority on any record, reproducing the original result; at 0x064a all six are unanimous, and differ from 302 in one bit of setting 2. The five-word shift is real for the extended +S block and does not extend to the settings records. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
65 lines
3.0 KiB
Python
65 lines
3.0 KiB
Python
"""Measure isolated QF identification/diagnostic replies using the CPU adapter."""
|
|
import json
|
|
import sys
|
|
from concurrent.futures import ProcessPoolExecutor, as_completed
|
|
from pathlib import Path
|
|
from courier_emu.machine import CourierMachine
|
|
from courier_emu.quad_board import QuadBoard
|
|
from courier_emu.quad_image import QuadImage
|
|
from courier_emu.nvram import CourierNvram, IDSDL403_NVRAM
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
OUT = ROOT / 'artifacts/quad-identify-20260910'
|
|
|
|
|
|
def run_command(command, nvram=True):
|
|
image = QuadImage.modem((OUT/'flash.bin').read_bytes(), (OUT/'ram.bin').read_bytes())
|
|
# The QF settings EEPROM is the same 93C66 part the 302/403 carry, reached
|
|
# over the same 186EB PIO lines machine.py already translates. Seeding it
|
|
# is what makes ATI7 report a profile the firmware actually read rather
|
|
# than the 0x1d its decoder returns from an absent part.
|
|
device = CourierNvram(data=bytearray(IDSDL403_NVRAM)) if nvram else None
|
|
m = CourierMachine(image, quad_terminal=True, tick_ms=5, nvram=device,
|
|
serial_input=('ATQ0V1\r'+command+'\r').encode())
|
|
boundary = None
|
|
last_size = 0
|
|
last_change = 0
|
|
def observe(pc):
|
|
nonlocal boundary, last_size, last_change
|
|
if m.quad_terminal.opened == 2 and boundary is None:
|
|
boundary = len(m.serial)
|
|
if len(m.serial) != last_size:
|
|
last_size = len(m.serial)
|
|
last_change = m.instructions
|
|
if (boundary is not None and not m.serial_rx and not m.uart.pending
|
|
and bytes(m.uc.mem_read(0x81f8,2)) == b'\xe6\x91'
|
|
and m.instructions - last_change > 200_000):
|
|
m.stop_requested = True
|
|
m._code_observer = observe
|
|
r=m.run(12_000_000)
|
|
raw=bytes(m.serial)[boundary:] if boundary is not None else b''
|
|
return dict(command=command, response=bytes(b&127 for b in raw).decode('ascii'),
|
|
raw_hex=raw.hex(), status=r.status, error=r.error,
|
|
instructions=r.instructions, input_remaining=len(m.serial_rx),
|
|
opened=m.quad_terminal.opened, nvram=nvram,
|
|
final_state=bytes(m.uc.mem_read(0x81f8,2)).hex())
|
|
|
|
|
|
if __name__ == '__main__':
|
|
OUT.mkdir(parents=True, exist_ok=True)
|
|
board=QuadBoard()
|
|
m=CourierMachine(QuadImage.controller(ROOT/'docs/x2/Qf060003.zip'),quad_board=board)
|
|
result=m.run(8_000_000)
|
|
if result.error: raise RuntimeError(result.error)
|
|
board.flush()
|
|
(OUT/'flash.bin').write_bytes(board.flash[0]);(OUT/'ram.bin').write_bytes(board.ram[0])
|
|
nvram='--no-nvram' not in sys.argv
|
|
commands=['ATI']+[f'ATI{i}' for i in range(31)]+[f'ATY{i}' for i in range(10,21)]
|
|
rows={}
|
|
with ProcessPoolExecutor(max_workers=3) as pool:
|
|
jobs={pool.submit(run_command, command, nvram):command for command in commands}
|
|
for future in as_completed(jobs):
|
|
row=future.result();rows[row['command']]=row
|
|
(OUT/'results.json').write_text(json.dumps([rows[c] for c in commands if c in rows],indent=2)+'\n')
|
|
print(json.dumps(row),flush=True)
|