mirror of
https://github.com/D-Modem/courier-emu.git
synced 2026-11-28 12:38:04 -08:00
Gate the mailbox tap on the loader window, and record an ATDT123 run
The first ATDT123 run reported 3542 messages whose tags were C5x opcodes (be42 = clrc ovm, 7a80 = call). Ports 0x58-0x5e are shared: they carry the upper half of the cold-boot transfer window until the program is in, and only become the mailbox afterwards. The tap now defers to the bridge's own `active` flag rather than keeping a parallel guess, and discards any header started during the loader phase. The recorded run uses main211.xmf, not a board capture: the ROM images carry no DSP program memory below 0x8000, so they cannot run the datapump. What it found, with a plain-AT control beside it: the mailbox carries a periodic service exchange, not per-digit commands. Both runs produce the same seven tags with the same arguments; the dial run just repeats the cycle about 135 times while audio plays. Nothing in the stream distinguishes digit 1 from 2 from 3. That is expected rather than disappointing - bridge.begin_dialing hands the digits to the core through set_dtmf_digits, bypassing the mailbox, which is the board-side model this repo already records as standing in for the unrecovered datapump handoff. The tap measured the path faithfully; the digits are not on it. The per-tag tone column in that run is uninformative and the manifest says so: messages repeat every ~7 samples while a DTMF digit lasts thousands, so every correlation window covers whatever is playing. Discriminating needs onset correlation or a differential, not a wider window. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
667c6d13c2
commit
c9bd78cf68
10 files changed
+70725
-1
No files matched your search
@@ -0,0 +1,498 @@
|
||||
{
|
||||
"line_rate": 9600,
|
||||
"window": 512,
|
||||
"samples": 1371,
|
||||
"messages": [
|
||||
{
|
||||
"sequence": 0,
|
||||
"tag": "0x007d",
|
||||
"argument": "0x0028",
|
||||
"kind": "tag+arg",
|
||||
"dispatchable": true,
|
||||
"pc": "6ad5b",
|
||||
"sample_index": 1338,
|
||||
"audio": {
|
||||
"samples": 33,
|
||||
"rms": 0.0,
|
||||
"peaks": [
|
||||
[
|
||||
350,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
440,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
480,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
620,
|
||||
0.0
|
||||
]
|
||||
],
|
||||
"dtmf": null,
|
||||
"progress": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"sequence": 1,
|
||||
"tag": "0x0001",
|
||||
"argument": "0x0000",
|
||||
"kind": "tag+arg",
|
||||
"dispatchable": true,
|
||||
"pc": "6ad5b",
|
||||
"sample_index": 1341,
|
||||
"audio": {
|
||||
"samples": 30,
|
||||
"rms": 0.0,
|
||||
"peaks": [
|
||||
[
|
||||
350,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
440,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
480,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
620,
|
||||
0.0
|
||||
]
|
||||
],
|
||||
"dtmf": null,
|
||||
"progress": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"sequence": 2,
|
||||
"tag": "0x0001",
|
||||
"argument": "0x0000",
|
||||
"kind": "tag+arg",
|
||||
"dispatchable": true,
|
||||
"pc": "6ad5b",
|
||||
"sample_index": 1344,
|
||||
"audio": {
|
||||
"samples": 27,
|
||||
"rms": 0.0,
|
||||
"peaks": [
|
||||
[
|
||||
350,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
440,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
480,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
620,
|
||||
0.0
|
||||
]
|
||||
],
|
||||
"dtmf": null,
|
||||
"progress": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"sequence": 3,
|
||||
"tag": "0x000f",
|
||||
"argument": "0x0600",
|
||||
"kind": "tag+arg",
|
||||
"dispatchable": true,
|
||||
"pc": "6aea5",
|
||||
"sample_index": 1347,
|
||||
"audio": {
|
||||
"samples": 24,
|
||||
"rms": 0.0,
|
||||
"peaks": [
|
||||
[
|
||||
350,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
440,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
480,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
620,
|
||||
0.0
|
||||
]
|
||||
],
|
||||
"dtmf": null,
|
||||
"progress": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"sequence": 4,
|
||||
"tag": "0x0001",
|
||||
"argument": "0x0000",
|
||||
"kind": "tag+arg",
|
||||
"dispatchable": true,
|
||||
"pc": "6ad5b",
|
||||
"sample_index": 1350,
|
||||
"audio": {
|
||||
"samples": 21,
|
||||
"rms": 0.0,
|
||||
"peaks": [
|
||||
[
|
||||
350,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
440,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
480,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
620,
|
||||
0.0
|
||||
]
|
||||
],
|
||||
"dtmf": null,
|
||||
"progress": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"sequence": 5,
|
||||
"tag": "0x000f",
|
||||
"argument": "0x1200",
|
||||
"kind": "tag+arg",
|
||||
"dispatchable": true,
|
||||
"pc": "6aea5",
|
||||
"sample_index": 1353,
|
||||
"audio": {
|
||||
"samples": 18,
|
||||
"rms": 0.0,
|
||||
"peaks": [
|
||||
[
|
||||
350,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
440,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
480,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
620,
|
||||
0.0
|
||||
]
|
||||
],
|
||||
"dtmf": null,
|
||||
"progress": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"sequence": 6,
|
||||
"tag": "0x0082",
|
||||
"argument": "0x00a0",
|
||||
"kind": "tag+arg",
|
||||
"dispatchable": false,
|
||||
"pc": "6ad5b",
|
||||
"sample_index": 1356,
|
||||
"audio": {
|
||||
"samples": 15,
|
||||
"rms": 0.0,
|
||||
"peaks": [
|
||||
[
|
||||
350,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
440,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
480,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
620,
|
||||
0.0
|
||||
]
|
||||
],
|
||||
"dtmf": null,
|
||||
"progress": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"sequence": 7,
|
||||
"tag": "0x0083",
|
||||
"argument": "0x0002",
|
||||
"kind": "tag+arg",
|
||||
"dispatchable": false,
|
||||
"pc": "6ad5b",
|
||||
"sample_index": 1359,
|
||||
"audio": {
|
||||
"samples": 12,
|
||||
"rms": 0.0,
|
||||
"peaks": [
|
||||
[
|
||||
350,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
440,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
480,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
620,
|
||||
0.0
|
||||
]
|
||||
],
|
||||
"dtmf": null,
|
||||
"progress": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"sequence": 8,
|
||||
"tag": "0x0084",
|
||||
"argument": "0x1468",
|
||||
"kind": "tag+arg",
|
||||
"dispatchable": false,
|
||||
"pc": "6aea5",
|
||||
"sample_index": 1362,
|
||||
"audio": {
|
||||
"samples": 9,
|
||||
"rms": 0.0,
|
||||
"peaks": [
|
||||
[
|
||||
350,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
440,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
480,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
620,
|
||||
0.0
|
||||
]
|
||||
],
|
||||
"dtmf": null,
|
||||
"progress": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"sequence": 9,
|
||||
"tag": "0x0084",
|
||||
"argument": "0x1408",
|
||||
"kind": "tag+arg",
|
||||
"dispatchable": false,
|
||||
"pc": "6aea5",
|
||||
"sample_index": 1365,
|
||||
"audio": {
|
||||
"samples": 6,
|
||||
"rms": 0.0,
|
||||
"peaks": [
|
||||
[
|
||||
350,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
440,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
480,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
620,
|
||||
0.0
|
||||
]
|
||||
],
|
||||
"dtmf": null,
|
||||
"progress": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"sequence": 10,
|
||||
"tag": "0x000f",
|
||||
"argument": "0x1200",
|
||||
"kind": "tag+arg",
|
||||
"dispatchable": true,
|
||||
"pc": "6aea5",
|
||||
"sample_index": 1368,
|
||||
"audio": {
|
||||
"samples": 3,
|
||||
"rms": 0.0,
|
||||
"peaks": [
|
||||
[
|
||||
350,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
440,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
480,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
620,
|
||||
0.0
|
||||
]
|
||||
],
|
||||
"dtmf": null,
|
||||
"progress": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"sequence": 11,
|
||||
"tag": "0x0067",
|
||||
"argument": "0x0000",
|
||||
"kind": "tag+arg",
|
||||
"dispatchable": true,
|
||||
"pc": "6ad5b",
|
||||
"sample_index": 1371,
|
||||
"audio": {
|
||||
"samples": 0,
|
||||
"rms": 0.0,
|
||||
"peaks": [
|
||||
[
|
||||
350,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
440,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
480,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
620,
|
||||
0.0
|
||||
]
|
||||
],
|
||||
"dtmf": null,
|
||||
"progress": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": {
|
||||
"0x007d": {
|
||||
"tag": "0x007d",
|
||||
"kind": "tag+arg",
|
||||
"dispatchable": true,
|
||||
"count": 1,
|
||||
"arguments": [
|
||||
"0x0028"
|
||||
],
|
||||
"first_pc": "6ad5b",
|
||||
"dtmf": [],
|
||||
"progress": [],
|
||||
"peak_rms": 0.0
|
||||
},
|
||||
"0x0001": {
|
||||
"tag": "0x0001",
|
||||
"kind": "tag+arg",
|
||||
"dispatchable": true,
|
||||
"count": 3,
|
||||
"arguments": [
|
||||
"0x0000"
|
||||
],
|
||||
"first_pc": "6ad5b",
|
||||
"dtmf": [],
|
||||
"progress": [],
|
||||
"peak_rms": 0.0
|
||||
},
|
||||
"0x000f": {
|
||||
"tag": "0x000f",
|
||||
"kind": "tag+arg",
|
||||
"dispatchable": true,
|
||||
"count": 3,
|
||||
"arguments": [
|
||||
"0x0600",
|
||||
"0x1200"
|
||||
],
|
||||
"first_pc": "6aea5",
|
||||
"dtmf": [],
|
||||
"progress": [],
|
||||
"peak_rms": 0.0
|
||||
},
|
||||
"0x0082": {
|
||||
"tag": "0x0082",
|
||||
"kind": "tag+arg",
|
||||
"dispatchable": false,
|
||||
"count": 1,
|
||||
"arguments": [
|
||||
"0x00a0"
|
||||
],
|
||||
"first_pc": "6ad5b",
|
||||
"dtmf": [],
|
||||
"progress": [],
|
||||
"peak_rms": 0.0
|
||||
},
|
||||
"0x0083": {
|
||||
"tag": "0x0083",
|
||||
"kind": "tag+arg",
|
||||
"dispatchable": false,
|
||||
"count": 1,
|
||||
"arguments": [
|
||||
"0x0002"
|
||||
],
|
||||
"first_pc": "6ad5b",
|
||||
"dtmf": [],
|
||||
"progress": [],
|
||||
"peak_rms": 0.0
|
||||
},
|
||||
"0x0084": {
|
||||
"tag": "0x0084",
|
||||
"kind": "tag+arg",
|
||||
"dispatchable": false,
|
||||
"count": 2,
|
||||
"arguments": [
|
||||
"0x1468",
|
||||
"0x1408"
|
||||
],
|
||||
"first_pc": "6aea5",
|
||||
"dtmf": [],
|
||||
"progress": [],
|
||||
"peak_rms": 0.0
|
||||
},
|
||||
"0x0067": {
|
||||
"tag": "0x0067",
|
||||
"kind": "tag+arg",
|
||||
"dispatchable": true,
|
||||
"count": 1,
|
||||
"arguments": [
|
||||
"0x0000"
|
||||
],
|
||||
"first_pc": "6ad5b",
|
||||
"dtmf": [],
|
||||
"progress": [],
|
||||
"peak_rms": 0.0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
12 mailbox messages, 1371 line-transmit samples at 9600 Hz
|
||||
|
||||
seq tag arg kind pc sample rms tone
|
||||
0 0x0007d 0x00028 tag+arg 6ad5b 1338 0.0 silent
|
||||
1 0x00001 0x00000 tag+arg 6ad5b 1341 0.0 silent
|
||||
2 0x00001 0x00000 tag+arg 6ad5b 1344 0.0 silent
|
||||
3 0x0000f 0x00600 tag+arg 6aea5 1347 0.0 silent
|
||||
4 0x00001 0x00000 tag+arg 6ad5b 1350 0.0 silent
|
||||
5 0x0000f 0x01200 tag+arg 6aea5 1353 0.0 silent
|
||||
6 0x00082 0x000a0 tag+arg 6ad5b 1356 0.0 silent
|
||||
7 0x00083 0x00002 tag+arg 6ad5b 1359 0.0 silent
|
||||
8 0x00084 0x01468 tag+arg 6aea5 1362 0.0 silent
|
||||
9 0x00084 0x01408 tag+arg 6aea5 1365 0.0 silent
|
||||
10 0x0000f 0x01200 tag+arg 6aea5 1368 0.0 silent
|
||||
11 0x00067 0x00000 tag+arg 6ad5b 1371 0.0 silent
|
||||
|
||||
per-tag rollup:
|
||||
0x0001 x3 dispatchable peak-rms 0.0 args 0x0000 -
|
||||
0x000f x3 dispatchable peak-rms 0.0 args 0x0600,0x1200 -
|
||||
0x0084 x2 raw-word peak-rms 0.0 args 0x1468,0x1408 -
|
||||
0x007d x1 dispatchable peak-rms 0.0 args 0x0028 -
|
||||
0x0082 x1 raw-word peak-rms 0.0 args 0x00a0 -
|
||||
0x0083 x1 raw-word peak-rms 0.0 args 0x0002 -
|
||||
0x0067 x1 dispatchable peak-rms 0.0 args 0x0000 -
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"status": "complete",
|
||||
"image": "main211.xmf",
|
||||
"command": "ATDT123",
|
||||
"instructions": 9000000,
|
||||
"daa_line": "dial-tone",
|
||||
"line_rate": 9600,
|
||||
"messages": 1628,
|
||||
"line_tx_samples": 13151,
|
||||
"control": "artifacts/mailbox-tap-at-01 (same image, plain AT)",
|
||||
"finding": "The mailbox carries a periodic service exchange, not per-digit commands. The AT control run produces the same seven tags with the same arguments and only 12 messages; the dial run repeats that cycle about 135 times while audio plays. No tag or argument distinguishes digit 1 from 2 from 3.",
|
||||
"cycle": "per cycle: 3x {0x01, 0x0f, 0x84}, 1x {0x82, 0x83, 0x67}",
|
||||
"caveat": "In this emulator the digits reach the C52 through bridge.set_dtmf_digits, not the mailbox, so a tap on the mailbox cannot attribute them. The tone attribution in report.txt is an artefact of window overlap: messages repeat every ~7 samples while a DTMF digit lasts thousands, so every window covers whatever is playing. Treat the per-tag tone column in this run as uninformative.",
|
||||
"assumptions": [
|
||||
"The ROM captures cannot run this: they carry no DSP program memory below 0x8000.",
|
||||
"Temporal correlation is not causal attribution."
|
||||
]
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,36 @@
|
||||
"""ATDT123 on the 403 capture with the mailbox tap attached."""
|
||||
import json, sys, time
|
||||
from pathlib import Path
|
||||
from courier_emu.cli import load_image
|
||||
from courier_emu.machine import CourierMachine
|
||||
from courier_emu.daa import CourierDaa
|
||||
from courier_emu.mailbox_tap import MailboxTap
|
||||
|
||||
IMAGE = sys.argv[1] if len(sys.argv) > 1 else "main211.xmf"
|
||||
COUNT = int(sys.argv[2]) if len(sys.argv) > 2 else 9_000_000
|
||||
OUT = Path(sys.argv[3]) if len(sys.argv) > 3 else Path("artifacts/mailbox-tap-atdt-01")
|
||||
|
||||
machine = CourierMachine(
|
||||
load_image(IMAGE),
|
||||
with_dsp=True,
|
||||
serial_input=(sys.argv[4].encode()+b"\r") if len(sys.argv)>4 else b"ATDT123\r",
|
||||
daa=CourierDaa("dial-tone"),
|
||||
)
|
||||
bridge = getattr(machine, "dsp_bridge", None)
|
||||
print("dsp_bridge:", type(bridge).__name__ if bridge else None, flush=True)
|
||||
if bridge is None:
|
||||
raise SystemExit("no dsp_bridge on the machine; cannot tap")
|
||||
|
||||
tap = MailboxTap(bridge).attach()
|
||||
start = time.time()
|
||||
result = machine.run(COUNT)
|
||||
tap.flush(); tap.detach()
|
||||
elapsed = time.time() - start
|
||||
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
summary = result.to_dict() if hasattr(result, "to_dict") else {}
|
||||
(OUT / "run.json").write_text(json.dumps(summary, sort_keys=True, indent=2) + "\n")
|
||||
tap.write_json(OUT / "mailbox.json")
|
||||
(OUT / "report.txt").write_text(tap.report() + "\n")
|
||||
print(f"\n{elapsed:.1f}s, {COUNT} instructions -> {OUT}")
|
||||
print(tap.report())
|
||||
@@ -223,9 +223,27 @@ class MailboxTap:
|
||||
|
||||
# -- message reconstruction -----------------------------------------
|
||||
|
||||
def _mailbox_open(self) -> bool:
|
||||
"""Whether these ports are currently the mailbox rather than the loader.
|
||||
|
||||
`0x58`-`0x5e` are shared: under the ROM's protocol they carry the upper
|
||||
half of the cold-boot transfer window until the program is in, and only
|
||||
become the mailbox afterwards. Without this gate a tap records the
|
||||
datapump download - thousands of C5x opcodes read back as tags. The
|
||||
bridge's own `active` flag is the same gate it uses to decide a message
|
||||
has been sent, so defer to it rather than keeping a parallel guess.
|
||||
"""
|
||||
active = getattr(self.bridge, "active", None)
|
||||
return True if active is None else bool(active)
|
||||
|
||||
def _observe(self, port: int, size: int, value: int, pc: int | None) -> None:
|
||||
if port not in MAILBOX_PORTS or size != 1:
|
||||
return
|
||||
if not self._mailbox_open():
|
||||
# Drop any half-built header from the loader phase.
|
||||
self._header = None
|
||||
self._value = 0
|
||||
return
|
||||
value &= 0xFF
|
||||
if port == 0x58:
|
||||
# A pending header with no argument was a one-word send.
|
||||
|
||||
@@ -29,8 +29,9 @@ class FakeCore:
|
||||
|
||||
|
||||
class FakeBridge:
|
||||
def __init__(self, core: FakeCore | None = None) -> None:
|
||||
def __init__(self, core: FakeCore | None = None, active: bool = True) -> None:
|
||||
self.core = core or FakeCore()
|
||||
self.active = active # False while the ports are the loader window
|
||||
self.writes: list[tuple[int, int, int, int | None]] = []
|
||||
|
||||
def write(self, port: int, size: int, value: int, pc: int | None = None) -> None:
|
||||
@@ -167,3 +168,26 @@ def test_report_and_rollup_mention_every_tag():
|
||||
assert summary["0x0021"]["arguments"] == ["0x0032", "0x0033"]
|
||||
text = tap.report()
|
||||
assert "0x0030" in text and "0x0021" in text and "per-tag rollup" in text
|
||||
|
||||
|
||||
def test_writes_are_ignored_while_the_ports_are_the_loader_window():
|
||||
"""0x58-0x5e carry the download until the bridge goes active.
|
||||
|
||||
Without this gate the tap records the datapump program as mailbox traffic:
|
||||
an untapped ATDT run showed 3542 "messages" whose tags were C5x opcodes.
|
||||
"""
|
||||
bridge = FakeBridge(active=False)
|
||||
with MailboxTap(bridge) as tap:
|
||||
send_pair(bridge, 0xBE42, 0xBF09) # C5x opcodes, not a message
|
||||
send_pair(bridge, 0x7A80, 0x8138)
|
||||
assert tap.messages == []
|
||||
assert len(bridge.writes) == 8 # still passed through
|
||||
|
||||
|
||||
def test_a_header_started_before_going_active_is_discarded():
|
||||
bridge = FakeBridge(active=False)
|
||||
with MailboxTap(bridge) as tap:
|
||||
bridge.write(0x58, 1, 0x42, None) # loader byte
|
||||
bridge.active = True
|
||||
send_pair(bridge, 0x0021, 0x0031)
|
||||
assert [(m.tag, m.argument) for m in tap.messages] == [(0x21, 0x31)]
|
||||
Reference in new issue
Block a user