HLASM Language Reference
HLASM Language Reference HLASM Language Reference
| Chapter 3. Program Structures and Addressing This chapter describes how you use symbolic addresses to refer to data in your assembler language program, and how you divide a large program into smaller parts and use symbolic addresses in one part to refer to data in another part. | Object Program Structures | High Level Assembler supports two object-program models. The older “load | module” model generally involves one or more independently relocatable control | sections combined into a single block of machine language text, which is loaded | into a single contiguous portion of memory. Addresses within this block of text are | resolved to locations within the block, or are left unresolved. Such programs may | be considered one-dimensional structures. Examples include MVS load modules, | CMS modules, and VSE phases. | The second object-program model supports a two-dimensional | structure called a program object. The loaded program may consist of one or more | contiguous blocks of machine language text grouped in classes and placed in | different portions of memory. Each contribution of machine language text to a class | is provided by an owning section, and the independently relocatable text from a | section that contributes to a class is an element. For certain types of class, an | element may contain parts. Unlike a control section, a program object section may | specify more than one independently relocatable block of text. Addresses within | each class may be resolved to addresses in the same or different classes. A class | in a program object has behavior properties similar to those of a load module. | Section names are specified with the CSECT, RSECT, and START statements, and | class and part names are specified with the CATTR statement. Additional | attributes can be assigned to external symbols with the XATTR statement. | | The program object model can be created only when the GOFF option is specified. | The “load module” model can be created when either the NOGOFF or GOFF option | is specified, but there are limitations on source program statements if GOFF is | specified. | Note: The term “section” is used in different senses for each object-program model. | In the load module model, a section is a control section. In the program object | model, a section is a one-dimensional cross-section of program object data | containing contributions to one or more classes. | Note: Features supported by High Level Assembler when you specify | the GOFF option may not be supported by the system linker/binder or run-time | environment where the assembled program will be processed. You should check | the relevant product documentation before utilizing the assembler's features. | | The following figure illustrates the differences between the object-program models. 50 © Copyright IBM Corp. 1982, 2004
| ┌─────────────┐ Class Class Class ─ ─ ─ | │ │ ┌─────────┬─────────┬─────────┬ ───┐ | │ Control │ │ │ │ part │ │ | │ Section │ Section │ element │ element ├─────────┤ │ | │ │ │ │ │ part │ │ | ├─────────────┤ ├─────────┼─────────┼─────────┼ ─ ─ ─┤ | │ Control │ │ │ │ │ │ | │ Section │ Section │ element │ element │ part │ │ | ├─────────────┤ │ │ │ │ │ | : : ├─────────┼─────────┼─────────┼ ───┤ | : : : : : : : | : : : : : : : | └─────────────┘ └─────────┴─────────┴─────────┴ ─ ─ ─┘ | Load Module Model Program Object Model | Figure 18. Load Module and Program Object Structures Source Program Structures This part of the chapter explains how to subdivide a large program into smaller parts that are easier to understand and maintain. It also explains how to divide | these smaller parts such as one section or element to contain executable instructions, and another to contain data constants and work areas. You should consider two different subdivisions when writing an assembler language program: The source module | The control section (load module model), or sections, elements, and parts | (program object model) You can divide a program into two or more source modules. Each source module is assembled into a separate object module. The object modules can then be combined to form an executable program. | You can also divide a source module into two or more sections, or (in the program | object model) into sections containing multiple classes. Each section is assembled as part of the same object module. By writing the correct linker control statements, you can select a complete object module or any individual section of the object module to be linked and later loaded as an executable program. | Size of Program Components: If a source module becomes so large that its | logic is not easily understood, divide it into smaller modules. For some instructions, | at most 4096 bytes can be addressed by one base register. Long-displacement | instructions allow you to address 1048576 bytes with one base register. Communication between Program Components: You must be able to communicate between the components of your program; that is, be able to refer to | data in a different component or branch to an instruction in another component. To communicate between two or more source modules, you must link them together with applicable symbolic references. To communicate between two or more sections or elements within a source | module, you must correctly establish the addressability of each to the others. Chapter 3. Program Structures and Addressing 51
- 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 66 and 67: Terms, Literals, and Expressions
- Page 68 and 69: Terms, Literals, and Expressions Th
- 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
- Page 116 and 117: Examples of Coded Machine Instructi
- Page 118 and 119: Examples of Coded Machine Instructi
| ┌─────────────┐ Class Class Class ─ ─ ─<br />
| │ │ ┌─────────┬─────────┬─────────┬ ───┐<br />
| │ Control │ │ │ │ part │ │<br />
| │ Section │ Section │ element │ element ├─────────┤ │<br />
| │ │ │ │ │ part │ │<br />
| ├─────────────┤ ├─────────┼─────────┼─────────┼ ─ ─ ─┤<br />
| │ Control │ │ │ │ │ │<br />
| │ Section │ Section │ element │ element │ part │ │<br />
| ├─────────────┤ │ │ │ │ │<br />
| : : ├─────────┼─────────┼─────────┼ ───┤<br />
| : : : : : : :<br />
| : : : : : : :<br />
| └─────────────┘ └─────────┴─────────┴─────────┴ ─ ─ ─┘<br />
| Load Module Model Program Object Model<br />
| Figure 18. Load Module and Program Object Structures<br />
Source Program Structures<br />
This part of the chapter explains how to subdivide a large program into smaller<br />
parts that are easier to understand and maintain. It also explains how to divide<br />
| these smaller parts such as one section or element to contain executable<br />
instructions, and another to contain data constants and work areas.<br />
You should consider two different subdivisions when writing an assembler language<br />
program:<br />
The source module<br />
| The control section (load module model), or sections, elements, and parts<br />
| (program object model)<br />
You can divide a program into two or more source modules. Each source module<br />
is assembled into a separate object module. The object modules can then be<br />
combined to form an executable program.<br />
| You can also divide a source module into two or more sections, or (in the program<br />
| object model) into sections containing multiple classes. Each section is assembled<br />
as part of the same object module. By writing the correct linker control statements,<br />
you can select a complete object module or any individual section of the object<br />
module to be linked and later loaded as an executable program.<br />
| Size of Program Components: If a source module becomes so large that its<br />
| logic is not easily understood, divide it into smaller modules. For some instructions,<br />
| at most 4096 bytes can be addressed by one base register. Long-displacement<br />
| instructions allow you to address 1048576 bytes with one base register.<br />
Communication between Program Components: You must be able to<br />
communicate between the components of your program; that is, be able to refer to<br />
| data in a different component or branch to an instruction in another component.<br />
To communicate between two or more source modules, you must link them<br />
together with applicable symbolic references.<br />
To communicate between two or more sections or elements within a source<br />
| module, you must correctly establish the addressability of each to the others.<br />
Chapter 3. Program Structures and Addressing 51