Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Query regarding registers .

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
Pankaj Shrivastava
Currently Banned

New User


Joined: 24 Jul 2009
Posts: 51
Location: Pune

PostPosted: Mon Jul 27, 2009 6:54 pm    Post subject: Query regarding registers .
Reply with quote

Hi All ,

This could be a very basic question , But conceptually I have no clue about the real story at the the hardware level .
When we say that we are working with registers of machine , Does this mean that a particular register is exclusively used by the program at a time . If yes ..then how does maniframe operates so many program at the same time using a set of registers , And if No then how does it cater to so many programs running using a limited number of registers .

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

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8055
Location: East Dubuque, Illinois, USA

PostPosted: Mon Jul 27, 2009 7:06 pm    Post subject:
Reply with quote

You may want to find a copy of the z/Architecture Principles of Operation and read it for a while. When the system stops executing an address space and starts executing another one, memory (which includes the registers) is stored for the old address space, then loaded for the new address space. So every program running has its own complete set of registers that remain uniquely assigned for it.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Mon Jul 27, 2009 7:07 pm    Post subject: Reply to: Query regarding registers .
Reply with quote

In Assembler application programs, unless you know what you're doing, don't use R0, R1, R13, R14 and R15 as they are used by System Level Services/Macros, etc (except R13), but R13 contains the address of the current program's 18 word savearea and you need to leave this register alone as well.

Also, if this is a sub-program called by a HLL which is LE compliant, avoid using R12 because it normally contains the address of the LE "CAA" (Common Anchor Area).

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

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Tue Nov 30, 2010 3:16 pm    Post subject:
Reply with quote

I'm new to Assembler, please allow me to ask a stupid question:
I find almost in all sub program, below segment is coded:
Code:
STM R14,R12,12(R13)

I know this is storing the register contents of calling program to Register 13, but why it's always 12(R13) rather than 4(R13),8(R13)?

Thanks for your kind reply in advance!
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8055
Location: East Dubuque, Illinois, USA

PostPosted: Tue Nov 30, 2010 5:15 pm    Post subject:
Reply with quote

The Assembler save area linkage convention requires it. The first 4 bytes of the save area are reserved, followed by 4 bytes of previous save area address, followed by 4 bytes of next save area address, followed by registers. Since the first 12 bytes are reserved, the registers must be stored at offset 12(R13). If properly constructed, the address of the save area IN YOUR PROGRAM will be stored at 8(R13).
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Nov 30, 2010 10:08 pm    Post subject:
Reply with quote

Hello,

Every assembler module you write should follow the standard linkage conventions. To do otherwise can cause all sorts of problems when modules call or are called by other modules.

There is more than the single instructoin and there should also be code that is executed when your code returns control to whatever invoked it.

Many organizations have macros defined for this purpose.
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Wed Dec 01, 2010 7:52 am    Post subject:
Reply with quote

Thank you very much!
I'll remember it.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Omegamon for DB2 query ashek15 DB2 0 Wed Feb 15, 2017 11:25 am
No new posts Query on DB2 WLM stored procedures ashek15 DB2 8 Sun Feb 12, 2017 11:13 pm
No new posts GETMAIN/FREEMAIN query Suja.Sai CICS 9 Tue Jan 31, 2017 12:01 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us