HACKER Q&A
📣 andrewstuart

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?


  👤 phire Accepted Answer ✓
It didn't really match the modern definition of emulator. AKA, something that takes raw machine code and implements all the IO capabilities of the target device.

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.


👤 Taniwha
So about the same time, in college in NZ we wrote a 6800 compiler for an algol like language (fit in 2k, written in assembler), to do bringup (on the university mainframe) we wrote a 6800 interpreter, it wasn't big ~1000 lines (cards), basically just a big case statement - it's not really a major feat, fom memory it took a few days. We called our company uSoft (with a mu), in retrospect it was a stupidly obvious name. Later on we discovered there was a US company using the same name, and they had an interpreter (how lame, we had a compiler).

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


👤 GianFabien
It wasn't that unusual. Microcomputers of the day were very limited, especially lacking memory. 4k RAM was considered to be a luxury. So many folks cross-developed using minicomputers. At my Uni, we often developed our tools on PDP-11 computers, especially using RSTS and BASIC, punched paper tape which could be read by hand fed paper tape readers. If you were lucky you had a ASR-33 terminal attached to your microcomputer or had a simple video card connected to a TV and a kludged up keyboard.

Development systems from Intel were almost as expensive as a cheap minicomputer.


👤 johndoe0815
The 8080 was brought to market in April 1974 and it’s not unrealistic to assume that preliminary information on instruction encodings etc. was available earlier.

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… :)


👤 JohnFen
> How is this feat of computer programming not a major legend in computing history?

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.


👤 timonoko
If you look at the 1974 8080 Assembly Programming Manual, there is not much to do. "Appendix A Instruction Summary" describes each operation in handy pseudocode. All you need to do is to make an interpreter for these:

CALL ADDR: ((SP)-1) <-- (PCH), ((SP)-2) <-- (PCL), (SP) <-- (SP)+2, (PC) <-- ADDR


👤 curiousObject
It was an 8800 emulator I believe, not 8080. (Edit - I’m mistaken - it was for the 8080 CPU)

Then 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)


👤 andrewstuart
It's funny the comments here saying it's not hard or unusual.

Paul Allen did this in 1974 without the Internet or modern software tools.

I think it is absolutely extraordinary and incredibly impressive.


👤 zabzonk
it's not so very impressive. the 8080 is quite an easy processor to emulate (but not at the transistor or i/o level) - you can do it with a switch - there are only 256 possible instructions (not all used). i wrote one on the Dec10 back in the early 1980s (with assembler, disassembler and debugger) in Fortran77 and ported it to VAX and IBM 4381. we used it to teach assembler programming at the polytechnic i worked for. you could easily (well, relatively easily) have written basic on my implementation.

👤 ggambetta
Writing an emulator for a simple processor isn't particularly complicated. You only need a reference manual of the processor (which I assume he had). The emulator itself can be as simple as a while loop with a switch statement inside and some simple variable manipulation. Nowhere near "feat of computer programming" or "major legend". Source: I've written Z80 and x86 emulators for fun.