Call Instruction; Do Until Loops - Analog Devices adsp-2100 Manual

Adsp-2100 family programmable single-chip microprocessors
Table of Contents

Advertisement

3.3.2

CALL Instruction

The CALL instruction executes in a similar fashion as the JUMP
instruction. The address of the subroutine is embedded in the CALL
instruction word and, once extracted from the instruction register, is fed
back the PC for the next cycle. In addition, the current value of the
program counter is incremented and pushed onto the PC stack. Upon
return from the subroutine, the PC stack is popped into the program
counter and execution resumes with the instruction following the CALL.
3.3.3

DO UNTIL Loops

The most common form of a DO UNTIL loop uses the counter register
(CNTR) as a loop iteration counter. When the counter is used to control
loop iteration, CE (counter expired) must be used as the DO UNTIL
termination condition. A simple example of this type of loop is as follows:
L0=10;
I0=^data_buffer;
M0=1;
CNTR=10;
DO loop UNTIL CE; {repeat loop until counter expired}
DM(I0,M0)=0;
...any instruction...
loop: ...any instruction...
When the
CNTR=10;
instruction is executed, prior to entering the loop, the counter is loaded via
the DMD bus. Any previously existing count would be simultaneously
pushed onto the count stack; this push operation is omitted if the counter
is empty. The
DO loop UNTIL CE;
instruction itself only sets up the conditions for looping; no other
operation occurs while the instruction is executed. This occurs only once,
at the beginning of the first time through the loop.
Program Control
{setup circular buffer length register}
{load pointer with first address of}
{circular buffer}
{setup modify register for pointer increment}
{load counter with circular buffer length}
{initialize/clear circular buffer}
3
3 – 9

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents