Popular Electronics
AUGUST 1976
[33] [34] [35] [36] [37] [38]
[Part 1] [Part 2] [Part 3] [Part 4]


Fig. 1. Block diagram of basic computer. Up to 65K bytes of memory, 91 instructions, and varied I/O ports can be added as the system grows.

ing capability that allows you to load a sequence of bytes without having to toggle in a new address for each byte. No ROM is required for the minimum trainer system described here. The multiple program counters permit some interesting programming "tricks," and the many single byte instructions keep programs short.

A block diagram of the Elf system is shown in Fig. 1. The pinout for the 1802 microprocessor chip is shown in Fig. 2.


Fig. 2. Pin out for the CDP1802 COSMAC microprocessor.

Basic Operation. The key to understanding the computer is the method used for addressing the memory. At first, the procedure may appear to be complicated, but you will soon see that it is not difficult.

The 1802 chip contains 16 general-purpose registers, each holding 16 bits (two bytes) of memory addresses for data. The registers are labeled R0 through RF to conform to the hexadecimal numbering system, as shown in Fig. 3. (In the diagrams, and in computer technology in general, a Danish zero -- a zero with a slash through it -- is used to distinguish zero from a capital letter O.) Hence, if we refer to the low-order, or least-significant, byte of R1, we can call it R1.0, while the high order byte of RF would be called RF.1.


Fig. 3. The 16 registers in the 1802 are labelled R0 through RF (hex).

There is also an 8-bit D register that is used to move bytes around. In the instruction set shown in part in the instruction Subset Table, note that the 8N (8 with a digit) code will copy a low order general register byte into register D. Writing this instruction as 81 in a program will cause R1.0 to be copied into D when the instruction is executed. We can then use instruction BF (BN in the table, with B and a digit) to copy the D byte into RF.1. It takes two bytes, 81 BF, to transfer a byte from R1.0 to RF.1 via temporary holding register D. The byte in D can also be used in arithmetic operations performed by the ALU (arithmetic logic unit) circuits.

There are three other important registers that are labelled N, P, and X. Each can hold a 4-bit digit that is used to select one of the 16 general-purpose registers. For example, if you wanted to talk about the general-purpose register selected by the hex digit in X, you would call it RX. If you wanted just the low-order byte of RX, call it RX.0. RN would refer to the general-purpose register designated by the 4-bit digit currently contained in N; if the digit is 4, RN = R4.

The general-purpose registers can contain 16-bit memory addresses. Suppose register R3 contains data 0012. M3 would mean the memory location specified by the contents of R3, and M(0012) means memory location 0012 directly. MX means the memory location addressed by the contents of the general register selected by the current digit in X. If X = 3, MX = M3; if R3 = 0012, MX = M3 = M(0012).

Since the basic computer has only 256 bytes of memory, we use just the low-order bytes of the general registers to address the memory. In expanded-memory systems, you can use the high-order bytes of the general-purpose registers to select individual 256-byte pages of random-access memory (RAM).

The memory contains both instructions and data bytes. Instruction bytes tell the computer what to do with the data bytes. One-byte instructions have two hex digits, where high-order bits 7, 6, 5, and 4 tell the computer what type of operation to perform. Low-order bits, 3, 2, 1, and 0 are usually placed in the N register when a new instruction is fetched from memory.

Any one of the general-purpose registers can be used as a program counter. The program counter addresses instruction bytes in memory. Each time an instruction is fetched from memory, the program counter is

[33] [34] [35] [36] [37] [38]
[Part 1] [Part 2] [Part 3] [Part 4]
34 POPULAR ELECTRONICS