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

Operand Entries “Program Structures and Addressing” on page 50 describes how you use symbolic addresses to refer to data in your assembler language program. Defining Symbolic Addresses: Define relocatable addresses by either using a symbol as the label in the name field of an assembler language statement, or equating a symbol to a relocatable expression. Define absolute addresses (or values) by equating a symbol to an absolute expression. Referring to Addresses: You can refer to relocatable and absolute addresses in the operands of machine instruction statements. (Such address references are also called addresses in this manual.) The two ways of coding addresses are: Implicitly—in a form that the assembler must first convert into an explicit relative-offset or base-displacement form before it can be assembled into object code. Explicitly—in a form that can be directly assembled into object code. Implicit Address An implicit address is specified by coding one expression. The expression can be relocatable or absolute. The assembler converts all implicit addresses into their relative-offset or base-displacement form before it assembles them into object code. The assembler converts implicit addresses into explicit base-displacement addresses only if a USING instruction has been specified, or for small absolute expressions, where the address is resolved without a USING. The USING instruction assigns both a base address, from which the assembler computes displacements, and a base register, which is assumed to contain the base address. The base register must be loaded with the correct base address at execution time. For more information, refer to “Addressing” on page 63. Explicit Address An explicit address is specified by coding two absolute expressions as follows: The first is an absolute expression for the displacement, whose value must lie in the range 0 through 4095 (4095 is the maximum value that can be represented by the 12 binary bits available for the displacement in the object code). The second (enclosed in parentheses) is an absolute expression for the base register, whose value must lie in the range 0 through 15. An explicit base register designation must not accompany an implicit address. However, in RX-format instructions, an index register can be coded with an implicit address as well as with an explicit address. When two addresses are required, each address can be coded as an explicit address or as an implicit address. Relative Address A relative address is specified by coding one expression. The expression may be relocatable or absolute. If a relocatable expression is used, then the assembler converts the value to a signed number of halfwords relative to the current location counter, and then uses that value in the object code. An absolute value may be used for a relative address, but the assembler issues a warning message, as it uses the supplied value, and this may cause unpredictable results. 88 HLASM V1R5 Language Reference

Operand Entries Relocatability of Addresses If the value of an address expression changes when the assumed origin of the program is changed, and changes by the same amount, then the address is simply relocatable. If the addressing expression does not change when the assumed origin of the program is changed, then that address is absolute. If the addressing expression changes by some other amount, the address may be complexly relocatable. Addresses in the relative-offset or base-displacement form are relocatable, because: Each relocatable address is assembled as a signed relative offset from the instruction, or as a displacement from a base address and a base register. The base register contains the base address. If the object module assembled from your source module is relocated, only the contents of the base register need reflect this relocation. This means that the location in virtual storage of your base has changed, and that your base register must contain this new base address. Addresses in your program have been assembled as relative to the base address; therefore, the sum of the displacement and the contents of the base register point to the correct address after relocation. Absolute addresses are also assembled in the base-displacement form, but always indicate a fixed location in virtual storage. This means that the contents of the base register must always be a fixed absolute address value regardless of relocation. Machine or Object Code Format Addresses assembled into the object code of machine instructions have the format given in Figure 23 on page 90. Not all of the instruction formats are shown in Figure 23. The addresses represented have a value that is the sum of a displacement (see ▌1▐ in Figure 23) and the contents of a base register (see ▌2▐ in Figure 23). Index Register: In RX-format instructions, the address represented has a value that is the sum of a displacement, the contents of a base register, and the contents of an index register (see ▌3▐ in Figure 23). Chapter 4. Machine Instruction Statements 89

Operand Entries<br />

“Program Structures and Addressing” on page 50 describes how you use symbolic<br />

addresses to refer to data in your assembler language program.<br />

Defining Symbolic Addresses: Define relocatable addresses by either using a<br />

symbol as the label in the name field of an assembler language statement, or<br />

equating a symbol to a relocatable expression.<br />

Define absolute addresses (or values) by equating a symbol to an absolute<br />

expression.<br />

Referring to Addresses: You can refer to relocatable and absolute addresses in<br />

the operands of machine instruction statements. (Such address references are<br />

also called addresses in this manual.) The two ways of coding addresses are:<br />

Implicitly—in a form that the assembler must first convert into an explicit<br />

relative-offset or base-displacement form before it can be assembled into object<br />

code.<br />

Explicitly—in a form that can be directly assembled into object code.<br />

Implicit Address<br />

An implicit address is specified by coding one expression. The expression can be<br />

relocatable or absolute. The assembler converts all implicit addresses into their<br />

relative-offset or base-displacement form before it assembles them into object code.<br />

The assembler converts implicit addresses into explicit base-displacement<br />

addresses only if a USING instruction has been specified, or for small absolute<br />

expressions, where the address is resolved without a USING. The USING<br />

instruction assigns both a base address, from which the assembler computes<br />

displacements, and a base register, which is assumed to contain the base address.<br />

The base register must be loaded with the correct base address at execution time.<br />

For more information, refer to “Addressing” on page 63.<br />

Explicit Address<br />

An explicit address is specified by coding two absolute expressions as follows:<br />

The first is an absolute expression for the displacement, whose value must lie<br />

in the range 0 through 4095 (4095 is the maximum value that can be<br />

represented by the 12 binary bits available for the displacement in the object<br />

code).<br />

The second (enclosed in parentheses) is an absolute expression for the base<br />

register, whose value must lie in the range 0 through 15.<br />

An explicit base register designation must not accompany an implicit address.<br />

However, in RX-format instructions, an index register can be coded with an implicit<br />

address as well as with an explicit address. When two addresses are required,<br />

each address can be coded as an explicit address or as an implicit address.<br />

Relative Address<br />

A relative address is specified by coding one expression. The expression may be<br />

relocatable or absolute. If a relocatable expression is used, then the assembler<br />

converts the value to a signed number of halfwords relative to the current location<br />

counter, and then uses that value in the object code. An absolute value may be<br />

used for a relative address, but the assembler issues a warning message, as it<br />

uses the supplied value, and this may cause unpredictable results.<br />

88 <strong>HLASM</strong> V1R5 <strong>Language</strong> <strong>Reference</strong>

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

Saved successfully!

Ooh no, something went wrong!