Edit: It happened already.

I'm really thrilled about Emulate an Intel 8086 cpu, but I wonder if there's simple ISA which could be implemented more fully in a page or two of code. Such a bank of solutions could then be used as targets for testing of a tantalizing series of challenges: assembler, calculator, debugger, shell, GUI??!

So what would be a good choice for a "Full-Featured CPU Emulator" challenge? PDP? 6502? UNIVAC???

To add some excitement, I'll accept this first answer to hit 5 votes and move it to the sandbox.

Update (1/24/2013): We have a front-runner.

Current Results (7/17/2013): 6502 clearly front of the heat.

0 for PDP-1

1 for PDP-8

3 for 6502

1 for MMIX

0 for 4004

  • \$\begingroup\$ A 6502 (on a Apple ][+) was my first processor, and I have a fondness for it: the instruction set is relatively orthogonal, modest in size and has enough addressing modes to make easy things easy. \$\endgroup\$ Commented Nov 28, 2012 at 18:44
  • \$\begingroup\$ I added 6502 as an answer. \$\endgroup\$ Commented Nov 30, 2012 at 8:23
  • \$\begingroup\$ I say that after we completely simulate a CPU, that we write our own operating system for it, and then we use it as an actual computer. We could then install C and Java onto it, and start running some games on its GUI. Sound feasible? \$\endgroup\$
    – PhiNotPi
    Commented Dec 19, 2012 at 3:21
  • \$\begingroup\$ @PhiNotPi Yes! That's exactly the sort of foolishness I'm talking about. A challenge that builds other challenges. \$\endgroup\$ Commented Dec 19, 2012 at 3:58

5 Answers 5


Intel 4004

The Intel 4004 was the first CPU to implemented into a single chip.

  • It is a 4-bit processor with 46 instructions.
  • It can directly access 32,768 bits of ROM and 5,120 bits of RAM.
  • It has sixteen 4-bit registers.
  • It also has a subroutine stack three levels deep.

(Data Sheet)

I like the idea of simulating this processor because I think that it would be fun to see what sort of programs we can write for it. How complex can we make the programs to run on this simple processor?



From the Master Handbook of Microprocessor Chips, by Charles K Adams:

Features of the 6502: Eight bit parallel processing. 56 Instructions. Decimal and binary arithmetic. Thirteen addressing modes. True indexing capability. Programmable stack pointer. Variable length stack. Interrupt capability. Bus compatible with M6800. Pipeline architecture. 65K Addressable bytes of memory (A0-A15). IRQ interrupt.

From Microcomputer Builder's Bible, by Chris Johnson:

The MOS Technology 6502 microprocessor, used in the APPLE II, Atari and OSI Superboard computer, is similar to the 6800. The 6502 runs on a single +5V power supply and has an onboard crystal oscillator. The crystal can be attached directly to the chip. The 6502 is designed around 256 word "pages" of memory. There are instructions that will work only with data in page 0 and the stack is similarly limited. The stack pointer is only eight bits wide (in contrast to the 8080 or 6800 sixteen bit stack pointer) which limits the stack to a single page in memory.

In general, the 6502 has a great number of addressing modes but is severely limited by the width of its registers. [source copyrighted 1982 -droog] The two index registers (X and Y) are also only eight bits wide. There are no general-purpose registers other than the accumulator. A common complaint about the 6502 concerns the exceptions in its instruction set -- some instructions can be used with only one index register or the other! All in all, however, it is efficient and quite fast. Basic interpreters written for the 6502 tend to be faster than similar programs on the other microprocessors. [source also describes 8080, 8085, Z-80, 6800, TMS 9900, 8086, Z8000, 68000, but none in detail]

Register: 8-bit accumulator, two 8-bit index registers, status register, 8-bit stack pointer, 16-bit program counter.

Interrupts: One maskable, one nonmaskable interrupt

I/O Space: Uses memory mapped I/O

