![background image](http://html.mh-extra.com/html/motorola/freescale-semiconductor-dsp56000/freescale-semiconductor-dsp56000_user-manual_246570071.webp)
MOTOROLA
DSP56000/DSP56001 USER’S MANUAL
A - 71
Operation:
Assembler Syntax:
SSL(LF)
➞
SR;SP – 1
➞
SP
ENDDO
SSH
➞
LA; SSL
➞
LC;SP –1
➞
SP
Description: Terminate the current hardware DO loop before the current loop counter (LC)
equals one. If the value of the current DO loop counter (LC) is needed, it must be read
before the execution of the ENDDO instruction. Initially, the loop flag (LF) is restored from
the system stack and the remaining portion of the status register (SR) and the program
counter (PC) are purged from the system stack. The loop address (LA) and the loop
counter (LC) registers are then restored from the system stack.
Restrictions: Due to pipelining and the fact that the ENDDO instruction accesses the pro-
gram controller registers, the ENDDO instruction must not be immediately preceded by
any of the following instructions:
Immediately before ENDDO
MOVEC to LA, LC, SR, SSH, SSL, or SP
MOVEM to LA, LC, SR, SSH, SSL, or SP
MOVEP to LA, LC, SR, SSH, SSL, or SP
MOVEC from SSH
MOVEM from SSH
MOVEP from SSH
ORI MR
ANDI MR
Also, the ENDDO instruction cannot be the last (LA) instruction in a DO loop.
Example:
:
DO Y0,NEXT
;exec. loop ending at NEXT (Y0) times
:
MOVEC LC,A
;get current value of loop counter (LC)
CMP Y1,A
;compare loop counter with value in Y1
JNE ONWARD
;go to ONWARD if LC not equal to Y1
ENDDO
;LC equal to Y1, restore all DO registers
JMP NEXT
;go to NEXT
ONWARD
:
;LC not equal to Y1, continue DO loop
:
;(last instruction in DO loop)
NEXT MOVE #$123456,X1
;(first instruction AFTER DO loop)
ENDDO
End Current DO Loop
ENDDO
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
.
..