bdfs1m0k | Structured Programming Macros |
Programming conventions in the TPF and ALCS environments allow the following assumptions when operands in an expression are evaluated:
These assumptions allow you to use condensed forms of certain conditional expressions.
You can omit the operation code when the context of a test is not ambiguous.
Table 3 shows examples of condensed conditional expressions and the
Cxx instruction that is generated for each one.
Table 3. Instructions Generated for Condensed Forms of Compare
Conditional Expression | Generates | Remarks |
---|---|---|
#IF R14,EQ,R15 | CR | |
#IF R14,GE,EBW000 | C | No slash (/) defaults to a 4-byte comparison. |
#IF R14,LT,10(R15) | C | |
#IF R14,LE,=H'123' | CH | |
#IF R14,GT,H/24(R15) | CH | The H/ forces a CH. |
#IF EBW000,NE,FLD | CLC | |
#IF EBW000,LT,5 | CLI | |
#IF EBW000,GT,C'D' | CLI | |
#IF EBW000,NL,#CAR | CLI | |
#IF EBW000,L,I/FLAG | CLI | The I/ forces a CLI. |
For a TM instruction, you can omit the operation code (TM) if the second
operand begins with the characters BIT. The second operand provides a
symbolic name for the bits to be tested, as shown in the examples in Table 4.
Table 4. Instructions Generated for Condensed Forms of TM
Conditional Expression | TM Mask | Remarks |
---|---|---|
#IF EBW000,BIT3,OFF | X'10' | Operand BITn tests bit n. |
#IF EBW000,BITS4-6,MIXED | X'0E' | Operand BITSn-m tests bits n through m. |
#IF EBW000,BITS1/3/5/7,ON | X'55' | Operand BITSp/q/r/s tests bits p, q, r, and s. |
You can omit the operation code and the second operand if the first and
second operands of an LTR or OC instruction are the same.
Table 5. Instructions Generated for Condensed Forms of LTR and OC
Conditional Expression | Generates |
---|---|
#IF R14,NONZERO | LTR R14,R14 |
#IF FLD(4),ZERO | OC FLD(4),FLD |
If the operand or condition code mnemonic (or both) are repeated in a test, you can omit the second operand or condition code mnemonic (or both).
#IF EBW000,GT,1,AND,EBW000,LT,5
can be coded as:
#IF EBW000,GT,1,AND,LT,5
EBW000 is implied as the operand for the AND test.
#IF EBW000,EQ,5,OR,EBW000,EQ,6
can be coded as:
#IF EBW000,EQ,5,OR,6
EBW000 and EQ are implied for the OR test.
#IF R14,GE,R15,AND,LE,EBW000,AND,NE,=H'123'
generates the following tests:
#IF R14,GE,R15,AND,LE,EBW000,AND,NE,=H'123' #IF R14,GE,R15,AND,LE,EBW000,AND,NE,=H'123' #IF R14,GE,R15,AND,LE,EBW000,AND,NE,=H'123'