TAL Reference Manual

Statements
TAL Reference Manual526371-001
12-18
Examples of CODE Statements
FOR Statements and CODE Statements
If you use a CODE statement to make a conditional jump from an optimized FOR loop,
the compiler emits warning 78 (TAL cannot set the RP value for the forward branch).
To set the RP value for the jump condition, use a CODE (STRP ...) statement or an RP
directive. The compiler can generate correct code only for the nonjump condition.
Examples of CODE Statements
1. This example shows instruction codes that turn off traps:
CODE (RDE; ANRI %577; SETE);
2. These examples show the six instruction forms:
CODE (ZERD; IADD); !Form 1
CODE (LADR a; STOR .b); !Form 2
CODE (LDI 21; ADDI -4); !Form 3
CODE (STAR 7; STRP 2); !Form 4
CODE (LDX a, 7; LDB stg, x); !Form 5
CODE (LDXI -15 ,5); !Form 6
3. This example scans from a code-relative address to the test character (which is a
0), and then saves the next address:
STRING .ptr;
!Some code here
STACK @ptr, 0;
CODE (SBU %040);
STORE @ptr;
4. This example decrements the compiler’s internal S-register counter by 2:
CODE (DECS 2);
5. This example decrements the run-time S-register by 2:
CODE (ADDS -2);
6. Each of these CON pseudocodes emits data in the next instruction location:
CODE (CON %125); !Emit %125
CODE (CON "the con pseudo operator code");
!Emit 14 words of constants
CODE (CON @labelid); !Emit a one-word algebraic signed
! difference between the address
!of LABELID and the current content
!of the program counter;
!that is, of @LABELID - @P.