Memory space: 64K of addressable space.

  • 1
    \$\begingroup\$ It's been done in under 2000 lines of JS. Needs a clear spec as to which variant to implement (and with which bugs!) \$\endgroup\$ Commented Dec 1, 2012 at 9:40
  • \$\begingroup\$ That list makes it sound like a very sophisticated machine, and I guess it was for it's era, but it was simple enough that I could--at one time--remember the entire instruction set and how many cycles any particular instruction would take. \$\endgroup\$ Commented Dec 3, 2012 at 1:19
  • \$\begingroup\$ I snagged a bunch a $1 1980s programming books a while ago on amazon. That was the first one in the stack to mention the 6502. It was focused on pins and circuits. I've got a better summary here from a programming angle. edit \$\endgroup\$ Commented Dec 3, 2012 at 2:37
  • \$\begingroup\$ I'm inclined to go with something like the Apple ][e as that is a machine I actually used as a child. :D Still looking for a good (free-online) spec. \$\endgroup\$ Commented Jul 19, 2013 at 4:20
  • \$\begingroup\$ I suppose the obvious choice for a canonical spec is the 1976 programming manual 10.4 MB scanned pdf (including ROR) linked from the Wikipedia page. \$\endgroup\$ Commented Jul 19, 2013 at 8:23
  • \$\begingroup\$ And in the extensive docs at [6502.org/] there is a link to Machine Language for Beginners, eminently pertinent. \$\endgroup\$ Commented Jul 19, 2013 at 8:45
  • \$\begingroup\$ Manuals for the KIM-1, a very small full-computer board (with a front panel [blinkenlights!]), here. \$\endgroup\$ Commented Jul 20, 2013 at 5:38

I was dorking around with a PDP-8 simulation a few months ago. It's both a very simple chip and possessed of tricky corners in the micro-coding. Nothing finished, however.

  • \$\begingroup\$ There's probably more programs out there for the 8. But I think the 11 would be too much (toomany varieties for starters). \$\endgroup\$ Commented Nov 28, 2012 at 6:44


I've already gathered some resources about it.

It'll run LISP and SpaceWar! (with a CRT device).

This could be more fun (or more preposterous) if it were made a GUI challenge to draw DAS BLINKENLIGHTS!

best image I could find, I'm afraid

Can't suggest edits on non-wiki meta posts! who knew?!

Here's some info on the PDP-8. From the digital Small Computer Handbook, 1967.

The PDP-8 is a general-purpose, stored-program computer, featuring a 1.5 microsecond random accesscoore memory, a fast arithmetic processor, and a buffered input-output control. These features combine to make the PDP-8 one of the most popular on-line computers for physics and biomedical analysis and process control. The PDP-8 is also used in large systems as a control element and as a training computer.

The PDP-8 is easy to install, maintain, and use, with comprehensive software, customer-tested in over 500 installations. The basic system includes 4096 words of 12-bit ferrite core memory, keyboard-printer and tape reader-punch, eight auto-index registers, wired-in analog-to-digital converter, program interrupt, data interrupt, and indirect addressing.

A partial list of central processor options includes the Extended Arithemtic Element for high speed, double precision arithmetic, Memory Modules and Control for increasing memory size in increments of 4096 words to 32,768 words; a Data Cannel Multiplexer providing direct memory access for seven external devies; and a Serial Drum for storage of 65.536 to 262,144 words.

The applications success of the PDP-8 has led Digital to develop a series of computers based on the PDP-8 to meet a number of special needs, resulting in a unique gaily of small computer products. These include the DISPLAY 8, the LINC-8, the TYPESETTING-8, the MULTIANALYZER-8, and the new PDP-8/S.

Word length: 12 bits
Memory: 4096 to 32,768 words; cycle time 1.5 microseconds
Add Time: 3.0 microseconds
In-Out Tranfer Rates: 7,992,000 bits per second Standard I/O Devices: Printer-keyboard with paper tape punch and reader Instructions: 49 with standard equipment, expandable to over 100 as optional equipment is added.


I've always loved the MMIX, which is the architecture to be used in future editions of The Art of Computer Programming. It has a very clean but rich instruction set, a good separation between user-mode and kernel-mode instructions, a register-based function call mechanism (rather than a stack-based one that most current architectures use), and so much more.

For coding challenges, I would probably just ask people to implement the user-mode instructions, leaving the kernel-mode instructions unimplemented.

  • \$\begingroup\$ Actually, I'd prefer the older MIX: my set is 2ed. \$\endgroup\$ Commented Dec 17, 2012 at 5:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .