HLASM - BAS = Branch And Save

The opcode of the BAS instruction is X'4D'.

Usage

  1. Branch to a subroutine in the current CSECT

Arguments

  1. Register to receive the return address.
  2. destination address (index, base, displacement).

Function

  1. The processor places the address of the byte following the BAS instruction (which is both the next sequential instruction address and the expected return address) in the first register.
  2. It branches to the destination address.
  3. The condition code does not change.

Special Cases

  1. Only if the processor is in Amode 31, then the high-order bit of the 32-bit return address will be set to 1.

Related Instructions

  1. BASR branches to a routine whose address is contained in a register.
  2. BCR is the preferred return instruction.
  3. BASSM branches to another routine that may need to be called in a different Amode.

Hardware

  1. The BAS instruction was introduced with the 370/XA architecture.

Remarks

  1. The PSW's Amode setting determines how many bits are used for the return and destination addresses.

Examples

         YREGS                          * Define register names
ENTRY    BASR  R15,R0                   * Obtain routine address
USEBASE  USING USEBASE,R15              * Make code addressable
         ...
         BAS   R14,SUBRTN               * Call subprogram
         ...
SUBRTN   DS    0H                       * Align routine to halfword
         ...                            * Subroutine logic goes here
         BR    R14                      * Return to caller
         ...

To the Opcodes Overview.
To the English Homepage for Hlasm.com.
To the General Homepage for Bixoft and Hlasm.com.

This site is a member of WebRing.
You are invited to browse the list of mainframe-loving sites.
Running Tyrannosaurus Rex Dinos are not dead. They are alive and well and living in data centers all around you. They speak in tongues and work strange magics with computers. Beware the dino! And just in case you're waiting for the final demise of these dino's: remember that dinos ruled the world for 155-million years!
Dinos and other anachronisms
[ Join Now | Ring Hub | Random | << Prev | Next >> ]
 

Below you find the logo of our sponsor and logos of the web-standards that this page adheres to.