Re: Re: Where do I start?

Ron Hudson <[email protected]> Wed, 26 May 2010 20:52:34 -0700
Newsgroups gmane.comp.emulators.turnkey-mvs
Message-ID <[email protected]>
Thanks, This is helpful - I have added it all to my notes

On Wed, May 26, 2010 at 6:11 PM, Gerhard Postpischil
<[email protected]>wrote:

>
>
> On 5/26/2010 6:59 PM, Ron Hudson wrote:
> > Well actually I know of the concepts - but the implementation gets me in
> > trouble with
> > "G" : ^ ) .. I know what I want to tell the machine - I just don't know
> > how to say it.
> >
> > For Example: A base register is a register holding an address that is
> > modified by an index or indexes to form a pointer. Usually a base
> > register points to the zero'th array element or the first element in a
> > buffer. A changeable index is added to the base register to access other
> > parts of the buffer or elements in the array.
>
> Yes and no. If you recall the reserved registers used for
> standard linkage, you'll note that R15 should contain the
> address of the invoked program. In order for your program to use
> branch instructions, it needs a base and offset, as you have
> above. However, in order to have branch instructions resolve
> correctly, you also need to tell the Assembler what to use for
> the base. A simple program might look like:
>
> MYCODE TITLE 'This is a test of the TPUT/TGET service'  <---   An assembler
> directive?
> MYCODE CSECT , tells Assembler you're starting something
> USING *,15 caller's set base
> <----------------------------------------------- What does the * mean?
> B BEGIN branch around program id
> DC AL1(17),CL17   'progname &SYSDATE'   <-------------------- What's this
> here?
> BEGIN STM 14,12,12(13) SAVE IN CALLER'S AREA
> LR 12,15 COPY TO LESS VOLATILE REGISTER
> DROP 15 NO LONGER NEEDED  <--- drop - that's a new one, is it the opposite
> of a 'using'?
>

So, the base register is the one that is wearing the "base register hat" at
any given moment.
You put the hat on a given register with the "using" instruction and take
the hat away with
the "drop" instruction?

What happens if there are two using instructions that promote different
registers without
a drop?

Between these two lines is the program without a base register?

Would I even need to branch to a specific address in memory?
Or all branches relative to the base address?
Shared Libraries?


> USING MYCODE,12 NEW BASE FOR BRANCHES
> LA 9,LOCSAVE IF NEEDED <----------------------------------------- the
> address of LOCSAVE goes into R9?
> ST 9,8(,13) DOWNLINK
> ST 13,4(,9) UPLINK
> LR 13,9 PROGRAM'S SAVE AREA
> ... your code
>
> pgmexit L 13,4(,13) USER'S AREA
> LM 14,12,12(13) RESTORE
> DROP 12
> LA 15,0 return code 0-up
> BR 14 exit pgm
> SPACE 1
> LOCSAVE DC 18F'0'
> LTORG , for =C'###' etc.
> END
>
> There are other ways of doing everything, but that's the basic
> linkage and base code.
>
> Also note that when TSO gives an error message with a ?, hitting
> enter will produce one or more additional messages.
>
> Gerhard Postpischil
> Bradford, VT
>  
>