360 Assembly/360 Instructions/USING

< 360 Assembly < 360 Instructions

The USING pseudo-instruction is used to inform the assembler of the contents of various registers which are to be used in base-displacement addressing. It does not generate any executable instructions, it provides information to the assembler.

The format for the USING pseudo-instruction is:

USING address,register1[,register2[,...]]

Register1 can be any of the general purpose registers 1 through 15. It tells the assembler that this register has been loaded with the address specified as the first parameter. Because many instructions - including branch instructions - treat register 0 as a non-action or containing the actual value 0, register 0 should not be used for this purpose. A second (or subsequent) register, indicated by the parameter register2 optionally provides a second base register, and is presumed to contain the address of the first parameter plus 4096. Each subsequent register, if specified, is presumed by the assembler tocontaino the address 4096 above the address specified in the preceding register

Example:

PROG     START 0
         BALR  12,0
         USING *,12,11
         LA    11,4095(12)
         LA    11,1(11)

In the above example, the USING pseudo-instruction tells the assembler that register 12 is established as the base register for the first 4096 bytes of this module, and that register 11 is established for the second 4096 bytes. After register 12 has been loaded with the current address through the BALR instruction, register 11 is loaded with the address 4096 bytes later in the program. Note that this uses the older LA instruction, which cannot add more than 4095 to the value contained in a register, so two LA instructions must be used. While this combination of instructions will work on all models of IBM hardware as well as competitor's equipment, later versions of IBM hardware such as the z/Series provide more efficient instructions for this purpose.

By convention

Address can be * for the current program counter, or it can be a label in the current module, or a label plus a value. This allows the assembler to know which base register to use for references to addresses in the current module. It may also be used when referencing a DSECT to assign to labels used in the DSECT a base/displacement address.

A main program (i.e. not a subroutine which has a base register loaded by the caller) would use the BALR or BASR instruction to load the contents of a base register, then issue a USING pseudo-instruction to inform the assembler that the particular register was available as a base register.

 
360 Assembler Pseudo Instructions
Address Related ADATA CNOP DROP EQU LOCTR LTORG ORG USING
Code Related ALIAS AMODE CATTR COM CSECT CXD DSECT DXD END ENTRY EXTRN OPSYN RMODE RSECT START WXTRN XATTR
Data Related CCW CCW0 CCW1 DC DS
Conditional Assembly and Macro related ACTR AGO AIF AINSERT ANOP AREAD COPY GBLA / GBLB / GBLC LCLA / LCLB / LCLC MACRO MEND MEXIT MNOTE SETA / SETB / SETC
Listing, output and source related Comments *PROCESS ACONTROL EJECT END EXITCTL ICTL ISEQ POP PRINT PUNCH PUSH REPRO SPACE TITLE
 
360 Assembly Language
360 Family Introduction · Basic FAQ · 360 Family · 360 Architecture
360 Instruction Set 360 Instructions · Branch Instructions · Data Transfer Instructions · Control Flow Instructions · Arithmetic Instructions · Logic Instructions · Shift and Rotate Instructions · Other Instructions
Syntaxes and Assemblers 360 Assemblers· Pseudo Instructions
Instruction Extensions Floating Point · High-Level Languages
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.