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

SETA Instruction | X2A Name Operation Operand &OP1 SETA -344 &OP2 SETA 4 &VAR SETA (&OP1 SRL &OP2) | Format: Function-invocation | Operands: Character | Output: X2A('hexstring') converts a character string argument containing | hexadecimal digits to an arithmetic value. | If the character string contains fewer than 8 characters, it is padded | internally on the left with '' characters. | Error conditions are detected if the argument contains invalid characters, | or if the argument length exceeds 8 characters, generating the message | ASMA214E. | Null argument strings return zero. | The result of the X2A function is the same as | &value SETA X'hexstring' | except that null strings are allowed by X2A but not by SETA. | Examples | X2A('11') has value 257 | X2A('C1') has value 193 | X2A('') has value | X2A('FFFFFFF') has value -16 XOR Format: Logical-expression Operands: Arithmetic Output: Each bit position in the result is set to 1 if the corresponding bit positions in the two operands are unlike, otherwise the result bit is set to 0. Example After the following statements &VAR contains the arithmetic value +8. Name Operation Operand &OP1 SETA 1 &OP2 SETA 2 &VAR SETA (&OP1 XOR &OP2) Rules for Coding Arithmetic Expressions: The following is a summary of coding rules for arithmetic expressions: 1. Unary (operating on one value) operators and binary (operating on two values) operators are allowed in arithmetic expressions. 2. An arithmetic expression can have one or more unary operators preceding any term in the expression or at the beginning of the expression. The unary operators are + (positive) and − (negative). 3. The binary operators that can be used to combine the terms of an expression are + (addition), − (subtraction), (multiplication), and / (division). 4. An arithmetic expression must not begin with a binary operator, and it must not contain two binary operators in succession. 358 HLASM V1R5 Language Reference

SETA Instruction 5. An arithmetic-valued function is a term. 6. An arithmetic expression must not contain two terms in succession. 7. An arithmetic expression must not contain a decimal point. For example, 123.456 is not a valid arithmetic term, but 123 is. 8. An arithmetic expression must not contain spaces between an operator and a term, nor between two successive operators except for built-in functions using the “logical-expression format” described at “Logical (SETB) Expressions” on page 365. 9. Ordinary symbols specified in arithmetic expressions must be defined before the arithmetic expression is encountered, and must have an absolute value. 10. An arithmetic expression can contain up to 24 unary and binary operators, and is limited to 255 levels of parentheses. The parentheses required for sublist notation, substring notation, and subscript notation count toward this limit. An arithmetic expression must not contain two terms in succession; however, any term may be preceded by up to 24 unary operators. +&A−&B is a valid operand for a SETA instruction. The expression &FIELD+− is invalid because it has no final term. Evaluation of Arithmetic Expressions: The assembler evaluates arithmetic expressions during conditional assembly processing as follows: 1. It evaluates each arithmetic term. 2. It carries out arithmetic operations from left to right. However, a. It carries out unary operations before binary operations, and b. It carries out the binary operations of multiplication and division before the binary operations of addition and subtraction. 3. In division, it gives an integer result; any fractional portion is dropped. Division by zero gives a 0 result. 4. In parenthesized arithmetic expressions, the assembler evaluates the innermost expressions first, and then considers them as arithmetic terms in the next outer level of expressions. It continues this process until the outermost expression is evaluated. 5. The computed result, including intermediate values, must lie in the range −2 31 | through +2 31 −1. (Note that if the value −2 31 is substituted in a SETC | expression, its magnitude, 2147483648, is invalid if subsequently substituted in | a SETA expression.) SETC Variables in Arithmetic Expressions: The assembler permits a SETC variable to be used as a term in an arithmetic expression if the character string value of the variable is a self-defining term. The value represented by the string is assigned to the arithmetic term. A null string is treated as zero. Examples: LCLC &C(5) &C(1) SETC 'B''11''' &C(2) SETC 'C''A''' &C(3) SETC '23' &A SETA &C(1)+&C(2)–&C(3) Chapter 9. How to Write Conditional Assembly Instructions 359

SETA Instruction<br />

5. An arithmetic-valued function is a term.<br />

6. An arithmetic expression must not contain two terms in succession.<br />

7. An arithmetic expression must not contain a decimal point. For example,<br />

123.456 is not a valid arithmetic term, but 123 is.<br />

8. An arithmetic expression must not contain spaces between an operator and a<br />

term, nor between two successive operators except for built-in functions using<br />

the “logical-expression format” described at “Logical (SETB) Expressions” on<br />

page 365.<br />

9. Ordinary symbols specified in arithmetic expressions must be defined before<br />

the arithmetic expression is encountered, and must have an absolute value.<br />

10. An arithmetic expression can contain up to 24 unary and binary operators, and<br />

is limited to 255 levels of parentheses. The parentheses required for sublist<br />

notation, substring notation, and subscript notation count toward this limit.<br />

An arithmetic expression must not contain two terms in succession; however,<br />

any term may be preceded by up to 24 unary operators. +&A−&B is a valid<br />

operand for a SETA instruction. The expression &FIELD+− is invalid because it<br />

has no final term.<br />

Evaluation of Arithmetic Expressions: The assembler evaluates arithmetic<br />

expressions during conditional assembly processing as follows:<br />

1. It evaluates each arithmetic term.<br />

2. It carries out arithmetic operations from left to right. However,<br />

a. It carries out unary operations before binary operations, and<br />

b. It carries out the binary operations of multiplication and division before the<br />

binary operations of addition and subtraction.<br />

3. In division, it gives an integer result; any fractional portion is dropped. Division<br />

by zero gives a 0 result.<br />

4. In parenthesized arithmetic expressions, the assembler evaluates the innermost<br />

expressions first, and then considers them as arithmetic terms in the next outer<br />

level of expressions. It continues this process until the outermost expression is<br />

evaluated.<br />

5. The computed result, including intermediate values, must lie in the range −2 31<br />

| through +2 31 −1. (Note that if the value −2 31 is substituted in a SETC<br />

| expression, its magnitude, 2147483648, is invalid if subsequently substituted in<br />

| a SETA expression.)<br />

SETC Variables in Arithmetic Expressions: The assembler permits a SETC<br />

variable to be used as a term in an arithmetic expression if the character string<br />

value of the variable is a self-defining term. The value represented by the string is<br />

assigned to the arithmetic term. A null string is treated as zero.<br />

Examples:<br />

LCLC<br />

&C(5)<br />

&C(1) SETC 'B''11'''<br />

&C(2) SETC 'C''A'''<br />

&C(3) SETC '23'<br />

&A SETA &C(1)+&C(2)–&C(3)<br />

Chapter 9. How to Write Conditional Assembly Instructions 359

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

Saved successfully!

Ooh no, something went wrong!