The gate array is the only thing on the 80186's I/O bus and is also the
DSP's entire external interface, so it has a decoder on each side and
they number independently. Only eight CPU data lines reach the package,
so one 16-bit DSP register is two 8-bit CPU ports. The two spaces
collide on 0x5e, where the CPU means the high byte of the word and the
DSP means the tag.
Nothing in the harness said so. `panel.py` models its corner of the chip
properly - pin, port, bit, and the firmware address each meaning came
from - but the mailbox was four constants and a hand-written mirror in
bridge.py, with the DSP half living in the C5x core's own port array. No
single place recorded that a CPU port and a DSP register are the same
piece of silicon, which is how `set_io(0x5E, 0x229E)` came to publish a
CPU-side latch into the part's tag register.
`asic.py` is that place. `bridge.py` derives DSP_TAG_PORT,
DSP_WORD_PORT, DSP_STREAM_PORT, HOST_STATUS_CELL, HOST_TAG_CELL,
HOST_WORD_CELL, DSP_RUNTIME_PORTS and MIRROR from it instead of
restating them, and `dsp_register()` raises for a register the DSP has
no path to rather than handing back an address to write into the part.
MIRROR is `asic.mirror("tag", "word")`, which is the four entries it
always had: the whole table also carries the status and stream, and
taking it wholesale would have started mirroring both. The panel rows
are recorded for completeness but `panel.py` is not driven from here.
Byte-identical on the leased ROM pair - mailbox log, messages taken, rx
peak, runtime messages and overlay downloads all unchanged on both ends.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
AT&N1&T1 on 302 crashed with "C51 ROM loader did not acknowledge strobe 1":
_commit_rom_group wrote @56 and stepped 4096 instructions waiting for the
acknowledgement, and nothing answered.
Port 0x18 is not the loader's alone. A supervisor routine at 0x95a54-0x95a6c
walks a single bit along it and mirrors it to 0x1a - ..0x20, 0, 1, 0, 2, 0,
4, 8, 0x10, 0x20.. - so three of its six values collide with the transfer
strobes. Every collision was being taken for a reload request.
The recovered mask ROM says exactly when the C51 is listening. Its download
loop is 0638-0652: bit 2/@56 for the finish strobe, bit 0/@56 then rpt #3 /
bldp *+ / lacl #01 / samm @56 for group 1, bit 1/@56 and the same for group
2, then bd 0638. Outside that span - resident code at 810a, a mask-ROM
vector at 0008 after a restart, the 0653 exit that branches into the
downloaded program - nothing polls @56 and no acknowledgement can come.
So arm a strobe only when the DSP pc is inside that loop, or when the loader
has not been started at all, which is the case the first commit synchronizes.
Real downloads acknowledge from 0642 and 064c, both inside it.
The crashing run now completes and reports CONNECT. Checked inert elsewhere:
a linked 302 pair with the DSP on both sides produces a byte-identical report
with the gate forced open, and the standalone AT&T1 run makes the same 13874
commit decisions as before.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`65` and `db` were stopping two of the flash captures, and neither is a
missing instruction.
`65` is the 386's GS prefix and is undefined on this part. The 80C186EB
manual says what the CPU does with one: "Execution of an undefined opcode
causes an Invalid Opcode trap" (Type 6). That trap has a handler waiting for
it - the Australian captures install a stub at 8000:0f83 that loads a fault
code and jumps to the common reporter - so the faithful model is to vector
it, not to end the run. 0f, 63, 64, 66, 67, d6 and f1 are undefined on the
186 for the same reason and take the same path; the 386ex profile keeps them.
`db` is ESC, a real encoding. Whether it faults depends on RELREG's ET bit,
which resets to zero and which nothing in these firmwares sets, so on this
16-bit part it goes out to an 80C187 instead. There is no 80C187 on the
board, so the operand cycle is read and execution carries on. ET is
modelled as a flag and takes the Type 7 path when set, which is what the
8-bit 80C188 would always do.
A trap restarts its instruction rather than resuming past it, so it cannot
go out as a software interrupt: `Uc.fault` marks which it is and the machine
dispatches it with the faulting address. A fault is also not a controller
request, so it stays out of the EOI stack that a hardware interrupt enters.
Going past those two exposed the next stop, which was a real gap rather than
a fault: SAHF, LAHF, INT3, INTO, WAIT, DAS, AAA, AAS and 82 as the
documented alias of 80 are all defined 80186 instructions that were simply
missing. They are implemented, and the line is kept deliberately - BOUND and
INS/OUTS are still absent and still raise, because a gap in the model must
not be swallowed by a trap that would hide it.
Both 20.16 MHz captures now run a 60,000,000 instruction boot without
error where they used to stop at about 6.2M. Neither reaches its ATI7: the
divergence that sent them there is upstream of any opcode. In both, the last
instruction fetched from flash is the `cb` ending the routine at 9e8cb, and
that far return lands two bytes before the entry its own caller targets
(`9a 39 07 00 80`, CALL FAR 8000:0739, against a return to 7ff8:07b7). One
board then decodes a misaligned stream and the other runs into cleared RAM.
That is the thing to chase next.
The 2806's boot is byte-identical and still prints its profile, and the three
XMF images are identical against a matched baseline.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Two strands, joined because machine.py carries both.
`machine_map` is the canonical description of the hardware: address ranges,
service vectors and the DSP reset port, which used to sit as module constants
beside whichever code happened to use them. An exact-digest `FirmwareProfile`
supplies only what moves between ROM revisions, so profile selection is
evidence rather than a revision-string guess.
`timebase` does the same for the clock. Three constants carried it between
them - pit's 5 cycles an instruction, timers' 5.93, and timers'
INSTRUCTIONS_PER_SECOND at 4,348,000 - and each described a different part
while being imported by whatever needed a rate. The 5 is the 386EX I-modem's;
the 5.93 is the 80C186EB's; the 4,348,000 is the 186's rate on main211's
25.8048 MHz crystal, and it was serving the 20.16 MHz 302/403 as well.
Cycles per instruction is a property of the part and the code mix, so both
186 boards share it. The crystal is a property of the board. Keeping them
apart is what lets one model serve all three:
courier-20.16 20.1600 MHz 5.93 3,399,663 insn/s dsp/x86 5.93
courier-25.8048 25.8048 MHz 5.93 4,351,568 insn/s dsp/x86 4.6328
imodem-386ex 25.0000 MHz 5.00 5,000,000 insn/s
That separation fixes two things. The DSP ratio is not shared by the two 186
boards: docs/asic-pinout.md traces the C5x's CLKIN to the ASIC, which runs
from the shared 40.320 MHz can either way, so the 2806's faster crystal is
the CPU's alone and the DSP does not speed up with it. And timers.py's note
that the crystal cancels is right about the timers - the ratio is CPI/4 on
both boards - but did not cover what takes INSTRUCTIONS_PER_SECOND as an
absolute rate. FRAME_HZ was measured on the live 403 at 20.16 MHz and then
divided into main211's figure, 28% fast on the board it was measured on.
The board is taken from the timer constant the firmware writes: 25,200 counts
is 5.000 ms only at 20.16 MHz and 32,256 only at 25.8048, and the 7.4.16
board checks its own value back at 0x4a83b. Anything unrecognised leaves the
assumed 302/403 in place rather than guessing from it. All three flash
captures identify themselves in agreement with their own ATI7.
The 2806's 60M-instruction boot is byte-identical and still prints its
profile. Elsewhere only timer counts and event instants shift, by the 0.08%
between the rounded 4,348,000 and an exact 5.93/4. Note that every XMF here
programs 0x7e00 - they are all 25.8048 builds - so the 20.16 correction bites
only on the flash captures, and both stall on unimplemented x87 opcodes
before reaching it. It is argued from the documentation and from the boards'
own ATI7, not yet demonstrated by a run that gets that far.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The scheduler used to reach the devices through a UC_HOOK_CODE the
interpreter fired on every instruction, which made ordinary ROM execution
cost what a tracing run costs. The deadline moves inside the dispatch loop
instead: `instruction_clock_add` sets a period, and the loop calls out only
when the count reaches it. Crossing into Python is now bounded by that
interval rather than by the guest's instruction rate.
Two costs in the loop itself go with it.
`_fetch` built a `range` per call to read what is almost always one or two
bytes - it is the most called helper here, 6.4M times per 12M instructions -
so both widths are written out and the general loop kept for the 386ex
profile's wider immediates.
The `group` dispatch is a 65-block if/elif chain that was in group-number
order, which is not frequency order: Jcc is 23% of the instructions a boot
executes and sat eleventh, RET nineteenth, CALL twentieth. Measured over 20M
instructions the chain averaged 16.0 comparisons an instruction; reordering
the blocks by that measurement gives 5.6. Each block moved verbatim - they
test exact equality on one local, so the order is free - and the re-emitted
chain was checked to be a permutation of the original.
Together 15.54s to 14.19s over 20M instructions, with byte-identical output
on MAIN_2.3.31, MAIN_2.3.15 and main2205. The chain reorder is worth less
than its comparison count suggests: CPython 3.14 specialises these well, and
the loop prologue, not the chain, is what sets the floor at 294ns for a NOP.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The +1 was applied to all three top-edge absolute readings on the
assumption the miscount covered the session. It covered one reading. 74
stands for the flash address pin; 71 and 70 go back as given.
Flash DQ11 on CPU AD11 closes the data side: flash pin 22 to CPU pin 20,
a data line straight onto the multiplexed bus with nothing in between.
Every finding so far had been about address, and none of them said how
data reaches the memories - it does not go anywhere, the parts hang
directly on AD0-AD15 and separate address from data with the strobes.
Which also bounds the ASIC: it has AD0-AD7 as an input for latching
while the memories have all sixteen as data, so its own 8-bit I/O window
shares the bus with the memory system rather than fronting it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The low-byte latch is the ASIC. Pin 70 drives RAM pin 10 and flash pin
11, which is A0 at both, so AD0-AD7 on pins 84-77 and ALE on pin 57 are
a latch's inputs rather than just self-decoding for the I/O window - the
reading the file had proposed and could not show.
The memory address bus comes from three places: A0-A7 from the ASIC,
A8-A15 from the '573, A16-A19 from the CPU except A17, which is the ASIC
again on pin 73. A17 needs no latch, so that one still looks like
remapping rather than buffering; A16 and A18 decide it.
Location correction: the outputs are on the top edge, not the 28-46 run
the last revision predicted. That edge is now the address side end to
end, with thirteen unread pins for the seven remaining low bits.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The owner read the parts off the units: AC01 on the 20 MHz boards, AC03
on the 25 MHz 2806, and an Si3021/Si3014 pair with no TI codec on the
3453C, which is taken to be main211.xmf. board-parts.md asked for
exactly this datum and listed two possibilities for it; the answer is
three generations with one part each, which retires the "one board, two
parts in two roles" option and confirms TI first, Silicon Labs last.
That costs us the section titled "the codec is a TLC320AC0x, and the
firmware proves it". The control table at program 0x019c is in
main211.xmf and nowhere else - that part was measured correctly - but
main211's board is the one with no TI codec on it, so the table is the
Silicon Labs bring-up and the attribution is backwards. The
secondary-frame protocol cannot carry the claim either: it appears both
in main211 and in the ID_SDL 4.03 build for an AC01 board, so it
describes the serial framing rather than the silicon. One thing is
recovered rather than lost - CodecBringUp running an SI3038 sequence is
the right family for that build after all, and only the part number is
still in doubt.
My previous commit called that table "the AC0x codec path" and had it
arriving with the newest generation. The offsets were right and the name
was wrong; it is corrected here rather than left standing.
Measured alongside: stock 7.3.14's DSP payload is byte-identical between
a 20.16 MHz AC01 board and the 25 MHz AC03 board - 126,851 consecutive
bytes from the shared anchor, covering the payload and all three
overlays. The AC01 to AC03 change is invisible to the DSP, which is what
an ASIC-fronted codec predicts, and it means an AC03 board cannot be
recognised from its DSP code.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
board-parts.md called the middle generation untested because the shared
DSP anchor could not be found in SV25.XMD, and concluded from that the
.XMD container is record-framed rather than flat. It is flat. Strip the
128-byte header and run the payload through the XOR block transform the
recovery harness already carries, and the anchor is at 0x296e0. The
search failed because the bytes were still encoded, not because the
framing differs.
The decode is confirmed against the board captured in the previous
commit: decoded SV25.XMD matches that 512 KiB image in every byte but
four. So the 25 MHz TARGETS anchors are no longer self-derived, and
their comment now says where they independently come from.
The four are the checksum words at 0x77ffc and 0x77ffe, blank in the
distributed image and programmed on a real board. IDSDL302.ROM differs
from decoded IDSDL302.XMD in exactly the same four, which makes this the
container's normal condition. That is the measured form of the caveat
sv25-recovery.md already carried: the 0xffff the harness compares
against is the unprogrammed state, so the recovery path it selects is an
artefact of the distributed image. Since 0x77ffc lies inside the CRC'd
range, a board's CRC input is not the image's; the algorithm is still
unidentified, with sum-8, sum-16 and five common CRC-16s all missing.
Testing the middle generation settles a question the doc left open, in
the opposite direction to the guess that drove it: the AC0x codec
initialisation table is in main211.xmf alone. It is absent from the
25 MHz build, from both 20.16 MHz builds and from IDSDL302.ROM. The
AC0x path does not separate 20.16 MHz hardware from 25 MHz hardware; it
arrives with the later 25.8048 MHz / 736 KiB generation.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The board at /dev/cu.usbserial-FT4TQOFT is a 25 MHz V.Everything
reporting supervisor 7.3.14 / DSP 3.0.13 - the same revision pair the
flash dumper already knew from the 20.16 MHz board, and a different
image. Its leading jump displacement is 0f93 rather than 0f7c, and its
reset vector enters at fc00:1bbf rather than fc00:11e9, so the recorded
anchors rejected it.
So the clock frequency joins the key rather than being asserted: TARGETS
is now (supervisor, dsp, clock) and validate_identity reads the reported
frequency instead of requiring 20.16. The clock goes last so every
caller's target[0]/target[1] keeps meaning what it did.
The new entry's anchors come from this same board, which makes them a
self-consistency check across the sweep rather than independent
confirmation of the build; the comment says so.
512 KiB captured, 2048 pages, two agreeing reads each, no failed
attempts, anchors unchanged on the recheck. Note that every page
terminated with ERROR rather than OK on this build, consistently and
with well-formed rows; that is unexplained and not yet modelled.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A B channel carries 8000 octets a second of G.711 and RTP's PCMU payload is
8000 octets a second of G.711, so --bri-sip puts a SIP call at the far end of
the bearer with nothing in between: no resampling, both sides being 8 kHz, and
no companding conversion.
The second one earns its place. SipSession's linear path decodes each codeword
and re-encodes it, which is identity for 255 of the 256 codewords and not for
7f. One in 256 is inaudible in speech and a defect here - V.90 and x2 are built
on exact codewords, the digital end of the call places them on the wire itself,
and this board is that end. send_pcmu/receive_pcmu sit beside send_audio and
the analogue path is untouched.
BearerSipLine satisfies the same start/stop/exchange contract V120Link does,
so BriNetwork carries either without knowing which. It does not pretend to
solve pacing: the emulator runs on an instruction budget and RTP on a clock,
so it returns as many octets as it was handed, fills the rest with mu-law
silence, and counts every octet of the fill.
Run end to end against tools/sip_answer_sink.py, the modem's ANSam arrives as
94,080 octets of RTP at 2100 Hz - the B channel's own octets, unchanged.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
courier_emu/v120.py is a V.120 far end on the same terms as the Q.921/Q.931
peer beside it: it reaches the modem only as octets on the B channel and sends
nothing the standards do not say to send. HDLC with zero-bit insertion and ISO
3309's FCS, the 13-bit logical link identifier across both address octets with
the C/R asymmetry LAPD gives it, and Q.921's procedures - SABME/UA, I frames
modulo 128, RR, DISC, DM, T200 counted in octets so a second of bearer means a
second whatever the harness is doing.
bri.py carries it: with --bri-v120 the media path stops being a recording and
becomes a conversation, one octet back for every octet the modem sends.
The bearer carries it and the modem does not answer it. Frames go out framed
and checked, flags come back - 8321 of them, no FCS errors, no runts - and the
modem never sends a frame of its own, in either bit order. What does change
its mind is offering V.120 in the SETUP's low layer compatibility element: the
firmware parses that, and clears the call with MISC_INFO rather than answering
it. So the element is off by default and --bri-v120-llc offers it as the probe
it is. docs/imodem-v120.md has the evidence and the three threads left.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
_tx_program wrote DXR without ever releasing the serial port, so it asserted
one octet per frame from a port whose word format it had not chosen. Now that
the core reads FO out of SPC rather than assuming it, an unprogrammed port
reads as FO=0 and the test saw sixteen-bit words.
splk @22, #40cc first - the Quad's own value, FO set for eight-bit bytes,
matching what _dsp_square_tone_program already does in the test beside it.
The expectation is then earned rather than inherited: the 302 writes 40c8 to
the same register and gets sixteen-bit words.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The chip model was wrong, as suspected. LSR's low three bits are the
LIU's state in the chip's own numbering, and this model reported 6 for
an activated line. The firmware stores (LSR & 7) + 2 and compares that
byte in seven places; six of them want 7, including the D-channel
transmit gate at 0x71c9b and the TEI entity at 0x6a932. Storing 8 means
every queued frame is silently dropped, which is what had been
happening in every run since the S interface was first brought up.
Driving the line to 5 instead changes nothing else and the whole stack
runs:
ID_REQUEST ref 11883: assigning TEI 64
SABME from TEI 64, answering UA
layer 2: multiple-frame-established
three frames transmitted where there had been none, and ATI12 in the
firmware's own words:
Physical Interface: Active
Data Link Layer : Active
The firmware takes the call - LINE_ACTIVE, --SETUP, START_ALERT - and
RING arrives on the AT interface.
This also explains the LINE_NOT_ACTIVE that was recorded as an
unexplained teardown and briefly blamed on this repository's own peer.
It was neither the peer nor the frame: 8 is a state the part does not
use for an active interface, so the firmware reported the line up and
then immediately down.
The mapping is a table rather than a formula, because the chip has fewer
LIU states than I.430 has F-states and a formula would invent the gaps.
Each entry carries whether it is shown or assumed; F7 -> 5 is the one
that is proven and the one everything depends on.
What is left is a call-level question, not a layer-2 one: the firmware
rings and then logs "SETUP not compatible INTL, release call".
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The chip model was answering LIU_LSR's low three bits - the F-state - and
zero for everything above, and two of those bits carry something. The
decode at 0x70e6f shows the shape without saying what it means: bit 7
gates a whole branch that logs "liu_stat.C : sending a LIU_STATUS", and
`and ax, 0x40 ; sar ax, 6` lifts bit 6 out as a 0/1 value the message
carries.
The firmware names them. Answering LSR with those bits set and reading
its own trace log back gives
0x80 -> STAT_OFFHOOK Detected>>>
0xc0 -> STAT_ONHOOK Detected
so bit 7 is a change indication and bit 6 is the handset hook state, 0
being off hook. That fits the board rather than being incidental: the
I-modem has an analogue phone port, the ADP whose directory number *P1
holds, and its hook switch is sensed here.
set_hook moves the switch, raises the part's interrupt the way a
line-state change does, and LSR reports both bits; reading LSR
acknowledges the change, because it is an indication and not a level.
The handset rests on hook, so a run that does not ask sees what it saw
before - only the bit-6 level changes and nothing reads it without bit
7. isdn-run --offhook-at N lifts it, and the firmware answers
LINE_ACTIVE Detected / STAT_OFFHOOK Detected>>>.
This is not what stops layer 2: the modem transmits nothing with the
handset either way. It is a part of the chip that was answering zero and
now answers what the part does.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Asked why it will not request a TEI. It does - two pages here saying
otherwise were wrong, and the distinction matters, because "has not
decided to ask" points at configuration and "has asked and the frame is
stuck" points at the transmit path.
Present an incoming call on the broadcast data link and the TEI entity
at 0x69b70 runs on event 0, finds the per-interface TEI state at
es:[bx+0x85] clear, sets the N202 retry counter at es:[bx+0x8e] to 1 -
the counter whose exhaustion the firmware logs as "N202 Cnt Exceeded -
no TEI assigned!!!" - and calls the builder at 0x6a755. That writes
message type 1 and Ai 0xff a byte at a time, and reading the assembled
buffer out of memory gives
0f 2e 6b 01 ff MEI, Ri, Identity Request, Ai = TEI 127
a textbook Q.921 Annex D request, exactly the shape courier_emu/bri.py
has been able to answer all along and has never been asked.
It is queued through 652e:000d and never transmitted: the chip
transmits 0 frames, the peer sees 0, and nothing in 0x71a00-0x72000
executes after the queue. Some 5,600 instructions later the stack raises
LINE_NOT_ACTIVE and abandons the procedure - and that verdict is not the
line. In the same window the chip is touched three times, and the
LIU_LSR read returns 0x06, which through the firmware's own (LSR & 7) + 2
is 8, F7, active. It reads the line as up and reports it as down.
One real fix fell out. The Ri above is 0x2e6b because the firmware reads
it from the Am79C30's random number generator, DLC_RNGR1/RNGR2, and
am79c30.py was answering those out of the register file - so they gave
back what had been written, 0. Every Identity Request this harness ever
built carried Ri 0000. Legal, not the cause, but not what the part does:
Ri exists so two terminals asking at once can tell their answers apart.
They are a generator now, seeded per instance with an LCG so runs stay
reproducible.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The last commit recorded the LINE_NOT_ACTIVE seen during an incoming call
as a defect in courier_emu/bri.py. It is not, and ruling that out is the
substance here, because "our peer must be breaking it" was the
comfortable answer.
The peer never touches the line after activation: a watch on
set_liu_state records exactly three changes in the run, F1->F2->F6->F7,
all during activation. The chip model is not mangling the frame: 35
bytes delivered, 35 read back, DRCR 35. The firmware re-reads the line
itself at 0x71b3d, computes (LSR & 7) + 2 = 8, stores F7, and raises the
status anyway - its own stored state says up while it reports down.
Injecting four frames separates the cause completely. A TEI identity
check on SAPI 63, and a UI on SAPI 0 / TEI 127 carrying 00 00 00, both
leave the log at LINE_ACTIVE only. A bare SETUP with no information
elements, and the full one, both produce LINE_NOT_ACTIVE and 001A. So it
is not the broadcast data link and not the IEs - only a valid Q.931
SETUP does it, and this is the firmware's layer 3 reacting to an
incoming call it owns no TEI for. 001A has no arm in its n_stat_in
dispatcher and falls to the default at 0x774ac.
Chasing it did find two real peer defects, both of which obscured the
firmware's behaviour rather than causing it:
- No T303. One SETUP went out and the peer then reported call-present
for the rest of the run, so a call nobody took looked like a call in
progress. Q.931 retransmits once after four seconds and then clears;
it does that now and says so in its events.
- No notion of the line going down underneath it. The peer only read
back the state it had set, so a firmware-side deactivation would have
left it reporting a data link that could not exist. It now notices,
drops its layer-2 and call state, and does not walk the line back up -
re-activating would hide exactly what is worth seeing.
Both covered by tests. Neither changes the trace, which is the point.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Traced ATD as asked. It does reach the ISDN stack - and the stack turns
out to be instrumented in English, which answers the question outright.
There is a printer at 0x77fc2 that packs a caller's string two
characters to a word into a ring at ds:0xa79a with the word count at
ds:0xb79a, appending CRLF per entry. ds is ce0, the segment the
initialiser relocates 0x41c0 bytes into from image 0x98d50, and
resolving the pushed string offsets against that block is what turned
`push 0x1594` into text. It is fill-once rather than wrap-around: the
guards at 0x78039 and 0x78051 stop appending at 0x7fd/0x7ef, so a long
run's log ends rather than losing its start. 2048 words.
courier_emu/imodem_trace.py reads it and every isdn-run report now
carries it as firmware_trace - two memory reads, so it costs nothing.
An index outside the ring reads as empty rather than decoding whatever
is at the address.
What it says about ATD:
LINE_ACTIVE Detected
l4_DISCONN : modem primitive
The dial reaches layer 3 and arrives as a DISCONNECT, not a setup. The
handler at 0x75882 dispatches a "modem primitive" on a character - '@'
logs l4_SETUP, 'B' logs l4_DISCONN - and ATD takes 'B'. So the question
shrinks from "why does the ISDN stack ignore ATD" to "why does the AT
layer hand it 'B'", which is one dispatch on one character.
465 symbolic strings sit in that block, and they confirm work done the
hard way: the layer-2 arms at 0x7743c/0x7744f/0x77468/0x77481 are
SPID_ERR, LINE_ACTIVE, LINE_NOT_ACTIVE and MISC_INFO, so 0x7744f setting
ce0:8d7c is exactly what its name says.
It also found a defect in this repository's own peer. Dialling with an
incoming broadcast call in flight logs LINE_ACTIVE then LINE_NOT_ACTIVE
plus `default of n_stat_in detected` / `001A`, and nothing in bri.py
deactivates the line in that run - so the peer is either disturbing the
S interface as it delivers the frame, or provoking the firmware into
dropping layer 1.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The switches are read through the same board-signal abstraction as the
rest of the board, and the firmware's own DIPSWITCH printer at 0xc7924
names them: a two-entry id table at 0xc79a3 holding 0x4023 and 0x1023,
whose low byte indexes the input-port table at a5f97 - entry 3 is port
0x12 - and whose high byte is the mask. So two switches, both bits of
one port, a sibling of the enclosure latch at 0x14. The table has
exactly two entries; what follows them is code, so two is all the
firmware reads.
The sense is the inversion the modem-status lines carry: a switch reads
present when its bit is 0, and the printer calls that ON. An unmodelled
port answering 0 therefore always read as both switches ON, which is the
default kept here so existing runs are unchanged. --dipswitch 1=off sets
one, and an explicit --port 0x12= still wins over the bank.
What they do is partly established. Switch 2 is read at boot by 0xa5fb4,
which sets [ca3f] bit 7 with [ca38] bit 2 clear when ON and the reverse
when OFF; five sites test that flag. Switch 1 is observable from
outside: with it OFF the modem stops answering the AT interface at all -
ATDT gets no response rather than NO CARRIER - which is what a Courier's
result-code or dumb-mode strap does.
It is not the answer to ATD, though. All four combinations of the two
switches leave ATDT transmitting no layer-2 frame.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffing runs was the cheap way to map this block and it got two fields
wrong, including one this branch "corrected" in the wrong direction.
There is a better source that needs no runs: ATI12's display is table
driven, and the table at 0xc4570-0xc4700 names each row's address. A
settings row's descriptor is `01 <lo> d4`, the RAM address 2600:d4<lo>
that row shows; subtracting the block base d476 turns each into an
index, and the spacings give the widths.
*W 0 *M 1 *S1 2 *S2 23 *P1 44 *P2 65 *T1 86 *T2 88 *O 90
with 21 bytes for each of the four number fields and 2 for each TEI.
The total is the check on the whole reading: 1+1+21+21+21+21+2+2+1 = 91,
exactly the length the checksum at c4ecb covers, so a wrong offset
anywhere would leave a gap or an overlap. tests/test_bri.py asserts the
tiling.
Two corrections fall out. *P1 is 21 bytes, not 8. And *T1/*T2 are 86 and
88, each two ASCII digits - not the 86/87 originally recorded, and not
the 88/89 this branch changed them to a commit ago. A run that sets only
*T2 leaves ff ff at 86 and 30 30 at 88, and ATI12 says exactly that:
*T1 Invalid fixed TEI, *T2 00 Automatic TEI.
*O, the field ATI12 has always called Invalid Value, is index 90, and
its renderer at 0xc3304 is the whole specification in four instructions:
clamp anything outside '0'..'1' to '2' and index a three-entry table of
En-Bloc mode, Overlap Sending mode, Invalid Value. So it is ASCII with
two valid values, and an unset 0xff is why it never read back. Sealed to
'0' it prints En-Bloc mode.
Also recorded, because both cost runs: the bearer capabilities *V1 and
*V2 are not in this block - it is full - and AT*V1=1, AT*V2=3, AT&W
changes one byte at page offset 0x25f. And the AT interface answers NO
CARRIER to everything from roughly 40,000,000 instructions in, ATI12
included, so settings have to be sent early or they silently do nothing.
None of it moves ATD. With every field ATI12 shows valid - NET3,
multipoint, En-Bloc, both TEIs automatic, a directory number - ATD still
answers NO CARRIER immediately and never touches the D channel.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The peer spoke Q.921 and Q.931 but did not terminate the S bus: layer 1
was still walked by the machine's own scripted --line-activate, so the
"network" was half a network. An NT owns activation, so it owns it here
now - the peer walks the terminal through F2, F6 and F7 the way INFO2
and INFO4 do, and the machine's walk stands down when a peer is
present rather than racing it. --line-activate still names when,
--no-bri-activate stands the NT down, and --bri-deactivate-at drops the
line back to F3, which is the only way to ask the firmware what it does
when the network goes away. F2 leads the walk for the firmware's
reason, not I.430's: its layer-1 machine dispatches on the state it is
already in and drops an event that skips ahead.
What terminating the bus properly bought is a way past the dead end in
the last commit. A point-to-point SABME is discarded because the modem
owns no TEI, but a network end has another door, and it is the one
Q.931 specifies for an incoming call on a multipoint bus: the network
does not know which terminal wants the call, so the SETUP goes on the
broadcast data link as a UI frame to TEI 127. That needs nothing of the
terminal in advance, which makes it the only path that can reach a
modem that has never transmitted. The peer takes it automatically when
it has no data link.
It gets in. The broadcast SETUP is accepted at 0x66814, marked with the
0xfa wildcard at 0x6685e, raises event 0x16 at 0x66882, and 0x6724d
walks the data-link entries and posts message 0x35 to layer 3 - the
body at 0x672bd executes, so the firmware's own call control is handed
the call. It then does nothing: no answer, no RING on the AT interface,
no frame out. Offering speech instead of unrestricted digital
(--bri-bearer speech) changes nothing, so it is not the bearer being
refused.
So the open question is no longer "the modem never transmits and
nothing is known about why". It is "call control has a SETUP and does
not act on it", with ATI12 still reporting Dialing Mode *O Invalid
Value as the leading suspect.
Terminal-initiated activation is deliberately absent: INFO1 would be
the firmware writing LIU_LMR1, and it writes that once at init, 0x40,
and never again in any run observed here. There is no request to
answer, and inventing a bit that means one would assert something the
image has not shown.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The D channel has had nobody on it. A BRI terminal does not open a data
link unprompted - point to point it waits for the network's SABME,
multipoint it asks for a TEI when it has traffic - so a harness with no
far end leaves the modem correctly silent, and that silence has been
read here as a missing transmit path.
courier_emu/bri.py is the far end: Q.921 and Q.931, built from the
standards, reaching the board only through the Am79C30A's own receive
and transmit buffers. It never writes the modem's memory and never
pokes a register, which is what keeps what it produces evidence. It
carries address decoding for SAPI and TEI, the U/S/I formats, TEI
assignment on SAPI 63, SABME/UA establishment with N(S)/N(R), RR and
REJ, T200 with N200 retransmissions, and enough call control to answer
a call the modem places or place one at it. isdn-run gains
--bri-network, --bri-establish, --bri-tei, --bri-call-at and
--bri-call-from, and reports what the peer did.
It answered its first question immediately. The modem does not ignore
the network's SABME: the chip counts the frames, the ISR reads every
byte, the DER check at 0x72eac passes and the frame is posted up as
message 0x33 to the Q.921 entity at 0x6674c. That entity validates the
address - EA bit, length, SAPI one of 0, 2, 0x10, 0x3f - and then looks
the data link up in the table at [0x6b88] through 6757:2fe. Nothing
matches SAPI 0 / TEI 0, so the frame is discarded. The modem is right:
it is configured for automatic TEI assignment, it does not own TEI 0,
and a network addressing TEI 0 is addressing nobody. So the transmit
path at 0x71cb0 is not unreachable through a missing pointer, which was
the standing hypothesis - it is never asked.
Still open, and both on the configuration side: the modem does not
request a TEI on its own even configured multipoint with an automatic
TEI, and ATD answers NO CARRIER before any D-channel activity while
ATI12 still reports Dialing Mode *O Invalid Value.
One correction on the way: the ISDN block's TEI field is at index 88,
two ASCII characters, not the 86 docs/imodem-config-sector.md lists.
AT*T1=0 then AT&W stores 30 30 there and ATI12 reads back Automatic
TEI.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
[d2c6] is the field-absent mask, established outright from the unpacker at
a4465..a44ab: bit 0 skips the d2c7 options walk, bit 1 skips d2c8 -> c8e4,
bit 2 skips d2c9 -> d2c5, bit 3 skips d2ca -> d2c4.
[d2c7] is modulation capability, mapped through the five-entry table at
a400:04ac - bits 0..4 setting e358 0x04, 0x08, 0x40, 0x80 and 0x20.
[d2c9] -> [d2c5] bit 0 is fax capability, and ATI7's own formatter names it:
c0d70..c0d92 picks between "Fax Options Class 1", "Class 2.0" and
"Class 1/Class 2.0", printing no line at all when the bit is clear. All three
tests read bit 0 - checked against raw bytes - so only the third is reachable.
[d2ca] -> [d2c4] bit 0 appends " MODEM" to the product type, at c0c17.
[d2c8] is left unidentified rather than guessed: its one consumer at bd1a1
splits it into a quotient at d2b0 and an xlatb'd remainder at d2b1, a grouped
code of some kind.
Two things this retires. The ALL_OPTIONS forcing was dead - the firmware writes
e358 again at a4446 after the hook and leaves it 0x23, and sweeping the forced
value changes ATI7's Options line not at all - so the write and the test that
asserted the constant are gone.
And it corrects the last commit's conclusion. [e770] bit 2 is gated on the fax
bit, and the command that sets it parses =0/=1/=2 and =? at c822c, which is the
shape of +FCLASS. Opening that branch would put the modem in fax mode, not fix
the result code. NO CARRIER remains open, at the same place it was.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
[d2c5] has one computed write, at a449b, inside a routine that unpacks a block
of capability bytes at d2c6..d2ca: [d2c9] becomes [d2c5] unless [d2c6] bit 2
says the field is absent. And d2c6 onwards is not computed - it is a 4 KiB
record copied out of flash. The loader at c532b walks four 0x1000-byte pages
from segment f800, validates each at c53fd with a CRC-16 seeded ffff whose
residue must be f0b8, prefers the highest version word at 0xffc, and copies the
winner verbatim to 2600:d2c6. When none validates, c5312 fills that 4 KiB with
ff instead - which is what happens here.
So the chain is: no record -> shadow blanked to ff -> d2c6 bit 2 set -> d2c5
stays 0 -> c83d0 gated off so [e770] bit 2 is never set -> adc63 falls through
to the call-termination epilogue -> cause 0 -> result code 3 for every command.
tools/imodem_capability_record.py builds a record and the firmware accepts it:
it validates, wins on version, stops the blank path running, and lands its
bytes with d2c9 copied on to d2c5. That is what verifies the CRC transcription
and the layout, and the test checks it against the firmware rather than against
our own arithmetic.
The field values are not recovered and are not guessed at. Setting d2c9 bit 0
leaves the firmware masking IRQ3 and silent, and an all-zero record silences it
too, so those bytes mean something specific. Nothing in this repository holds a
page the loader accepts.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The rewrite in isdn.py substituted a DTR-dropped cause when the recorded cause
was Keypress Abort with no flags, so that a plain AT would answer OK. It never
fired: the cause is 0, not 0x17, because the receive callback that recorded
0x17 is not the one [c922] holds any more. Removed, along with the unit test
that exercised the function without the run ever calling it.
What is actually true is broader than a bare AT. Watching AL at acf8c across
AT, ATZ, AT&F, ATE1, ATH, ATQ0, ATV1, ATX0 and AT&V, every command emits result
code 3 and code 0 is never emitted at all.
That also retires this page's argument that the result table cannot be
mis-indexed because ATI2 answers OK. ATI2's OK is its own text; the result code
after it is NO CARRIER like all the others.
The reason table starts at c194a, not c1abb which lands mid-string. Indexed
from there, 1 is DTR dropped and 23 = 0x17 lands exactly on Keypress Abort,
which cross-checks the indexing - so index 0 means no disconnect was recorded,
and that is what the firmware is answering NO CARRIER for.
Commands reach the decision through adc82, taken only when [e78e] bit 0,
[e78f] bit 0 and [e770] bit 2 are all clear. They are, all run; [e770] bit 2
has one setter at c83d0 gated on [d2c5] bit 0, which is also 0. Ruled out:
--line-activate to F7 changes nothing, and a sealed all-zero config record
makes the modem silent rather than fixing it.
Not fixed. The test now pins the current behaviour so a real fix fails loudly.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The board latch at port 0x14 is modelled, so the firmware's probe completes
and reaches its own verdict instead of abandoning at its first sense. The
sense wiring is what --product-type now selects: external straps it to the
0x08 drive and the probe stores 0x22, internal to the 0x80 drive and it stores
0x28, undefined leaves it dead. Nothing is written into d2c3 by the harness
any more - the previous forcing both never ran and, once it did, dropped the
probe's bit 5.
That also retires an earlier wrong conclusion. Comparing "External" against
"Internal" with the forcing hook active compared two Internal runs, which is
why both looked like the 0x80 UART. Left alone, External uses SIO0 at 0xf8f8
on IRQ3 - the part the harness already had - and only the internal card moves
the command port to 0x80 on IRQ0.
TERMINAL_PRESENT was backwards. The signal query masks the MSR and does sete,
so a signal is present when its bit reads 0, and the set/clear routines drive
the MCR the same way. With DSR reading 1 the firmware decides no terminal is
attached and goes silent on anything longer than a bare AT: ATI7 printed
nothing at all. With it reading 0, ATI7 prints its whole profile - and now
reports Product type External rather than Undefined, and ATI3 answers OK.
The internal card is wired up but unfinished: its UART at 0x80 and the tick on
IRQ0 bring the handler at b2f1a to life and all received characters are
dispatched, but the transmit routine finds nothing to send, so it does not
answer yet.
Rackmount is dropped from --product-type: ATI7 can name the bit but the board
probe has no verdict that produces it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The formatter at c0be0 tests bit 1, then 3, then 2, with a fallback, and the
four string offsets it loads point into consecutive strings whose lengths match
the gaps exactly. Reading them back: bit 1 External, bit 3 Internal, bit 2
Rackmount, none Undefined. PRODUCT_TYPE_MODES had every entry one position out,
so --product-type external wrote the Internal bit.
That resolves the contradiction from the last commit. 0x28 is Internal and
0x22 is External, so the ISA PnP responder and its "INT" identifier were simply
the Internal branch, reached because the first latch wiring guessed was the
0x80 one. Measured at a4503: sense following 0x80 gives Internal, sense
following 0x08 gives External, and only one write to d2c3 happens all run.
Both real variants then produce identical hardware - the same port block at
0x80 and the same 0xda mask. So the 0xf8f8 / IRQ3 interface the harness has
always driven is the fallback the firmware takes when the probe fails, not
what either product uses. With the latch answering, a channel at 0x80 and the
tick on IRQ0, the polled handler at b2f1a runs 8,703 times instead of never.
The old product-type test asserted the wrong mapping inline, which is how it
stayed pinned and looking verified; the bit values are now checked against
ATI7's string table in the firmware.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The echo at b2ca0 is gated on [d2c3] bit 3, and [d2c3] is 0 in every run
because the board probe abandons at its first sense: it drives 0x08 and 0x80
into the latch at port 0x14 and reads bit 0x40 back from the same port, and
the harness answers 0 there. The same hole makes --product-type a no-op, since
the flag is applied by a hook on 0xa4506, inside the part of the probe that is
never reached.
Modelling the latch is not enough on its own. The probe then completes and
stores External, and the command port stops transmitting entirely - [d2c3]
bit 3 switches the signal routines onto the UART's MCR and MSR and inverts
their sense in both directions, and sweeping the modem-status inputs does not
bring transmit back. Recorded as an open problem rather than half-modelled.
The divisor-table test asserted arithmetic against constants retyped from
sio.py and could not fail. Replaced with one that reads the table out of the
booted firmware at c774:04db and checks it against both clocks - it fails on
12.288 MHz, which is the obvious wrong answer it needs to exclude.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The rate setter at c7ae7 indexes a twelve-word table at c774:04db, and the
setup menu at c0570 names the rates those codes stand for. Once named, every
divisor in the table is exact - but against two clocks, not one: 3.6864 MHz
for 230400..38400 and 12.3456 MHz for 19200..300. The firmware picks between
them itself, clearing bit 1 of 0xf836 for the fast four and setting it for the
rest, which is exactly where one clock stops fitting and the other starts.
So the character interval is now derived rather than pinned at 20,000. Scaled
against the 20.16 MHz ATI7 prints for its own board, a 9600 character comes
out at 20,903 instructions - within 5% of the number that was verified
empirically before either clock was known.
The link is 7E1, generated in software: the part is programmed 8N1 and the
firmware computes the parity into the top bit, which puts the same ten bits on
the wire. 73 bytes of 73 agree, and ATI4 says PARITY=E WORDLEN=7. The console
now sends it that way too, though the firmware masks it rather than checking
it.
Two claims that were wrong are retired. The firmware does not swallow the
first line - a lone ATI3 answers - so interactive_pump no longer types an AT
the user did not, and what looked like a lost line was a bare AT answering
NO CARRIER. And SIO1's interrupt line is not missing from the decode: the
variable block at e83a holds all nine registers of one part and there is no
second block, and SIO1 is addressed seven times, all in init. The only other
serial interrupt path is IRQ12, a DMA-fed transmitter for SIO0 that no
command session touches.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
read_serial_number returns the twelve bytes ATI7 prints; the test still
expected the thirteen that were written. Assert what the firmware reports.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Seeding a sealed record carrying IMD0123456789 and 00:c0:49:01:ab:74 makes
ATI7 report
Serial Number IMD012345678
so the serial field is twelve characters, not the fifteen the copied span
covers; what the remaining three bytes before the MAC carry is left open.
The same run shows the report itself gains from a valid record: product type,
the supervisor and DSP dates and the serial are all absent without one, which
the earlier ATI sweep recorded and this explains. Product type reads
"Undefined", so there is a product-type field still to locate.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The firmware's own printer at cd270 names both: it loads bx with d2e6 before
the literal "MAC " and with d2d7 before "Serial Number ", so those are the RAM
addresses. Both read back as ff rather than the 00 the RAM wipe leaves, which
is the tell that they come from the config record and are merely unset -- an
update-written sector carries no identity, because a factory unit already had
one.
Painting the sector puts them at page offsets 0x011 (15 bytes) and 0x020 (8
bytes), contiguous, ending just before the generation byte at 0x02e. Writing
them through a resealed sector loads them: "IMD0123456789" at d2d7 and
00:c0:49:01:ab:74 at d2e6. The serial is ASCII and NUL-terminated, the MAC is
six raw bytes in an eight-byte field, and 00:c0:49 is USRobotics' OUI -- the
same prefix the board's barcode label carries.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Rather than painting offsets, set each field over the AT interface, let the
firmware write its own sector, and diff it. ATI12 then reads the result back
in the firmware's own words -- *M 1 Multi-point, *P1 5551000 ADP Directory
Number, *T1 00 Automatic TEI -- and the sector differs in exactly the fields
that were set:
index 0 *W switch protocol, ASCII digit
index 1 *M bus configuration
index 44-51 *P1 voice directory number, ASCII, NUL terminated
index 86/87 *T1 and *T2, ASCII
Two things fall out for free. The firmware answers "*ATZ! Required* :
Settings Have Changed" until a reset, so a session that changes settings must
end AT&W, ATZ. And a sector the firmware itself wrote verifies against
page_crc -- so the recovered CRC is now checked from both sides, not only by
the firmware accepting ours but by us computing the word it writes.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The seal is the routine at 0xba80f: a reflected CRC-16-CCITT, poly 0x1021,
which proves its own transcription against that algorithm's published check
value -- crc16(b"123456789", 0) is 0x2189.
The seed was solved rather than read. Two pages of a captured sector differ
in two bytes, so a single seed exists only if stored ^ crc(page, 0) matches
across them; it does, 0x0267 both times, and solving over GF(2) gives 0x169e,
which reproduces 0x7fea and 0x7ef0 exactly.
Then the record was mapped by construction: painting every erased byte of a
resealed page with its own offset and reading 2600:d476 back puts the 91-byte
ISDN block at page offset 0x1b0, ending at 0x20a -- immediately before the
0x20b field the original sector already showed. Setting its first byte to
ASCII 4 and resealing makes ATI12 print
Switch Protocol *W 4 ETSI NET3 (Mu-Law)
so the firmware checked the CRC of a record this repository built, loaded it,
and named the switch type back.
courier_emu/imodem_config.py carries crc16, seal, read_isdn_block and
set_switch_protocol, with nine tests. Also fixes a name collision in the
isdn-run CLI where the flash-overlay parsing clobbered the image variable.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A photograph of the board shows two 4 Mbit flash parts side by side, an Intel
28F400 and an AMD Am29F400AT, which is why the boot code probes Intel first
and falls back to AMD. The harness was answering as Intel at the window the
updater identifies, and the difference is not cosmetic: under Intel the
updater erased and programmed nothing, under AMD it erases its sector and
writes 4,096 words.
So the model defaults to the Am29F400AT and carries AMD's command set -- a0
program, 80/30 sector erase, 10 chip erase, f0 reset -- alongside Intel's,
with the part's real top-boot geometry instead of a uniform block. That
geometry confirms the 8 KiB block size this repository had inferred from the
erase address alone: 78100 falls in SA8, its first boot sector.
Reading back the 386EX chip-select unit gives the board's map outright: 256
KiB of SRAM at 00000-3ffff, which is ATI7's Ram 256k, and 768 KiB from 40000
to fffff, which is its Eprom 768k -- across two parts, since the identify at
34983 is hardwired to 80000 with no bank loop. The 40000 window this
repository called "the updater in RAM" is its own chip select.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>