INSIDE THE
MICROPROCESSOR

by Stan Veit

Stan Veit is editor-in-chief of Computer Shopper. He is one of the pioneers of the computer industry, having opened the first computer store on the East Coast and the first robot store in the world.

The microprocessor is easy to spot inside the housing of your personal computer. Usually the largest rectangle on the main circuit board, its black plastic casing is over a half-inch wide and about two inches long, with dozens of metal legs, or pins, attached to it. The microprocessor chip within is a half-inch-square sliver of silicon with connections to each of the pins.
    The Zylog Z-80 microchip, used in such popular computers as the Radio Shack TRS-80 series, the Coleco Adam and countless CP/M-based business systems, is typical of central processing chips now in general use. The Z-80's inner workings will provide us with the key to the secrets of the electronic brain.
    Of the forty pins attached to the Z-80, sixteen are known as the address bus. ("Bus" is what we call a group of computer connections with a common purpose.) These have to do with the unique address of each of the computer's memory locations. Since the computer uses the binary system, each address pin can be in either a zero or a one state. With each additional address line offering choices counted in powers of 2 (2 x 2 = 4, 2 x 2 x 2 = 8, etc. ), we will come to the sixteenth power of 2 = 65,536, or 64K, as we call it. This is the number of unique memory locations that sixteen address lines can specify.
    The next group of pins constitutes the data bus. These are the lines the data moves on. The Z-80 uses an 8-bit data word, so there are eight data lines. The rest of the pins are used for control of the processes involved in the computer's operations; for example, the system control bus line regulates the flow of information throughout the computer system.
    Now that we have some idea of its operating connections, we are ready to visit the microprocessor chip itself. To do this we will have to be reduced to the size of electrons. Beam us down, Scotty!

Z-80

An Electron's-Eye View
Spread out before us is a vast piece of silicon real estate called the Z-80. It is composed of etched sections of silicon material, each with intermixed materials called "doped" areas. Seen from above, the chip resembles a city map with rectilinear paths and sizable areas that perform specific functions. These silicon "neighborhoods" are easily identified by their uses.
    The first section we will look at contains the registers. These are convenient storage areas for memory, much like the warehouse district of a city. All the microprocessor's operations are performed on instructions or data contained in the registers. The Z-80 holds 208 such memory bins accessible to the programmer.
    Some of the registers are devoted to special functions. The program counter, for example, holds the address of the instruction being fetched from memory. When its contents are put on the address lines, the register is incremented and then reads the address of the next instruction. If the program contains a jump, the new value is automatically placed in the counter.
    Another special-purpose register is the stack pointer, which holds the address of the top of a stack of data stored anywhere in memory. A stack is a sequential group of memory locations in the shape of a chest of drawers. If need be, the computer can temporarily store data here by pushing it onto a stack.
    Now that we've explored the memory neighborhoods on the chip, let's visit the business district. Called the arithmetic logic unit (ALU), this is the computational part of the microprocessor. It does all 8-bit arithmetic and logical operations such as add, subtract, logical OR, logical AND, compare, increment, left or right shifts, and testing of bits.
    The rest of the chip-the government district, if you will-is devoted to the control of computer instructions and the sequence of operations. The instructions recognized by the chip are part of its design, and their number and complexity define its power. Each chip design has a different instruction set, though some include the instruction sets of previous microprocessors.
    For a program to be executed, specific instructions are placed in the computer's memory and the information to be processed is fed into the machine. As the central processor operates, the control section fetches the instructions from memory, places them into the instruction register and decodes them. The control section then generates the signals to read or write data from or to the registers. It also regulates the ALU and provides the external control signals.
    Since all bytes are of a similar format, how do computers know whether they're getting instructions or data? The answer is: they don't. Computers crash if they get data when they need instructions, and vice versa, so it's important for the programmer to supply a precise sequence of operations in composing the program. In addition, the computer can only operate by following this sequence at the proper time. The timing is controlled by a clock circuit elsewhere on the main board of the computer.

Chains of Command
You are now normal size, and you are sitting in front of the computer. Turn it on and load BASIC. Type PRINT 2 + 2, press the ENTER key, and the BASIC interpreter will translate your instructions into a form that the computer can understand (a pattern of 1s and 0s called machine language).
    The instruction PRINT tells the computer that the result of the operation is to be displayed on the video screen. The machine code for the quantity "2" is stored in the general-purpose register. The symbol "+" tells the computer that the ALU is to add the next number received to the quantity already in the register and to place the result in the accumulator. The number 2 comes along, is translated into machine code and added to the previous number 2, and the resulting machine code for the quantity 4 is placed in the accumulator. The instruction PRINT in BASIC causes many complicated machine-language instructions to occur. The outcome is the result of the arithmetic operation-in this case, 4-displayed on the video screen.
    Had we been running a program to add 2 + 2 and save the results in memory, the computer would have shown the results and at the same time saved them at the specified memory location.
    Of such building blocks, whether machine language or higher-level, English-like commands, are programs written. The microprocessor chip has no way of knowing whether it's crunching numbers, processing text or playing a game. The ultimate team player, it just follows orders, millions of them per second, and does what it's told.


Return to Table of Contents | Previous Article | Next Article