15
15 – 81
PROGRAM FLOW
DO UNTIL
COND: condition
Syntax: DO <addr> [UNTIL term] ;
Permissible terms
EQ NE GT GE LT FOREVER
LE NEG POS AV NOT AV
AC NOT AC MV NOT MV CE
Example: DO loop_label UNTIL CE ; {CNTR is decremented
each pass through loop}
Description: DO UNTIL sets up looping circuitry for zero-overhead
looping. The program loop begins at the program instruction immediately
following the DO instruction, ends at the address designated in the
instruction and repeats execution until the specified termination condition is
met (if one is specified) or repeats in an infinite loop (if none is specified). The
termination condition is tested during execution of the last instruction in the
loop, the status having been generated upon completion of the previous
instruction. The address (<addr>) of the last instruction in the loop is stored
directly in the instruction word.
If CE is used for the termination condition, the processor’s counter (CNTR
register) is decremented once for each pass through the loop.
When the DO instruction is executed, the address of the last instruction is
pushed onto the loop stack along with the termination condition and the
current program counter value plus 1 is pushed onto the PC stack.
Any nesting of DO loops continues the process of pushing the loop and PC
stacks, up to the limit of the loop stack size (4 levels of loop nesting) or of the
PC stack size (16 levels for subroutines plus interrupts plus loops). With
either or both the loop or PC stacks full, a further attempt to perform the DO
instruction will set the appropriate stack overflow bit and will perform a no-
operation.
Status Generated:
ASTAT: Not affected.
SSTAT: 76543210
LSO LSE SSO SSE CSO CSE PSO PSE
*0 ––––*0
LSO Loop Stack Overflow: set if the loop stack overflows; otherwise not affected.
LSE Loop Stack Empty: always cleared (indicating loop stack not empty)
PSO PC Stack Overflow: set if the PC stack overflows; otherwise not affected.
PSE PC Stack Empty: always cleared (indicating PC stack not empty)
(instruction continues on next page)