> They gave registers mnemonic names

When I was a coding baby I saw some IBM code that did that, and thought "what a 
great idea -- I can readily change the mapping of register numbers to 
functions." I wrote one module like that and decided it was a disaster.

You can spend an hour looking for a bug before realizing that the problem is 
that LoopCount and BufferAddress are in fact the same register. Nor is the 
architecture "register independent." SLDL LoopCount,3 works if LoopCount is 
assigned to 6 but not if it is assigned to 7.

Charles


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf 
Of Paul Gilmartin
Sent: Wednesday, June 16, 2021 3:21 PM
To: [email protected]
Subject: Re: EXTERNAL: Coding for the future

On Wed, 16 Jun 2021 16:48:43 +0000, Savor, Thomas wrote:

> ==>        LA    R7,5              Put 5 in register 7
>
>It depends on the intended target audience.  Now I and you know that a 5 is 
>put in Register 7, but many shops have only a couple Assembler 
>Programmers....but many more Cobol programmers.  Telling "them" that a 5 is 
>put in Register 7 can be helpful to solving a problem or learning what a 
>program does.
>
Indeed.  And: " A little learning is a dangerous thing ;. ...".

Once, chasing a problem, I inspected some ISV code, apparently by
expert assembler programmers, but utterly mainframe-naive.  They
gave registers mnemonic names:

LoopCount EQU 7
         ...
        LA    LoopCount,5

That's severely deprecated by mainframe experts.

They were accustomed to negative displacements and immediate  
operands, but not to base registers.  So:
         LH    RM4K,=H'-4096'  (once in each module)
         LH    RM8K,=H'-8192'
         ...
         LA    POINTER,4096-5(POINTER,RM4K)  Decrement POINTER by 5.

It works, within addressability range.  John Ehrman and Dave Cole agreed
while noting that it would get pushback in a code review (as it did in
ASSEMBLER-LIST.)

They never coded a USING nor dedicated a  base register.  Their code teemed 
with:
         BALR  RBASE,0  (Establish local addressability)
and convoluted algebra in storage accesses.

I think it was mechanically generated from a single source
for multiple target platforms.  I could understand it once I
learned their conventions.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to