> LARL  14,*+((48+32+16)/8)
>  L         14,0(15,14)
>  BR       14
>  J    RC0ROUTINE
>  J    RC4ROUTINE
>  J    RC8ROUTINE

The code is incorrect and would be clearer if you replaced the magic number 
with a label:

         LARL  R14,BRTAB
         BR    0(R14,R15)
BRTAB    EQU   *
         J     RC0ROUTINE
         J     RC4ROUTINE
         J     RC8ROUTINE
LIMIT    EQU   *-BRTAB

Personally I'd include error checking:

         LTR   R15,R15
         JM    BADIX
         CHI   R15,LIMIT
         JH    BADIX
         TML   R15,3
         JNZ   BADIX
         J     *+4(R15)
BRTAB    EQU   *
         J     RC0ROUTINE
         J     RC4ROUTINE
         J     RC8ROUTINE
LIMIT    EQU   *-BRTAB
.



--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3

________________________________________
From: IBM Mainframe Assembler List [ASSEMBLER-LIST@LISTSERV.UGA.EDU] on behalf 
of Mark Hammack [mark.hamm...@gmail.com]
Sent: Tuesday, November 23, 2021 10:41 AM
To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
Subject: Re: Base-less macros

So as a related question, I started working on a 'baseless' version of a
branch table macro I wrote years ago.  I have it working but was curious
what other people have done.

In 'based' code, it typically generates something like:

B   *+4(15)
B    RC0ROUTINE
B    RC4ROUTINE
B    RC8ROUTINE
etc.

The best I could come up with for 'baseless' code is:

LARL  14,*+((48+32+16)/8)
L         14,0(15,14)
BR       14
J    RC0ROUTINE
J    RC4ROUTINE
J    RC8ROUTINE

As to the specific question asked in the thread, I recently ran into an
issue where a macro expanded by a couple of bytes which threw the literals
out of the 4k 'base'.  The way I took care of *most* of the issue was to go
with immediate, long displacement or relative instructions as much as
possible which all but eliminated the need for an LTORG or at least reduced
the need for multiple LTORGs in the program.

*Mark Hammack*
Systemware, Inc.
Senior z/OS Developer
mark.hamm...@gmail.com
214-478-0955 (c)


On Sun, Nov 7, 2021 at 6:25 PM Tony Thigpen <t...@vse2pdf.com> wrote:

> I finally am to the point where I no longer need to worry about specific
> customers having hardware that does not support relative instructions,
> so I am updating some macros I provide to be baseless.
>
> What is the 'preferred' approach to macro generated constants? In the
> past, I have used both inline constants that I branch around, and ltorg
> literals (=c'x').
>
> In the past, I have been bitten by using ltorg literals and the client
> did not put a LTORG after my macro causing a 'no active base register'
> issue. So, I am thinking inline with a BRAS is better.
>
> Maybe there is another approach that I missed?
>
> Suggestions?
>
> Tony Thigpen
>

Reply via email to