Jump to content

Address constant

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 86.142.120.161 (talk) at 14:03, 19 October 2009 (a--> 'an'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In IBM/360 (and through to present day z/Architecture), an address constant or "adcon" is an Assembly language data type whose value refers directly to (or "points to") another value stored elsewhere in the computer memory using its address. An address constant can be one, two, three or four bytes long (for IBM/360 architecture). It is defined using an assembler language "DC" statement using a type of A (or V if the adcon refers to an address outside of the current program module).

If the adcon is less than three bytes it is usually used to hold a 16bit integer such as a length, a relative address or some index value. If the adcon is a 'V' type, it addresses an external program entry point, resolved by the link-editor when the external module is included with the module making the reference.

IBM S/360 and z/Architecture Assembler example

All these are valid adcon's:-

ADCONS   DS    0A                     an aligned label of implicit length 4 (for the next 4 byte address that follows it)
         DC    A(FIELDA)              a 4 byte word, aligned, absolute address of a variable 'FIELDA'
         DC    AL4(FIELDA)            as above but not (necessarily) aligned on a word boundary
         DC    AL3(FIELDA)            a three byte equivalent of the above (maximum 16 megabytes)
         DC    AL2(FIELDA-TABLES)     two byte offset from 'TABLES' label to start of 'FIELDA'
         DC    AL2(L'FIELDA)          a two byte length of the field called 'FIELDA' (=26 in decimal)
         DC    AL1(C'A')              hexadecimal value of the EBCDIC character 'A' (=C1 in hex)
         DC    A(FIELDA-C'A')         a 4 byte, aligned, absolute address --> 192 bytes before the start of FIELDA
         DC    A(*)                   a 4 byte, aligned, address of this adcon  (* means 'here')
INDIRECT DC    A(*+4)                 address of next byte after this adcon (the V-type adcon)
         DC    V(SUBRTNX)             address of an external subroutine entry point
         DC    AL1(-1)                a one byte negative value (= x'FF'), often used as a table de-limiter
.
SUBRTNA   DS    0H                    start of (internal) sub-routine A 
.         instructions go here
.
TABLES   DS    0H                     base address for tables section (halfword aligned)
LENGTHS  DC    Al2(5,27,56,83,127,32563)   an arbitrary array of 6 x 2 byte hex lengths (defined by their decimal values)
PARMLIST  DC   A(HERE,THERE,EVWHERE,-1)  an array of 3 x 4 byte aligned pointers to various field labels/entrypoints with additional negative value end-pointer (=X'FFFFFFFF').
.
ZERO_255 DC    256AL1(ZERO_255-*)               an array of 256 single byte hex values 00-FF
* ---------end of adcon examples ---------------- *
FIELDA   DC    C'ABCDEFGHIJKLMNOPQRSTUVWXYZ'    a field containing a character string (not an adcon) = A-Z
.

See also

Pointer (computer science)

External references