Memory
Program memory size is 4 KB. All conditional
instructions work within currently selected ROM (256 bytes).
Unconditional jump and jump to subroutine instructions can be
used to jump to any address.
Data memory size is 640 bytes. RAM access is done in
the same way as access to I/O ports. First, a SRC instruction is
used to tell the processor what memory address to access, and
successive WRM or RDM writes accumulator data to memory or reads
data into accumulator. Data memory is separate from program
memory.
Stack is 3-level deep (3 x 12-bit registers). Stack is
separate from program memory and data memory.
Interrupts
None.
I/O ports
16 4-bit input ports.
16 4-bit output ports.
Registers
Program counter (12-bit).
Stack registers. There are three 12-bit stack level
registers, which is sufficient to implement 3-level deep
subroutine calls. Every subroutine call stores return address in
one of the stack registers. Contents of the accumulator and the
index registers is not preserved.
Accumulator (4-bit). Mainly used for arithmetic and
logic operations, as well as for reading and writing data from/to
RAM and I/O ports.
Index registers. The microprocessor has 16 4-bit
registers, that can work in pairs as 8 8-bit registers.
Instruction Set
4004 instruction set consists of 46 instructions:
- Data moving instructions.
- Arithmetic - add, subtract, increment, decrement.
- Logic - rotate.
- Control transfer - conditional (limited to current ROM),
unconditional, call subroutine and return from subroutine.
- Input/Output instructions.
- Other - carry flag operations, decimal adjust, etc.
Instruction length can be one or two bytes.
Addressing modes
Register (4-bit).
Memory direct.
Register indirect. Register indirect can access data only within
current ROM.
Immediate (4 and 8-bit data).
|