Ask HN: How did Paul Allen write an 8080 emulator in 1974?
Listening to the audiobook of “The Innovators” (highly recommend) today and the story tells of how Bill Gates wrote Basic for the Altair on an 8080 emulator written by Paul Allen in 1974.
How is this feat of computer programming not a major legend in computing history? Surely Paul Allen writing this emulator is even more impressive than Bill writing basic?
60 comments
[ 3.3 ms ] story [ 121 ms ] threadThen they wrote the BASIC interpreter on the emulator, copied it to punched paper tape and Allen wrote the loader for that while he was on the plane to demo it for Altair.
On the real Altair 8800 hardware which they had never seen, it worked first time (they must have had some advance knowledge of the Altair’s I/O functions)
It was a series of amazing feats
https://en.m.wikipedia.org/wiki/Altair_BASIC
Edit: maybe this feat was not so famous because the Altair was not sold in numbers like the Apple II, which Steve Wozniak is well known for (25000 Altairs sold vs Apple’s 6 million - plus clones)
The Motorola 6800 and Mostek 6502 soon became more popular because they were easier to interface than the Intel 8080A. The Zilog Z80 came out a couple of years later.
Intel did originally call their iAPX CPU the 8800, but that’s almost got to be an unrelated coincidence because the Altair 8800 was launched in late 1974, but the iAPX’s development didn’t begin at Intel until 1975. The iAPX is also an utterly diverse architecture and instruction set that Intel abandoned later, and they continued with the x86 line.
https://en.wikipedia.org/wiki/Intel_iAPX_432
The earlier versions that ran on things back to the 8086 were more impressive, to me.
The 8008 would have been available already, but it was not binary compatible. However, an assembly translator was available (similar to the latter one translating 8080 asm to 8086).
So the question is if Allen wrote a binary emulator or perhaps something that interpreted asm source code? Maybe the emulator code is still hiding somewhere in the Microsoft archives… :)
https://retrocomputing.stackexchange.com/questions/4984/how-...
And a bit more about the PDP10 macro assembler that was used (also for 6502 BASIC) at Michael Steil's site:
https://www.pagetable.com/?p=774
Development systems from Intel were almost as expensive as a cheap minicomputer.
https://news.ycombinator.com/item?id=15005101
CALL ADDR: ((SP)-1) <-- (PCH), ((SP)-2) <-- (PCL), (SP) <-- (SP)+2, (PC) <-- ADDR
Typo I think, should be '-2', since that stack grows downward.
https://news.ycombinator.com/item?id=33566110 (Nov 2022)
https://news.ycombinator.com/item?id=32359604 (Aug 2022)
If you don't want to be banned, you're welcome to email hn@ycombinator.com and give us reason to believe that you'll follow the rules in the future. They're here: https://news.ycombinator.com/newsguidelines.html
Instead, Paul Allen's emulator worked at the code source level, and was implemented as a macros for the assembler. This wasn't even an 8080 assembler, it was a PDP-10 assembler and they created a bunch of macros to output the proper bytes for 8080 machine code.
For PDP-10 mode, they switched to a different set of macros, that took the same source code but for each 8080 instruction, it generated one or more PDP-10 to replicated the behaviour of 8080. The source code also replaced the IO code with native PDP-10 IO routines. This gives you a PDP-10 binary that you can run as normal.
I'm sure Paul Allen could have written an 8080 machine code interpreter if he wanted to; It's really not that hard to make an emulator of a single CPU with limited IO, especially when the instructions are all documented. But the goal wasn't to emulate other people's 8080 binaries, the goal was to quickly create a programming environment to target the 8080 platform.
https://en.wikipedia.org/wiki/TYPSET_and_RUNOFF
I would not be surprised if some version / implementation of roff ran on PDP-10 under some OS.
IMO, the problem that our modern definition of "emulator" is overly opinionated. The strict definition requires that the emulator take the CPU's machine code at runtime and either interpret it, or dynamically recompile it.
You could have an xbox emulator that dynamically recompiled x86 to x86 and everyone would agree that's an "emulator". But you make a few minor changes to that dynamic decompiler and turn it into a static decompiler and suddenly people start debating if it's still an emulator. If you go a step further and switch to using the CPU's virtualisation support or even just running the x86 code direction people will really put their foot down and say it's not an emulator. Despite the fact it's still emulating the GPU and Audio DSP and a bunch of other hardware.
The CPU is usually one of the simpler parts to emulate, the real complexity is in emulating the rest of the hardware, so I find it really weird that our definition of "emulator" only cares about how the CPU is implemented.
If we switch to a slightly less strict definition of "emulator" then there is nothing wrong with Paul Allen's 8080 emulator meeting the definition. It still emulates the behaviour of the 8080 cpu, so it is an emulator.
That's what I was thinking. These guys were pretty bright and an 8080 is not exactly a complex CPU. It wouldn't be a trivial task by any means, but I'm sure he or billg could have pulled it off.
Don't get me wrong: I doubt it was enough enough to run a BASIC implementation but the 8080 instruction set is so simple that I was able to write a few simple bit-manipulation programs and believe they worked. I'm sure Allen's was much more capable, but it would not have needed to do any of the things expected of a modern emulator (timing, cache, complex addressing modes, interrupts...)
Also, why would Harvard do that anyway? They didn't murder someone, they formed one of the biggest companies in history with their computers.
Also did Gates not buy DOS off of Seattle Computer Products? How did he screw him over exactly? Wikipedia says that it ended up making SCP millions of dollars.
https://en.wikipedia.org/wiki/Seattle_Computer_Products
2 - It was still pretty novel back then, but "borrowing" computer time w/o paying for it is (and was) theft of services. Like sneaking into a movie theater without paying. It wasn't their hardware to use, it was a critical part of a commercial endeavor. They didn't have permission in advance to use it. They didn't murder someone, but they were a couple of spoilt brats who figured they could get rich by ripping people off. They ripped off SCP (next point) and they screwed over IBM & Digital Equipment Corp. with the OS/2 gaslighting & NT intellectual property theft (case settled out of court).
3 - Gates wired up the deal with IBM then "bought" 86-DOS from Seattle Computer Products knowing very well it was going to be worth millions since people were waiting for IBM to release a PC at the time. SCP made less than a million dollars and had it drawn out in court (from that same article - "Microsoft paid SCP US$925,000 and reclaimed its license for DOS"). He saw an opportunity to play middle man and then shanked SCP.
Him playing the middle man happens all the time. Nothing illegal about that.
https://www.youtube.com/watch?v=9nfgRf2A0Tc
Bill & Balmer didn't even have an agreement with Seattle Computer Products when they pitched it to IBM. They waltzed in, lied & said they HAD IT and they could SELL IT knowing it could go into millions of computers. Then, they bought it for chump change from SCP. SCP was a tiny nothing of a company.
It's like finding a homeless guy with a stamp collection & buying his Inverted Jenny for $1,000 USD knowing damn well it's worth over $1.5M USD (https://en.wikipedia.org/wiki/Inverted_Jenny). Is it illegal? No. Is it greedy and cruel for no good reason? Absolutely. Did it help SCP? Sure. Just like it helps the homeless guy to have a thousand dollars while you keep $1.5M simply because you could take advantage of him and there was nothing he could do about it.
Again. Gates is a liar and a thief. It's probably damn lucky for him Epstein "hung himself" in that jail cell. Otherwise, we'd probably have proof a few more choice names to call him as well.
So you admit Gates did nothing legally wrong, it just offends you that SCP didn't make as much as you personally feel is valid.
You seem to dislike Bill Gates to an extreme degree to where you find the fact that he did something that is completely legal, and happens in nearly every business, to be abhorent.
Paul Allen did this in 1974 without the Internet or modern software tools.
I think it is absolutely extraordinary and incredibly impressive.
Compared to modern programming, assembler on a 16- or 36-bit machine is simple, logical, and not at all abstract. DEC made a point of offering high quality detailed docs to students, and there was a kind of assembler culture that produced operating systems like TOPS-10, compilers for various languages, and editing tools, often with access to the sources.
And as others have pointed out, the 8080 was not a complex processor. So mapping its instructions to macros wasn't hugely challenging.
I had a friend who wrote a Z80 emulator - a harder challenge - on a PDP-10 as a spare time hobby project. It took about a month of after-hours programming. Full-time, it would have taken much less.
More interesting is that it's possible Gates & Allen had access to the sources for the PDP-11 4K word Dartmouth BASIC.
I have no idea if the original 8-bit MS-BASIC was a clean room reimplementation. But it's at least possible it wasn't.
^^^ This.
Back in the 80s I wrote a 8051 assembler running on a Z80 system. This involves a parser, and also a bunch of tables with opcodes, operand formats & so on.
Took a number of weeks parttime (not sure if I ever completed it, but the bulk of the functionality was there iirc). This was using just text editor, Z80 assembler, maybe a debugger, and 8051 family datasheet(s).
Apart from emulating I/O (as simple or complex as that in emulated machine), difficulty-wise this should be similar to writing an emulator.
8051 and 8080 are not very different in complexity.
Anyone doing anything with computers in 1974 did it without the internet or modern software tools. It seems to me it was an era where you were either a 'computer whizz' or else you didn't really get involved with computers.
Not saying its not impressive though, I think any programmers from that period who are still remembered now would be rated as 'very very good' by modern standards.
I'd highly encourage anyone to read a data sheet for something like an ESP32.
It's literally not extraordinary because it wasn't that rare of a thing to do. I'd expect most expert engineers of the day would be able to accomplish the same.
The internet and modern tools are merely conveniences that increase productivity. Devs have been working without them for longer than they've been working with them.
I once stuffed a software UART, simple command interpreter and a temperature control algorithm into a microcontroller that had a single accumulator and a grand total of 504 bytes of OTP Flash (a donut to anyone who can guess what it was from that odd memory size :-) and didn't give it a second thought until years later someone pointed out that it was unusual.
In retrospect they had a giant market and we were kids at the end of the world, they did a little better than us. Always wished we'd trademarked the name, it would have been worth something
While what he did was certainly impressive, I don't understand why it would qualify for legendary status. Doing things like this wasn't all that rare back in the day.
I find that the devs in those spaces tend to regard working directly with hardware as being akin to magic. It's not surprising: very few developers these days are working on bare metal, so the work they do seems weird and out there, even though for us it's just another day at the office.
As a graybeard, I forget that what I expect pretty much any competent dev to know is no longer the baseline expectation.