Files
courier-emu/tests
Cryan209andClaude Opus 5 e030d0d4e4 Read the ISDN Courier's two containers, which agree with each other
The ISDN Courier ships its firmware as a pair of update files, and neither
loaded. Both do now, and each one independently confirms the other.

An XMP is a 0x80-byte header over a 0xb8000 payload with every byte XOR'd by
0x45. The key needs no code analysis: erased flash still dominates the image,
its pad byte reads 0xba, and 0xff ^ 0xba is 0x45. Decoding turns 0xff back into
the most common byte and yields the VRTX kernel banner and the V.110 rate
adaptation strings, so the body was never compressed, only obfuscated.

A NAC is Intel HEX with the ASCII stripped out: a length byte, a big-endian
16-bit address, a type byte, and that many data bytes. The big-endian address is
the giveaway, because everything else in these images is little-endian. Its
header declares the record-stream length as file size minus header minus
trailer, which is what locates the true stream start at 0x20 rather than at the
first data record; the record sitting there is a type 0x02 setting segment
0x4000. Unlike ASCII Intel HEX there is no per-record checksum byte, and parsing
without one consumes the stream exactly.

That segment record means the NAC places itself at physical 0x40000 instead of
the harness assuming a base, and it is the same base the XMP payload had to
infer from the boot code installing its INT1 handler in segment 0x4000. The two
decodes then agree completely: flattening the NAC's 42,023 data records gives a
0xb8000 image at 0x40000 that is byte-for-byte identical to the XOR-decoded XMP
payload, and the 82,879 bytes the NAC never paints are exactly the bytes that
read as erased flash in the XMP. Two independently encoded containers landing on
one image is the strongest available check on both, and the tests assert it.

Two fields stay unrecovered rather than guessed at. The XMP's 0x70-byte header
table at offset 0x10 is plaintext and plainly structured, but its layout is not
worked out, and the NAC's two trailing bytes are not a byte sum of the stream
and match none of the common CRC-16s over either the stream or the whole file.
Both are reported verbatim by their describe().

Nothing here executes. The payload is 80386 code, and it says so at offset 0x38
where it clears dr0..dr3 and dr7, registers the 80186 supervisor does not have.
No lgdt, lidt, lmsw, or mov cr appears anywhere in it, so this is 386 real mode,
which the existing Unicorn core already runs. What is missing is the board, and
the debug registers: the firmware installs its own INT1 handler and arms
hardware breakpoints as a runtime mechanism, which Unicorn will not deliver.

The firmware inputs themselves stay out of the tree, like the other images, so
the new tests skip when they are absent.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-05 16:34:00 +12:00
..
2026-08-04 15:16:26 +12:00
2026-08-04 15:16:26 +12:00
2026-08-04 13:01:29 +12:00