HLASM Language Reference
HLASM Language Reference HLASM Language Reference
Terms, Literals, and Expressions ┌───────────┐ │ │ │Absolute │ │Expression │ │ │ └─────┬─────┘ │ ▼ Can be any of ├─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ │ │ │ │ │ │ │ │ │ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐ │ ││ ││ ││ ││ ││ ││ ││ ││ │ │ Rel. Exp. │ │ Absolute │ │ Abs. Exp. │ │ Abs. Exp. │ │ Abs. Exp. │ │ Abs. Exp. │ │(Abs. Exp.)│ │ +Abs. Exp.│ │ –Abs. Exp.│ │ – │ │ Term │ │ + │ │ – │ │ │ │ / │ │ │ │ ▲ │ │ ▲ │ │ Rel. Exp. │ │ │ │ Abs. Exp. │ │ Abs. Exp. │ │ Abs. Exp. │ │ Abs. Exp. │ │ │ │ │ │ │ │ │ └─────┬─────┘ └─────┬─────┘ └───────────┘ └───────────┘ └───────────┘ └───────────┘ └───────────┘ └─┼─────────┘ └─┼─────────┘ │ │ └──────┬──────┘ │ ▼ Can be any of │ │ ├─────────────┬─────────────┬─────────────┬─────────────┐ unary operators │ │ │ │ │ │ │ ▼ ▼ ▼ ▼ ▼ │ ┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐ │ │Absolute │ │ Self- │ │ Symbol │ │ Symbol │ │ Symbol │ │ │Valued │ │ Defining │ │ Length │ │ Integer │ │ Scale │ │ │Ordinary │ │ Term │ │ Attribute │ │ Attribute │ │ Attribute │ │ │Symbol │ │ │ │ │ │ │ │ │ │ └───────────┘ └───────────┘ └───────────┘ └───────────┘ └───────────┘ │ ▼ ┌─────┴─────┐ │ │ │Relocatable│ │Expression │ │ │ └─────┬─────┘ │ ▼ Can be any of ├─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ │ │ │ │ │ │ ▼ ▼ ▼ ▼ ▼ ▼ ┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐ Operators Allowed │ ││ ││ ││ ││ ││ │ │Relocatable│ │ Rel. Exp. │ │ Rel. Exp. │ │(Rel. Exp.)│ │+Rel. Exp. │ │–Rel. Exp. │ Unary: + Positive │Term │ │ + │ │ – │ │ │ │▲ │ │▲ │ – Negative │ │ │ Abs. Exp. │ │ Abs. Exp. │ │ │ ││ │ ││ │ └─────┬─────┘ └───────────┘ └───────────┘ └───────────┘ └┼──────────┘ └┼──────────┘ Binary: + Addition │ │ │ – Subtraction │ └──────┬──────┘ Multiplication ▼ Can be any of │ / Division ├─────────────┐ unary operators │ │ ▼ ▼ ┌─────┴─────┐ ┌─────┴─────┐ │Relocatable│ │ Location │ Rel. Exp. = Relocatable Expression │Valued │ │ Counter │ Abs. Exp. = Absolute Expression │Ordinary │ │ Reference │ │Symbol │ │ │ └───────────┘ └───────────┘ Figure 17. Definitions of Absolute and Relocatable Expressions Evaluation of Expressions A single-term expression, like 29 or BETA, has the value of the term involved. The assembler reduces a multiterm expression, like 251+A/B or BETA+1, to a single value, as follows: 1. It evaluates each term. 2. It does arithmetic operations from left to right. However: a. It does unary operations before binary operations. b. It does 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 0. 46 HLASM V1R5 Language Reference
Terms, Literals, and Expressions 4. In parenthesized expressions, the assembler evaluates the innermost expressions first and then considers them as terms in the next outer level of expressions. It continues this process until the outermost expression is evaluated. 5. A term or expression's intermediate value and computed result must lie in the range of −2 31 through +2 31 −1. The assembler evaluates paired relocatable terms at each level of expression nesting. Absolute and Relocatable Expressions An expression is absolute if its value is unaffected by program relocation. An expression is relocatable if its value depends upon program relocation. The two types of expressions, absolute and relocatable, take on these characteristics from the term or terms composing them. A description of the factors that determine whether an expression is absolute or relocatable follows. Absolute Expression: An absolute expression is one whose value remains the same after program relocation. The value of an absolute expression is called an absolute value. An expression is absolute, and is reduced to a single absolute value if the expression: 1. Comprises a symbol with an absolute value, a self-defining term, or a symbol length attribute reference, or any arithmetic combination of absolute terms. 2. Contains relocatable terms alone or in combination with absolute terms, and if all these relocatable terms are paired. Relocatability Attribute: The relocatability attribute describes the attribute of a relocatable term. If a pair of terms are defined in the same control section, they are characterized as having the same relocatability attribute. | If the terms are defined in different control sections, or have different relocatability | attributes, the expression is said to be “complex relocatable.” | The relocatability attribute is the same as the ESDID for external symbols, and the | “Relocation ID” in the listing. Paired Relocatable Terms: An expression can be absolute even though it contains relocatable terms, provided that all the relocatable terms are paired. The pairing of relocatable terms cancels the effect of relocation. The assembler reduces paired terms to single absolute terms in the intermediate stages of evaluation. The assembler considers relocatable terms as paired under the following conditions: The paired terms must have the same relocatability attribute. The paired terms must have opposite signs after all unary operators are resolved. In an expression, the paired terms do not have to be contiguous (that is, other terms can come between the paired terms). The value represented by the paired terms is absolute. Chapter 2. Coding and Structure 47
- Page 16 and 17: | The Internet. You can access IBM
- Page 18 and 19: ▌C▐ The item referred to by ▌
- Page 20 and 21: Miscellany The ASCII translation t
- Page 22 and 23: Part 1. Assembler Language—Struct
- Page 24 and 25: Language Compatibility Language Com
- Page 26 and 27: Assembler Program Assembler Program
- Page 28 and 29: Relationship of Assembler to Operat
- Page 30 and 31: Coding Made Easier Linkage between
- Page 32 and 33: Character Set Compatibility with Ea
- Page 34 and 35: Assembler Language Coding Conventio
- Page 36 and 37: Assembler Language Coding Conventio
- Page 38 and 39: Assembler Language Coding Conventio
- Page 40 and 41: Assembler Language Coding Conventio
- Page 42 and 43: Assembler Language Structure Condit
- Page 44 and 45: Assembler Language Structure Machin
- Page 46 and 47: Assembler Language Structure Condit
- Page 48 and 49: Terms, Literals, and Expressions Te
- Page 50 and 51: Terms, Literals, and Expressions -
- Page 52 and 53: Terms, Literals, and Expressions As
- Page 54 and 55: Terms, Literals, and Expressions Se
- Page 56 and 57: Terms, Literals, and Expressions Fo
- Page 58 and 59: Terms, Literals, and Expressions I
- Page 60 and 61: Terms, Literals, and Expressions Th
- Page 62 and 63: Terms, Literals, and Expressions 1.
- Page 64 and 65: Terms, Literals, and Expressions
- Page 68 and 69: Terms, Literals, and Expressions Th
- Page 70 and 71: | Chapter 3. Program Structures and
- Page 72 and 73: Source Module A source module is co
- Page 74 and 75: The CSECT instruction can be used a
- Page 76 and 77: | in linker control statements for
- Page 78 and 79: This is not only convenient, but it
- Page 80 and 81: | SECT_A CSECT , Define section SEC
- Page 82 and 83: | For executable sections, the loca
- Page 84 and 85: Addressing | The System/390® and z
- Page 86 and 87: Addressing | Parts must always be r
- Page 88 and 89: Addressing Literal Pools ALPHA LR 3
- Page 90 and 91: Addressing If the symbol is the nam
- Page 92 and 93: Addressing External Symbol Dictiona
- Page 94 and 95: Addressing 74 HLASM V1R5 Language R
- Page 96 and 97: Part 2. Machine and Assembler Instr
- Page 98 and 99: General Instructions Chapter 4. Mac
- Page 100 and 101: Input/Output Operations For further
- Page 102 and 103: Branching with Extended Mnemonic Co
- Page 104 and 105: Symbolic Operation Codes variations
- Page 106 and 107: Operand Entries Registers You can s
- Page 108 and 109: Operand Entries “Program Structur
- Page 110 and 111: Operand Entries Format │ Coded or
- Page 112 and 113: Examples of Coded Machine Instructi
- Page 114 and 115: Examples of Coded Machine Instructi
Terms, Literals, and Expressions<br />
4. In parenthesized expressions, the assembler evaluates the innermost<br />
expressions first and then considers them as terms in the next outer level of<br />
expressions. It continues this process until the outermost expression is<br />
evaluated.<br />
5. A term or expression's intermediate value and computed result must lie in the<br />
range of −2 31 through +2 31 −1.<br />
The assembler evaluates paired relocatable terms at each level of expression<br />
nesting.<br />
Absolute and Relocatable Expressions<br />
An expression is absolute if its value is unaffected by program relocation. An<br />
expression is relocatable if its value depends upon program relocation. The two<br />
types of expressions, absolute and relocatable, take on these characteristics from<br />
the term or terms composing them. A description of the factors that determine<br />
whether an expression is absolute or relocatable follows.<br />
Absolute Expression: An absolute expression is one whose value remains the<br />
same after program relocation. The value of an absolute expression is called an<br />
absolute value.<br />
An expression is absolute, and is reduced to a single absolute value if the<br />
expression:<br />
1. Comprises a symbol with an absolute value, a self-defining term, or a symbol<br />
length attribute reference, or any arithmetic combination of absolute terms.<br />
2. Contains relocatable terms alone or in combination with absolute terms, and if<br />
all these relocatable terms are paired.<br />
Relocatability Attribute: The relocatability attribute describes the attribute of a<br />
relocatable term. If a pair of terms are defined in the same control section, they<br />
are characterized as having the same relocatability attribute.<br />
| If the terms are defined in different control sections, or have different relocatability<br />
| attributes, the expression is said to be “complex relocatable.”<br />
| The relocatability attribute is the same as the ESDID for external symbols, and the<br />
| “Relocation ID” in the listing.<br />
Paired Relocatable Terms: An expression can be absolute even though it<br />
contains relocatable terms, provided that all the relocatable terms are paired. The<br />
pairing of relocatable terms cancels the effect of relocation.<br />
The assembler reduces paired terms to single absolute terms in the intermediate<br />
stages of evaluation. The assembler considers relocatable terms as paired under<br />
the following conditions:<br />
The paired terms must have the same relocatability attribute.<br />
The paired terms must have opposite signs after all unary operators are<br />
resolved. In an expression, the paired terms do not have to be contiguous<br />
(that is, other terms can come between the paired terms).<br />
The value represented by the paired terms is absolute.<br />
Chapter 2. Coding and Structure 47