Classic Computer Magazine Archive CREATIVE COMPUTING VOL. 11, NO. 6 / JUNE 1985 / PAGE 40

It's 16 bits, but is that wide or what? May of today's small computers are called 16-bit systems, but what does that actually mean? Douglas A. Kerr.

It's 16 Bits, But Is That Wide or What?

Many of today's small computer systems are described as being "16-bit' systems, and they typically use the Intel 8086 or 8088 "16-bit' microprocessors. But just what does that really mean, and how are these systems different from the "8-bit' systems we have known?

A Starting Point

Let's look at the characteristics of a typical 8-bit small computer system, one using an 8080 or Z80 microprocessor. Later, we will compare it with a typical 16-bit machine.

Memory

The memory of the 8-bit machine is organized into locations each of which can hold eight bits of data, or one byte. The byte may represent a character, such as the letter A or the numeral 3, or it may be eight bits of an instruction in machine language or of a numeric quantity represented in one of various binary formats.

So that the central processing unit (CPU) can access a particular memory location to store a byte of data there, or to read the byte already stored there, the locations have addresses in the form of 16-bit numbers. Since 2(16) is 65,536, there can be that many distinct addresses, and thus that many memory locations. This leads to the 64 kilobyte (64K) maximum memory capacity of the typical 8-bit system.

(We often describe large quantities which are powers of two as multiples of 1024, which is 2(10), borrowing and stretching the scientific prefix for one thousand, kilo, abbreviated K.)

The CPU stores data in the memory, or reads it, one location at a time. Thus, only eight bits are moved during a single memory access cycle. Although the CPU has instructions which move binary numbers made up of 16 bits, it does this in two steps, eight bits at a time.

Disk Storage

Data storage on either a floppy or a hard disk is also organized into 8-bit units. Transfer of data between the CPU and the disk drive is done eight bits (one byte) at a time.

Input/Output

Human input from the console keyboard and output to the console screen or to a printer is organized as sequences of characters. The characters are represented in a 7-bit coded form known as ASCII, the American National Standard Code for Information Interchange. Each 7-bit ASCII character code is carried in an 8-bit byte. Most often, the eighth bit is a binary zero and just goes along for the ride. In some systems, the eighth bit is used to expand the repertoire of characters beyond the 128 ASCII characters to provide for special graphics.

Machine Intructions

Regardless of the language in which the programmer works, the computer ultimately does its work through the CPU executing a series of machine instructions. Individually, these cause rather primitive actions, such as moving a byte from a memory location to a register in the CPU, or causing the CPU to add two 8-bit binary numbers, to be taken.

In a machine language program (one ready for the CPU to execute directly), the machine instructions are represented as sequences of bytes stored in memory. Some instructions require only one byte. Most require from two to four bytes, which are always stored in consecutive locations in memory.

Data Manipulation

The 8080 or Z80 CPU has seven principal data registers, which are used for data manipulation. Any of these can hold eight bits, or one byte, of data. Six of these registers are grouped into pairs. Any of these three register pairs can be used to hold a 16-bit number. As the program does its work, the machine instructions successively cause data to be moved between the registers and memory locations, or cause various operations to be performed on the data in the registers.

The CPU also has a 16-bit register, the Program Counter, which holds the memory address where the next machine instruction begins. Since the instructions in a program are most often executed in sequence, this register is nomally set automatically to the address immediately after the current instruction. However, if the current instruction is one which calls for a jump to another part of the program, the Program Counter is reset to the corresponding new address.

Another 16-bit register, the Stack Pointer, keeps track of the next location scheduled for use in a memory area assigned by the programmer as the machine stack. This area is used to store temporarily the contents of registers while they are "borrowed' by the program for other purposes.

The CPU can perform a number of arithmetic and logical operations on binary numbers. It can, for example, add or subtract two 8-bit numbers. These functions take place in the one data register which is not paired with another, the A Register, or accumulator. The CPU can perform many of the same operations on 16-bit numbers. In this case, one of the register pairs is the host, the one known as HL (made up of the H and L registers).

The internal structure of the 8080 or Z80 microprocessor is such that operations on 16-bit numbers are done, in effect, eight bits at a time. For this reason, 16-bit operations take substantially more time than the same operations on 8-bit numbers.

A 16-Bit System

Now let's look at a typical 16-bit small computer system, such as the IBM PC, based on the Intel 8088 microprocessor.

Memory

As in the case of the 8-bit machine, the memory is organized into locations which hold eight bits or one byte of data. The CPU can still store or read only one byte at a time; when it stores or reads 16-bit numbers, it does so in two steps, eight bits at a time.

In the 16-bit machine, however, memory locations have 20-bit addresses (see sidebar). As 2(20) is 1,048,576, the CPU can access up to that many locations, if the memory is in fact that large. (Since that number is 1024 X 1024, and since we treat 1024 as if it were one thousand, we call that amount of memory one megabyte, borrowing the scientific prefix for one million, abbreviated M.) It is the ability to use such large amounts of memory that is a major advantage of the 8088 microprocessor.

