MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Assembler: Difference btn L and LA while using values

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
rnanavaty
Beginner


Joined: 12 Apr 2006
Posts: 29
Topics: 20

PostPosted: Fri Oct 30, 2009 4:45 am    Post subject: Assembler: Difference btn L and LA while using values Reply with quote

Hi,

Can you tell me what is the difference between L and LA instructionin MVS assembely while using constant as second operand even though they perform the same operation ?

For example: L R3,5
and LA R3,5

Both will load value 5 in register R3

And what should be used at what time?
Back to top
View user's profile Send private message
Bill Dennis
Advanced


Joined: 03 Dec 2002
Posts: 579
Topics: 1
Location: Iowa, USA

PostPosted: Fri Oct 30, 2009 8:28 am    Post subject: Re: Assembler: Difference btn L and LA while using values Reply with quote

rnanavaty wrote:
Both will load value 5 in register R3


Why do you say this? Have you tested your theory? You need more study in the z/OS Principles of Operation.
_________________
Regards,
Bill Dennis

Disclaimer: My comments on this foorum are my own and do not represent the opinions or suggestions of any other person or business entity.
Back to top
View user's profile Send private message
rnanavaty
Beginner


Joined: 12 Apr 2006
Posts: 29
Topics: 20

PostPosted: Mon Nov 02, 2009 1:48 am    Post subject: Reply with quote

See the link http://publib.boulder.ibm.com/infocenter/tivihelp/v1r1/index.jsp?topic=/com.ibm.itsm390n.doc/anrzgd55664.htm

Here also in the sample code instruction
LA R7,8 Gonna loop 8 times

is used to move 8 to register R7. can you explain it pls?
Back to top
View user's profile Send private message
RonB
Beginner


Joined: 02 Dec 2002
Posts: 93
Topics: 0
Location: Orlando, FL

PostPosted: Mon Nov 02, 2009 7:43 am    Post subject: Reply with quote

R7 is being initialized in preperation for the

BCT R7,LOOP1 Loop 8 times (Reg7 init to 8 )

instruction that follows.
The BCT ( Branch on Count ) instruction subtracts 1 from the indicated Register, and, if the resulting value in the Register is NOT zero, takes the indicated branch. So, in this case, since the instruction set following the LA R7,8 is performed 8 times - once before hitting the BCT, and seven more times following the BCT ( that is, when its execution results in values of 7,6,5,4,3,2, and 1 ).
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Mon Nov 02, 2009 3:14 pm    Post subject: Reply with quote

You need to do as Bill suggested and spend some time doing the proper research.

The Load (L) and Load Address (LA) instructions are NOT the same - even though in some situations the same result happens. . .

As we said many years ago:

Rookie: What
_________________
All the best,

di
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Mon Nov 02, 2009 3:29 pm    Post subject: Reply with quote

I think what people are referring to is that you should study how the the different instruction formats are represented in machine code and how assembler instructions get translated to machine code. Each instruction in the Principle of Operations has a description of the various parts of the machine code that is generated.

When you see how the instructions are represented in storage, you will see why this appears to work the same, but why it is a dangerous thing to assume. (hint : see how register 0 works in addressability). It will also be the 1st step in being able to read dumps without the original source code (if you ever care to do that -- most people don't Smile ).
_________________
New members are encouraged to read the How To Ask Questions The Smart Way FAQ at http://www.catb.org/~esr/faqs/smart-questions.html.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group