1 / 10

Understanding the LA Instruction in Assembly Language Programming

This guide provides a comprehensive overview of the LA (Load Address) instruction within assembly language programming. It details how to use LA effectively for loading addresses into registers, illustrating the process with examples. The differences between LA and L (Load) are clarified, highlighting the importance of correctly identifying when to use each. Additional programming tips aid in avoiding common mistakes during coding. Example scenarios demonstrate how to manipulate registers and memory effectively, assisting learners in grasping the concept of address loading in assembly language.

adonis
Télécharger la présentation

Understanding the LA Instruction in Assembly Language Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. LA

  2. LA • Instruction type: RX • Explicit Coding: L1,D2(X2,B2) • Example LA 5,3(4,5) • Example LA 8,TABLE(7) • Use: Creates an address (operand 2) which is loaded into the operand 1 register

  3. What does it do? LA 8,Y R8 00 12 3D 8A (Before) R8 00 00 10 04 (After) Memory F1 F2 F3 F4 F5 F6 F7 F8 F9 Address X’1000’ Y

  4. What does it do? LA 8,Y(9) (Before) R8 00 12 3D 8A R9 00 00 00 04 R8 00 00 10 08 (After) Memory F1 F2 F3 F4 F5 F6 F7 F8 F9 Address X’1000’ Y

  5. What does it do? LA 7,5(8,9) (Before) R8 00 00 20 00 R9 00 00 10 00 R7 00 00 12 34 R7 00 00 30 05 (After)

  6. What does it do? LA 7,5(0,9) or LA 7,5(,9) R8 00 00 20 00 R9 00 00 10 00 (Before) R7 00 00 12 34 R7 00 00 10 05 (After)

  7. What does it do? LA 7,5 or LA 7,5(0,0) (Before) R7 00 00 12 34 R7 00 00 00 05 (After) This is an effective way to load a “small” number into a register. Small means < 4096. Why?

  8. LA • Example use: Assume: TABLE DC F ‘1’ Assume address 1000 DC F ‘2’ DC F ‘3’ TABENTRY DS F You execute: LA R7,4 LA R8,TABLE LA R9,4(R7,R8) MCV TABENTRY(L’TABLE),0(R9) R9 After: 00001008

  9. Programming Tips • It’s easy to make a simple mistake by coding L for LA or LA for L. Give it a moment’s extra thought when you code these. Do you want an address (LA)? Or do you want the contents at an address (L)? • LA is often used for loading multiple base registers: BASR R12,R0 USING *,R12,R11 LA R11,2048 LA R11,2048(R11,R12)

  10. Try it in VisibleZ • Try the following programs: • la.obj

More Related