Disk Storage

As in the case of the 8-bit machine, storage on floppy or hard disk is organized into units of eight bits, or one byte.

Input/Output

Also as in the case of the 8-bit machine, input from the keyboard and output to the screen or a printer is conducted in the form of ASCII characters carried within 8-bit bytes.

Machine Instructions

Again as in the 8-bit machine, the machine instructions used by the 16-bit CPU are coded as sequences of 8-bit bytes, from one to six bytes being required depending upon the instruction. The bytes which represent one instruction are stored in consecutive memory locations.

The 8088 CPU, however, has a valuable feature called instruction prefetch. While the CPU is executing one instruction, it brings from memory the next several bytes (which we would expect to include the next instruction) and places them in a special "pipeline' buffer within the CPU. In this way, when the time comes to work on the next instruction, it is already close at hand. This significantly speeds up the operation of the system.

Of course, if the surrent instruction requires a jump to an instruction other than the next one in sequence, the information in the pipeline is useless: the required instruction is somewhere else in memory. In that case the pipeline is emptied, the bytes of the instruction are brought in from the new locations, and the pipeline is refilled with subsequent bytes.

Data Manipulation

The 8088 CPU has eight principal data registers, each capable of holding a 16-bit number. Each is divided into two portions, either of which can be used to hold an 8-bit number (one byte).

The 8088 CPU can perform a wider range of arithmetic and logic functions than the 8080 or Z80. For example, it can directly perform multiplication and division of 8- or 16-bit binary numbers important functions in the multiplication and division of decimal numbers. With the 8080 or Z80, these functions must be performed by long sequences of program steps which involve addition or subtraction of the binary number, plus shifting the bits of a number left or right to multiply or divide it by powers of two--in effect, doing "binary long multiplication' (or division).

All arithmetic and logic operations can be performed on either 8- or 16-bit numbers. Most operations can be performed formed in any register which is convenient, not just in certain ones, as in the 8-bit machine. In addition, arithmetic and logical operations can be performed on numbers stored in memory locations without first bringing them into a CPU register. The internal structure of the CPU performs 16-bit operations just as quickly as 8-bit ones. These features greatly speed most data manipulation compared to the 8-bit machine.

The 8086 CPU

The Intel 8086 microprocessor is also used by certain modern 16-bit computer systems (like the ACT Apricot). It is almost identical in function to the 8088 with one exception: the memory used in 8086-based systems is organized into 16-bit words rather than the 8-bit bytes we have previously encountered. Nevertheless, for addressing purposes, each word is considered to be two consecutive 8-bit locations, each of which has its own 20-bit location address.

When the CPU wants to store or read an 8-bit number (one byte), it gives the 20-bit address of the location, along with an extra electrical signal which tells the memory to access only the eight bits from that location, not all 16 bits which are stored together.

When a 16-bit number is stored in memory by the CPU, it may end up in either of two situations, depending on the address assigned to it. It may occupy an entire 16-bit word, or it may occupy the second half of one word and the first half of the next.

In the first case, the CPU will store or read the entire 16-bit number in one memory access cycle, giving the address for the location of the first part of the word but signaling the memory to access the entire word. In the second case, the CPU must access the memory twice, in each case accessing only one of the two locations, joining the two returned bytes (in the case of a read) to form the entire 16-bit number.

For this reason, if a program needs to store or read a long sequence of 16-bit numbers, it is worthwhile for the programmer to arrange the address of each to be "even' so that each number cleanly occupies one memory word. If this is done, the speed of an 8086-based system, when handling 16-bit data, can be significantly greater than for an 8088-based system.

In the case of program instructions, this consideration does not arise. When the CPU "prefetches' additional bytes, it always does so an entire memory word (containing two consecutive bytes) at a time.

What Does All this Mean To The User?

We have that a 16-bit machine works with both 8- and 16-bit data, just as an "8-bit' machine does. We have also seen that an 8-bit machine uses 16-bit addresses, while a 16-bit machine uses 20-bit addresses. And, we have seen that, with the 8088 CPU, the 16-bit machine uses an 8-bit memory. No wonder it has been hard to answer the question, "16-bit?' What does that mean?'

Much more important is that the 16-bit systems offer substantial advantages to the programmer and user. Direct access to as much as one megabyte of memory, as a result of the 20-bit address structure, allows large application programs and large arrays of data to reside in memory. This minimizes the need to move program portions and data records from disk. Various other new features of the CPUs, not necessarily related to their 16-bit orientation, provide additional speed and programming power.

We now hear that 32-bit machines are coming into use in the personal/ professional computer world. Let's see, will they have 32-bit memories? Maybe not. But we can be certain that they will reflect the continuing progress of the computer industry.

Photo: Figure 1. Organization of typical small computers.

Photo: Figure 2. Memory organization with the 8086 CPU.