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

| 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

| ┌─────────────┐ 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

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

Saved successfully!

Ooh no, something went wrong!