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

DC Instruction—Address Constants ACON DC A(18,LOP,END–STRT,+496) LM 4,7,=A(18,LOP,END–STRT,+496) A location counter reference () appears in the fourth constant (+496). The value of the location counter is the address of the first byte of the fourth constant. When the location counter reference occurs in a literal, as in the LM instruction, the value of the location counter is the address of the first byte of the instruction. Note: It is important to remember that expression evaluation for address constants is restricted to using 32-bit internal arithmetic. The result is then sign-extended to the length of the constant. This means that certain expressions in AD-type constants may not yield expected results, especially if the resulting value is negative. Address Constant—S: Use the S-type address constant to assemble an explicit address in base-displacement form. You can specify the explicit address yourself or let the assembler compute it from an implicit address, using the current base register and address in its computation. The nominal values can be specified in two ways: 1. As one absolute or relocatable expression (see ▌1▐ in Figure 45 on page 157) representing an implicit address. 2. As two absolute expressions (see ▌2▐ in Figure 45) the first of which represents the displacement and the second, enclosed in parentheses, represents the base register. The address value represented by the expression in ▌1▐ in Figure 45, is converted by the assembler into the correct base register and displacement value. An S-type constant is assembled as a halfword and aligned on a halfword boundary. The leftmost four bits of the assembled constant represent the base register designation; the remaining 12 bits, the displacement value. Notes: 1. The value of the location counter (*) when specified in an S-type address constant varies from constant to constant if one or more the following is specified: Multiple operands Multiple nominal values A duplication factor In each case the location counter is incremented with the length of the previously assembled constant, except when multiple S-type address constants are specified in a literal. In a literal, the same location counter value is used for each of the multiple values. 2. If a length modifier is used, only 2 bytes may be specified. 3. S-type address constants can be specified as literals. The USING instructions used to resolve them are those in effect at the place where the literal pool is assembled, and not where the literal is used. 4. The location counter value used in the literal is the value at the point where the literal is used, not where it is defined. For example: 156 HLASM V1R5 Language Reference

DC Instruction—Address Constants USING ,15 DC 2S() generates FF2 LA 1,=2S() generated constants are F4F4 Note that this behavior is different from that in A-type address constants and Y-type address constants. Figure 45. S Address Constants Subfield Value Example Result 1. Duplication factor Allowed 2. Type S 3. Type Extension Not allowed | 4. Program type Allowed 5. Modifiers Implicit length: (length modifier not present) Alignment: (Length modifier not present) Range for length: Range for scale: Range for exponent: 6. Nominal value Represented by: 2 bytes Halfword 2 only (no bit length) Not allowed Not allowed Absolute or relocatable expression ▌1▐ DC S(RELOC) DC S(124) Base Disp X YYY 0 400 Enclosed by: Exponent allowed: Number of values per operand: Padding: Truncation of assembled value: Two absolute expressions ▌2▐ Parentheses No Multiple Not applicable Not applicable DC S(512(12)) C 200 Address Constant—V: The V-type constant reserves storage for the address of a location in a control section that is defined in another source module. Use the V-type address constant only to branch to an external address, because link-time processing may cause the branch to be indirect (for example, an assisted linkage in an overlay module). That is, the resolved address in a V-type address constant might not contain the address of the referenced symbol. In contrast, to refer to external data you should use an A-type address constant whose nominal value specifies an external symbol identified by an EXTRN instruction. Because you specify a symbol in a V-type address constant, the assembler assumes that it is an external symbol. A value of zero is assembled into the space Chapter 5. Assembler Instruction Statements 157

DC Instruction—Address Constants<br />

USING ,15<br />

DC 2S() generates FF2<br />

LA 1,=2S() generated constants are F4F4<br />

Note that this behavior is different from that in A-type address constants and<br />

Y-type address constants.<br />

Figure 45. S Address Constants<br />

Subfield Value Example Result<br />

1. Duplication factor Allowed<br />

2. Type S<br />

3. Type Extension Not allowed<br />

| 4. Program type Allowed<br />

5. Modifiers<br />

Implicit length:<br />

(length modifier<br />

not present)<br />

Alignment:<br />

(Length modifier<br />

not present)<br />

Range for length:<br />

Range for scale:<br />

Range for exponent:<br />

6. Nominal value<br />

Represented by:<br />

2 bytes<br />

Halfword<br />

2 only<br />

(no bit length)<br />

Not allowed<br />

Not allowed<br />

Absolute or<br />

relocatable<br />

expression ▌1▐<br />

DC S(RELOC)<br />

DC S(124)<br />

Base Disp<br />

X YYY<br />

0 400<br />

Enclosed by:<br />

Exponent allowed:<br />

Number of values<br />

per operand:<br />

Padding:<br />

Truncation of<br />

assembled value:<br />

Two absolute<br />

expressions ▌2▐<br />

Parentheses<br />

No<br />

Multiple<br />

Not applicable<br />

Not applicable<br />

DC S(512(12))<br />

C 200<br />

Address Constant—V: The V-type constant reserves storage for the address of a<br />

location in a control section that is defined in another source module. Use the<br />

V-type address constant only to branch to an external address, because link-time<br />

processing may cause the branch to be indirect (for example, an assisted linkage in<br />

an overlay module). That is, the resolved address in a V-type address constant<br />

might not contain the address of the referenced symbol. In contrast, to refer to<br />

external data you should use an A-type address constant whose nominal value<br />

specifies an external symbol identified by an EXTRN instruction.<br />

Because you specify a symbol in a V-type address constant, the assembler<br />

assumes that it is an external symbol. A value of zero is assembled into the space<br />

Chapter 5. Assembler Instruction Statements 157

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

Saved successfully!

Ooh no, something went wrong!