Address constant

Last updated

In IBM System/360 through present day z/Architecture, an address constant or "adcon" is an assembly language data type which contains the address of a location in computer memory. An address constant can be one, two, three or four bytes long, although an adcon of less than four bytes is conventionally used to hold an expression for a small integer such as a length, a relative address, or an index value, and does not represent an address at all. Address constants are defined using an assembler language "DC" statement.

Contents

Other computer systems have similar facilities, although different names may be used.

Types of address constants

A adcons normally store a four byte relocatable address, however it is possible to specify the length of the constant. For example, AL1(stuff) defines a one-byte adcon, useful mainly for small constants with relocatable values. Other adcon types can similarly have length specification.

V type adcons store an external reference to be resolved by the link-editor.

Y is used for two byte (halfword) addresses. 'Y' adcons can directly address up to 32K bytes of storage, and are not widely used since early System/360 assemblers did not support a 'Y' data type. Early DOS/360 and BOS/360 systems made more use of Y adcons, since the machines these systems ran on had limited storage. The notation 'AL2(value)' is now usually used in preference to 'Y(value)' to define a 16 bit value.

Q address constants contain not actual addresses but a displacement in the External Dummy Section – similar to the Linux Global Offset Table (see Position-independent code). A J adcon is set by the linkage editor to hold the cumulative length of the External Dummy Section, and does not actually contain an address.

Other types of address constants are R which had special significance for TSS/360 to address the PSECT, and S, which stores an address in base-displacement format – a 16 bit value containing a four bit general register number and a twelve bit displacement, the same format as addresses are encoded in instructions.

System z supports types AD, JD, QD, and VD, which represent 8 byte (doubleword) versions of types 'A', 'J', 'Q', and 'V' to hold 64 bit addresses.

Relocatability

The nominal value of the 'DC' is a list of expressions enclosed in parentheses. Expressions can be absolute, relocatable, or complex relocatable.

An absolute expression can be completely evaluated at assembly time and does not require further processing by the linkage editor. For example, DC A(4900796) has an absolute nominal value.

A relocatable expression is one that contains one or more terms that require relocation by the linkage editor when the program ls linked, for example, in the following code 'ACON' has a relocatable nominal value.

LAB  DC H'0'     ... ACON DC A(LAB-4)

A complex relocatable expression contains terms that relate to addresses in different source modules. For example, DC A(X-Y) where 'X' and 'Y' are in different modules.

Examples

All these are valid adcon's:-

ADCONS   DS    0A                     an aligned label of implicit length 4 and actual length 0          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')          DC    S(SUBRTNA)             a 2 byte, aligned   base+displacement address of the program label "SUBRTNA"          DC    X'47F0',S(SUBRTNA)     an unconditional branch instruction (built using an S-type address constant)          DC    SL2(SUBRTNA)           a 2 byte, UNALIGNED base+displacement address of the program label "SUBRTNA" STAB     DC    SL2(SUBRTNA,SUBRTNB,SUBRTNC,.etc.) AN ARRAY OF unaligned S-TYPE ADCONS  * 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    0Y                    start of (internal) sub-routine A .         instructions go here . TABLES   DS    0Y                     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

Related Research Articles

In computer programming, a magic number is any of the following:

The syntax of the C programming language is the set of rules governing writing of software in the C language. It is designed to allow for programs that are extremely terse, have a close relationship with the resulting object code, and yet provide relatively high-level data abstraction. C was the first widely successful high-level language for portable operating-system development.

<span class="mw-page-title-main">Pointer (computer programming)</span> Object which stores memory addresses in a computer program

In computer science, a pointer is an object in many programming languages that stores a memory address. This can be that of another value located in computer memory, or in some cases, that of memory-mapped computer hardware. A pointer references a location in memory, and obtaining the value stored at that location is known as dereferencing the pointer. As an analogy, a page number in a book's index could be considered a pointer to the corresponding page; dereferencing such a pointer would be done by flipping to the page with the given page number and reading the text found on that page. The actual format and content of a pointer variable is dependent on the underlying computer architecture.

In computer systems a loader is the part of an operating system that is responsible for loading programs and libraries. It is one of the essential stages in the process of starting a program, as it places programs into memory and prepares them for execution. Loading a program involves memory-mapping the contents of the executable file containing the program instructions into memory, and then carrying out other required preparatory tasks to prepare the executable for running. Once loading is complete, the operating system starts the program by passing control to the loaded program code.

In computer science, a union is a value that may have any of several representations or formats within the same position in memory; that consists of a variable that may hold such a data structure. Some programming languages support special data types, called union types, to describe such values and variables. In other words, a union type definition will specify which of a number of permitted primitive types may be stored in its instances, e.g., "float or long integer". In contrast with a record, which could be defined to contain both a float and an integer; in a union, there is only one value at any given time.

