HLASM Language Reference

HLASM Language Reference HLASM Language Reference

faculty.cs.niu.edu
from faculty.cs.niu.edu More from this publisher
22.02.2015 Views

SETB Instruction Any expression that may be used in the operand field of a SETA instruction may be used to refer to an operand in an operand sublist. Sublists are described in “Sublists in Operands” on page 304. The following macro definition adds the last operand in an operand sublist to the first operand in an operand sublist and stores the result at the first operand. A sample macro instruction and generated statements follow the macro definition. MACRO ADDX &NUMBER,® Statement 1 LCLA &LAST &LAST SETA N'&NUMBER Statement 2 L ®,&NUMBER(1) A ®,&NUMBER(&LAST) Statement 3 ST ®,&NUMBER(1) MEND ------------------------------------------------------------------- ADDX (A,B,C,D,E),3 Statement 4 ------------------------------------------------------------------- + L 3,A + A 3,E + ST 3,A &NUMBER is the first symbolic parameter in the operand field of the prototype statement (statement 1). The corresponding characters (A,B,C,D,E) of the macro instruction (statement 4) are a sublist. Statement 2 assigns to &LAST the arithmetic value +5, which is equal to the number of operands in the sublist. Therefore, in statement 3, &NUMBER(&LAST) is replaced by the fifth operand of the sublist. SETB Instruction Use the SETB instruction to assign a bit value to a SETB symbol. You can assign the bit values, 0 or 1, to a SETB symbol directly and use it as a switch. If you specify a logical (Boolean) expression in the operand field, the assembler evaluates this expression to determine whether it is true or false, and then assigns the value 1 or 0, respectively, to the SETB symbol. You can use this computed value in condition tests or for substitution. ►►──variable_symbol──SETB──binary_value────────────────────────────►◄ variable_symbol is a variable symbol. A global variable symbol in the name field must have been previously declared as a SETB symbol in a GBLB instruction. Local SETB symbols need not be declared in a LCLB instruction. The assembler considers any undeclared variable symbol found in the name field of a SETB instruction as a local SET symbol. The variable symbol is assigned a type attribute value of N. binary_value is a binary bit value that may be specified as: A binary digit (0 or 1) 362 HLASM V1R5 Language Reference

SETB Instruction A binary value enclosed in parentheses An arithmetic value enclosed in parentheses is allowed. This value can be represented by: – An unsigned, self-defining term – A SETA symbol – A previously defined ordinary symbol with an absolute value – An attribute reference other than the type attribute reference. If the value is 0, the assembler assigns a value of 0 to the symbol in the name field. If the value is not 0, the assembler assigns a value of 1. A logical expression enclosed in parentheses A logical expression is evaluated to determine if it is true or false; the SETB symbol in the name field is then assigned the binary value 1 or 0, corresponding to true or false, respectively. The assembler assigns the explicitly specified binary value (0 or 1) or the computed logical value (0 or 1) to the SETB symbol in the name field. Rules for Coding Logical Expressions: The following is a summary of coding rules for logical expressions: A logical expression must not contain two logical terms in succession. A logical expression can contain two logical operators in succession; however, the only allowed combinations are OR NOT, XOR NOT and AND NOT. The two operators must be separated from each other by one or more spaces. Any logical term, relation, or inner logical expression can be optionally enclosed in parentheses. The relational and logical operators must be immediately preceded and followed by at least one space, except when written (NOT bexpr). A logical expression can begin with the logical unary operator NOT. A logical expression can contain up to 18 logical operators. The relational and other operators used by the arithmetic and character expressions in relations do not count toward this total. Up to 255 levels of nested parentheses are allowed. Absolute ordinary symbols specified in logical expressions must be defined before the logical expression is encountered. The assembler determines the type of a logical relation by the first comparand. If the first comparand is a character expression that begins with a single quotation mark, then the logical relation is a character relation, otherwise the assembler treats it as an arithmetic relation. Chapter 9. How to Write Conditional Assembly Instructions 363

SETB Instruction<br />

A binary value enclosed in parentheses<br />

An arithmetic value enclosed in parentheses is allowed. This value can be<br />

represented by:<br />

– An unsigned, self-defining term<br />

– A SETA symbol<br />

– A previously defined ordinary symbol with an absolute value<br />

– An attribute reference other than the type attribute reference.<br />

If the value is 0, the assembler assigns a value of 0 to the symbol in the<br />

name field. If the value is not 0, the assembler assigns a value of 1.<br />

A logical expression enclosed in parentheses<br />

A logical expression is evaluated to determine if it is true or false; the SETB<br />

symbol in the name field is then assigned the binary value 1 or 0,<br />

corresponding to true or false, respectively. The assembler assigns the<br />

explicitly specified binary value (0 or 1) or the computed logical value (0 or<br />

1) to the SETB symbol in the name field.<br />

Rules for Coding Logical Expressions: The following is a summary of coding<br />

rules for logical expressions:<br />

A logical expression must not contain two logical terms in succession.<br />

A logical expression can contain two logical operators in succession; however,<br />

the only allowed combinations are OR NOT, XOR NOT and AND NOT. The<br />

two operators must be separated from each other by one or more spaces.<br />

Any logical term, relation, or inner logical expression can be optionally enclosed<br />

in parentheses.<br />

The relational and logical operators must be immediately preceded and<br />

followed by at least one space, except when written (NOT bexpr).<br />

A logical expression can begin with the logical unary operator NOT.<br />

A logical expression can contain up to 18 logical operators. The relational and<br />

other operators used by the arithmetic and character expressions in relations<br />

do not count toward this total.<br />

Up to 255 levels of nested parentheses are allowed.<br />

Absolute ordinary symbols specified in logical expressions must be defined<br />

before the logical expression is encountered.<br />

The assembler determines the type of a logical relation by the first comparand.<br />

If the first comparand is a character expression that begins with a single<br />

quotation mark, then the logical relation is a character relation, otherwise the<br />

assembler treats it as an arithmetic relation.<br />

Chapter 9. How to Write Conditional Assembly Instructions 363

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!