Dependent addressing
Dependent addressing lets you minimize the number of base
registers required to refer to data by making greater use of established
addressability. For example, you might want to describe the format
of a table of data defined in your source module with a dummy control
section (see Dummy control sections). To refer to the
data in the table using the symbols defined in the dummy section,
you need to establish the addressability of the dummy section. To
do this you must:
- Code a USING instruction to assign one or more base registers to a base address.
- Code machine instructions to load each base register with the base address.
Establish addressability of the control section in which the table is defined. Then you can establish addressability of the dummy section by coding a USING statement which specifies the name of the dummy section and the address of the table. When you refer to the symbols in the dummy section, the assembler uses the already established addressability of the control section when converting the symbolic addresses into their base-displacement form.
For example, suppose addressability has been established for a
control section containing a data structure that is mapped by a dummy
control section:
DATAMAP DSECT , DSECT describing data structure
FIELD1 DS F
FIELD2 DS CL32
FIELD3 DS CL24
- - -
CODE CSECT , Program code
BASR 12,0 Set base register
USING *,12 Provide addressability
- - -
USING DATAMAP,REALDATA Map DSECT onto REALDATA
L 2,FIELD1 Register 12 is base register
LA 3,FIELD3 Address of DATA3
- - -
REALDATA DS 0F Data mapped by DATAMAP
DATA1 DC F'32'
DATA2 DC CL32'Actual Data'
DATA3 DC CL24'Additional Data'