Groups | Search | Server Info | Login | Register


Groups > comp.lang.asm370 > #42

Re: "Using" statement? -

Message-ID <5016F801.3000207@xs4all.nl> (permalink)
Date 2012-07-30 22:09 +0100
From JEmebius <jemebius@xs4all.nl>
Newsgroups comp.lang.asm370
Subject Re: "Using" statement? -
References <500061a6$0$6058$607ed4bc@cv.net> <acc1286749193b7abb3956c4eb054e8a@breaka.net>

Show all headers | View raw


Anonymous wrote:
> John W Kennedy <jwkenne@attglobal.net> wrote:
> 
>> On 2012-07-13 12:12:09 +0000, Fritz Wuehler said:
>>
>>> John W Kennedy <jwkenne@attglobal.net> wrote:
>>>
>>> Didn't see Pete's post since I killfile everything from google
>>>
>>>> On 2012-07-12 15:36:32 +0000, Pete Nelson said:
>>>>
>>>>> On Friday, July 6, 2012 10:24:16 AM UTC-5, John W Kennedy wrote:
>>>>>> But, as I say, if you are writing code expressly for z/Architecture,>
>>>>>> and use only the Branch Relative family of instructions, and put all>
>>>>>> your data in a separate CSECT or DSECT (or PSECT), you do not need a>
>>>>>> base register for your code CSECT. That&#39;s why the Branch Relative>
>>>>>> instructions were invented -- so that you have one more general>
>>>>>> register to use for other purposes.
>>>>>>
>>>>> Basically true, although whether your literal pool and constants are in
>>>>> a separate CSECT or the same CSECT as your executable code, a base
>>>>> register is still needed to address the data.  For small programs, you
>>>>> probably end up using just as many base registers either way; when the
>>>>> size of your executable code approaches/exceeds 4K, then you start
>>>>> avoiding register starvation by using relative branching.
>>> It's true many people allocate additional base registers when code exceeds
>>> 4K but there is another way around this and I have written and worked on
>>> substantial pieces of code that use one code base register no matter how
>>> large the CSECT. There is really no excuse to use more than one code base
>>> register, and I am saying that in reference to OS/360, not just since the
>>> branch relative and immediate facility came out.
>> Back in the OS/360 days, frankly, I always regarded more than one code 
>> base register (for which I generally used GR12 unless in a PL/I 
>> environment, in which case I used GR11) as a sure sign that the module 
>> had grown too big, and needed to be refactored.
> 
> Agreed. 
> 

When I knew in advance that my OS/360 module would occupy more than 8 Kbytes (4096 bytes) and 
certainly less than 12 Kbytes I would define registers GR12, GR11 and GR10 as base registers for the 
first 4K, the second 4K and the last 4K, and load them in advance with the appropriate values:
<GR15>, <GR15> + 4096, <GR15> + 8192.

The most straightforward coding for this reads [use fixed-space font]

ABCDEFGH CSECT
          USING 12,11,10
          LR    12,15
          LR    11,15
          AH    11,=H'4096'
          LR    10,15
          AH    10,=H'8192'
          .................
          LTORG
          DC    H'4096'     (I am not sure if this the correct printing in the output listing)
          DC    H'8192'

(Takes 18 bytes)

Programmers who dislike literals can of course code something like

IKJL     CSECT
          USING 12,11,10
          LR    12,15       Origin of CSECT to GR12
          LA    11,2048     Number 2048 to GR11
          SLL   11,1        Shift one bit to the left so as to obtain 4096
          LA    10,2048     Number 2048 to GR10
          SLL   10,2        Shift two bits to the left so as to obtain 8192
          AR    11,12       Add contents of GR12 to contents of GR11, obtaining <GR12> + 4096
          AR    10,12       Add contents of GR12 to contents of GR10, obtaining <GR12> + 8192
          ...................................................................................

(Takes 20 bytes)

Enjoy this old and bygone(?) stuff!

Ciao: Johan E. Mebius

