How do you determine how many base registers to use? 
Author Message
 How do you determine how many base registers to use?

I need help in determining how many base registers are needed for a
program. I know that a register can define up to 4096 bytes, but what
items are used to count these bytes, and how do you do it? Can you use
the program size given in the link output? I had been doing this by
trial and error, but now I need a good technique because I have a few
pgms which need mods and are using almost all of the available registers
already. I have been told that the use of ADCONS could extend the base
register concept if I exhaust the registers in one particularly large
pgm I am working on, but I'm not sure how to do this. Any help would be
appreciated on either of these topics.

Thanks,
Richard



Fri, 27 Jul 2001 03:00:00 GMT  
 How do you determine how many base registers to use?
Richard, you are asking a difficult question. But I will attempt to answer
as best
as possible.

I generally think about one thing: How big will the program get in
subsequent
releases. I have a register convention that works very well for me, and is
easy to
follow from a susequent-maintenance-by-an-apprentice's point of view. So if
it's
a quick-and-dirty-one-time-throwaway type of program, then the h*ll with
base
registers, use what's there and run with it. That means generally one
register for
the code base (R12) and one for the savearea and constants (R13). That gives
me an effective "space" (in the esoteric term) of 8,192 bytes. And if I have
things
like long tables, they can go at the end of either area, just as long as the
FIRST
byte remains addressable by a LA instruction.

If I think, at the program's inception that "This could become a monster,"
then I
will generally restructure everything so that it revolves around two code
bases,
(R11,R12 in that order) and the save/const register (R13).

And then there are times when two code regs aren't even enough. Then the
thing
will take on the appearance of a highly proceduralized PL/I program where
each
subroutine will establish its own USING on a unique local base reg, and then
drop
it when the routine's code is complete. Of course, that isn't known until
the request
comes down to "enhance" the existing program. Sigh... If they only knew...

So, to quote the long-time IBM instructor, Larry Profft (sp?), "Standard
answer
number one: It depends."

Feel free to write for more assisatance...

BillB.

*** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ***



Fri, 27 Jul 2001 03:00:00 GMT  
 How do you determine how many base registers to use?
While the previous poster's conditional assembly is good, actually
clever, it neglects one thing in the establishment of base registers.
Namely, that of using the LA instruction to step the second/subsequent
regs by 2048 twice. This has the effect of zeroing out the high-order
bit in the PSW address field if that register were ever to be used in
a target branch instruction. While it will work perfectly well in
AMODE24 and RMODE24 CSECT's, when specifying ANY in either
of those assembler instructions, it could result in unpredictable
behaviour...

While I am not attempting to criticize, I think that performing an
AL &CURRD,Some_4K_constant
would be a better appriach...

Just my opinion, of course...
Bill.

*** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ***



Sun, 29 Jul 2001 03:00:00 GMT  
 How do you determine how many base registers to use?
: While the previous poster's conditional assembly is good, actually
: clever, it neglects one thing in the establishment of base registers.
: Namely, that of using the LA instruction to step the second/subsequent
: regs by 2048 twice. This has the effect of zeroing out the high-order
: bit in the PSW address field if that register were ever to be used in
: a target branch instruction. While it will work perfectly well in
: AMODE24 and RMODE24 CSECT's, when specifying ANY in either
: of those assembler instructions, it could result in unpredictable
: behaviour...

I don't follow this one.  Could you explain?

: While I am not attempting to criticize, I think that performing an
: AL &CURRD,Some_4K_constant
: would be a better appriach...

Wouldn't AHI reg,4096 be even better?

--

Columbus, Ohio



Mon, 30 Jul 2001 03:00:00 GMT  
 How do you determine how many base registers to use?


:>While the previous poster's conditional assembly is good, actually
:>clever, it neglects one thing in the establishment of base registers.
:>Namely, that of using the LA instruction to step the second/subsequent
:>regs by 2048 twice. This has the effect of zeroing out the high-order
:>bit in the PSW address field if that register were ever to be used in
:>a target branch instruction. While it will work perfectly well in
:>AMODE24 and RMODE24 CSECT's, when specifying ANY in either
:>of those assembler instructions, it could result in unpredictable
:>behaviour...

Not it will not. Standard branches do not require the high order bit to be
set.

Of course, if one uses BSM 0,Rx rather than BR Rx for internal branches, then
yes, this will cause trouble in AMode31 code.

But, then again, I see no reason not to use base registers with odd values. I
personally like:

         LA    Base2,Base1+4095
         USING Csect+4095,Base2

which requires only one instruction and no literals and loses only one byte of
addressability (if I must use two base registers, a condition I do my best to
avoid).

   [ snipped ]

--


Director, Dissen Software, Bar & Grill - Israel



Mon, 30 Jul 2001 03:00:00 GMT  
 How do you determine how many base registers to use?
Barry,

Binyimin delights himself in stirring up mud and dirt and "diss"ing
others in an attempt to prove superiority. I merely apply killfile
principles.

