Hardware Reference
In-Depth Information
Figure 3.17 Screen after downloading the program eg2_13.s19 onto the demo board
The second line of the terminal window that contains the statement User Bkpt Encountered
is caused by the swi (software interrupt) instruction. The swi instruction caused the program
control to be returned to the D-Bug12 monitor. This instruction is often used as the last instruc-
tion of a program to be executed on a demo board with the D-Bug12 monitor. The last line of
the terminal window displays the contents of the memory locations $1010 to $101F. The first 5
bytes represent the ASCII codes of 1, 2, 3, 4, and 5. Therefore, the program executes correctly.
If the program does not work correctly, we can set breakpoints at locations we suspect or
we can even trace the execution of some instructions to find out the error. Suppose the execu-
tion result (we take out the first xgdx instruction) looks as follows:
+ md 1010
1010 30 30 35 33 - 35 2D 2D 2D - 2D 2D 2D 2D - 2D 2D 2D 2D 00535---------------
.
The first four digits were found to be incorrect. Since this program is short, we can trace
through it. One approach is the following:
Step 1
Trace through the first six instructions and check to see if the quotient (in index register X) and
the memory contents at $1014 are correct. The last seven lines of the terminal window are
PP PC
SP
X
Y
D 5 A:B
CCR 5 SXHI
NZVC
38 150F
3C00
04D2
1010
00:35
1001
0000
xx: 150F
CE000A
LDX
#$000A
. md 1010
1010 30 30 35 33 - 35 2D 2D 2D - 2D 2D 2D 2D - 2D 2D 2D 2D 00535---------------
.
 
Search WWH ::




Custom Search