
3-6
Optimizing DSP56300/DSP56600 Applications
MOTOROLA
Program Control
The Hardware Stack
;example of loop and subroutine nesting.
;interrupt definitions: fast interrupt from IRQA_
org
p:I_IRQA
bset
#5,x:(r0)
nop
...
;program area
;after jsr execution, sp == 1,
;execution continues at _SUB1
jsr
_SUB1
...
...
...
_SUB1
do
#6,_LOOP1
;after instruction, sp == 3
...
do
forever,_LOOP2 ;after instruction, sp == 5
btst
#0,x:(r0)
brkcs
;if condition true, resume at
;_LOOP2,and sp == 3.
move
a0,x:(r1)+
;<---- irqA occurs here.
move
a1,x:(r1)+
move
a2,x:(r1)+
_LOOP2
;after loop is braked, sp == 3
nop
...
nop
_LOOP1
nop
;after normal loop
;termination, sp == 1
rts
;after execution, SP == 0,
;execution returns to main
Direct user access with the MOVEC instruction is possible to
SSL,SSH. Note that MOVEC to/from SSH implicitly increments or
decrements SP, while the same instruction on SSL has no effect on
SP. A manual “pop” operation will usually have the format:
movec
ssl,<destination 1>
movec
ssh,<destination 2>;implicit sp decrement
Explicit access to the stack registers is not recommended for the
general user. Such accesses have severe restrictions on them (see
Appendix B
in the
DSP56300
and
DSP56600 Family Manuals
). A
user who wishes to manually access the stack must take into
account pipeline effects that are usually transparent, and that long
interrupts may enter.