Back to comp.lang.asm370 | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

"Using" statement? hancock4@bbs.cpcn.com - 2012-07-06 06:52 -0700
  Re: "Using" statement? John W Kennedy <jwkenne@attglobal.net> - 2012-07-06 11:24 -0400
    Re: "Using" statement? hancock4@bbs.cpcn.com - 2012-07-06 10:15 -0700
    Re: "Using" statement? Fritz Wuehler <fritz@spamexpire-201207.rodent.frell.theremailer.net> - 2012-07-12 07:31 +0200
      Re: "Using" statement? John W Kennedy <jwkenne@attglobal.net> - 2012-07-12 22:09 -0400
    Re: "Using" statement? Pete Nelson <plnelsonoma@yahoo.com> - 2012-07-12 08:36 -0700
      Re: "Using" statement? John W Kennedy <jwkenne@attglobal.net> - 2012-07-12 22:13 -0400
        Re: "Using" statement? Fritz Wuehler <fritz@spamexpire-201207.rodent.frell.theremailer.net> - 2012-07-13 14:12 +0200
          Re: "Using" statement? John W Kennedy <jwkenne@attglobal.net> - 2012-07-13 13:57 -0400
            Re: "Using" statement? Anonymous <noreply@breaka.net> - 2012-07-15 05:54 -0400
              Re: "Using" statement? -  JEmebius <jemebius@xs4all.nl> - 2012-07-30 22:09 +0100
                Re: "Using" statement? -- JEmebius <jemebius@xs4all.nl> - 2012-07-30 22:13 +0100
                Re: "Using" statement? --- JEmebius <jemebius@xs4all.nl> - 2012-07-30 22:19 +0100
                Re: "Using" statement? --- woodag@trap.ozemail.com.au (Andy Wood) - 2012-07-31 06:22 +0000
                Re: "Using" statement? --- reply JEmebius <jemebius@xs4all.nl> - 2012-08-01 02:44 +0100
                Re: "Using" statement? - Fritz Wuehler <fritz@spamexpire-201207.rodent.frell.theremailer.net> - 2012-07-31 20:46 +0200
                Re: "Using" statement? - reply JEmebius <jemebius@xs4all.nl> - 2012-08-01 03:10 +0100
                Re: "Using" statement? - reply Fritz Wuehler <fritz@spamexpire-201208.rodent.frell.theremailer.net> - 2012-08-07 16:36 +0200
                Re: "Using" statement? - reply Nomen Nescio <nobody@dizum.com> - 2012-08-07 21:33 +0200
                Re: "Using" statement? - reply Clark F Morris <cfmpublic@ns.sympatico.ca> - 2012-08-07 18:13 -0300
                Re: "Using" statement? - "Michel Castelein" <arcis@advalvas.be.without.this.no.spam.tail> - 2012-08-03 11:13 +0200
                Re: "Using" statement? - Anonymous <nobody@remailer.paranoici.org> - 2012-08-03 13:05 +0000
                Re: "Using" statement? - Allodoxaphobia <knock_yourself_out@example.net> - 2012-08-03 13:29 +0000
                Re: "Using" statement? - WAB JEmebius <jemebius@xs4all.nl> - 2012-08-04 00:03 +0100
                Re: "Using" statement? - WAB Allodoxaphobia <knock_yourself_out@example.net> - 2012-08-04 03:14 +0000
                Re: "Using" statement? - Nomen Nescio <nobody@dizum.com> - 2012-08-06 15:15 +0200
  Re: "Using" statement? alistair.j.l.maclean@gmail.com - 2012-08-19 05:58 -0700
    Re: "Using" statement? John W Kennedy <jwkenne@attglobal.net> - 2012-08-19 13:15 -0400
      Re: "Using" statement? Nomen Nescio <nobody@dizum.com> - 2012-08-19 22:20 +0200
        Re: "Using" statement? John W Kennedy <jwkenne@attglobal.net> - 2012-08-19 18:30 -0400

csiph-web