User’s Manual
M68HC12A4EVB Evaluation Board — Rev. 1
52
Operation
MOTOROLA
Operation
CALL
Call Subroutine
Syntax:
CALL [<
Address>]
Where:
<
Address>
is an optional 16-bit hexadecimal number.
The CALL command is used to execute a subroutine and return to the D-Bug12
monitor program when the final RTS of the subroutine is executed. When
control is returned to D–Bug12, the CPU register contents are displayed. All
CPU registers contain the values at the time the final RTS instruction was
executed, with the exception of the program counter (PC). The PC contains the
starting address of the subroutine. If a subroutine address is not supplied on the
command line, the current value of the PC is used as the starting address.
NOTE:
No user breakpoints are placed in memory before execution is transferred to
user code.
Restrictions:
If the called subroutine modifies the value of the stack pointer during its
execution, it must restore the stack pointer’s original value before executing the
final RTS of the called subroutine. 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 to execute properly.
Example:
>CALL 820
Subroutine Call Returned
PC
SP
X
Y
D = A:B
CCR = SXHI
NZVC
0820
0A00
057C
0000
0F:F9
1001
0000
>
F
re
e
sc
a
le
S
e
m
ic
o
n
d
u
c
to
r,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
c
.
..
AR
CH
IVE
D B
Y F
RE
ES
CA
LE
SE
MI
CO
ND
UC
TO
R,
IN
C.