[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Assembler Language Reference

Implicit-Based Addressing

An implicit-based address is specified as an operand for an instruction by omitting the RA operand and writing the .using pseudo-op at some point before the instruction. After assembling the appropriate .using and .drop pseudo-ops, the assembler can determine which register to use as the base register. At run time, the processor computes the effective address just as if the base were explicitly specified in the instruction.

Implicit-based addresses can be relocatable or absolute, depending on the type of expression used to specify the contents of the RA operand at run time. Usually, the contents of the RA operand are specified with a relocatable expression, thus making a relocatable implicit-based address. In this case, when the object module produced by the assembler is relocated, only the contents of the base register RA will change. The displacement remains the same, so D(RA) still points to the correct address after relocation.

A dsect is a reference control section that allows you to describe the layout of data in a storage area without actually reserving any storage. An implicit-based address can also be made by specifying the contents of RA with a dsect name or a a dsect label, thus associating a base with a dummy section. The value of the RA content is resolved at run time when the dsect is instantiated.

If the contents of the RA operand are specified with an absolute expression, an absolute implicit-based address is made. In this case, the contents of the RA will not change when the object module is relocated.

The AIX Version 4 assembler only supports relocatable implicit-based addressing.

Perform the following when using implicit-based addressing:

  1. Write a .using statement to tell the assembler that one or more general-purpose registers (GPRs) will now be used as base registers.
  2. In this .using statement, tell the assembler the value each base register will contain at execution. Until it encounters a .drop pseudo-op, the assembler will use this base register value to process all instructions that require a based address.
  3. Load each base register with the previously specified value.

For implicit-based addressing the RA operand is always omitted, but the D operand remains. The D operand can be an absolute expression, a TOC-relative expression, a relocatable expression, or a restricted external expression.

Notes:
  1. When the D operand is an absolute expression or a restricted external expression, the assembler always converts it to D(0) form, so the .using pseudo-op has no effect.
  2. The .using and .drop pseudo-ops affect only based addresses.
    .toc
    T.data: .tc data[tc],data[rw]
    .csect data[rw]
            foo: .long 2,3,4,5,6
            bar: .long 777
     
            .csect text[pr]
            .align 2
            l 10,T.data(2)   # Loads the address of
                                     # csect data[rw] into GPR 10.
     
            .using data[rw], 10      # Specify displacement.
            l 3,foo          # The assembler generates l 3,0(10)
            l 4,foo+4        # The assembler generates l 4,4(10)
            l 5,bar          # The assembler generates l 5,20(10)

See the .using pseudo-op for more information.

Related Information

Absolute addressing.

Absolute immediate addressing.

Relative immediate addressing.

Explicit-Based addressing.

Location Counter.

Branch Processor.

The bcctr or bcc (Branch Conditional to Count Register) instruction, bclr or bcr (Branch Conditional Link Register) instruction, b (Branch) Instruction, bc (Branch Conditional) instruction.

The .using pseudo-op, .drop pseudo-op.


[ Previous | Next | Contents | Home | Search ]