Re: Re: Assembler Clarification

Mike Schwab <[email protected]>
Newsgroups gmane.comp.emulators.turnkey-mvs
Message-ID <[email protected]>
Where you store the registers is called a save area.  These are
forward and backward linked like a stack.  For Open System Services, a
hardware stack was added in OS/390.

Upon Entry,
R0 can be used as a binary number, but is evaluated as 0 as an address value.
R1 points to a list of addresses to the parameters, the high order bit
is set to 1 for the last 24/31 bit address.
R2 is used by some instructions and an alternative cannot be coded..
R2-12 can be used as base registers.
R13 points to the previous save area, which you use to store the registers.
R14 points to the return address, where you branch when you are done.
R15 points to the entry address, the first instruction in your program.
R2 is used by some instructions.
R2-12 can be used as base registers.
R15 is used as a base address until you get your own going.

On Sun, May 9, 2010 at 9:01 PM, Ron Hudson <[email protected]> wrote:
>
>
> The return address is stored in a register? No recursion... right?
>
> Is there a stack?
>
>
> On Sun, May 9, 2010 at 2:16 PM, peter.thingsted <[email protected]> wrote:
>>
>>
>>
>> The first thing a program needs to do is to save the contents of the general registers (16 of them ) in memory.
>>
>> The general registers are to be thought of as separate electronic pieces of storage - outside the main storage.
>>
>> You need to save the contents of these registers when your program starts running, and restore them after your program has finished doing whatever it is programmed to do.
>>
>> One register (14) is especially important to preserve, because it contains the return address of the calling program, i.e. the program that was running just before your assembler program. So the very last instruction in your program should be a BR 14, i.e branch to the machine instruction stored in the memory location that register 14 poinded to when YOUR program took over.
>>
>> You can play with one register for good effects just before your BR 14 instucton. You can put a value in register 15, e.g. a big fat zero by coding SR 15,15. This signals that all ended well. It is customary (but not required or in any way enforced) that you can put various powers of 2 into reg 15 to signal any number of abnormal situations thet your program detected.
>>
>> The latter here is part of what we call the linkage conventions. Note that they are conventions not enforced by any part of MVS - but you best know these conventions otherwise your program wil not cooperate well with all the other programs that taken together constitute the MVS sustem.
>>
>> Rgs,
>>
>> Peter
>> mvsaudit.org
>>
>> --- In [email protected], Ron Hudson <hudson.ra@...> wrote:
>> >
>> > Hey Wizards of Assembly Language..
>> >
>> > It looks to me like one of the first things a program does in setting up
>> > it's own environment
>> > is tell the CPU where to put the registers? Are do the registers actually
>> > reside in memory?
>> > Does each program get it's own set of registers? Gee that would make context
>> > changes
>> > really easy..
>> >
>> > (Not starting assembly language just yet but interested...)
>> >
>> > Thanks.
>> >
>>
>
>
>
> 


--
Mike A Schwab, Springfield IL USA
Where do Forest Rangers go to get away from it all?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.