[TUHS] C from 1980 binaries
John Foust via TUHS
tuhs at tuhs.org
Sun Nov 1 13:30:22 AEST 2026
At 12:36 PM 10/31/2026, James Frew via TUHS wrote:
>Back in The Day I was responsible for a CS student lab full of Teraks,
Yes, that was the situation when I was an undergrad at UW-Madison in '81
and that's why I baby-duck imprinted on it and still have ten or so Teraks.
>So I'm seconding John's suggestion. Seems like a perfectly do-able task for an LLM!
Yes, Claude made short work of it. It studied the V7 'cc' code and
its output, it re-used a PDP-11 disassembler toolchain I used for the
Terak emulator work I did in another project, and it compared it
against Reko's output, and found a few bugs but improved itself, it handled
some sections of the binary that were straight assembler instead of C,
it read Teitelbaum's paper on his CSP,it analyzed what the code was doing
against the Terak hardware, it analyzed the functions and determined
what they were doing, it reverse-eningeered the yacc for the PL/CS (PL/I-like) /
language based on the decompiled code, and this interatively guided it to name
variables and functions, so now I have code like that below.
This is 100% Claude's output and creation.
LLMs are fun as long as you can throw out everything you thought
you knew about the software development process, but also retain all your
grey-beard wisdom about what you want and how to get there.
- John
/* 074544..074722: Unlinks the subtree at the cursor's placeholder: a1 is the address of the subtree's last continuation link.
In: a1 link address; curNode, curKind, kindList (list kinds), kindOptional (optional kinds), atListEnd.
Out: if that link points back to curNode + 3 (the subtree was the only occupant) curNode's code byte is rewritten as empty: 0105 for a list placeholder, 26 for an optional element, 0116 otherwise; else setLink(curNode, the link's target) so the placeholder skips the removed part, parseLine, and atListHead = 1 (cursor at the list head) unless already at a list end.
Calls: getLink, setLink, parseLine. */
unlinkSubtree(a1)
int a1;
{
register int r3, r4;
r4 = a1;
r3 = getLink(r4);
if (r3 == curNode + 3) {
if (kindList[curKind] == 0) {
if (kindOptional[curKind] == 0) {
*(char *)curNode = 0116;
} else {
*(char *)curNode = 26;
}
} else {
*(char *)curNode = 0105;
}
} else {
setLink(curNode, getLink(r4));
parseLine();
if (atListEnd == 0) {
atListHead = 1;
}
}
}
More information about the TUHS
mailing list