My contention is that code base registers should ALWAYS reflect the
addressing mode of the current AMODE/RMODE settings. Although
it's not necessary from a purely functional issue, meaning that the
two LA +2048 instuctions will work a vast majority of the time, I
think it is bad practice to do it that way. Hence, the comment
regarding the insertion of a AL Rx,FourK instruction. (Note the op
code AL)

Back to the original subject...
If, for example, you have a program that requires two base registers
for the main CODE CSECT, you need to examine three principles of
work here. The first is, will the "MAIN" program (with subroutines)
occupy more than one base register. Second, will the main program
AND the internal subroutines occupy two bases nicely. Third, Will the
"fit" be better off with a MAIN base reg and subroutine base reg?

For situation one, a simple USING MAINEPA,Rx,Ry and the related
setup stuff, be sufficuent.

For sutuation two: USING MAINEPA,Rx and USING SUBROUTS,Ry
work?

The latter is the situation I find myself faced with most often. In fact,
the problem *I* face is that of needing (sometimes) one basereg for
MAIN, and TWO or more for the internal subroutines. I draw the line
at three base registers for code. Any more, and I need to rethink the
overall structure of the entire program...



Regards,
BillB.

*** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ***



Mon, 30 Jul 2001 03:00:00 GMT  
 How do you determine how many base registers to use?


:>Binyimin delights himself in stirring up mud and dirt and "diss"ing
:>others in an attempt to prove superiority. I merely apply killfile
:>principles.

??????

:>My contention is that code base registers should ALWAYS reflect the
:>addressing mode of the current AMODE/RMODE settings. Although
:>it's not necessary from a purely functional issue, meaning that the
:>two LA +2048 instuctions will work a vast majority of the time, I
:>think it is bad practice to do it that way. Hence, the comment
:>regarding the insertion of a AL Rx,FourK instruction. (Note the op
:>code AL)

Please show one case where an AMODE31 program with a base (or index) register
with a cleared high order bit will cause trouble other than with improper
protocols.

The AMODE bit in the PSW controls whether 24 or 31 bits of the base register
are used for either data reference or conditional branching.

   [ snipped ]

--


Director, Dissen Software, Bar & Grill - Israel



Tue, 31 Jul 2001 03:00:00 GMT  
 How do you determine how many base registers to use?




:>> :>While the previous poster's conditional assembly is good, actually
:>> :>clever, it neglects one thing in the establishment of base registers.
:>> :>Namely, that of using the LA instruction to step the second/subsequent
:>> :>regs by 2048 twice. This has the effect of zeroing out the high-order
:>> :>bit in the PSW address field if that register were ever to be used in
:>> :>a target branch instruction. While it will work perfectly well in
:>> :>AMODE24 and RMODE24 CSECT's, when specifying ANY in either
:>> :>of those assembler instructions, it could result in unpredictable
:>> :>behaviour...

:>> Not it will not. Standard branches do not require the high order bit to be
:>> set.

:>> Of course, if one uses BSM 0,Rx rather than BR Rx for internal branches, then
:>> yes, this will cause trouble in AMode31 code.

:>> But, then again, I see no reason not to use base registers with odd values. I
:>> personally like:

:>>          LA    Base2,Base1+4095
:>>          USING Csect+4095,Base2

:>> which requires only one instruction and no literals and loses only one byte of
:>> addressability (if I must use two base registers, a condition I do my best to
:>> avoid).

:>>    [ snipped ]
:>>

:>Ben,

:>I can't believe that you're telling him to do that (LA BASE2,BASE1+4096)
:>rather than the standard:  LA BASE2,4095(,BASE1)  -- LA  BASE2,1(,BASE2).  I
:>know you're a lot better at machine language and dump reading than I am, but
:>why make it confusing.

Yes, I should have used

           LA    Base2,4095(,Base1)

I see no problem with the base registers being 4095 apart. The loss of one
byte in addressability is made up by the fact that only one instruction and no
data is required to prime the second base.

And I think odd displacements in branches are cool.

:>By the way, I often use 2,3, or even 4 base registers in my code.

If I reach a point like that I will modularize and use subroutines with their
own base register. An assembler program with many base registers is much
harder to maintain than a program and a few subroutines.

--


Director, Dissen Software, Bar & Grill - Israel



Tue, 31 Jul 2001 03:00:00 GMT  
 
 [ 24 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Using FP registers as additional GP registers

2. X-based/elm-based mail browser using tk

3. Error: Clock skew plus hold time of destination register exceeds register-to-register delay

4. Error: Clock skew plus hold time of destination register exceeds register-to-register delay

5. Anyone doing hosting of lisp-based web apps?

6. Initializing Base Register(s) in Multi-entry-point CSECT

7. Communicating with PC Based CArd on Register Level

8. Register based VM

9. Register based traps in MacOberon

10. Register based traps in MacOberon

11. How to make a RAM-based registers for 32-TAPS

12. difference between stack / register based architecture?

 

 
Powered by phpBB® Forum Software