
COMPUTER ORGANIZATION AND PROGRAMMING
42-3
INTRODUCTION*
Computers come in all shapes and sizes, from large
corporate data-processing machines that fill a room to
tiny microcontrollers buried deep in automobiles, ster-
eo
systems, and toasters. Even though computers span a
wide range of sizes, capabilities, and cost, they share a
great many characteristics and operating principles. The
goal of this chapter is to describe general principles of
computer organization and programming that apply to
computers of any category.
Taken as a whole, a computer is an incredibly
complex system, with many more levels of detail than,
say, the noncomputer part of a radio. Fortunately, a
computer system
is
structured into many levels,
so
that
it is easy to understand
if
taken one level at a time; see
Fig.
1.
Hardware
Central to the organization,
or
indeed existence, of
a computer is its
architecture.
The architecture of
a computer
is
really an abstract concept-it is just a
definition
of
the functionality
of
the computer as seen
by a machine-language programmer. A user of a
particular computer architecture does not care how its
functions are achieved, only that they match their
definitions. An example of a particular computer archi-
tecture, the Motorola
68000,
is given later in the
chapter.
At the next level down is
implemenration,
the logic
structures used to accomplish the functions defined by
the architecture. An implementation consists of a block
diagram of the system hardware modules, their inter-
connections,
and further refinements
of
the internal
logic structure
of
each module. Note that implementa-
tion is still a somewhat abstract concept in that an
implementation can exist
on
paper without the machine
actually having been built. Chapter
43
discusses logic
design-the tools and techniques for designing hard-
ware modules.
The lowest level of detail in a computer is its
hurdfiure realizarion-the
electronic circuits and other
components from which the computer is built. Realiza-
tion encompasses integrated-circuit technologies, such
as those discussed in Chapter
20,
as well as packaging,
interconnections, and all other physical details of the
machine.
The bottom three levels
of
a computer just described
are often grouped together and simply called “the
hardware.” The higher levels in Fig.
1
are usually
grouped together as “software.”
*
The
material in this chapter is adapted, with permission,
from portions
of
Chapters
1,
4,
5,
and
10
of
Microcomputer
Architecture and Programming: The
68000
Family
by John
F.
Wakerly,
0
1989
by
John
Wiley
&
Sons, Inc., New
York.
Software
Computer
software
consists of the instructions and
data that the computer hardware manipulates
to
perform
useful work.
A
sequence of instructions for a computer
is called
aprogram.
The data manipulated by a program
is called a
data base,
a
file,
input,
or simply
data,
depending on its nature and extent.
The most primitive instructions that can be given to a
computer are those interpreted directly by hardware,
in
the
machine language
of the computer. Machine-
language instructions are encoded as strings of bits in
the computer memory, often one instruction per memo-
ry location. The processor fetches machine instructions
from memory and executes them one by one.
Since it is difficult for humans to read and recognize
strings of bits, machine-language programs are written
in
assembly language
and translated into bit strings by
an
assembler.
Assembly language represents machine
instructions by mnemonic names and allows memory
addresses and other constants to be represented by
symbols rather than bit strings.
Most programs are written in
high-level languriges
that allow common operations such as expression
evaluation, repetition, assignment, and conditional ac-
tion to be invoked in a single high-level
stcitemenr.
Popular high-level languages include BASIC,
FOR-
TRAN, and Pascal.
Few computers execute a high-level language direct-
ly. Therefore, a
compiler
is needed to translate a
high-level-language program into a sequence of ma-
chine instructions that performs the desired task.
Assemblers and compilers are not the only
sofnture
tools
that a programmer may encounter. Other
useful
tools related to program development are interpreters,
simulators, and on-line debuggers. Like a compiler. an
interpreter
processes a high-level-language program.
Unlike a compiler, an interpreter actually executes the
high-level-language program one statement at a time.
rather than translating each statement into a sequence
of
machine instructions
to
be
run
later. Most BASIC
environments use an interpreter.
A
simulator
is a program that simulates individual
machine instructions, usually
on
a machine other than
the one being simulated.
A
typical
use
of a simulator
is
to test programs to be run on a processor before the
processor hardware is available. An
on-line
debugger
executes a program
on
a machine one
or
a
few instruc-
tions at a time, allowing the programmer to see the
effects of small pieces
of
the program and thereby
isolate programming errors
(bugs).
Texr
editors
are used
to
enter and edit text in a
general-purpose computer. whether the text is a letter.
a
report,
or
a computer program.
Text
furmuffen
read
text with imbedded formatting commands and produce
formatted documents such as this book.
Text editors
and formatters belong to the area of computing known
as
word processing.
In a medium to large computer system. cooperating