Portal | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
LA instruction in assembler

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
janishyathi bonam

New User


Joined: 05 May 2020
Posts: 2
Location: USA

PostPosted: Tue May 05, 2020 8:17 am    Post subject: LA instruction in assembler
Reply with quote

Hi!
I'm trying to LA R1,5000 and it says invalid displacement. Is there a limit to the value of the second operand? How can I achieve this?
Back to top
View user's profile Send private message

steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 860
Location: The Universe

PostPosted: Tue May 05, 2020 9:52 am    Post subject:
Reply with quote

Yes, there is a limit: 4095. There are at least three ways to achieve your goal.
  • Two LA instructions, for example
    Code:
             LA    R1,2500
             LA    R1,2500(,R1)

    Dinosaurs like me would use this solution. The actual immediate values can be anything that adds to 5000; they do not have be 2500.
  • LHI instruction
    Code:
             LHI   R1,5000

    This solution uses just 4 bytes.
  • LGFI instruction
    Code:
             LGFI  1,5000

    This is hidden in Principles of Operation, but the sign of the immediate value is extended to bits 0 through 31 of the register. This solution uses 6 bytes.
Back to top
View user's profile Send private message
janishyathi bonam

New User


Joined: 05 May 2020
Posts: 2
Location: USA

PostPosted: Tue May 05, 2020 9:56 am    Post subject:
Reply with quote

Thank you!!
Back to top
View user's profile Send private message
Ravi GA

New User


Joined: 20 Mar 2020
Posts: 7
Location: India

PostPosted: Tue May 05, 2020 10:47 am    Post subject: Re: LA instruction in assembler
Reply with quote

janishyathi bonam wrote:
Hi!
I'm trying to LA R1,5000 and it says invalid displacement. Is there a limit to the value of the second operand? How can I achieve this?


LAY R1,5000 is one more way to load values greater than 4095.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 860
Location: The Universe

PostPosted: Tue May 05, 2020 11:43 am    Post subject: Re: LA instruction in assembler
Reply with quote

Ravi GA wrote:
... LAY R1,5000 is one more way to load values greater than 4095.
Yes, indeed. I had forgotten about LAY. I would suggest you read Principles of Operation very carefully before using 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 Learning about Systems Assembler prog... WilliamDownie PL/I & Assembler 5 Mon Jul 20, 2020 3:27 pm
No new posts Using L' to get length of instruction WilliamDownie PL/I & Assembler 1 Thu Jul 09, 2020 9:20 pm
No new posts TSO and the STAX Assembler Macro mxgdontmics PL/I & Assembler 43 Mon Jun 15, 2020 10:33 am
No new posts Mainframe ASSEMBLER LEARNING MANUAL w... upendrasri PL/I & Assembler 2 Tue May 05, 2020 11:42 am
No new posts Debug set up for COBOL module but ope... elixir1986 IBM Tools 1 Sun Dec 22, 2019 12:05 am

Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us