100 likes | 209 Views
LA. 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. What does it do?. LA 8,Y. R8. 00 12 3D 8A (Before). R8.
E N D
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
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
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
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)
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)
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?
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
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)
Try it in VisibleZ • Try the following programs: • la.obj