From tuhs at tuhs.org Sun Nov 1 03:36:12 2026 From: tuhs at tuhs.org (James Frew via TUHS) Date: Sat, 31 Oct 2026 10:36:12 -0700 Subject: [TUHS] C from 1980 binaries In-Reply-To: <20261030194928.C61F7125F8670@ary.qy> References: <188ef5e9-d1c4-4acd-a6f4-e97a018abf24@xavax.com> <7.1.0.9.0.20261030133125.085d7e50@threedee.com> <56b6be1a-8253-4b30-b5b6-36177f45edfa@xavax.com> <20261026233611.1B47D1253528F@ary.qy> <20261030194928.C61F7125F8670@ary.qy> Message-ID: I love the memories this list dredges up: Back in The Day™ I was responsible for a CS student lab full of Teraks, and one of my first tasks was to get a serial line file transfer program running between the Teraks and the dept VAX. The program I inherited was written in PDP-11 assembler, needless to say completely uncommented. So I put my Lions-notes-level reading knowledge of assembler to work and commented it in C so I could understand it. The correspondence was almost 1:1 line-for-line. Pity the Terak didn't have a C compiler... So I'm seconding John's suggestion. Seems like a perfectly do-able task for an LLM! Cheers, /Frew On 2026-10-30 12:49 PM, John Levine via TUHS wrote: > I do not ever recall a PDP-11 to C decompiler. Compiling was painful enough. > On the other hand, the instruction set was small and the translation from C > to machine code was pretty straightforward so it might be interesting to set > an LLM loose on it and see what you get. > > On Fri, Oct 30, 2026 at 11:31 AM John Foust via TUHS wrote: >>> I'm working on a fun project with Prof. Tim Teitelbaum of Cornell, who >>> developed the Cornell Program Synthesizer, an early IDE that ran on the >>> Terak computer. We have an image of an 8" disk with the executables. >>> >>> Source has been lost, so I'd like to try to reconstruct it. He believes >>> the original was in an early C, circa 1979-1982, compiled on >>> (I presume Unix) on maybe an 11/30 and them copied down to the >>> Terak (like a PDP-11/03). >>> >>> Is there an existing tool chain that is good at reconstructing C from >>> binaries of the C compiler of this era? From tuhs at tuhs.org Sun Nov 1 13:30:22 2026 From: tuhs at tuhs.org (John Foust via TUHS) Date: Sat, 31 Oct 2026 22:30:22 -0500 Subject: [TUHS] C from 1980 binaries In-Reply-To: References: <188ef5e9-d1c4-4acd-a6f4-e97a018abf24@xavax.com> <7.1.0.9.0.20261030133125.085d7e50@threedee.com> <56b6be1a-8253-4b30-b5b6-36177f45edfa@xavax.com> <20261026233611.1B47D1253528F@ary.qy> <20261030194928.C61F7125F8670@ary.qy> Message-ID: <7.1.0.9.0.20261031223227.0989ee48@threedee.com> 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; } } } From tuhs at tuhs.org Sun Nov 1 23:08:23 2026 From: tuhs at tuhs.org (Ralph Corderoy via TUHS) Date: Sun, 01 Nov 2026 13:08:23 +0000 Subject: [TUHS] C from 1980 binaries In-Reply-To: <7.1.0.9.0.20261031223227.0989ee48@threedee.com> References: <188ef5e9-d1c4-4acd-a6f4-e97a018abf24@xavax.com> <7.1.0.9.0.20261030133125.085d7e50@threedee.com> <56b6be1a-8253-4b30-b5b6-36177f45edfa@xavax.com> <20261026233611.1B47D1253528F@ary.qy> <20261030194928.C61F7125F8670@ary.qy> <7.1.0.9.0.20261031223227.0989ee48@threedee.com> Message-ID: <20261101130823.51617C5440@hal.inputplus.co.uk> Hi John, > This is 100% Claude's output and creation. Assuming getLink() doesn't have side effects, line 18's getLink(r4) looks like it can be replaced with r3 given line 6. Is Claude deliberately rendering a duplicate call in the machine code? 1 unlinkSubtree(a1) 2 int a1; 3 { 4 register int r3, r4; 5 r4 = a1; 6 r3 = getLink(r4); 7 if (r3 == curNode + 3) { 8 if (kindList[curKind] == 0) { 9 if (kindOptional[curKind] == 0) { 10 *(char *)curNode = 0116; 11 } else { 12 *(char *)curNode = 26; 13 } 14 } else { 15 *(char *)curNode = 0105; 16 } 17 } else { 18 setLink(curNode, getLink(r4)); 19 parseLine(); 20 if (atListEnd == 0) { 21 atListHead = 1; 22 } 23 } 24 } -- Cheers, Ralph. From tuhs at tuhs.org Mon Nov 2 00:55:17 2026 From: tuhs at tuhs.org (Larry McVoy via TUHS) Date: Sun, 1 Nov 2026 06:55:17 -0800 Subject: [TUHS] C from 1980 binaries In-Reply-To: <7.1.0.9.0.20261031223227.0989ee48@threedee.com> References: <188ef5e9-d1c4-4acd-a6f4-e97a018abf24@xavax.com> <7.1.0.9.0.20261030133125.085d7e50@threedee.com> <56b6be1a-8253-4b30-b5b6-36177f45edfa@xavax.com> <20261026233611.1B47D1253528F@ary.qy> <20261030194928.C61F7125F8670@ary.qy> <7.1.0.9.0.20261031223227.0989ee48@threedee.com> Message-ID: <20261101145517.GK15589@mcvoy.com> On Sat, Oct 31, 2026 at 10:30:22PM -0500, John Foust via TUHS wrote: > 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. I was there too but not in CS yet. I was undergrad '80-85, grad '86-87. It took me a while to get to CS, I started as an accounting major because my high school coach was also my accounting teacher, so I excelled in high school accounting because, well, coach. College accounting without my coach quickly taught me I hated accounting, still do. I then, much to my culture vulture father's surprise, drifted into Art History. Got good enough in Greek pottery that I pointed out a dating error in Janson. My dad was a physics prof there, he started taking art history classes with me. I became friends with the dean, we'd go out drinking together. He eventually told me "Larry, you are one of the best students I've had, but unless you are willing to do a PhD, there are no jobs, and even then, you'll be in a long line of people for every job". So I went to my dad and said "what do I do?" He gave me some very good advice. He said "It doesn't matter. Well, you can't pick something that goes against your grain like accounting, you have to pick something you like. When you do, learning becomes its own reward". So while I had been drifting around, I had taken a bunch of STEM classes, calc, diffie q, physics (all the easy stuff, I got to quantum mechanics and bowed out, just couldn't wrap my head around probability being the basis). And some CS classes. The data structures course in Pascal resonated with me and I got an A in that. So I picked that. It worked out well for me. All that is to say, John, I don't remember Teraks. I definately remember the terminal room with ~40 terminals hooked up to a VAX 780 (and I fondly remember slovax that had the BSD source on it, I got an account on there eventually and spent a lot of time reading. Ever since then, my main machine has been slovax. slovax is mcvoy.com). So where were the Teraks? I probably got serious in CS around 1982 or 83. Were they still somewhere? --lm From tuhs at tuhs.org Mon Nov 2 01:06:25 2026 From: tuhs at tuhs.org (Jeffrey Joshua Rollin via TUHS) Date: Sun, 1 Nov 2026 15:06:25 +0000 Subject: [TUHS] C from 1980 binaries In-Reply-To: <20261101145517.GK15589@mcvoy.com> References: <188ef5e9-d1c4-4acd-a6f4-e97a018abf24@xavax.com> <7.1.0.9.0.20261030133125.085d7e50@threedee.com> <56b6be1a-8253-4b30-b5b6-36177f45edfa@xavax.com> <20261026233611.1B47D1253528F@ary.qy> <20261030194928.C61F7125F8670@ary.qy> <7.1.0.9.0.20261031223227.0989ee48@threedee.com> <20261101145517.GK15589@mcvoy.com> Message-ID: I have never heard of Teraks. Sounds like an alien species from Star Trek! (I'm of a similar vintage to Dan Cross and am familiar with such things as the separate ports to the 32-bit Interdata machines, although the closest I have gotten to a minicomputer is, depending on your perspective, either using the University library computer terminals which, I later found out, were connected to a VAX of some sort, or occasionally entertaining the idea of buying a PiDP.) Jeff On Sun, 1 Nov 2026, 14:55 Larry McVoy via TUHS, wrote: > On Sat, Oct 31, 2026 at 10:30:22PM -0500, John Foust via TUHS wrote: > > 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. > > I was there too but not in CS yet. I was undergrad '80-85, grad '86-87. > It took me a while to get to CS, I started as an accounting major because > my high school coach was also my accounting teacher, so I excelled in high > school accounting because, well, coach. College accounting without my > coach quickly taught me I hated accounting, still do. I then, much to my > culture vulture father's surprise, drifted into Art History. Got good > enough in Greek pottery that I pointed out a dating error in Janson. > My dad was a physics prof there, he started taking art history classes > with me. I became friends with the dean, we'd go out drinking together. > He eventually told me "Larry, you are one of the best students I've had, > but unless you are willing to do a PhD, there are no jobs, and even then, > you'll be in a long line of people for every job". > > So I went to my dad and said "what do I do?" He gave me some very good > advice. He said "It doesn't matter. Well, you can't pick something > that goes against your grain like accounting, you have to pick something > you like. When you do, learning becomes its own reward". So while I > had been drifting around, I had taken a bunch of STEM classes, calc, > diffie q, physics (all the easy stuff, I got to quantum mechanics and > bowed out, just couldn't wrap my head around probability being the basis). > And some CS classes. The data structures course in Pascal resonated with > me and I got an A in that. So I picked that. It worked out well for me. > > All that is to say, John, I don't remember Teraks. I definately remember > the terminal room with ~40 terminals hooked up to a VAX 780 (and I > fondly remember slovax that had the BSD source on it, I got an account > on there eventually and spent a lot of time reading. Ever since then, > my main machine has been slovax. slovax is mcvoy.com). > > So where were the Teraks? I probably got serious in CS around > 1982 or 83. Were they still somewhere? > > --lm >