Ordinary USING instruction

The ordinary USING instruction format specifies a base address and one or more base registers.

Ordinary USING
Read syntax diagramSkip visual syntax diagram>>-+-----------------+--USING--+-base-------------+------------->
   '-sequence_symbol-'         '-(base-+------+-)-'  
                                       '-,end-'      
 
   .----------------.  
   V                |  
>----,base_register-+------------------------------------------><
 
sequence_symbol
is a sequence symbol.
base
specifies a base address, which can be a relocatable or an absolute expression. The value of the expression must lie between 0 and 231-1.
end
specifies the end address, which can be a relocatable or an absolute expression. The value of the expression must lie between 0 and 231-1. The end address may exceed the (base address + default range) without error. The end address must be greater than the base and must have the same relocatability attribute.

The resolvable range of a USING with an 'end' operand is

base,MIN(4095,end-1)

Thus USING base,reg is equivalent to USING (base,base+4096),reg.

base_register
is an absolute expression whose value represents general registers 0 through 15.

The default range is 4096 per base register.

The assembler assumes that the base register denoted by the first base_register operand contains the base address base at execution time. If present, the subsequent base_register operands represent registers that the assembler assumes contain the address values base+4096, base+8192, and so forth.

For example:

         USING           BASE,9,10,11

has the logical equivalent of:

         USING           BASE,9
         USING           BASE+4096,10
         USING           BASE+8192,11

In another example, the following statement:

         USING           *,12,13

tells the assembler to assume that the current value of the location counter is in general register 12 at execution time, and that the current value of the location counter, incremented by 4096, is in general register 13 at execution time.

Computing displacement

If you change the value in a base register being used, and want the assembler to compute displacements from this value, you must tell the assembler the new value by means of another USING statement. In the following sequence, the assembler first assumes that the value of ALPHA is in register 9. The second statement then causes the assembler to assume that ALPHA+1000 is the value in register 9.

         USING           ALPHA,9
         .
         .
         USING           ALPHA+1000,9

Using General Register Zero

You can refer to the first 4096 bytes of storage using general register 0, subject to the following conditions:

The assembler assumes that register 0 contains zero. Therefore, regardless of the value of operand base, it calculates displacements as if operand base were absolute or relocatable zero. The assembler also assumes that subsequent registers specified in the same USING statement contain 4096, 8192, etc.

If register 0 is used as a base register, the referenced control section (or dummy section) is not relocatable, despite the fact that operand base may be relocatable. The control section can be made relocatable by:

Range of an ordinary USING instruction

The range of an ordinary USING instruction (called the ordinary USING range, or simply the USING range) is the 4096 bytes beginning at the base address specified in the USING instruction, or the range as specified by the range end, whichever is the lesser. For long-displacement instructions, the range is the addresses between (base_address-524288) and (base_address+524287). Addresses that lie within the USING range can be converted from their implicit to their explicit base-displacement form using the designated base registers; those outside the USING range cannot be converted.

The USING range does not depend upon the position of the USING instruction in the source module; rather, it depends upon the location of the base address specified in the USING instruction.

The USING range is the range of addresses in a control section that is associated with the base register specified in the USING instruction. If the USING instruction assigns more than one base register, the composite USING range is the union of the USING ranges that would apply if the base registers were specified in separate USING instructions.

Note that USING ranges need not be contiguous. For example, you could specify

      USING X,4
      USING X+6000,5

and implicit addresses with values between X+4096 and X+5999 would not be addressable by instructions with unsigned 12-bit displacements.

Two USING ranges coincide when the same base address is specified in two different USING instructions, even though the base registers used are different. When two USING ranges coincide, the assembler uses the higher-numbered register for assembling the addresses within the common USING range. In effect, the domain of the USING instruction that specifies the lower-numbered register is ended by the other USING instruction. If the domain of the USING instruction that specifies the higher-number register is subsequently terminated, the domain of the other USING instruction is resumed.

Two USING ranges overlap when the base address of one USING instruction lies within the range of another USING instruction. You can use the WARN suboption of the USING assembler option to find out if you have any overlapping USING ranges. When an overlap occurs the assembler issues a diagnostic message. However, the assembler does allow an overlap of one byte in USING ranges so that you don't receive a diagnostic message if you code the following statements:

PSTART   CSECT
         LR     R12,R15
         LA     R11,4095(,R12)
         USING  PSTART,R12
         USING  PSTART+4095,R11

In the above example, the second USING instruction begins the base address of the second base register (R11) in the 4096th byte of the first base register (R12) USING range. If you don't want the USING ranges to overlap, you can code the following statements:

PSTART   CSECT
         LR     R12,R15
         LA     R11,4095(,R12)
         LA     R11,1(,R11)
         USING  PSTART,R12
         USING  PSTART+4096,R11

When two ranges overlap, the assembler computes displacements from the base address that gives the smallest non-negative displacement; or if no non-negative displacement can be found, for long-displacement instructions, the base register giving the smallest negative displacement; it uses the corresponding base register when it assembles the addresses within the range overlap. This applies only to implicit addresses that appear after the second USING instruction.

LOCTR does not affect the USING domain.

Domain of an ordinary USING instruction

The domain of an ordinary USING instruction (called the ordinary USING domain, or simply the USING domain) begins where the USING instruction appears in a source module. It continues until the end of a source module, except when:

The assembler converts implicit address references into their explicit form when the following conditions are met:

The assembler does not convert implicit address references that are outside the USING domain. The USING domain depends on the position of the USING instruction in the source module after conditional assembly, if any, has been done.


[ Top of Page | Previous Page | Next Page | Contents | Index ]