Address constant
| Industry | Computer hardware, software, and IT services |
|---|---|
| Founded | June 16, 1911 in Endicott, New York, United States |
| Products | System/360, z/Architecture, High Level Assembler (HLASM) |
| Website | www |
In the context of IBM System/360 through z/Architecture, an address constant or "adcon" refers to an assembly language data type that holds the location of a specific point within computer memory. These adcons range from one to four bytes in length; those shorter than four bytes generally represent small integers such as lengths, relative offsets, or index values rather than full addresses. The assembler directive "DC" is used to define them.
Comparable constructs exist in other systems but may be known by different terms.
Categories of address constants
A type adcons typically contain four-byte relocatable addresses but can also define their length explicitly. For example, AL1(stuff) creates a one-byte adcon intended for small relocatable constants. Other variants similarly allow length customization.
Adcons of the V category store references to external symbols, which are resolved during linking by the link-editor.
Y adcons hold two-byte (halfword) addresses with a range up to 32K bytes. These were more prevalent in earlier systems like DOS/360 and BOS/360, where memory constraints were significant, but their usage has diminished over time. Frequently, the notation 'AL2(value)' is used instead of 'Y(value)' for representing 16-bit quantities.
The Q address constants represent displacements within the External Dummy Section, analogous to Linux's Global Offset Table (refer to Position-independent code). A J adcon, set by the linkage editor, indicates the total length of this section and does not correspond to an actual memory address.
Additional types include R, utilized in TSS/360 for addressing the PSECT, and S, which encodes addresses using base-displacement format—a 16-bit value split into a 4-bit register identifier and a 12-bit displacement, mirroring instruction encoding schemes.
On System z, there are 8-byte (doubleword) variants named AD, JD, QD, and VD, which correspond respectively to 'A', 'J', 'Q', and 'V' types but store 64-bit addresses.
Relocation characteristics
The nominal value defined by a 'DC' statement consists of a list of expressions enclosed in parentheses. These expressions may be classified as absolute, relocatable, or complex relocatable.
Absolute expressions are fully computed at assembly time and require no further processing by the linker, such as DC A(4900796).
Relocatable expressions depend on linker adjustments during the linking phase. For instance:
LAB DC H'0'
...
ACON DC A(LAB-4)
Complex relocatable expressions span symbols from multiple source modules; an example is DC A(X-Y), where 'X' and 'Y' are defined in different modules.
Illustrative examples
Examples of valid adcons include:
ADCONS DS 0A aligned label with implicit length 4 and actual length zero
DC A(FIELDA) four-byte aligned absolute address referencing variable 'FIELDA'
DC AL4(FIELDA) similar to above but alignment not guaranteed
DC AL3(FIELDA) three-byte address constant (maximum range 16 MB)
DC AL2(FIELDA-TABLES) two-byte offset from 'TABLES' to 'FIELDA'
DC AL2(L'FIELDA) two-byte length of field 'FIELDA' (decimal 26)
DC AL1(C'A') single byte hex value representing EBCDIC character 'A' (hex C1)
DC A(FIELDA-C'A') four-byte aligned absolute address offset by -192 bytes from 'FIELDA'
DC A(*) four-byte aligned address pointing to this adcon location ('*' denotes current position)
DC S(SUBRTNA) base+displacement 2-byte aligned address of label "SUBRTNA"
DC X'47F0',S(SUBRTNA) unconditional branch instruction using S-type address constant
DC SL2(SUBRTNA) unaligned base+displacement 2-byte address of "SUBRTNA"
STAB DC SL2(SUBRTNA,SUBRTNB,SUBRTNC,.etc.) array composed of unaligned S-type ADCONS
INDIRECT DC A(*+4) address pointing four bytes beyond this adcon (V-type adcon)
DC V(SUBRTNX) address of an external subroutine entry point
DC AL1(−1) single byte negative value (hex x'FF'), commonly used as table terminator
SUBRTNA DS 0Y start marker for internal subroutine A . instructions follow here
TABLES DS 0Y halfword-aligned base address for tables section LENGTHS DC Al2(5,27,56,83,127,32563) array of six two-byte hexadecimal lengths defined by decimal literals PARMLIST DC A(HERE,THERE,EVWHERE,-1) array containing three four-byte aligned pointers followed by end-marker X'FFFFFFFF'
ZERO_255 DC 256AL1(*-ZERO_255) array consisting of 256 single-byte hex values from 00 to FF
* ---------end of adcon examples ---------------- *
FIELDA DC C'ABCDEFGHIJKLMNOPQRSTUVWXYZ' character string field (not an adcon), letters A through Z