inter
PHYSICAL DESIGN AND DEBUGGING
11.5.5 Other Simple Diagnostic Software
Other simple programs can be used to check the other operations the system must perform.
The program described here
is
longer than the 4-byte program illustrated previously; it tests
the abilities to write data into RAM and read the data back to the 80386.
This second diagnostic program, shown
in
Figure 11-12,
is
also suitable for placing into
EPROMS. Because this diagnostic loops back to itself, the ADS# LED should glow contin-
uously, just as it does when running the 4-byte program.
The program in Figure 11-12
is
based
on
the assumption that hardware exists to report
whether the data being read back from RAM
is
correct. This hardware consists of a writable
output latch
that
can display a byte value written to it. The byte value written
is
a function
of the
RAM
data comparison test.
If
the data
is.
correct, the byte value written
is
AAH
(10101010); if the data
is
incorrect, 55H (01010101)
is
written.
This diagnostic program
is
not comprehensive, but it does exercise EPROM, RAM, and an
output latch to verify that the basic hardware works.
The program
is
short (45 bytes) to be easily understood. Because it
is
short and because it
loops continuously, a logic analyzer or even an oscilloscope can be used to observe system
activity.
This program can be written
in
ASM86 assembly language. Because the primary purpose of
this program
is
to exercise the system hardware quickly, the 80386
is
not tested extensively,
and Protected Mode
is
not enabled.
The diagnostic software verifies the ability of the system to perform bus cycles. The 80386
fetches code from the EPROMs, implying
that
EPROM read cycles function correctly.
Instructions
in
the program explicitly generate bus cycles to write and read RAM. The data
value read back from
RAM
is
checked for correctness, then a byte (AAH if the data
is
correct, 55H if it
is
not)
is
output to the 8-bit output latch. The program then loops back to
its beginning and starts over.
After the source code
is
assembled, the resulting object code should be as shown
in
Figure 11-l3.
11.5.6 Debugging Hints
The debugging approach described
in
this section
is
incremental; it lets the programmer
debug the system piece by piece.
If
even the simple 4-byte program does not run, a logic
analyzer can be used to determine where the problem
is.
At
the very least, the 80386 should
be initiating a code fetch cycle to EPROM.
11-14