mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 02:11:36 -04:00
8b0fc34714
Real card protocol restarts on every fresh 0x81 — SELECT deassert is
a bus-wide reset signal. Earlier model preserved mc_state across
deassert via mc_save_slot, which caused every subsequent 0x81 to land
on a stale non-IDLE saved state and trigger abort_reselect bookkeeping.
Audit confirmed the BIOS-visible RX was still correct (the abort path
itself reset mc_state), but the retained sector/cmd/counter context
across logically-independent transactions was wrong per no$psx.
Clear volatile protocol state on SELECT deassert (state, cmd, sector,
sector_msb, sector_lsb, data_idx, checksum on both slots). Preserve
mc_slots[].flag (persistent "new card" metadata) and mc_slots[].data
(sector buffer, harmless to retain).
Result on a 4-press boot run: 6 transactions reach READ_DATA (ts=10)
and successfully read the "MC" header magic (RX bytes 0x4D 0x43);
remaining txns continue as 4-byte presence pings. Pre-fix: 0 reads
of card data ever; post-fix: card protocol can complete the setup
phase and enter data phase.
The byte-15 abort that follows is a separate blocker — kernel chain
dispatcher interleaves pad polling into the card data read. Tracked
for next session via the chain dispatcher disassembly.
Also includes:
- Slot-state capture in SioTraceEntry + sio_trace JSON emission
- dirty_ram_interp: replace mid-block fprintf+fflush with a counter
(CLAUDE.md §3 — synchronous Windows console I/O at high rate
starves the dispatch loop)
- Passive Python TCP probes (raw_tcp, trace_audit, trace_range,
txn_summary, txn_dist, txn_bytes, drs_filter, readram_test,
step_audit{,2}, verify_card_buffer, wtrace_filter)
- docs/MEMCARD_AUDIT_2026_04_28.md (prior session's 7-layer audit)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
20 lines
671 B
Python
20 lines
671 B
Python
"""Summarize card txns: per-txn line + max stats."""
|
|
import sys, json, re
|
|
|
|
txt = sys.stdin.read()
|
|
m = re.search(r'\{.*\}', txt, re.S)
|
|
if not m:
|
|
print('parse fail'); sys.exit(1)
|
|
j = json.loads(m.group(0))
|
|
ents = j.get('entries', [])
|
|
|
|
for e in ents:
|
|
print(f"txn {e.get('txn_seq')}: slot={e.get('slot')} cmd={e.get('cmd')} "
|
|
f"sect={e.get('sector')} bytes={e.get('bytes')} "
|
|
f"ts={e.get('terminal_state')} reason={e.get('end_reason')}")
|
|
|
|
if ents:
|
|
mb = max(e.get('bytes',0) for e in ents)
|
|
mt = max(e.get('terminal_state',0) for e in ents)
|
|
print(f"\n[max bytes/txn={mb}, max terminal_state={mt}, total_closed={j.get('total_closed')}]")
|