22.02.2015 Views

HLASM Language Reference

HLASM Language Reference

HLASM Language Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

SETB Instruction<br />

Logical (SETB) Expressions<br />

You can use a logical expression to assign a binary value to a SETB symbol. You<br />

can also use a logical expression to represent the condition test in an AIF<br />

instruction. This use lets you code a logical expression whose value (0 or 1) varies<br />

according to the values substituted into the expression and thereby determine<br />

whether or not a branch is to be taken.<br />

Figure 101 on page 364 defines a logical expression.<br />

It is important to note that logical expressions contain unquoted spaces that do not<br />

terminate the operand field. This is called “logical-expression format,” and such<br />

expressions are always enclosed in parentheses.<br />

A logical expression can consist of a logical expression and a logical term<br />

separated by a logical operator delimited by spaces. The logical operators are:<br />

AND<br />

Format: Logical-expression<br />

Operands: Binary<br />

Output: (aexpr1 AND aexpr2) has value 1, if each logical expression<br />

evaluates to 1, otherwise the value is 0.<br />

Example<br />

After the following statements &VAR contains the arithmetic value .<br />

Name Operation Operand<br />

&OP1 SETB 1<br />

&OP2 SETB <br />

&VAR SETB (&OP1 AND &OP2)<br />

AND NOT<br />

| ISBIN<br />

Format: Logical-expression<br />

Operands: Binary<br />

Output: The value of the second logical term is inverted, and the expression<br />

is evaluated as though the AND operator was specified.<br />

Example<br />

(1 AND NOT ) is equivalent to (1 AND 1).<br />

| Format: Function-invocation<br />

| Operands: Character<br />

| Output: ISBIN('cexpr') determines the validity of cexpr, a string of 1 to 32<br />

| characters, as the nominal value of a binary self-defining term usable in a<br />

| SETA expression. If valid, ISBIN returns 1; otherwise, it returns zero. The<br />

| argument string may not be null.<br />

| Example<br />

| ISBIN('111') returns 1<br />

| ISBIN('11111111111111111') returns (excess digits)<br />

| ISBIN('12121') returns (non-binary digits)<br />

| ISBIN('') indicates an error condition<br />

Chapter 9. How to Write Conditional Assembly Instructions 365

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

Saved successfully!

Ooh no, something went wrong!