mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 10:19:47 -04:00
711d22cff3
The SIO model had a single global mc_state shared between both card slots, which caused 100% probe abort rate when the BIOS alternates between slot 0 and slot 1: each new 0x81 probe on the other slot would abort the in-flight state from the previous slot. Changes: - Per-slot McSlotState saved/restored on slot switch via mc_save_slot/mc_load_slot - 0x01 (pad select) preserves card state instead of aborting it - SIO_IRQ_DELAY split into PAD (4) and CARD (8) — card delay tuned so the SIO chain walker can dispatch func_00004D6C before next idle path tick clears the protocol counter Diagnostic tooling: - I_MASK[7] trace ring buffer with bit-7 set/clear counts and caller info - Counter (0x7514) field added to SIO trace so card protocol state machine progress is visible - check_card.py inspects card directory contents Runtime evidence: mc_aborts went from 100% → 0% (when slots don't overlap). mc_max_state advanced from 1 (only MC_CMD) to 8 (MC_READ_DATA). dispatch_check confirms _new_card AND its body 0x5688 are dispatched. Detection callback (func_00005D94 at BFC15894) verified to clear v0=0 before return — continue path of func_00004D6C IS being taken (133 I_MASK[7] sets observed). Remaining: 0x7550 stays NULL despite _new_card being dispatched. Either shell passes NULL buffer or early-return path of _new_card triggers. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Dump I_MASK bit 7 trace from debug server."""
|
|
import json, sys, socket, time
|
|
|
|
def main():
|
|
count = int(sys.argv[1]) if len(sys.argv) > 1 else 64
|
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
s.connect(('localhost', 4370))
|
|
s.sendall(('{"cmd":"imask_trace","count":%d}\n' % count).encode())
|
|
time.sleep(0.5)
|
|
buf = b''
|
|
while True:
|
|
chunk = s.recv(65536)
|
|
if not chunk:
|
|
break
|
|
buf += chunk
|
|
try:
|
|
data = json.loads(buf)
|
|
break
|
|
except json.JSONDecodeError:
|
|
continue
|
|
s.close()
|
|
|
|
print('bit7_sets=%d bit7_clears=%d total_writes=%d' % (
|
|
data['bit7_sets'], data['bit7_clears'], data['total']))
|
|
print()
|
|
for e in data['entries']:
|
|
b7s = ' +SIO' if e['b7s'] else ''
|
|
b7c = ' -SIO' if e['b7c'] else ''
|
|
exc = 'EXC' if e['exc'] else ' '
|
|
old_v = int(e['old'], 0) if isinstance(e['old'], str) else e['old']
|
|
new_v = int(e['new'], 0) if isinstance(e['new'], str) else e['new']
|
|
func_v = int(e['func'], 0) if isinstance(e['func'], str) else e['func']
|
|
print('old=0x%03X new=0x%03X func=0x%08X w=%d %s%s%s' % (
|
|
old_v, new_v, func_v, e['w'], exc, b7s, b7c))
|
|
|
|
if __name__ == '__main__':
|
|
main()
|