🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.folklore.computers
Article #625595

Re: PDP 11/40 system manual

#625595
From: Dan Espen
Date: Sun, 12 Aug 2018 23:22
83 lines
4533 bytes
Peter Flass <peter...@yahoo.com> writes:

> Dan Espen <dan1...@gmail.com> wrote:
>> Peter Flass <peter...@yahoo.com> writes:
>> 
>>> Dan Espen <dan1...@gmail.com> wrote:
>>>> I've done huge amounts of assembly programming and the instructions
>>>> get the job done.  Issues with the base registers are easy to deal with
>>>> once you figure out that each subroutine should have it's own base
>>>> register, don't attempt to make all code addressible at once.
>>>> 
>>> 
>>> My copy of Pugh is packed, but I think this was the intention. 4K can be a
>>> bit small for a subroutine, but I think the designers expected programmers
>>> to divide their programs into smallish subroutines. I don't think I've
>>> written a lot of programs that needed multiple base registers. On the other
>>> hand it's more complicated than it needs to be to save a base register and
>>> load a new one - especially if you want to write reentrant code, where the
>>> recommended technique requires OS intervention to get a free the savearea.
>>> A hardware stack would have helped. and maybe one instruction to push a
>>> register and load it with the address of the next instruction.
>> 
>> Not really that hard:
>> 
>>  LARL R11,SUB1   R11 <- subroutine address and base
>>  BALR R14,R11   Go to subroutine
>> 
>> ...
>> 
>> SUB1 DS 0H
>>  USING R11,*
>>  STM   R2,R14,SUB1_SAVE
>> do something
>>  LM    R2,R14,SUB1_SAVE
>>  BR  R14
>>  DROP R11
>> 
>> Of course, there are always macros for the LARL/BALR and subroutine
>> entry and exit so it looks like:
>> 
>>  XBAL SUB1
>> 
>> ...
>> 
>> SUB1 ENT
>>  do something
>>  LEAVE
>> 
>> The macros push the subroutine name
>> into a macro array for later automatic save area generation.
>> 
>> I'm never clear on what happens when you exceed
>> the limits of a hardware stack.
>> 
>
> Sure, now you have LARL.

Not required, the actual macro I'm thinking of originally
used an ADCON for the subroutine address.

> You can also preallocate a largeish storage area
> as a stack to grab saveareas off, to avoid GETMAIN/FREEMAIN.

Yes, the actual macro set included:

 STACKBEG
 STACKEND

The STACKBEG macro looked at all the subroutine names stored in
an array and generated the save areas.

Another way to do this is to mark each subroutine with a depth:

SUB1 ENT DEPTH=2

Then all subroutines at calling depth 2 share the same save area.

So, a program needed 1 base register for it's code, (no matter how
much code), one or more base registers for the stack and one or more
base registers for constants.  This covered most cases pretty well.

-- 
Dan Espen
Technical Details
Message-ID: <pkqfgj$f47$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!a22-v6ni11117wmg.0!nntp.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!nntpfeed.proxad.net!news.muarf.org!news.uzoreto.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
References: <21aaeee8-c41a-4442-a4eb-ea6a29b1e4f1@googlegroups.com> <0001HW.211B94B1040CADA5700004B5B2CF@news.giganews.com> <mdd7ekzl6pr.fsf@panix5.panix.com> <pki8ae$ca0$1@dont-email.me> <mddh8k2vyfh.fsf@panix5.panix.com> <pkmrkc$6lm$1@dont-email.me> <767649820.555764566.888777.peter_flass-yahoo.com@news.eternal-september.org> <pkpgkg$grv$1@dont-email.me> <997178083.555797132.949481.peter_flass-yahoo.com@news.eternal-september.org>

Show Full Headers
Complete Article Headers
X-Received: by 2002:a7b:c081:: with SMTP id r1-v6mr948577wmh.26.1534116180575;        Sun, 12 Aug 2018 16:23:00 -0700 (PDT)
X-BeenThere: alt.folklore.computers@googlegroups.com
Received: by 2002:a1c:7a0a:: with SMTP id v10-v6ls1800398wmc.9.canary-gmail; Sun, 12 Aug 2018 16:22:59 -0700 (PDT)
X-Received: by 2002:a1c:f213:: with SMTP id s19-v6mr938385wmc.23.1534116179754;        Sun, 12 Aug 2018 16:22:59 -0700 (PDT)
X-FeedAbuse: http://nntpfeed.proxad.net/abuse.pl feeded by 78.192.65.63
Path: mbox-mo1.pugleaf.net!a22-v6ni11117wmg.0!nntp.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!nntpfeed.proxad.net!news.muarf.org!news.uzoreto.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Dan Espen <dan1...@gmail.com>
Newsgroups: alt.folklore.computers
Subject: Re: PDP 11/40 system manual
Date: Sun, 12 Aug 2018 19:22:57 -0400
Organization: A noiseless patient Spider
Lines: 83
Message-ID: <pkqfgj$f47$1@dont-email.me>
References: <21aaeee8-c41a-4442-a4eb-ea6a29b1e4f1@googlegroups.com> <0001HW.211B94B1040CADA5700004B5B2CF@news.giganews.com> <mdd7ekzl6pr.fsf@panix5.panix.com> <pki8ae$ca0$1@dont-email.me> <mddh8k2vyfh.fsf@panix5.panix.com> <pkmrkc$6lm$1@dont-email.me> <767649820.555764566.888777.peter_flass-yahoo.com@news.eternal-september.org> <pkpgkg$grv$1@dont-email.me> <997178083.555797132.949481.peter_flass-yahoo.com@news.eternal-september.org>
Mime-Version: 1.0
Injection-Info: reader02.eternal-september.org; posting-host="f85887c92775115f6aec8b33b69cda43"; logging-data="15495"; mail-complaints-to="ab...@eternal-september.org"; posting-account="U2FsdGVkX1+Wj55CG2tOXHUu7eKEXM7LkpOdGZl1S+A="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)
Cancel-Lock: sha1:K3eI4TO/IaZ3AXR7VEh9gqI62gI=
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit