Assembly Language Programming 16 31

Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

,

Microcomputer
Systems

Overview This chapter provides an Introduction to the architecture of micro-


computers in general and to the IBM PC in particular. You will learn about
the main hardware components: the central processor, memory, and the
peripherals, and their relation to the software, or programs. We'll see exactly
what the computer does when it executes an instruction, an<l discuss the
main advantages (and disadvantages) of assembly language programming. If
you arc an experienced microcomputer user, you arc already familiar with
most of the Ideas discussl'CI here; if you are a novice, this chapter Introduces
many of the important terms used In the rest of the book.

1.1 . .
The Components Figure 1.1 shows a typical microcomputer system, consisting of a
of a Microcomputer system unit, a keyboard, a dispiay screen, and disk drives. The system unit
is often referred to as "the computer," because It houses the circuit boards
System of the computer. The keyboard, display screen, and disk drives are called 1/0
devices because they perform input/output operations for the computer.
They arc also called peripheral devices or peripherals. -
Integrated-circuit (IC) chips are used in the construction of computer
circuits. · c c I ma con ai h dreds or even thousands of transistors.
These IC circuits arc .kriown !IS di~tial c --~ s ause t ey operate on .
discrete voltage slBnal levels, typiCaly, a high voltage and a low voltage. We
use the symbols 0 ailcf' T'to represent the low- and high-voltage signals,
respectively. These symbols are called l_!!..°.!!'"Y digit~, or,.bits. All information
processed by the computer ls.represented by strings of O's and l's; that is,
by bit strings. . · ·
4 7. 1 The Components of a Microcomputer System

,---
Figure 1. 1 A Mlaoc""1pUtlW ;
System

'~, .
.··>r-.:~~,
·.·• ... \

·.

Functionally, thl' cqmputer circuits consist of three parts: the cen-


tral processing unit (CPU), the memory circuits, and the 1/0 circuits. In
a microcomputer, the 9~iogle-ch.iP_P-~~called.! mlcrop~
sor. The CPU is the brain of the computer, and it controls all operations. It
uses the memory circuits to store Information, and the 1/0 drculls to com-
municate with 1/0 devices ..

The System Board


Inside the system unit is a main circuit board called the-.~·
board, which contains the microprocessor and memory circuits. The systena
board is also called a motherboard because· it contains expansion slots.
which are connectors for additional circuit boards called add-in boards or
add-_in cards. 1/0 circuits are usually located on add-In cards. Figure 1.2
shows the picl;11·e of a motherboard.

1.1.1
Memory Bites and Words
Infonnatlon"·processed by the computer Is stored In Its memory. A
niemorys1i_cu}t_elem~nt_ can store one bit of data. However, the mtmory
circuits are usually organized Into groups that can store eight bits of daf,J,
and a string of eight bits ls called a byte. Each memory byte clrcult_:or
memory byte, for short-is identified by a· number that Is called its IMI-
·~. like the street address of a house. The first memory byte has address
Chapter 7 Microcomputer Systems s.

, . . _ 1.2 A Motherboard
--·--·--------· ·-::- ···-· -··1

i!m~ a&m· 1
• 1

'V'
0. The data "!lltOred in a memory byte are called Its i;pgtcgts. When the
contents of a ml'mory hytl' are treated as a single numhcr, we often i1w the
term v.atue to denote them ..
It is important °t; understand the difference b<'twecn address and
contents. The address of a memory byte i~ fixed and is different from the
address t>f ahy otlll'r memory byte in the l''o111j1uter. Yet the contcnt5 of a
memory byte arc not unique and arc subject to change, because they denote
the data curmilly l~ing siored. Hgure 1.3 shows the organization of memory
bytes; tl'n: contents ille arbitracy. ~
Another distinction between address and contents.ls that while the
contents of .a memory byte are always eight bits, the numtrer of bits ln an

Flgur,e 1.3 Memory


- Address Conterits'
'lepresented as Bytes

7 0 0 1 0 1 1 0
6 1 1 0 0 1 1 1 0
5
4
0 0 0 0
1 1 1 0
,,
1 1
1
0 1
0 1
3 0 0 0 0 0 0 0 0
2 1 1 1 1 1 1 1
1 • 0 0 1 1 1 1 0
0 0 1 0 0 0 0 I
6 · 1. t The Components of a Microcomputer System

address depends on the processor. For example, the Intel 8086 microprocessor
assigns a 20-bit address, and the Intel 80286 microprocessor uses a 24~bit
address. The number of bits used In the address determines the number of
bytes that can be accessed by the processor. '

Example 1.1 Suppose a processor uses 20 bits for an address. How


many memory bytes can be accessed?

Solution: A bit can have two possible values, so In a 20-blt addre~s


there can be 2 20 .. 1,048,576 different values, with each value being the
potential address of a memory byte. In computer terminology, the mun·
ber 220 is called 1 mega. Thus, a 20-bit address can be used to address
1 megabyte or 1 MB.

Jn a typical microcomputer, two bytes form a word. To accommo-


date word data, the IBM PC aijows any pair of successive memory bytes to
be treated as a single unit, calil'Cl a naemory word. The lower address of
the two memory bytes Is used as the address of the memory word. Thus the
memory word with the address 2 Is made up of the memory bytes with the
addresses 2 and 3. The microprocessor can always tell, by other information
contained In each Instruction, whether an address refers. to a byte or a word.
In this book, we use the term memory location to denote either
a memory byte or a memory word.

Bit Position\/"'
Figure 1.4 shows the bit positions in a microcomputer word and a
byte. The positions are numbered from right to left, starting with O. In a
word, the bits 0 to 7 form the low byte and the bits 8 lo 15 form the ltigll
byte. For a word ~tored In memory, its low hyte comes from the memory
byte with the lower address and Its high byte Is from the memory byte with
the higher address.

Memory Operationi. •
The processor can perform two operations on memory: r~ad (fetch)
the contents of a location and write (store) dilla at a locallon. In a read
operation, the processor only gets a copy of the data; the original contents

Figure 1.4 Bit Positions in a


Byte and a Word 7 6 5 4 3 2 0
Byte bit
position

Word bit
position
15 14 13 12 11 10 9 8 7 6 5 4 3 2 0
~1
I I I I
High byte Low byte
Chapter 7 Microcomputer Systems 7

:r
Figure 1.5 Bus Connections
of a "Microcomputer Address bus

of the location are unchanged. In a wri~e operatiqn, the _data written become
the new c~ntents of the location; ·t_he original contents are thus lost.

R.:W aqd BQM~.


There are two kinds of memory drcu.lts: random access memory
(RAM) and read-only m-cmory (~Q_M). The difference is that RAM loca-
tions can be read and written, whlle, as the name implies, RO~ locations
can only be read. This is because the contents of ROM m~nl-
tlalized, cannot be changed. ,
Program instructions and data are nornially loaded Into RAM mem-
ory. However, the contents of RAM memory are lost when the machl11~ Is
turned off, so anything valuable In RAM must be saved on a disk or printed
out beforehand. ROM cln:ulls retain their values even when the power Is off.
Consequently, ROM is used by computer manufacturers to store systefu pro-
grams. These ROM-based programs are known as .firmware. Tu~y are rel
sponsible for loasJing~s from disk as well as for self-testing ·
the computer Wfteilitis turned on~

Buses
A processor communicates with memory and l/Q.,clrcults by using
signals that travel along a set of wires or connections called .Juua that
connect the different comp0nents. There are ~hrec kinds of slgnals:.address,
data, and control. And there are three buses:.address bus; data bus, and
control bus. For example, to read the contents of a mc.mory location, th~
CPU places the address oC the memory location on the address bus, and It
re<;elves the data, sent by tlie memory circuits, on the data bus, A control
signal l~ required to inform the memory to perform a read operation. The
CPU sends the control signal on the control bus. Figure 1.5 Is a diagram of
the bus connections for.a microcomputer. · · ·

