Why use an LA instruction? 
Author Message
 Why use an LA instruction?

I was disassembling a program (not copyrighted!) a while ago and found it
starting with the instructions below.  I understand all of it but the LA.
Can someone shed some light on its purpose?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


Allegheny College      (814) 332-5304
Meadville, PA          (814) 332-5366

PROGRAM  BALR  4,0                load base register
         BCTR  4,0                back off one byte to point
         BCTR  4,0                to label at start of program
         LA    4,0(0,4)           ???????



Fri, 20 Aug 1993 18:38:14 GMT  
 Why use an LA instruction?
This practice (LA 4,0(0,4)) is Not Recommended in these days of MVS/XA
and 31-bit addressing. On a 24-bit (MVS/370-mode) machine, this would
clear out the high byte (which has stuff put in it by the BALR
instruction - I've forgotten what, exactly, now). On a 31-bit machine,
it simply clears the high bit.

In the current case, it might not be so bad. But why the programmer
didn't just use LR R4,R15 / USING WHATNOT,R4 is beyond me. Perhaps
this is an entry into the Unclear Assembler contest? :-)

 --- Joe M.



Sat, 21 Aug 1993 00:32:35 GMT  
 Why use an LA instruction?
On Mon, 4 Mar 91 10:38:14 GMT Pete Gifford said:
Quote:
>..starting with the instructions below. I understand all of it but the LA.
>Can someone shed some light on its purpose?
>PROGRAM  BALR  4,0                load base register
>         BCTR  4,0                back off one byte to point
>         BCTR  4,0                to label at start of program
>         LA    4,0(0,4)           ???????

Whoever wrote this had something in mind - there're rumors that there's been a
time when one of the major goals  in software writing was "just to confuse the
Russians".
Well, the  LA clears bits 0-7  (24bit mode) or  bit 0 (31bit mode)  to zeroes.
Still this  could be  done without  the BCTR instruction  (given that  you are
happy with the base register offset 2 bytes from the entry point).
Christian


Sat, 21 Aug 1993 08:50:09 GMT  
 Why use an LA instruction?
RFC-822-HEADERS:
Newsgroups: comp.lang.asm370
Organization: Ciba-Geigy AG, Basel, Switzerland

==================

hello

the only effect of the la instruction is to clear bit 0-7, if you are in 24-
bit - addressing mode. if you are in 31-bit addressing mode, then it clears
only bit 0.

if you have any more questions, look at the ibm manual pricnciples of
 operation (sa22-7200-0). there you will find explanations to all valid
instructions of the ibm 370 and 390 architexture.

regards
rainer



Mon, 23 Aug 1993 21:47:00 GMT  
 Why use an LA instruction?
It's a trick.  BALR loads the program mask into the lowest nibble of r4...or it
        used to.   I'll bet the LA 4,0(0,4) is just there to zero out the
        program mask.
This is not good code, as the program mask being loaded depends on the operating
systems (doesn't work that way in MVS/XA or MVS/ESA).

James



Tue, 24 Aug 1993 02:13:04 GMT  
 Why use an LA instruction?
It's a trick.  BALR loads the program mask into the lowest nibble of r4...or it used to.   I'll bet the LA 4,0(0,4) is just there to zero out the program mask.
This is not good code, as the program mask being loaded depends on the operating
systems (doesn't work that way in MVS/XA or MVS/ESA).

James



Tue, 24 Aug 1993 02:13:04 GMT  
 Why use an LA instruction?
If the instruction

         LA    x,0(0,x)

is understood to mean "zero all non-address bits in register x" then
it works perfectly well for all addressing modes and all operating
systems.  In fact it is the best way to accomplish this since it
automatically adjusts to the addressing mode being used.

Brian Eliot
Information Technology Services
Rensselaer Polytechnic Institute



Tue, 24 Aug 1993 06:31:46 GMT  
 Why use an LA instruction?

Quote:

>I was disassembling a program (not copyrighted!) a while ago and found it
>starting with the instructions below.  I understand all of it but the LA.
>Can someone shed some light on its purpose?
>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


>Allegheny College      (814) 332-5304
>Meadville, PA          (814) 332-5366
>PROGRAM  BALR  4,0                load base register
>         BCTR  4,0                back off one byte to point
>         BCTR  4,0                to label at start of program
>         LA    4,0(0,4)           ???????

Well, I believe it throws away the 8 high order bits.

At least it used to, I don't know about in XA.



Fri, 27 Aug 1993 18:05:45 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Instructions of the week -- LA and EX

2. Instructions of the week -- LA and EX

3. why why why oh why why baby

4. RISC 32bit instruction word -- Why not 16?!

5. why do these instructions start at offset 100h ?

6. why only 1 instruction per line ?

7. Re : why only 1 instruction per line ?

8. Why does this give illegal instruction?

9. why using using vrml1 to vrml2 convertors?

10. Clarification on USING instruction

11. Uses for the rotate instruction

12. time used for pentium instructions

 

 
Powered by phpBB® Forum Software