Re: Assembler Clarification

"peter.thingsted" <[email protected]>
Newsgroups gmane.comp.emulators.turnkey-mvs
Message-ID <[email protected]>
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.
>
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.