"""Dump CORRECT A0/B0/C0 tables from DuckStation.""" import socket, json, time HOST='127.0.0.1'; PORT=4371 def send(cmd, timeout=3.0): s=socket.socket(socket.AF_INET, socket.SOCK_STREAM); s.settimeout(timeout); s.connect((HOST,PORT)) s.sendall((json.dumps(cmd)+'\n').encode()); buf=b'' deadline=time.time()+timeout while time.time()len(d): break w=int.from_bytes(d[i:i+4],'little') if w==0: continue annot = TARGETS.get(w, '') # Try fuzzy match for shell kernel functions if not annot and 0x8005A000 <= w < 0x8005B000: # RAM alias of 0xBFC42xxx rom = w - 0x8005A000 + 0xBFC42000 annot = f'shell_kern 0x{rom:08X}' elif not annot and 0x80059000 <= w < 0x8005A000: rom = w - 0x80059000 + 0xBFC41000 annot = f'shell_kern 0x{rom:08X}' elif not annot and 0xBFC00000 <= w < 0xBFC80000: annot = f'ROM_direct' nonzero.append((i, w, annot)) print(f' {len(nonzero)} non-zero entries:') for i,w,annot in nonzero: idx = i // 4 print(f' [{idx:3d}] +0x{i:03X}: 0x{w:08X}' + (f' {annot}' if annot else '')) send({"cmd":"pause"}); time.sleep(0.3) dump('A0 TABLE', 0x00000200, 0x100) # A0:0..63 entries (probably enough) dump('B0 TABLE', 0x00000874, 0x100) dump('C0 TABLE', 0x00000674, 0x100) send({"cmd":"continue"})