The Simplified Instructional Computer is a hypothetical computer system introduced in System Software: An Introduction to Systems Programming, by Leland Beck. Due to the fact that most modern microprocessors include subtle, complex functions for the purposes of efficiency, it can be difficult to learn systems programming using a real-world system. The Simplified Instructional Computer solves this by abstracting away these complex behaviors in favor of an architecture that is clear and accessible for those wanting to learn systems programming.

In computing, position-independent code (PIC) or position-independent executable (PIE) is a body of machine code that, being placed somewhere in the primary memory, executes properly regardless of its absolute address. PIC is commonly used for shared libraries, so that the same library code can be loaded in a location in each program address space where it does not overlap with other memory in use. PIC was also used on older computer systems that lacked an MMU, so that the operating system could keep applications away from each other even within the single address space of an MMU-less system.

A Java class file is a file containing Java bytecode that can be executed on the Java Virtual Machine (JVM). A Java class file is usually produced by a Java compiler from Java programming language source files containing Java classes. If a source file has more than one class, each class is compiled into a separate class file.

Addressing modes are an aspect of the instruction set architecture in most central processing unit (CPU) designs. The various addressing modes that are defined in a given instruction set architecture define how the machine language instructions in that architecture identify the operand(s) of each instruction. An addressing mode specifies how to calculate the effective memory address of an operand by using information held in registers and/or constants contained within a machine instruction or elsewhere.

Loop unrolling, also known as loop unwinding, is a loop transformation technique that attempts to optimize a program's execution speed at the expense of its binary size, which is an approach known as space–time tradeoff. The transformation can be undertaken manually by the programmer or by an optimizing compiler. On modern processors, loop unrolling is often counterproductive, as the increased code size can cause more cache misses; cf. Duff's device.

A bit array is an array data structure that compactly stores bits. It can be used to implement a simple set data structure. A bit array is effective at exploiting bit-level parallelism in hardware to perform operations quickly. A typical bit array stores kw bits, where w is the number of bits in the unit of storage, such as a byte or word, and k is some nonnegative integer. If w does not divide the number of bits to be stored, some space is wasted due to internal fragmentation.

In computing, a word is the natural unit of data used by a particular processor design. A word is a fixed-sized datum handled as a unit by the instruction set or the hardware of the processor. The number of bits or digits in a word is an important characteristic of any specific processor design or computer architecture.

The computer programming languages C and Pascal have similar times of origin, influences, and purposes. Both were used to design their own compilers early in their lifetimes. The original Pascal definition appeared in 1969 and a first compiler in 1970. The first version of C appeared in 1972.

Data structure alignment is the way data is arranged and accessed in computer memory. It consists of three separate but related issues: data alignment, data structure padding, and packing.

In computer science, an offset within an array or other data structure object is an integer indicating the distance (displacement) between the beginning of the object and a given element or point, presumably within the same object. The concept of a distance is valid only if all elements of the object are of the same size.

Intel hexadecimal object file format, Intel hex format or Intellec Hex is a file format that conveys binary information in ASCII text form. It is commonly used for programming microcontrollers, EPROMs, and other types of programmable logic devices and hardware emulators. In a typical application, a compiler or assembler converts a program's source code to machine code and outputs it into a HEX file. Some also use it as a container format holding packets of stream data. Common file extensions used for the resulting files are .HEX or .H86. The HEX file is then read by a programmer to write the machine code into a PROM or is transferred to the target system for loading and execution.

sizeof is a unary operator in the programming languages C and C++. It generates the storage size of an expression or a data type, measured in the number of char-sized units. Consequently, the construct sizeof (char) is guaranteed to be 1. The actual number of bits of type char is specified by the preprocessor macro CHAR_BIT, defined in the standard include file limits.h. On most modern computing platforms this is eight bits. The result of sizeof has an unsigned integer type that is usually denoted by size_t.

Systems Programming Language, often shortened to SPL but sometimes known as SPL/3000, was a procedurally-oriented programming language written by Hewlett-Packard for the HP 3000 minicomputer line and first introduced in 1972. SPL was used to write the HP 3000's primary operating system, Multi-Programming Executive (MPE). Similar languages on other platforms were generically referred to as system programming languages, confusing matters.

<span class="mw-page-title-main">Control table</span>

Control tables are tables that control the control flow or play a major part in program control. There are no rigid rules about the structure or content of a control table—its qualifying attribute is its ability to direct control flow in some way through "execution" by a processor or interpreter. The design of such tables is sometimes referred to as table-driven design. In some cases, control tables can be specific implementations of finite-state-machine-based automata-based programming. If there are several hierarchical levels of control table they may behave in a manner equivalent to UML state machines

The GOFF specification was developed for IBM's MVS operating system to supersede the IBM OS/360 Object File Format to compensate for weaknesses in the older format.