Hacker News new | past | comments | ask | show | jobs | submit login
Intel 4004 programming manual (1973) [pdf] (trailing-edge.com)
73 points by noncoml on Aug 24, 2017 | hide | past | favorite | 20 comments



Thanks, this clears up some of the strange wonderment with the Intel 4004. For example, I never knew what the "status characters" in the data RAM chips were for. This manual suggests to use them to store sign and exponent, or program RAM addresses. They seem to be general purpose, though.

Note that there is separate "program RAM" and "data RAM", the latter having a more complicated structure with the aforementioned status characters. It's surprisingly complicated to address any RAM on the 4004, with both types of RAM having separate quirks for doing so.

There are also plenty of other oddities, like I/O ports on both RAM and ROM chips, dedicated instructions for e.g. "keyboard processing" but no AND or OR instruction (with horrifyingly long examples on how to implement them in this document), and some instruction names for seemingly straightforward things that are completely unintuitive.

It's well worth exploring.


The 4004 is often described as the world's first microprocessor, but it has more in common with contemporary microcontrollers --- programmable, yet not really general-purpose. The Von Neumann architecture and specialised instructions are examples of this.


You mean Harvard architecture?


"There are also plenty of other oddities, like I/O ports on both RAM and ROM chips, dedicated instructions for e.g. "keyboard processing" but no AND or OR instruction"

It makes sense, AFAIK it was designed for calculators.


A 4 bit datapath may seem very limiting, but note that 4-bit microcontrollers are still produced in massive quantities today, used in devices which you may not even be aware of as having a microcontroller: https://en.wikichip.org/wiki/4-bit_architecture


I had know idea they were still popular! Thanks


It is a special kind of online community that downvotes someone for liking the idea of four-bit integrated circuits. I will try to regain my lost karma by upvoting a chip at the 32- or 64-bit level.


I like all the tables at the end, the manual for one of the first calculator ICs of course predates handheld calculators that convert between hex and decimal.


We've come a long way, but it is really cool how easy is to tell that it is the x86-64's ancestor.


The 4004 is not an ancestor of x86 even though the part numbers make it seem so. The 4004 was s 4-bit processor designed for calculators, and is different from x86 in almost every way. The 4004 isn't even a von Neumann architecture; it has separate data and instruction memory. The 4004 has weird instructions like KBP (Keyboard Process) to decode a calculator keyboard. I/O is done through RAM ports , not memory-mapped I/O, but I/O ports built into the RAM chips!

The origin of x86 is the Datapoint 2200, a desktop computer built from TTL chips. Datapoint contracted Intel to build a single-chip version of the 2200's processor, and Intel built the 8008, which was essentially a clone. Datapoint decided not to use the chip and gave the rights to Intel and the rest is history. Intel improved the 8008 to get the popular 8080 microprocessor. Intel then created the 8086, which was a 16-bit processor loosely based on the 8080. From that, the x86 architecture developed. Many features of x86 can be mapped back to the Datapoint 2200, such as little-endian.


I'd say the 4004 has more in common with a PIC10 than it does x86.


Noncoml, did you really read the manual? The 4004 is unrelated to the x86-64.

Perhaps you are confusing it with the 8008 which is related to the 8080 which is related to the 8086 which is related to the 80286, 80386, 80486, and so forth.


Poor, neglected 80186, nobody ever remembers it...

https://en.wikipedia.org/wiki/Intel_80186


Hmm, I don't know. Especially the way the segregate RAM into banks reminds me a lot of the x86 segments with their direct and indirect addressing modes.

Also a lot of instructions have similar names: CLC

You are right, it is not a true ancestor, but ready through the manual, it did seem to me that it was designed by the same people.

To be honest I haven't dig into other CPU families, so maybe these were pretty common.

But I can definitely see 4004 DNA in x86.


The CLC - clear carry - instruction predates the 4004. The PDP-11 for instance used it. I think you're seeing patterns that aren't really there.

One thing the 4004 and 8008 do have in common is a similar floor plan for the chips. They both have the ALU on the left, data bus along the top, instruction decoding in the middle, registers on the right, and on-chip stack on the right. Other processors of that era (e.g. 6800, 6502, 8080) have very different layouts so it's not just coincidence. Texas Instruments produced the TMC 1795, a chip equivalent to the 8008 (before the 8008), and it also has a completely different layout.

If you look lower-level, at e.g. the ALU implementation or the register implementation or the pin drivers, there's less similarity. I would have expected they would essentially cut-and-paste some of these low-level pieces, but they are more different than I would expect.


The 4004 is so weird that it stands in a class of its own, for me. I'm not sure how much of its instruction set came from Busicom, the company that the 4004 was made for, instead of from Intel engineers.


It is a bit excessive to say that it is unrelated. Many of the techniques and methologies created for the 4004 were instrumental in the development the 8008. Also, the 4004, 8008, and 8080 were all designed by more or less the same people (esp. Faggin).


It's way easier to tell when looking at the 8008.

The 4004 has all kinds of strange instructions, like DAA (for BCD) and separate instructions for accessing main memory, ROM, and RAM. It's pretty clear that it was made to be in a calculator.

On the other hand, the 8008 has the familiar IN, OUT, MOV, PUSH, etc.


The BCD stuff made it into 8086, too:

http://x86.renejeschke.de/html/file_module_x86_id_69.html


Too bad my favorite 1802 instruction never caught on:

9N GHI Get high reg N R(N).1->D

The "Break and Make Smoke" instruction was the predecessor of the "Halt and Catch Fire" instruction.

http://www.elf-emulation.com/1802.html




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: