Looking more at the description of the problem, you want to use BSM to return
no matter how called, where the mode you wish to return in is the same at
entry to the routine.

The following sequence will do it much more easily:

         LA    14,0(,14)           Fix-up address (in case 24 bit)
         BSM   14,0                Now BSM 0,14 will restore the current amode

Simple. 



On Tue, 11 Aug 2020 13:57:23 -0400 Tony Thigpen <t...@vse2pdf.com> wrote:

:>I came across the following code today. The program can either be called 
:>by JCL or from either an HLL or assembler program. While I included some 
:>extra code for clarity, the code I am asking for comments on is the code 
:>that 'fixes' R14 so that a BSM can be used instead of a BR. I just 
:>thought I would ask what others think about this method.
:>
:>XXXXXXXX CSECT
:>XXXXXXXX AMODE ANY
:>XXXXXXXX RMODE 24   SOME IBM CODE IN HERE MAY REQUIRE R24
:>          USING XXXXXXXX,R15
:>          B     COPYRGHTEND
:>......
:>COPYRGHTEND DS 0D
:>          STM   R14,R12,12(R13)     SAVE CALLERS REGISTERS
:>          BCTR  R14,0               BACKUP TO CALLING INST
:>          BCTR  R14,0                 .
:>          CLI   0(R14),X'0C'        BASSM?
:>          BE    R14_OK
:>          CLI   0(R14),X'0D'        BSM?
:>          BE    R14_OK
:>          L     R14,12(,R13)        GET ORG R14
:>          LA    R14,0(,R14)         CLEAR HI BIT/BYTE
:>          BSM   R14,0               ADD PROPER AMODE
:>          ST    R14,12(,R13)        SET R14 FOR RETURN BY BSM
:>R14_OK   DS    0H
:>          DROP  R15
:>          LA    R1,SAVEAREA
:>          ST    R1,8(,R13)          FORWARD POINTER
:>          ST    R13,4(,R1)          BACKWARD POINTER
:>          LR    R13,R1              ESTABLISH PERM R13 AREA
:>          L     R1,4(,R13)          GET BACK ORG R0 & R1
:>          LM    R0,R1,20(R1)          FROM ORG SAVEAREA
:>*
:>          LA    R8,0(,R15)          ESTABLISH ADDRESSABILITY
:>          LA    R15,1                 .
:>          LA    R10,4095(R15,R8)      .
:>          USING XXXXXXXX,R8,R10       .
:>
:>The return code is:
:>RETURNR15 DS   0H
:>          L     R1,4(,R13)          GET CALLER SAVE AREA ADDRESS
:>          ST    R15,16(,R1)         SAVE RETURN CODE
:>          LM    R14,R12,12(R13)     RESTORE REGISTERS
:>          BSM   0,R14               GO BACK
:>
:>Tony Thigpen

--
Binyamin Dissen <bdis...@dissensoftware.com>
http://www.dissensoftware.com

Director, Dissen Software, Bar & Grill - Israel


Should you use the mailblocks package and expect a response from me,
you should preauthorize the dissensoftware.com domain.

I very rarely bother responding to challenge/response systems,
especially those from irresponsible companies.

Reply via email to