"""Minimal i860 COFF (magic 0x014d) reader: dump file header, sections, and the symbol table (function/global names + section + value). Deterministic -- no instruction decoding -- so it is a trustworthy reference map of the firmware objects. Validates the format by checking the symbol names look like the known AS860/PGI source (e.g. _createBang, _PAZsfx).""" import sys, struct, glob, os def rd(b, off, fmt): return struct.unpack_from(fmt, b, off) def parse(path): d = open(path, 'rb').read() magic, nscns, timdat, symptr, nsyms, opthdr, flags = rd(d, 0, '0, class EXT/STAT), text-ish funcs = [(nm, v, sc) for (nm, v, sn, ty, sc, na) in o['syms'] if sn > 0 and sc in (2, 3) and not nm.startswith('.')] print(f" -- {len(funcs)} defined EXT/STAT symbols:") for nm, v, sc in sorted(funcs, key=lambda x: x[1]): print(f" {v:#010x} {SCLASS.get(sc,sc):<5} {nm}") if __name__ == '__main__': pats = sys.argv[1:] or [r'C:\VWE\TeslaRel410\sda4\DPL3\VRENDER\*.O'] files = [] for p in pats: files += glob.glob(p) for f in sorted(files): try: report(parse(f)) except Exception as e: print(f"\n=== {f}: PARSE FAILED: {e} ===")