If I think that the code is unclear then I will include an appropriate comment,
in some cases across multiple lines. For LA it's likely to be terse, e.g.,
LA R14,L'TABELENT Increment for BXLE
> Now, both of the following *do* (as you said) nearly the same
> thing.
> LA R5,0(,16)
> LHI R5,16
Shirley you're joking. I would never use LA 16(,0), which is what I assume you
meant, because I would consider it to be less clear than LA R5,16. Also, I'd
probably have a comment explaining why 16 as opposed to some other number.
--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3
________________________________________
From: IBM Mainframe Assembler List [[email protected]] on behalf
of Dave Clark [[email protected]]
Sent: Tuesday, February 8, 2022 12:58 PM
To: [email protected]
Subject: Re: Making Encoded Bits Human Readable
"IBM Mainframe Assembler List" <[email protected]> wrote on
02/08/2022 11:23:03 AM:
> I use instructions for what they do, not for their motivation or
> nomenclature.
I would never begrudge another programmer their choices in getting
their job done. Then again, I love it when I look at someone else's code
and I don't have to guess what it does or what was intended -- in
particular, my own, after many years since I originally wrote it. So, I
like to write my code to be as self-documenting as possible.
Now, both of the following *do* (as you said) nearly the same
thing.
LA R5,0(,16)
LHI R5,16
But not only will the first one yield different results depending
upon the current addressing mode, but will also *require* you to look
elsewhere to determine what is being done with those results. Why do you
have to look elsewhere? Because you have to determine if the original
writer intended it for addressing, or not.
The second one, on the other hand (and without looking anywhere
else), leaves no doubt in your mind that the original writer wanted
nothing more than a signed-halfword value as the one and only possible
result.
The same goes for the following two instructions. If I'm dealing
with an address, then I'll use the first one. If I'm dealing with a
counter, then I'll use the second one. Why? Because, again, the second
one has only one result where the results of the first one depend upon
addressing mode.
BCTR R5,0
SHI R5,1
So, where possible, I *do* use instructions that make my intent
more obvious and I'll not apologize for that.
Sincerely,
Dave Clark
--
int.ext: 91078
direct: (937) 531-6378
home: (937) 751-3300
Winsupply Group Services
3110 Kettering Boulevard
Dayton, Ohio 45439 USA
(937) 294-5331
*********************************************************************************************
This email message and any attachments is for use only by the named
addressee(s) and may contain confidential, privileged and/or proprietary
information. If you have received this message in error, please
immediately notify the sender and delete and destroy the message and all
copies. All unauthorized direct or indirect use or disclosure of this
message is strictly prohibited. No right to confidentiality or privilege
is waived or lost by any error in transmission.
*********************************************************************************************