#!/usr/bin/env python3 """ vrcapture.py -- quiet raw capture board for the first live FLYK run. Listens where the DOSBox-X vrlink C012 bridge connects (127.0.0.1:8620), logs every host->board byte to capture.raw.bin (+ an annotated hex log), and replies NOTHING (input-status stays 0). FLYK therefore streams its whole boot -- transputer .BTL, then framed vr_860code/data/bss/args, then vr_init -- without the stock garbage-read error, and we record the exact bytes to design the responder's boot handling against. python vrcapture.py # listen; Ctrl-C or kill to stop """ import socket, sys, time HOST, PORT = '127.0.0.1', 8620 BIN = "capture.raw.bin" HEX = "capture.hex.log" def main(): binf = open(BIN, "wb") hexf = open(HEX, "w") srv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) srv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) srv.bind((HOST, PORT)); srv.listen(1) print(f"vrcapture listening on {HOST}:{PORT} -> {BIN} / {HEX}") conn, addr = srv.accept() print(f"vrlink connected from {addr}") total = 0 last = time.time() with conn: conn.setblocking(True) conn.settimeout(2.0) while True: try: data = conn.recv(4096) except ConnectionResetError: print("(peer reset the connection -- FLYK closed/exited)") break except socket.timeout: # note idle gaps -- they mark phase boundaries (BTL end / read waits) if total: hexf.write(f"# --- idle {time.time()-last:.1f}s at offset {total} ---\n"); hexf.flush() continue if not data: break binf.write(data); binf.flush() # annotated hex: offset + first bytes of each chunk head = ' '.join(f"{b:02x}" for b in data[:16]) hexf.write(f"[{total:7}] +{len(data):-5} {head}{' ...' if len(data)>16 else ''}\n") hexf.flush() total += len(data) last = time.time() print(f"connection closed; captured {total} bytes -> {BIN}") if __name__ == '__main__': main()