2

I was looking at this emulator of a Intel 4004, and I noticed something with the RAM. It had something called "Status Chars". There were 4 of them per memory line and all were 4-bit numbers which could be set from 0-F. They didn't seem like they had any use to me, so I searched on Google to find answers, but I found nothing. They appeared on every single RAM chip on the emulator, and they didn't appear at all in the ROM. What are these "Status characters", and what is their purpose in the 4004 and other microprocessors?

2 Answers 2

3

[...] RAM. It had something called "Status Chars". There were 4 of them per memory line and all were 4-bit numbers which could be set from 0-F. [...] They appeared on every single RAM chip on the emulator, and they didn't appear at all in the ROM.

The 4004 can address 16 ROMs and 4 RAM chips. When addressing a ROM port 4 bits are used to indicate the ROM. With RAMs two are used to address the chip, while the two remaining select the register (*1)

What are these "Status characters",

They are simple RAM cells, like all the others. Except, they got kind of an immediate addressing mode.

  • To access any of the 'main' words the address (chip/bank in R and address in R+1) had to be set with the SRC instruction and fetched/written with RDM/WRM. For accessing another word the address had to be set again and issued with a SRC instruction.
     LDM   0        / 0 -> ACCU
     DCL            / Select Data Bank 0
     FIM   2   4    / Load register pair 2/3 with address for Chip 0 Register 0 Word 4
     SRC            / Set address
     RDM            / Read word 4 into ACCU
     ...
     WRM            / Write the same word
     ...
     INC   3        / Increment Word address
     SRC
     RDM            / Read word 5
  • To access the 'status character' only the chip/bank part had to be set via SRC, while the individual words were addressed by specific instructions, resulting in faster access
     LDM   0        / 0 -> ACCU
     DCL            / Select Data Bank 0
     FIM   2   0    / Load register pair 2/3 with address for Chip 0 Register 0 Word x
     SRC            / Set address
     RD0            / Read status character 0
     ...
     RD1            / Read status character 1
     ...
     WR0            / Write status character 0

and what is their purpose in the 4004

Primary to work as fast, direct accessible scratch pad and/or markers for the value stored in a (RAM) register. The 4 status characters of a (RAM) register addressed can be accessed direct without setting up and issuing an SCL instruction.

Like with any RAM it's up to the programmer what to use it for. The Busicom 141PF, the first device using a 4004, had two RAM chips for a total of 8 registers of 20 words each. While register 0 was used as keyboard buffer, the other seven stored numbers.

  • Special Character 0 held the sign in bit 0, while
  • SC1 held the position of the decimal point, essentially the decimal exponent (*2).
  • SC2 and SC3 of some registers held various flags,

So long story short, the RAM was used as 7 registers, one keyboard buffer and 32 words of other RAM.

and other microprocessors?

They are specific to the 4004


At that point one may ask why this strange organisation. After all, there were enough opcodes to address a second set of 16 word registers instead of fiddling with normal RAM and 'special' RAM.

  • For one such a chip would have been way to complex (and expensive) at the time. The 4002 RAM had already a transistor count similar to the 4004 CPU. Doubling that was simply unrealistic.

  • For the intended use as calculator the main need for RAM comes from number storage, not so much from runtime variables and alike. The Busicom 141PF uses only 8 words to store other information then numbers, most of them holding just one or two valid bits.

  • Of course Intel could have gone for a straight 4x16x4 RAM instead, but then calculators would have had to limit precision to less than 16 digits (*3) or use a second RAM chip.

  • By implementing full 16 digit storage per register and 4 word scratch in one device a simple calculator could be made with a single RAM chip. Further lowering entry cost.


*1 - The description from the Wiki about them being addressed instead of ports is misleading, as for one a different instruction is used, but even if assuming, it's not instead of ports but instead of ROM addresses.

*2 - Except only positive - the machine was intended as business device, a task in no need for real small numbers.

*3 - Busicom 141PF used only 14, but that's due the printer only offering 15 positions.

4
  • 1
    You mention an SRC instruction but I don't see one in the example code you presented. I see SCL which seems like it might be doing the operation described. Do I misunderstand? (As you can tell, I know nothing about 4004) Aug 2, 2020 at 17:02
  • @another-dave Oh. Well, thanks fo taking on the role of an assembler and flagging my typos :)) one thing to learn here is that 4004 mnemonics are seriously strange. I guess I mixed up DCL and SRC when writing.
    – Raffzahn
    Aug 2, 2020 at 17:35
  • @Raffzahn Ah! "We meet again!" I'm GLAD I read this, Raff - hope you don't mind that nickname! You illustrate I made the RIGHT move when considering using those early chips a bit later: What A Pain In The Butt they are to deal with! BUT, as you also point out, were valuable "at the time." Spot on there. I did a lot of hardware design work in the late '70s and very early '80s, including designing a quad CPU "upgrade" for Motorola 65xx and 68xx CPU systems, and more ... but always preferred Motorola over Intel and you helped reinforce that I was right; hard to use and oft "illogical." ;-)
    – Richard T
    Aug 8, 2022 at 4:36
  • @RichardT The 4004 is really a very special case of CPU. More of a border case between no CPU and a 'real' one :)) It's geared toward a special case and the system offers very interesting ideas to squeeze more out of the given resources (instructions bit lengths, etc.), adapting its hardware to the max. Like a DSP may seem weird when viewed as a GP-CPU. Intel isn't bad per se, just a different way of thinking than the Motorola/MOS line. Same way a /370 requires a different approach. I enjoy learning the way each of them ticks and then play it like it's supposed to sound.
    – Raffzahn
    Aug 8, 2022 at 10:18
3

Per Wikipedia

4002: 40-byte RAM (80 4-bit data words), and one built-in 4-bit output port; the RAM portion of the chip is organized into four "registers" of 20 4-bit words:

16 data words (used for mantissa digits in the original calculator design), accessed in a relatively standard manner, and

4 status words (used for exponent digits and signs in the original calculator design), accessed using I/O type commands in place of the ROM's input channel.

3
  • So those 4-bit status words are used for floating-point operations and positive/negative signs?
    – Nip Dip
    Aug 2, 2020 at 1:26
  • I assume they can be used to store whatever you wish in your program. The only mention is one particular program, the Busicom calculator. There is no hardware floating point. Aug 2, 2020 at 2:24
  • Ok, I'll look at Busicom to see if I missed anything.
    – Nip Dip
    Aug 2, 2020 at 3:10

You must log in to answer this question.

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