Go to Triangle Digital Support Home Page TDS9092 TECHNICAL MANUAL
Programming
Control structures
Live website search
Enter key words
 

CONTROL STRUCTURES

These are abbreviated details from the section WORD LIST grouped here for convenience. The numbers n can be negative or positive 16-bit integers. There are similar control structures in assembler, see the section STRUCTURED CONTROL IN ASSEMBLER.

 

n2 n1 DO  .  LOOP

Loop n2-n1 times, maximum 32767 times but will always loop at least once. Index starts with n1 and increments at LOOP each time around

n2 n1 DO  .  n3 +LOOP

Similar but index increases by n3 each time giving a maximum number of loops of INT((n2-n1))/n3)

BEGIN  .   f UNTIL

Loops until f is true (non-zero)

BEGIN  .   AGAIN

Indefinite loop used only as top level of hierarchy of software, such as the word entered at power-up or the word executed by another task

BEGIN  .  f WHILE  .  REPEAT

Most general of loops. Circulates around BEGIN and REPEAT until f is true, when execution jumps from WHILE to after REPEAT

n IF  .  ELSE  .  THEN

Executes code from IF to ELSE if n is true, otherwise executes the code from ELSE to THEN

RECURSE

Execute the current word definition, occasionally preferable to loops

CASE w OF  .  ENDOF

Executes one of many possible sections of

     x OF  .  ENDOF

code. nx represents possible value(s)

     y OF  .  ENDOF

of n. cond is any conditional such as

     ... (more if needed) ...

>  = or < .  See example in WORD LIST

     R nx cond IFCASE . ENDOF

 

     ... (default if none of above) ...

 

ENDCASE

 
Go to Triangle Digital Support Home Page Go to top   Next page