8008 Introduction

        .cr     8008       To load this cross overlay

The 8008, or 8 MOD 8 as it was called, was Intel's first 8 bit micro processor. I must admit that I've never seen one myself. In fact they were rare objects when Intel introduced the 8080 microprocessor a few years later. So if you do own an 8008 it may be worth something today.
If you look at the 8008's programming model you may find some striking similarities with modern Pentium processors.

In fact the 8008 was designed for a company called Computer Terminal Corporation, who wanted to build a universal terminal around it. Intel failed to meat the deadline so Computer Terminal Corporation canceled the order and built the Datapoint 2200 terminal using about 100 TTL ICs as CPU.
About 2 years later Intel finally finished the 8008 and put it to market. It came in an 18 pin package, because that was as big as they could make them.

I have found 2 different instruction sets for the 8008. The first one came from an Intel document dating from November 1972, the second one came from an Intel data book from 1976. Both instruction sets only differ in the syntax of the assembly instructions, the instructions themselves didn't change.
The 1972 instruction set was very easy because all register operands were embedded in the instruction mnemonic itself. There were only a few instructions that required an operand in this instruction set.
The 1976 instruction set required more typing because all registers were entered as operands to the mnemonics.

I've included both instruction sets in the cross overlay and both sets can be used interchangeably. Which one you prefer is up to you. I prefer the 1972 syntax because it requires less typing. The 8008.asm source in the opcode.tst directory shows both syntax options.

The 8008 can address up to 16k of memory and it runs at a dazzling speed of 500kHz. Most instructions are one byte long. Only those instructions that need an immediate value operand are 2 bytes long and all jump instructions that require a destination address are 3 bytes long.

Programming Model

The programming model in the picture below shows the most important registers of the 8008 processor. I only include a little summary about the features of the 8008's programming model here. It is not my intention to make the original documentation obsolete, so please refer to the original documentation for further details.

8008 programming model

The Accumulator

The Accumulator is the most important register for 8 bit arithmetic operations.

The Program Status Word

There is no real Program Status Word on an 8008. The 4 system flags (C, Z, S, P) can be tested by the different conditional jump, call and return instructions.

General Purpose Registers

Apart from the Accumulator the 8008 is equipped with 6 additional general purpose 8-bit registers. The HL pair is used as a data pointer to transfer data to and from memory.
This is the only time that two registers are concatenated to form one 16-bit register. The H and L register must be loaded with two 8-bit values separately to form the address of the required memory location.

The Stack

The stack on an 8008 can not be manipulated manually. An 8008 has 8 14-bit program counters, which are used as return stack. A subroutine call or interrupt simply switches over to the next available program counter, effectively saving the previous one. Return instructions switch back to the previous program counter, effectively restoring the previous program counter.
The stack will overflow, and wrap back, when subroutines are nested more than 7 levels deep.

The Program Counter

The program counter PC is normally incremented after fetching each instruction or operand byte during program execution. The only way you can change this behaviour is with the jump, call and return instructions. Also interrupts can change the program counter's value.
The program counter on an 8008 is only 14-bits wide, enabling it to address up to 16k of memory.

Timing

SB-Assembler Version 3 can show you the cycle times of each instruction when the TON list flag is switched on. The numbers presented are the number of states each instruction takes. Conditional instructions have two possible timings, the first one for when the condition is false, the second one for when the condition is true.

Reserved Words

Only the register names are reserved. These are the names you better avoid using as label names:

A, B, C, D, E, H, L, M.

Special Features

Restart Vectors

Originally the 8 possible restart vectors are numbered from 0 to 7 in other 8008 assemblers. This is very inconvenient, because you can't let the restart vector point to the appropriate vector address by using its label name.
Therefore I added another addressing format to the RST instructions. Not only can you use the original addressing format, using a number from 0 to 7, but you can also use the appropriate vector addresses as well. The list below shows the relation between the vector address and interrupt number.

Vector Address Interrupt Number
$000
$081
$102
$183
$204
$285
$306
$387

Please note that the value of the operand after an RST instruction may not be any other value than 0 to 7, $08, $10, $18, $20, $28, $30 or $38. Any other value will result in a Out of range error to be reported.

Instruction sets

As mentioned before I have included 2 instruction sets in this cross-overlay. Both instruction sets can be used interchangeably. You don't even have to tell the assembler which instruction set you'd like to use.

Example:

        LAB              1972 syntax that loads A with B
        MOV   A,B        1976 syntax doing the same

Both instructions can be used in the same source program. This is very convenient, but causes a few tiny problems. E.g. in 1972 the CPE instruction compared A with E, while in 1976 it was used to Jump if Parity was Even and now the instruction requires a destination operand.
I could show a few more examples causing similar problems. Instructions like this must have their operand following the instruction within 8 spaces (10 spaces for version 3). If not the SB-Assembler will assume no operand was following the instruction, effectively interpreting it as a 1972 instruction.

Overlay Initialization

Two things are set while initializing the 8008 overlay every time it is loaded by the .CR directive.

  • Little endian model is selected for 14-bit addresses and for the .DA and .DL directives. This means that words or long words are stored with their low byte first.
  • The maximum program counter value is set to $3FFF.

Differences Between Other Assemblers

There are some differences between the SB-Assembler and other assemblers for the 8008 processor, if there are any. These differences require you to adapt existing source files before they can be assembled by the SB-Assembler. This is not too difficult though, and is the (small) price you have to pay for having a very universal cross assembler.

  • The 8008 instruction set knows special mnemonics that indicate immediate addressing mode. Therefore it is not absolutely necessary to add the immediate mode identifier # in front of the operand. Although it wouldn't hurt if you did.
    E.g. the two instructions LAI VALUE and LAI #VALUE have exactly the same effect.
    If you want another part of the 32-bit number to be loaded immediately into any of the registers you could use the other immediate mode identifiers /, =, or \.
  • Octal numbers are used to represent the I/O addresses in the original manual that I've got. In the manual these numbers are confusingly written as 13B, where the B identifies octal representation. The SB-Assembler uses the @ prefix to represent octal numbers, so the value above must be written as @13.
    Values for the INP instruction can range from @0 to @7, while the value for the OUT instructions range from @10 to @37.
  • The obvious differences in notation of directives and radixes common to all SB-Assembler crosses.
  • Don't forget that the SB-Assembler does not allow spaces in or between operands. Only Version 3 will allow one space after each comma separating operands in the operand field.