IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

Differences between BAL,BAS,BASSM


 
IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: :: View next topic  
Author Message
ganasrinivasan

New User


Joined: 06 Nov 2006
Posts: 27
Location: Montreal

PostPosted: Fri Nov 10, 2006 5:13 pm
Reply with quote

Can any one explain me the exact differences between BAL,BASSM,BAS?
Back to top
View user's profile Send private message
kalpana

New User


Joined: 19 Nov 2004
Posts: 24
Location: Banglore

PostPosted: Tue Nov 14, 2006 12:10 pm
Reply with quote

BAL stands for Branch and link

IF you give BAL 12,Rout means

First operand specified the address of NSI( Next sequential instruction will be loaded into 12 register and the second operand specifies that Rout -> it will branch to Rout

BALR 12,0

Here both operands are registers. Here the second operand is 0. it specifies no branching will takes place.

BAS stands for Branch and save


Unconditional branching and the possibility of returning to the branch point is performed by BAS.
The address of the next sequential instruction (NSI) is placed in the 1st-operand register. Subsequently a branch is made to the location given by a 2nd-operand label.
The instruction(s) is commonly used to branch to a subroutine with an expected return. Now to return, the help of the unconditional BR (Branch Register) instruction is needed (see the BC instruction).


BASSM

BASSm stands for Branch and save set mode
Back to top
View user's profile Send private message
vigneshs

New User


Joined: 07 Nov 2006
Posts: 1

PostPosted: Wed Nov 15, 2006 4:42 pm
Reply with quote

The exact differences of BAL, BAS and BASSM are explained below:

BAL is used in 24bit operating system and maintained in 32 bit also to maintain compatibility.

BAL stores the return address(24 bits) and the linkage information (Condition code, program mask and ICL (cond code length))

In 32 bit environment BAL is similar to BAS.

BAS - Branch and Save instruction stores the right half of the PSW (i.e., The return address). It does not set the addressing mode bit.
It is used when there is no change in the addressing mode.

In 32 bit environment usage of BAS is preferred than BAL.

BASSM - Branch and save set mode

It stores the right half of the PSW in the target register and sets the addressing mode in the higher order bit.

This is the basic info I have it.
If anybody have some more info plz append to this info.
Back to top
View user's profile Send private message
Shruthi Raghavan

New User


Joined: 17 Jan 2007
Posts: 9
Location: India

PostPosted: Tue Jan 23, 2007 4:00 pm
Reply with quote

I dont think that the BAL and BAS instructiuons has anything to do with the 24 or 31-bit addressing mode.
In both addressing mode either of the instructions can be used unlike what vighneshs says.
The pimary function of BAL and BAS instructions is to brach to the address specified by the 2nd operand but feore branching the addresss of the next sequentioal instruction will be saved in the 1st operand register.

when BAL is used in 24-bit addressing mode, the address of NSI(Next Sequential Instruction) is saved in the first operand register
and consists of
The instruction length code (ILC) in bits 0-1,
The condition code (CC) in bits 2-3,
The program mask in bits 4-7, and
The linkage address in bits 8-32.

In 31-bit mode, a 31-bit linkage address
is loaded and bit 0 is set to 1.

The difference in the two instructions is as follows:
The BAS instruiction doesnot save the ILC, CC and program mask in the 1-7 bits hence the BAS executes faster than the BAL.
For the same reason, BAS is used to branch to programs in the same addressing mode as the caller.
Back to top
View user's profile Send private message
sol

New User


Joined: 03 May 2020
Posts: 1
Location: United States

PostPosted: Sun May 03, 2020 8:15 pm
Reply with quote

The BAL and BALR branch and link instructions were designed for the regular IBM 360 mainframe hardware models.

The BAS and BASR Branch and Store instructions worked on the much smaller IBM 360/20 (and IBM 360/10?) which were card/printer based single unit devices (and a printer). I don't remember seeing tape or disk on them. They didn't support the BAL BALR instructions as they didn't have more than 16 bits worth of addressing or require the type of task switching used in the larger machines.
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 876
Location: Maryland

PostPosted: Sun May 03, 2020 9:24 pm
Reply with quote

ganasrinivasan wrote:
Can any one explain me the exact differences between BAL,BASSM,BAS?

The question is about differences only.

BAL is Branch And Link working in 24-bit environment, with all those limitations and restrictions on using address registers, PSW, e.a.

BAS and BASSM are functionally equivalent instructions adjusted to 31-bit addressing, and also to switch between two addressing modes.

This short explanation of differences is useless without a good understanding of all specifics of the two addressing modes.
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10695
Location: italy

PostPosted: Sun May 03, 2020 10:53 pm
Reply with quote

a new record ...

Quote:
Posted: Fri Nov 10, 2006 12:43 pm


resurrecting a 14 years old topic icon_cool.gif
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 863
Location: The Universe

PostPosted: Sun May 03, 2020 11:21 pm
Reply with quote

sol wrote:
... The BAS and BASR Branch and Store instructions worked on the much smaller IBM 360/20 (and IBM 360/10?) which were card/printer based single unit devices (and a printer). I don't remember seeing tape or disk on them. They didn't support the BAL BALR instructions as they didn't have more than 16 bits worth of addressing or require the type of task switching used in the larger machines.

360/10???? No such animal. And, yes, you could get both tape and disk on 360/20 machines. I saw, with my own eyes, tape, but never saw a /20 with disk.

BAS also existed on the 360/67 for use in the /67 AMODE 32 - yes, Virginia, there was such an animal. It could also be RPQed on the 370/168 to support TSS/370, another rare animal. As has been noted, it was fully resurrected for 370 "Extended architecture" (XA) machines.

As has been noted, BAL stores the instruction length code, condition code and program mask in the link register in AMODE 24; in the 360/20 there was no room for this data in the link register, as was also true for the 360/67 run in AMODE 32. I recall how disappointed I was when the original 370 virtual storage hardware only had AMODE 24.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 863
Location: The Universe

PostPosted: Mon May 04, 2020 10:05 am
Reply with quote

To illustrate the differences between Branch and Link and Branch and Save I wrote the following -
Code:
         MACRO
&NAME    NEWSAVE &ADDR
&NAME    LR    15,13               COPY SAVE AREA ADDRESS TO REG 15
         AIF   ('&ADDR' EQ '').STACK
         LA    13,&ADDR            COMPUTE NEW SAVE AREA ADDRESS
         AGO   .CHAIN
.STACK   LA    13,72(,13)          COMPUTE NEW SAVE AREA ADDRESS
.CHAIN   ST    13,8(,15)           ADD NEW SAVE AREA TO THE
         ST    15,4(,13)            SAVE AREA CHAIN
         MEND
MAIN     CSECT
         USING *,12
         SAVE  (14,12),,*
         LR    12,15
         NEWSAVE SAVEAREA
         OPEN  (PRINT,OUTPUT)
         MVC   AM,=C'24'
         PUT   PRINT,AMLINE
         BAL   14,RUN
         MVC   AM,=C'31'
         PUT   PRINT,AMLINE
         SAM31
         BAL   14,RUN
         CLOSE PRINT
         L     13,4(,13)
         RETURN (14,12),RC=0
         CNOP  0,8
RUN      BASR  15,0
         SAVE  (14,1),,RUN
         NEWSAVE ,
         MVC   OPCODE,=CL4'BALR'
         LA    15,LISTLINK
         BALR  14,15
         MVC   OPCODE,=CL4'BAL'
         BAL   14,LISTLINK
         MVC   OPCODE,=CL4'BASR'
         LA    15,LISTLINK
         BASR  14,15
         MVC   OPCODE,=CL4'BAS'
         BAS   14,LISTLINK
         L     13,4(,13)
         RETURN (14,1)
         CNOP  0,8
LISTLINK BASR  15,0
         SAVE  (14,1),,LISTLINK
         NEWSAVE ,
         L     15,4(,13)
         UNPK  LINKREG(9),12(5,15)
         TR    LINKREG,HEXTAB
         PUT   PRINT,LINKLINE
         L     13,4(,13)
         RETURN (14,1)
         PRINT NOGEN
PRINT    DCB   DSORG=PS,MACRF=PM,DDNAME=SYSPRINT,RECFM=VBA,LRECL=125
AMLINE   DC    AL2(AML,0),C' AM '
AM       DC    CL2' '
AML      EQU   *-AMLINE
LINKLINE DC    AL2(LINKL,0),C' '
OPCODE   DC    CL4' ',C' '
LINKREG  DC    CL8' '
LINKL    EQU   *-LINKLINE
         DC    C' '
SAVEAREA DC    (3*9)D'0'
HEXTAB   EQU   *-C'0'
         DC    C'0123456789ABCDEF'
         LTORG ,
         END   MAIN
For those not familiar with Assembler there are three functions in this program. The MAIN function sets the AMODE, 24 or 31, and calls the RUN function (using the BAL instruction, though that does not matter here). The RUN function calls the LISTLINK function to display the link register using the BALR, BAL, BASR and BAS instructions. The output is -
Code:
AM 24
BALR 500370A0
BAL  900370AA
BASR 000370B6
BAS  000370C0
AM 31
BALR 800370A0
BAL  800370AA
BASR 800370B6
BAS  800370C0
In AMODE 24, the instruction length code, condition code and program mask are in the high order 8 bits of the link register. 50 is 01 01 0000, Instruction length code 01 means BALR is a 2 byte instruction. 90 is 10 01 0000, so BAL is a 4 byte instruction.

Branch and Save does not leave an instruction length code; this area is 00 in AMODE 24 and 10 in AMODE 31, which reflects the AMODE.

While I rather doubt anyone will respond, if an EX instruction executes a BALR instruction in AMODE 24, what will be the instruction length code, and why? Tuesday or Wednesday I'll respond with the answer.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 863
Location: The Universe

PostPosted: Wed May 06, 2020 8:13 am
Reply with quote

steve-myers wrote:
... if an EX instruction executes a BALR instruction in AMODE 24, what will be the instruction length code, and why? Tuesday or Wednesday I'll respond with the answer.
The instruction length code wil be B'10' because you get the ILC of the EX instruction, but the BALR instruction.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts Differences between copying members b... TSO/ISPF 8
No new posts Differences between z/VM REXX and TSO... CLIST & REXX 4
No new posts Display differences between current a... DFSORT/ICETOOL 6
No new posts Plan table differences - trying to im... DB2 5
No new posts Calling module using BASSM PL/I & Assembler 8

Back to Top