Hardware Reference
In-Depth Information
PP PC
SP
X
Y
D 5 A:B
CCR 5 SXHI
NZVC
38 1507
14FE
1000
1002
1E:00
1001
0000
xx: 1507
861E
LDAA
#$1E
.
The first command in this example sets the program counter to $1500 so that the user knows
where the program execution starts. This command is normally needed when tracing a program.
call [ * Address + ]
The call command is used to execute a subroutine and returns to the D-Bug12 monitor program
when the final rts instruction of the subroutine is executed. All CPU registers contain the values at
the time the final rts instruction was executed, with the exception of the program counter. The pro-
gram counter contains the starting address of the subroutine. If a subroutine address is not supplied
on the command line, the current value of the program counter is used as the starting address.
No user breakpoints are placed in memory before execution is transferred to the subroutine.
If the called subroutine modifies the value of the stack pointer during its execution, it must re-
store the stack pointer's original value before executing the rts instruction. This restriction is
required because a return address is placed on the user's stack that returns to D-Bug12 when the
final rts of the subroutine is executed. Obviously, any subroutine must obey this restriction in
order to execute properly.
Example 3.14
+ call 1600
Subroutine Call Returned
pp PC
SP
X
Y
D 5 A:B
CCR 5 SXHI
NZVC
38 1600
0A00
0032
0900
00:31
1001
0000
xx: 1600
FC1000
LDD
$1000
.
This command is useful for testing a subroutine without writing a testing program.
3.5.4 Entering an Assembly Program
When a program is first created, one needs to open a new file to hold it. To do that, one
presses the File menu from the MiniIDE window and selects New, as shown in Figure 3.11.
After one selects the New command from the menu, an empty screen will appear allowing the
user to enter a new program. The user can now start to enter a new program.
The editing window (upper half of the IDE window) may be too small and should be ad-
justed. After adjusting the window size, the user enters the program that converts a hex number
into BCD digits as in Example 2.13. This program performs the repeated divide-by-10 operation
to the given number and adds hex number $30 to each remainder to convert to its correspond-
ing ASCII code. The result is shown in Figure 3.12.
3.5.5 Assembling the Program
To assemble an assembly program, press the Build menu and select Build eg02_13.asm, as
shown in Figure 3.13. If the program is assembled successfully, the status window will display
the corresponding message, as shown in Figure 3.14.
 
Search WWH ::




Custom Search