IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Addressablility question in assmbler


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

Active User


Joined: 09 Jun 2014
Posts: 125
Location: US

PostPosted: Mon May 11, 2015 8:21 pm
Reply with quote

Hi ,

When i read the book the format to establish the addressability is using following code :

Code:
BALR 12,0
USING *,12


And book siad BALR is used to actually write the address into R12 at run time. But when i read the following exit code , i got two questions.
1. In this code , it not use BALR ,how to put address in R12 at run time ?
2. Why it use two USING here ? get two different address for base address? why?

Code:
                EJECT                                                         
TMSXITC  CSECT ,                                                       
TMSXITC  AMODE 31                                                     
TMSXITC  RMODE ANY                                                     
         TMMLINK ENTRY,BASE=(R12),EQUS=YES,                           
                        DATA=WORKAREA,                                         
                        SYSMOD=CAL0C60                                   CAL0C60
                EJECT                                                         
                SPACE 2                                                       
                LR          R8,R1                       PARAMETER LIST                       
                USING    UX0CPARM,R8          ADDRESSABILITY                       
                LM         R9,R11,UX0CPARM    LOAD ALL PARAMETERS                 
                USING   TMRECST,R10            ADDRESSABILITY                       
                LTR        R11,R11                   Q. IS THIS A MULTI-VOLUME           
                BNZ       MULTIVOL              A. YES, COPY ONLY CERTAIN ELDS     



Thanks
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon May 11, 2015 8:29 pm
Reply with quote

Since it is a run-time thing, it does not matter how the correct address is stored where it is needed, just that it is.

For the "why two USINGs" you should explore the difference between USING *,.. and USING somename,...

You also need to know exactly what BALR x,0 actually does. You'll see lots of other use of BALR that are nothing to do with this specific, conventional, use.
Back to top
View user's profile Send private message
jackzhang75

Active User


Joined: 09 Jun 2014
Posts: 125
Location: US

PostPosted: Mon May 11, 2015 8:51 pm
Reply with quote

Hi Bill,

Thanks for your asnwer. as you siad "Since it is a run-time thing, it does not matter how the correct address is stored where it is needed, just that it is."

Why it does matter the correct address is used otherwise it cant find where is the program ?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon May 11, 2015 8:55 pm
Reply with quote

Yes, if you use an incorrect address, naturally you won't be using the correct data (except in very rare coincidences).
Back to top
View user's profile Send private message
steve-myers

Active Member


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

PostPosted: Mon May 11, 2015 10:07 pm
Reply with quote

Actually, there are at least 3 base registers -

R12, established by the TMMLINK macro, to provide addressability for the exit. The address in R12 is established by the TMMLINK macro. There are - usually - two ways to initialize a base register for a program.
  1. Use the module's address. The convention in all operating systems derived from OS/360 is that register 15 contains the address of the module when it is entered, so you see something like this -
    Code:
    AMODULE  CSECT
             USING *,R12
             SAVE  (14,12),,*
             LR    R12,R15
             ...
    Some expansions of the SAVE macro, by the way, and including the one used here, assume register 15 contains the address of the first instruction of the SAVE macro.
  2. If you are unwilling to trust the common rule, you store the address yourself -
    Code:
    AMODULE  CSECT
             SAVE  (14,12),,*
             BALR  R12,0
             USING *,R12
You can determine the convention used by TMMLINK by reviewing its expansion

R8, to provide addressability to the parameter list built by the exit's caller. In turn, the data in R8 was copied from R1. At a guess the module that called TMSXITC stored the address in R1.

R10, to provide addressability to a data area defined by the TMRECST DSECT. Its address is in the parameter list.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Question for file manager IBM Tools 7
No new posts question for Pedro TSO/ISPF 2
No new posts question on Outrec and sort #Digvijay DFSORT/ICETOOL 20
No new posts panel creation question TSO/ISPF 12
No new posts Sort w/OUTREC Question DFSORT/ICETOOL 2
Search our Forums:

Back to Top