1.1.2
The CPU . As stated, ttie CPU Is the brain of the computer. It controls the i.:om-
pute(by executing programs stored In memory. A program might be a system
program. ·or an application program. written by a user. In any ease, each
lnstiuctlon that the CPU executes Is a bit string (for the Intel 8086, instruc-
tions are from one to six bytes long). This language of O's and 1's is called
machine. language.
1, l ~~ts <?fa. MicrQcomputer System

Figure t.6 Intel BOBS


MicroprocessOI' Organiz•tion Execution Unit (EU) Bus Interface unit.

AX
BX
ex
ox
General registers
BP
cs

External bus

Temporary registers

The instructions performed by a CPU are called its instruction set,


and the Instruction set for each CPU is unique. To keep the cost of computers
down, machine language Instructions are designed to be simple; for example,
adding two numbers or moving a number from one location to another. The
amazing thing about computers Is that the incredibly complex tasks they
perform are, In the end, just a sequence of very basic operations.
In the following, we will use the Intel 8086 microprocessor as an
example of a CPU. Figure 1.6 shows its organization. There are two main
components: the execution unit and the bw interface unit.

Execution Unit (EU)


As the name lmpUcs, the purpose of the execution unit (EU} is to
execute Instructions. It contains a circuit called the arithmetic and logic
unit (ALU). The ALU can-perform·arithmetic (+, - , x ,I) and logic (AND,
OR, NOT} operations. The data for the operations are stored in circuits called
rcgutcn .. A register is like a memory location except that we normally refer
to it by a name rather than a number. The EU has eight registers for storing
data; their names arc AX, BX, CX, DX, SJ, DI, Br, and SP. We'll become
orcquainted with them in Chapter 3. In addition, the EU contains temporary
' registers for holding operands for the ALU, and the FLAGS register whose
individual bits reflect the result of a computation.
Chapter 1 Microcom,,Uter Systems 9

B~afe, <fnJ!.J!U!:!!t~
The bus_ Interface unit (BIU) facilitates communication betw,cc1· 'he
EU and the memory or J/0 circuits. It is responsible for transmittir"' ad-
dresses, data,· and control signals on the buses. Its registers are named CS, •
OS, ES, SS,. and IP; they hold addresses of memory locations. The IP
(qistruCtion pointer) contains the address of the next instruction to be
executed 'by the EU. · ' · ·
The fill and the filY. are connected by an ~nternal b~; and they work
together. While the EU is executing an instruction, the BJU fetches up to six
byte% of the next instruction and places them in the instruction queue. This
operation is called i1rsrruc«qr1 qrefetch. The purpose is to speed up the pro-
Cj!.ll_Or. If the EU needs to communicate with memory or the peripherals, the
BIU suspends instruction prefetch and performs the needed oneratians • ....-

1.1.3
110 Ports 1/0 devjces are connected to the computer through 1/0 circuits. Each
of these circuits contains several registers called 1/0 ports. Some are used
for data while others are used for control commands. Like memory locations,
the I/O ports have addresses and arc connected to the bus system. However,
these addresses are known as 110 addresses and can only be used in input or
output instructions. This allows the Cl'U to distinguish between an 1/0 port
and a memory location.
1/0 ports function as transfer points between the Cl'U and 1/0 de-
vices. Data to be Input from :m 1/0 devise arc st·nt to ii port where they can
. be read by the CPU. On output, the CPU writes data to an 1/0 port. The 1/0
circuit then transmits the data to the 1/0 device.

Serial and Parallel Ports


The data transfer between an 1/0 port and an 1/0 device can be l
bit at a time (serial), or 8 or 16 b.its at a time (parallel). A parallel port requires
more wiring connections, while a serial port tends to be slower. Slow devices,
like the keyboard, always connect to a serial port, and fast devices, like the
disk drive, always connect to a parallel port. llul some devices, like the ...,,
printer, can connect to either a serial or ·a parallel port.
. . ' .

1.2
Instruction To understand how the CPU operates, let's look at how an Instruction
Execution Is executed. First of all, a machine instruction has two parts: an opcode and
operands. The opcode specifies the type of operation, and the operands are
often given as memory addresses to the data to be operated on. The CPU
goes through the following steps to execute a machine instruction (the
fctch,..exccutc cycle):

Fetch
1. Fetch an lmtruction from memory.
2. Decode the Instruction to determine the operation.
3. · Fetch data from memory if necessary.
7.2 Instruction Execution

Execute
4. Perform the operation on the data.
5.. Store the result in memory if needed.
To see what this entails, let's trace through the execution of a typical machine
language instruction for the 8086. Suppose we look at the iustructlon that
adds the contents of register AX to the contents of the memory word at
address 0. The CPU actually adds the two numbers in the ALU and then
stores the result back to memory word O. The machine code is
00000001 00000110 00000000 00000000
Before execution, we assume that the first byte of the Instruction is stored
at the location indicated by the IP.
1. Fetch the instruction. To start the cycle, the BIU places a mem-
ory read request on the control bus and the address of the in-
struction on the address bus. Memory responds by sending the
contents of the location specified-namely, the instruction
.code just given-over the data bus, Because the instruction
code Is four bytes and the 8086 c:an only read a word at a
time, this involves two read operations. The CPU accepts the
data and adds four to the JP so that the IP will contain the ad-
dress of the next instruction.
2. Decode the lnstmction. On receiving the Instruction, a decoder
circuit in the EU decodes the instruction and determines that it is
an ADD operation involving the word at address 0.
3. Fetch data from memory. The EU informs the BIU to get the con-
tents of memory word 0. The BIU sends address 0 over the ad-
dress bus and a memory read request is again sent over the
control bus. The contents of memory word 0 arc sent back over
the data bus to the EU and arc placed In a holding register.
4. Perform the oper<1tiun. The contents of the holding register and
the AX register arc sent to the ALU circuit, which performs the re-
quired addition and holds the sum.
5. Store the result. The EU directs the BIU to store the sum at ad-
dress 0. To do so, the llIU sends out a memory write request over
the control bus, the ;iddress 0 over the address bus, and the sum
10 be stored over the data bus. The previous contents of memory r
word 0 arc ov1:rwritl1.•n by the sum.
The cycle is now repeated for the instruction whose address is con-
t;iined in the II'.

Timing
The prl'Cl.'ding example shows that even though machine instructions
are very simple, their execution is actually quite complex. To ensure that the
steps arc carried out in an orderly fashion, a clock circuit controls the processor

=igure 1.7 Train of Clock


'ulses
-
lt-1 period-+!
Chapter 1 Microcomputer Systems 11

hy generating a train of clock pulses as shown in Figure 1.7. The time inter\'al
!Jetwcen two pulses· is known as·a clock period, and the nwnbcr of pulses per
second is calk'CI the clock rate or clock speed, measured In megahertz
(MHz)." One megahertz Is 1 million cycles (pulses) per second. The original
lnM PC had a clock rate of.4.77 MHz, but the latest PS/2 model has .1 cluck
rate of 33 MHz.
. · Th~ _fi>mputer circuits.are activated by the clock pulses; that is, the
circuits perform an operation only. when a clock pulse is present. E.Jch step
in the instru<.:tiun fct<.:h and execution <.:ydc requires one or more do<.:k pe-
riods. For example, the 8086 takes four clock periods to do a memory read
and a multiplication operation may take more than seventy clock periods.
If we s·peed up the clock circuit, a processor can be made to operate faster.
. However,_ each processor has a rated maximum clock speed beyond which
it may not function properly..

1.3 ...
110 Devices 1/0 devices are needed to get information into and out of the com-
puter. The primary 1/0 devices are magnetic disks, the keyboard, the display
monitor, and the printer.

· Magnetic Disks
We've seen that the contl'nts of RAM arc lost when the computer
is turned off, so magnetic disks an: used for permanent storage of programs
and data. There are two kinds of disks: tlOJJJlY disks (also calll'd diskettes)
and hard disks. The device that reads and writes data ori a disk is called
· a disk drive.
Floppy lfoks come in s i/4-inch or :n~-in<.:h diameter siZl!S. They arc
lightweight and portable; it is easy to put a diskette away for safekeeping or
use it on different computers. The amount of data a floppy disk can hold
depends on the ly~c:; it ,1nges from 360 kilobytes to 1.44 megab.ytcs. A
°
kilobyte (KU) is 2 bytes. · ·•
. A hard disk and its disk drive are cndoscd in a hermetically scaled
container that is not removable: from the computer; thus, it is also called a
fixed disk. It can hold a Jot more data than a floppy disk-typically 20,
·HI. to over 100 megabytes. A program can also access information on a hard
disk much foster than a floppy disk.
. Disk operations arc covered in Chapter 19.

Keyboard
The keyboard allows the user to enter information into the cornputt:r.
It has the keys usual!)' fo_und on a typewriter, plus a number of <.:ontml and
function keys. It has its own microprocessor that sends a coded signal to the
computer whenever a key is pressed or released.
When a key is prc!>sed, the corresponding key character normally
appears on the screen. Uut Interestingly enough, there is no direct <.:onnc:ction
between the keyboard and the screen. The data from the keyboard are re-
ceived by the current running program. The program must send the data to
the screen before a character is displayed. In Chapter 12 you will learn how
to control the keyl>Oard.
12 1.4 Programming Languages

Display Monitor
1be display monitor is the standard output device of the computer.
The information displayed on the screen Is generated by a circuit In the com-
puter called a video adapter. Most adapters can generate both text characters
and graphics images. Some monitors are capable of displaying In color.
We discuss text mode operations in Chapter 12, and cover graphics
mode in Chapter 16.

Printers
Although monitors give fast visual feedback, the information is not
permanent. Printers, however, arc slow but provide more permanent output.
Printer outputs arc known as hardcopies.
111e three common kinds of printers are daisy wllL'f!I, dot matrix, and
/nscr printers. The output of a daisy wheel printer is similar to that of a typewriter.
A dot matrix printer prints characters composed of dots; depending on the
number of dots useu per character, some dot matrix printers can generate
near-letter-quality printing. The advantage of dot matrix printers is that they
can print characters with different fonts as well as graphics.
The laser printer also prints characters composed of dots; however,
the resolution is so hi~h (JOO dots per Inch) that it has typewriter quality.
The laser printer is expensive, but in the field of desktop publishing it is
indispensable. It is also quiet compared to the other printers.

1.4
Programming The operations of the computer's hardware are controlled by its
Languages software. When the computer is on, itls always in the process of executing
instructions. To fully understand the computer's operations, we must also
study its instructions.

Machine Language
A CPU can only execute machine language instructions. As we've
seen, they arc bit strings. The following Is a short machine language program
for the I BM PC:
Machine instruction Operation
10100001 00000000 00000000 Fetch the contents of memory word 0
and put it in register AX. ·
00000101 00000100 00000000 Add 4 to AX.. "
10100011 00000000 00000000 Store the contents of AX in memory
word 0.
A~ you can wl'll imagine, writing programs in machine language is
tt>dious and subject to error!

Assembly Language.
A more convenient language to use is asftmbly language. In as-
sembly language, we use symbolic names to represent operations, registers,
and memory locations. If location 0 is symbolized by A, the preceding pro-
gram expressed in lllM J>C assembly language would look like this:
Chapter 7 Microco/T1puter Systems .13

Assembly language instruction Comment


MOV .AX,A ;fetch the cont~nts of
; location A and
;put it iw regi:;tcr AX
ADD AX, 4 ;add 4 to AX
MOV A,AX ;move the contents of AX
;into location A

A program written in assembly language must be converted to machine lan-


guage before the CPU can execute it. A program called the assembler trans-
lates each assembly language statement into a single machine language
instruction.

High-Level Lang~ages
Even though it's easier to write programs in asscrn6Jly language than
machine language, it's still difficult because the instruction set is so primitive.
That is why high-level languages such as F.QJ..U:JiAN, l~I. ~ml others
were devel0ped. Different high-level languages arc designed for different ap-
plications, but they generally allow programmers to write programs that look
.more like natural language text than is possible in assembly la11guage.
A program called a C0-1tpill"r is needed to·translate a high-level lan-
ghage program into machine code. \. .,11.:_Jilation is milleiiWOlvcd than assem-
hling lx.'(;ause it entails the trnnslation or comp;1•x mathematical (:xpressions and
natural language comniands i·nto simple'macl1i.nc operations. A high-level lan-
guage statement ty1>kally translates into many machine lanb'Uage instructions.

Advantages of High-Level Languages 4':\-


There are many reasons why a programmer might choose to write
a program in a high-level language rather than In assembly language.
First, because high-level languages are clo~er to natural languages,
It's easier to convert a natural language algorithm to a high-level language
program than to an assembly language program. For the same reason, it's
easier to read and understand a high-level language program than an assem-
bly language program.
Second, an assembly language program generally contains more
statements than an equivalent high-level lanb'Uage program. so more time
is needed to code thc assembly language program.
Third, bccau~c c;ich computer has its own unique assembly language,
assembly language programs are limited to one machine, but a high-level
language program can be executed on any machine that has a compiler for
that language.

Advantages of Assembly Languages


The main reason for writing assembly language programs is effi-
ciency: because assembly language is so close to machine.language, a well-
written assembly language program produces a faster, shorter machine
langu;1ge program. Also, some operations, such as reading or writing to spe-
cific memory locations and 1/0 ports, can be done easily in assembly lan-
guage but may be impossible at a higher level.
· Actually, it is not alway~ necessaiy for a programmer to choose be-
tween assembly language and high-level languages, beeause many high-level
languages accept subpro0rams written in assembly language. This means that

.1
14 1.5 An Assembly language Program

crucial parts of a program can be written in assembly language, with the rest
written in a high-level language.
In addition to these considerations, there is another reason for
learning assembly language. Only by studying assembly language ls it
possible to gain a feeling for the way the computer "thinksn and why
certain things happen the way they do inside the computer. High-level
languages tend to obscure the details of the compiled machine language
program that the computer actually executes. Sometimes a slight change
in a program produces a major increase in th~ run time of that program,
or arithmetic overflow unexpectedly occurs. Such things can be under-
stood on the assembly language level.
Even though here you will study assembly language specifically for.
the IBM PC, the techniques you wlll learn are typical of those used in any
assembly language. Learning other assembly languages should be relatwely
easy after you have read this boOk. ~

;
r'Assembly To give an idea of what an assembly language program looks like, here
nguage Program is a simple example. The following program adds the contents of two memory
locations, symbolized by A and n. The sum is stored in location SUM.

Program Listing PGM1_ 1.ASM


TITLE PGMl 1: SAMPLE PROGRhM
.MODEL SMALL
.STACK !OOH
.DATA
A ow 2
B DW 5
SUM OW ?
.CODE
f>!/IIN PROC
; i:iit.ialize DS
MOV AX,@CATA
MOV DS,AX
;add t.he numb~rs
MOV AX,A ;AX has A
AD!:> AX,B ;AX has A+B
MOV SUM,AX ;SUM = A+B
;exit to DOS
MOV ;,x, 4CGOH
IN1' 21H
f?IN. ·END?
END MAIN

As~embly language programs consist of statements. A statement is


either an Instruction to be executed ·when the program is run, or a directive
for the assembler: !=or example, .b:{ODEL SMALL is an assembler directive
that specifies the size of the progr.IWi. MOV AX,A is an Instruction. Anything
that follows a semicolon Is a comment, and Is ignored by the assembler.
Chapter 1 Microcomputer Systems 15

The preceding program consists of three parts, or segments: the stack


segment, the data segment, and the code segment. They begin with the directives
.STACK, .DATA, and .CODE, respectively.
The stack segment is used for temporary storage of addresses and
data. ·If no stack segment is declared, an error message is generated, so there
must be a stack segmerit even if the program doesn't utilize a stack.
Variables are declared in the data segment. Each variable is assigned
space In memory and may be- initialized. For example, A DW 2 sets aside a
a
memory word for variable called A and initializes it to 2 (DW stands fo~
uoefine Word"). Similarly, B DW 5 sets aside a word for variable Band ini-
tializes it to 5 (these initial values were chosen arbitrarily). SUM DW ? sets
Aside an uninitialized word for SUM. ·
, A program's instructions are placed in the code segment. Instruction~
are usually organized into uni~s cailed woccd1m;s. The preceding program has
only one procedure, called MAlN,.which begins with the line MAIN l'ROC
' and· ends with line MAIN ENDP. ·
The main procedure begins and ends. with instructions that are
needed to initialize the DS register and to return to the DOS operating system.
Their purpose is explained iri Chapter 4. The instructions for adding A and
B arid putting the answer in SUM are as follows:
. . .
0

MOV ·AX, A ;AX h.is A


ADD hX,3 ; AX ha~ i>:+ B
MOV· SUM,AX ; SUM a A+B

MOV AX,A copies the contents of word A into register AX. AOD AX,B.adds
the c'?ntents o~ B _to it, _so that AX now, hol~s the total!~-~OV SUM,ft,.X
stores the answer in vanable SUM.
• Before this program could be run on the computer, it would have
to be assembled into a.machine language program. The steps are explaim:d
in Chapter 4. Because there were no output lnstructi9ns, we could not see
the answer on the screen, but we·co.uld trace the program's exeeutlon ain
debugger such as the DEUUG program,

Glossary
add-In board or card Circuit board that connects to the
'motherboard, usually containsJ/O cir-
• cuits or additional memory
address A number that identifies a memory location
address bus The set of electrical pathways for address
signals
arithmetic and logic unit, • ~.PU. circ·~it where arithmetic and logic
ALU operations arc done
i:uscn1blcr , ~ program that translates an assembly lan-
guage program into machine language
assembly language ~y~~onc representation of machine lan-
guage
.binary digit A symbol,that can have value 0 or 1
bit , ~in,ary ~igit
bus A set of wires or connections connecting
the CPU, mcmol)', ilml J/O .PQIU
16 Gtossar'y

bus interface llllit, BW Part of the CPU that facilitates communi-


cation between the CPU, memory, and
1/0 ports ·
byte 8 bits
central processing unit, The main processor t:ircuit of a computer
CPU
clock period The time interval between two dock pulses
clock pulse An electrical signal that rises from a low
voltage to a high voltage and down again
to a low voltage, used to synchronize
computer circuit operations ·
clock rate The number of clock pulses per second,
measured In megahertz (MHz)
clock speed Clock rate
compiler A program that translates a high-level lan-
guage to machine language
contents The data stored in a register or memory
location
control bus The set of cla"trical p.lths for control signals
data bus The set of electrical paths for data signals
digital circuits circuits that operate on discrete voltage
levels
disk drive The device that reads and writes data on
a disk
execution unit, EU Part of the CPU that executes instructions
expansion slots Connectors in the motherboard where
other circuit boards can be attached
fetch~xecute cycle Cycle the CPU goesJhrough to execute
an instructlu1I --
firmware Software supplied by the computer manu-
facturer, usually stored in ROM
fixed disk Nonremovable disk, made of metal
floppy disk Removable, flexible disk
hardcopy Printer output
hard disk Fixed disk
1/0 devices Devices that handle input and output
data of the computer; typical 1/0 devices
are display mo!litor, disk drl~e. and
printer
1/0 ports Circuits that function as transfer points
between the CPU and 1/0 devices
instructfon pointer, IP A CPU register that contains the address
of the next instruction
instruction set The instructions the CPU is capable of
performing
kilobfte, KB 2 10 or 1024 bytes
machine language Instructions coded as bit strings: the lan-
guage of the computer
Chapter 1 Microcomputer Systems 17

mega A unit that usually denotes 1 million, but


in computer terminology 1 mega is 220
(or 1,048,576)
megabyte, MB 2 20 or 1,048,576 bytes
megahertz, MHz 1,000,000 cycles per second
memory byte (circuit) A memory circuit that can stor~ one byte
memory location A memory byte or memory word
n1cmory word Two memory bytes
microprocessor A processing unit fabricated on a single
circuit chip
n1otbcrboard The main circuit board of the computer
opcode Numeric or symbolic code denoting the
type of operation for an instruction
operand The data specified in an instruction
peripheral (de.vice) 1/0 device
random access memory, Memory circuits that (an be read or
RAM written
read-only 1nemory, ROM Memory circuits that can only be read
re&ris~er A Cl'U circuit for storing information
system board Motherboard
video adapter Computer circuit that converts computer
data into video signals for the display
monitor
word 16 bits

Exercises

1. Suppose memory bytes ~4 have the following contents:


Address Contents
0 01101010
11011101
00010001
11111111
01010101

a. Assuming that a word is 2 bytes, what are the contents.of


the memory word at addre>s 2!
the nwn10ry word at <H.h.lrc~~ J?
• the memory word whose high byte is the byte at aJdress 2?

b. Wlut is
• l:it 7 of ~te 2°!
• bit 0 of word 3?
o bit 4 of byte 2?

• bit 11 of word 2?
18 Exercises

2. A nibble is four bits. Each byte is composed of a high nibble and


a low nibble, similar to the high and low bytes of a word. Using
th~ data in exercise 1, give the contents of
a. the low nibble of byte 1.
b. the high nibble of byte 4.
3. The two kinds of memory art! RAM and ROM. Which kind of
memory
a. holds a user's program?
b. holds the program used to start the machine?
c. can be changed by the user?
d. retains its contents, even when the power is turned off?
4. What is the function of
a. the microprocessor?
b. the buses?
5. The two parts of the microprocessor are the EU and the BIU.
a. What is the function of the EU?
b. What is the function of the BIU?
6. In the microprocessor, what is the function of
a. the IP?
b. the ALU?
7. a. What are the 1/0 ports used for?
b. How are they different from memory locations? .
8. What is the maximum length (in bytes) of an instruction for the
8086-based IBM PC?
~. Consider a machine language instruction that moves a copy of
the contents of register AX in the Cl'U to a memory word. What
happens during
a. the fetch cycle?
b. the execute cycle?
>. Give
a. three advantages of high-level language programming.
b. the primary advanl.ige ul assembly language programming.
. ~· .

You might also like