HLASM Language Reference
HLASM Language Reference HLASM Language Reference
Addressing | Parts must always be referenced using Q-type address constants using the | techniques shown in this example, whether or not they reside in deferred load | classes. This is because parts are subject to reordering during binding. | Base Register Instructions The USING and DROP assembler instructions enable you to use expressions representing implicit addresses as operands of machine instruction statements, leaving the assignment of base registers and the calculation of displacements to the assembler. In order to use symbols in implicit addresses in the operand field of machine instruction statements, you must: Code a USING instruction to assign one or more base registers to a base address or sequence of base addresses Code machine instructions to load each base register with the base address Having the assembler determine base registers and displacements relieves you of the need to separate each address into an explicit displacement value and an explicit base register value. This feature of the assembler eliminates a likely source of programming errors, thus reducing the time required to write and test programs. You use the USING and DROP instructions to take advantage of this feature. For information about how to use these instructions, see “USING Instruction” on page 218 and “DROP Instruction” on page 172. Qualified Addressing Qualified addressing lets you use the same symbol to refer to data in different storage locations. Qualified symbols are simply ordinary symbols prefixed by a symbol qualifier and a period. A symbol qualifier is used to specify which base register the assembler should use when converting an implicit address into its explicit base-displacement form. Before you use a symbol qualifier, you must have previously defined it in the name entry of a labeled USING instruction. For information about labeled USING instructions, see “USING Instruction” on page 218. When defined, you can use a symbol qualifier to qualify any symbol that names a storage location within the range of the labeled USING. Qualified symbols may be used anywhere a relocatable term may be used. The following examples show the use of qualified symbols. SOURCE and TARGET are both symbol qualifiers previously defined in two labeled USING instructions. X and Y are both symbols that name storage locations within the range of both labeled USING instructions. MVC TARGET.X,SOURCE.X MVC TARGET.Y+5(3),SOURCE.Y+5 XC TARGET.X+1(L'X-1),TARGET.X+1 LA 2,SOURCE.Y 66 HLASM V1R5 Language Reference
Addressing Dependent Addressing Dependent addressing lets you minimize the number of base registers required to refer to data by making greater use of established addressability. For example, you may want to describe the format of a table of data defined in your source module with a dummy control section (see “Dummy Control Sections” on page 56). To refer to the data in the table using the symbols defined in the dummy section, you need to establish the addressability of the dummy section. To do this you must: Code a USING instruction to assign one or more base registers to a base address Code machine instructions to load each base register with the base address However, dependent addressing offers an alternative means of establishing addressability of the dummy section. When you have established addressability of the control section in which the table is defined, you can establish addressability of the dummy section by simply coding a USING statement which specifies the name of the dummy section and the address of the table. When you subsequently refer to the symbols in the dummy section, the assembler makes use of the already established addressability of the control section when converting the symbolic addresses into their base-displacement form. | For example, suppose addressability has been established for a control section | containing a data structure that is mapped by a dummy control section: | DATAMAP DSECT , DSECT describing data structure | FIELD1 DS F | FIELD2 DS CL32 | FIELD3 DS CL24 | - - - | CODE CSECT , Program code | BASR 12, Set base register | USING ,12 Provide addressability | - - - | USING DATAMAP,REALDATA Map DSECT onto REALDATA | L 2,FIELD1 Register 12 is base register | LA 3,FIELD3 Address of DATA3 | - - - | REALDATA DS F Data mapped by DATAMAP | DATA1 DC F'32' | DATA2 DC CL32'Actual Data' | DATA3 DC CL24'Additional Data' Relative Addressing Relative addressing is the technique of addressing instructions and data areas by designating their location in relation to the location counter or to some symbolic location. This type of addressing is always in bytes—never in bits, words, or instructions. Thus, the expression +4 specifies an address that is 4 bytes greater than the current value of the location counter. In the sequence of instructions in the following example, the location of the CR machine instruction can be expressed in two ways, ALPHA+2, or BETA-4, because all the machine instructions in the example are for 2-byte instructions. Chapter 3. Program Structures and Addressing 67
- 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 66 and 67: 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 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
- Page 116 and 117: Examples of Coded Machine Instructi
- Page 118 and 119: Examples of Coded Machine Instructi
- Page 120 and 121: Chapter 5. Assembler Instruction St
- Page 122 and 123: *PROCESS Statement *PROCESS Stateme
- Page 124 and 125: ACONTROL Instruction ►►──
- Page 126 and 127: ACONTROL Instruction FLAG(PAGE0) in
- Page 128 and 129: AINSERT Instruction character_strin
- Page 130 and 131: AMODE Instruction alias_string is t
- Page 132 and 133: CATTR Instruction Figure 25. AMODE/
- Page 134 and 135: CATTR Instruction | statements for
Addressing<br />
| Parts must always be referenced using Q-type address constants using the<br />
| techniques shown in this example, whether or not they reside in deferred load<br />
| classes. This is because parts are subject to reordering during binding.<br />
|<br />
Base Register Instructions<br />
The USING and DROP assembler instructions enable you to use expressions<br />
representing implicit addresses as operands of machine instruction statements,<br />
leaving the assignment of base registers and the calculation of displacements to<br />
the assembler.<br />
In order to use symbols in implicit addresses in the operand field of machine<br />
instruction statements, you must:<br />
Code a USING instruction to assign one or more base registers to a base<br />
address or sequence of base addresses<br />
Code machine instructions to load each base register with the base address<br />
Having the assembler determine base registers and displacements relieves you of<br />
the need to separate each address into an explicit displacement value and an<br />
explicit base register value. This feature of the assembler eliminates a likely source<br />
of programming errors, thus reducing the time required to write and test programs.<br />
You use the USING and DROP instructions to take advantage of this feature. For<br />
information about how to use these instructions, see “USING Instruction” on page<br />
218 and “DROP Instruction” on page 172.<br />
Qualified Addressing<br />
Qualified addressing lets you use the same symbol to refer to data in different<br />
storage locations. Qualified symbols are simply ordinary symbols prefixed by a<br />
symbol qualifier and a period. A symbol qualifier is used to specify which base<br />
register the assembler should use when converting an implicit address into its<br />
explicit base-displacement form. Before you use a symbol qualifier, you must have<br />
previously defined it in the name entry of a labeled USING instruction. For<br />
information about labeled USING instructions, see “USING Instruction” on<br />
page 218. When defined, you can use a symbol qualifier to qualify any symbol<br />
that names a storage location within the range of the labeled USING. Qualified<br />
symbols may be used anywhere a relocatable term may be used.<br />
The following examples show the use of qualified symbols. SOURCE and TARGET are<br />
both symbol qualifiers previously defined in two labeled USING instructions. X and<br />
Y are both symbols that name storage locations within the range of both labeled<br />
USING instructions.<br />
MVC<br />
TARGET.X,SOURCE.X<br />
MVC<br />
TARGET.Y+5(3),SOURCE.Y+5<br />
XC<br />
TARGET.X+1(L'X-1),TARGET.X+1<br />
LA<br />
2,SOURCE.Y<br />
66 <strong>HLASM</strong> V1R5 <strong>Language</strong> <strong>Reference</strong>