11.07.2015 Views

HLASM: V1R6 Language Ref

HLASM: V1R6 Language Ref

HLASM: V1R6 Language Ref

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

AddressingBase Address Definition: The term base address is used throughout this manual tomean the location counter value within a control section, element, or part fromwhich the assembler can compute displacements to locations, or addresses. The baseaddress need not always be the storage address of a control section, element, orpart when it is loaded into storage at execution time.How to establish addressabilityTo establish the addressability of a control section, element, or part (see “Sections,elements, and parts” on page 51), you must:v Specify a base address from which the assembler can compute displacements tothe addresses within the control section, element, or part.v Assign the base registers to contain the base addresses.v Write the instructions that load the base registers with the base addresses.The following example shows the base address at MYPROG, that is assigned byregister 12. Register 12 is loaded with the value in register 15, which by conventionusually contains the storage address (set by the operating system) of the controlsection (CSECT) when the program is loaded into storage at execution time.MYPROG CSECT The base addressUSING MYPROG,12 Assign the base registerLR 12,15 Load the base addressSimilarly, you can use a BASR or similar instruction to put the address of thefollowing instruction into register 12.BASR 12,0USING *,12The USING instruction indicates that register 12 may be used as a base registercontaining that address.During assembly, the implicit addresses you code are converted into their explicitbase-displacement form; then, they are assembled into the object code of themachine instructions in which they have been coded.During execution, the base address is loaded into the base register.z/VM and z/OSIf you specify multiple classes, you must provide addressability for each element.For example, suppose you define two classes that must reference positions in theother:MYPROG CSECT ,CLASS_A CATTR RMODE(24) Define class CLASS_ABASR 12,0 Local base registerUSING *,12 Addressability for this element- - -L 1,Addr_B Address of BDATA in CLASS_BUSING BDATA,1- - -ADATA DS F Data in CLASS_AAddr_B DC A(BDATA)- - -CLASS_B CATTR RMODE(31) Define class CLASS_BBASR 11,0 Local base registerUSING *,11 Addressability for this element- - -L 2,Addr_A Address of ADATA in CLASS_AChapter 3. Program structures and addressing 63

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!