/sys$common/syshlp/HELPLIB.HLB  —  MACRO  /ALPHA  Directives  .BASE  Examples
      Example 1
        .EXTERNAL COMM_AREA       1
        .BASE R1, COMM_AREA       2
        CURR_LINE       = COMM_AREA + 0
        CURR_COLUMN     = COMM_AREA + 4
        CURR_MODE       = COMM_AREA + 8
        LDA     R4, 17                  ; LDA R4, 17(R31)  3
        LDL     R2, CURR_LINE           ; LDL R2, 0(R1)    4
        LDL     R3, CURR_COLUMN         ; LDL R3, 4(R1)
        STL     R4, CURR_MODE           ; STL R4, 8(R1)

      1  This statement declares an external symbol, COMM_AREA.
         COMM_AREA is a global symbol that represents the base
         address of a three-longword communication area that is used
         by different routines in the program.

      2  This statement informs the assembler that base register R1
         contains the base address, COMM_AREA, of this communication
         area. The next three statements define variables within the
         communication area.

      3  The first instruction shows how you can load registers
         with constant values in the range -32,768 to +32,767 by
         implicitly using R31 as the base register.

      4  The last three statements show how the .BASE directive
         allows you to implicitly reference base registers
         and automatically compute offsets. In each of these
         instructions, the second argument is defined to require
         an offset and a base register.

         Since no base register is specified, the assembler attempts
         to imply the base register and compute the offset based upon
         information given in previous .BASE directives.

         In the last three instructions, the address argument is
         within -32,768 to +32,767 of the base address known to
         be in R1 (that is, COMM_AREA). Therefore, R1 is selected
         as the base register. The assembler also computes the
         correct offset from the base address known to be in R1 to
         the address specified in the instruction argument.

      Example 2
      The assembler performs a sequential search through the list
      of possible base registers, R0 through R31. It uses the first
      definition possible if multiple base registers are valid. For
      example:

             .BASE R5, 300
             :
             LDQ  R10, 100

      The assembler outputs the LDQ instruction as follows:

             LDQ  R10, -200(R5)

      Both R31 and R5 are defined as base registers that can be used
      in constructing the instruction argument. R31 always contains
      0. In this example, R5 is also known to contain the constant
      300. The assembler uses the first base register, starting at
      R0 and progressing to R31, which provides a known value within
      -32,768 to +32,767 of the specified argument value. Since the
      assembler considers R5 before it considers R31, R5 is used
      rather than R31.
Close Help