22.02.2015 Views

HLASM Language Reference

HLASM Language Reference

HLASM Language Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Addressing<br />

Establishing symbolic linkage<br />

You must establish symbolic linkage between source modules so that you can refer<br />

to or branch to symbolic locations defined in the control sections of external source<br />

modules. You do this by using external symbol definitions, and external symbol<br />

references. To establish symbolic linkage with an external source module, you<br />

must do the following:<br />

In the current source module, you must identify the symbols that are not<br />

defined in that source module, if you want to use them in instruction operands.<br />

These symbols are called external symbols, because they are defined in<br />

another (external) source module. You identify external symbols in the EXTRN<br />

or WXTRN instruction, or the V-type address constant. For more information<br />

about the EXTRN and WXTRN instructions, see “EXTRN Instruction” on<br />

page 189 and “WXTRN Instruction” on page 229.<br />

In the external source modules, you must identify the symbols that are defined<br />

in those source modules, and that you refer to from the current source module.<br />

The two types of definitions that you can use are control section names<br />

(defined by the CSECT, RSECT, and START instructions), and entry symbols.<br />

Entry symbols are so called because they provide points of entry to a control<br />

section in a source module. You identify entry symbols with the ENTRY<br />

instruction. For more information about the ENTRY instruction, see “ENTRY<br />

Instruction” on page 183.<br />

To reference the external symbols, you must either<br />

– provide the A-type or V-type address constants needed by the assembler to<br />

reserve storage for the addresses represented by the external symbols, or<br />

| – reference an external symbol in the same class in a relative branch<br />

| instruction.<br />

The assembler places information about entry and external symbols in the external<br />

symbol dictionary. The linker uses this information to resolve the linkage addresses<br />

identified by the entry and external symbols.<br />

Referring to external data<br />

Use the EXTRN instruction to identify the external symbol that represents data in<br />

an external source module, if you want to refer to this data symbolically.<br />

For example, you can identify the address of a data area as an external symbol<br />

and load the A-type address constant specifying this symbol into a base register.<br />

Then, you use this base register when establishing the addressability of a dummy<br />

section that describes this external data. You can now refer symbolically to the<br />

data that the external area contains.<br />

You must also identify, in the source module that contains the data area, the<br />

address of the data as an entry symbol.<br />

Branching to an external address<br />

Use the V-type address constant to identify the external symbol that represents the<br />

address in an external source module that you want to branch to.<br />

For example, you can load into a register the V-type address constant that<br />

identifies the external symbol. Using this register, you can then branch to the<br />

external address represented by the symbol.<br />

Chapter 3. Program Structures and Addressing 69

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

Saved successfully!

Ooh no, something went wrong!