The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Phil Budne <phil@ultimate.com>
To: tuhs@tuhs.org, f4grx@f4grx.net
Subject: [TUHS] Re: Software written in B
Date: Wed, 07 Jun 2023 14:16:55 -0400	[thread overview]
Message-ID: <202306071816.357IGtA0046002@ultimate.com> (raw)
In-Reply-To: <1e651370-3ada-e211-c277-409d6563500d@f4grx.net>

Here's what I know about surviving early UNIX B implementations bits:

Two surviving B programs from PDP-7 UNIX listings:
https://github.com/DoctorWkt/pdp7-unix/blob/master/scans/ind.b
https://github.com/DoctorWkt/pdp7-unix/blob/master/scans/lcase.b

NOT a b program, but for "fun" I tried my hand at recreating the TMG
compiler compiler for the PDP-7 (we only have the original library
routines, but not the TMG (.t) source for the compiler at:

https://github.com/philbudne/pdp7-unix/tree/tmg/src/other/pbtmg and
tried writing a B compiler in TMG (b.t in the above directory) based
on Robert Swierczek's decoding of the B interpreter/runtime.

Both the PDP-7 and (initial?) PDP-11 B compilers generated interpreted code.

I'm not aware if the PDP-11 B compiler source has ever been unearthed,
but a ar(chive) file of the library and interpreted was found, and
Robert S posted disassemblies here:

https://github.com/rswier/pdp11-B/

With this explanation of where the files were discovered:
https://github.com/rswier/pdp11-B/tree/master/fs

As well as
http://squoze.net/B/bilib/

Which I added to Robert's tree in a private branch that I guess
I never opened a Pull Request for:
https://github.com/philbudne/pdp11-B/tree/pb/source/bilib

And I (think) I had to make up brt1.s and brt2.s files:
https://github.com/philbudne/pdp11-B/blob/pb/source/brt/brt1.s
https://github.com/philbudne/pdp11-B/blob/pb/source/brt/brt2.s

based on the usage description in Ken's manual:
https://www.bell-labs.com/usr/dmr/www/kbman.html :
	ld object /etc/brt1 -lb /etc/bilib /etc/brt2

I tried to hack Robert's PDP-7 B compiler to work with the above
PDP-11 runtime:
https://github.com/philbudne/pdp11-B/blob/pb/source/b711/

But I don't remember what state I left it in.

Ken's manual indicates that the original PDP-11 B compiler had two
phases: "bc" which generated intermediate code, and "ba" which turned
that into a .s file.

A "fun fact" about all the above compilers (TMG and B) for both the
PDP-7 and the PDP-11 is that the compilers (eventually) output
assembly language source that was assembled (and for the PDP-11
loaded) with an interpreter library and runtime.

I seem to recall that for the PDP-7, the interpreted code (for both
TMG and B) looks much like PDP-7 instructions (same number of high
order "opcode" bits, some use of the indirect bit, and an address
field while the PDP-11 B compiler (at least) generated code is more
like threaded code, with an interpreter program counter in r3, and
"jmp *(r3)+" to dispatch to the next instruction.

  parent reply	other threads:[~2023-06-07 18:17 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-07 10:14 [TUHS] " Sebastien F4GRX
2023-06-07 10:38 ` [TUHS] " Lars Brinkhoff
2023-06-07 15:05 ` Angelo Papenhoff
2023-06-07 15:57 ` Clem Cole
2023-06-07 16:21   ` Lars Brinkhoff
2023-06-07 17:26 ` Bakul Shah
2023-06-07 18:16 ` Phil Budne [this message]
2023-06-07 23:49 ` Andrew Hume
2023-06-08  2:10   ` segaloco via TUHS
2023-06-08  3:31     ` Phil Budne
2023-06-08 15:05       ` segaloco via TUHS
2023-06-14 11:51         ` Angelo Papenhoff
2023-06-14 20:03           ` Angelo Papenhoff
2023-06-14 21:53             ` segaloco via TUHS
2023-06-14 22:05               ` Angelo Papenhoff
2023-06-15  8:00             ` Sebastien F4GRX
2023-06-15  8:21               ` Angelo Papenhoff
2023-06-15  8:33                 ` Sebastien F4GRX
2023-06-17  8:19             ` Angelo Papenhoff
2023-06-19  9:52               ` Sebastien F4GRX
2023-06-19 10:18                 ` Sebastien F4GRX
2023-06-19 10:48                   ` Lars Brinkhoff
2023-06-19 10:55                     ` G. Branden Robinson
2023-06-19 11:07                       ` Sebastien F4GRX
2023-06-19 18:44                         ` segaloco via TUHS
2023-06-23 10:59               ` Angelo Papenhoff
2023-06-23 13:32                 ` Sebastien F4GRX
2023-06-23 14:01                   ` Angelo Papenhoff
2023-06-23 14:14                     ` Sebastien F4GRX
2023-06-23 14:39                       ` Angelo Papenhoff
2023-06-23 14:10                 ` Sebastien F4GRX
2023-06-23 14:49                   ` Angelo Papenhoff
2023-06-23 15:31                     ` Sebastien F4GRX
2023-06-23 15:36                       ` Angelo Papenhoff
2023-06-23 15:53                         ` Sebastien F4GRX
2023-06-08 14:41   ` arnold
2023-06-09  8:56 ` Sebastien F4GRX
2023-06-09  9:57   ` Lars Brinkhoff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202306071816.357IGtA0046002@ultimate.com \
    --to=phil@ultimate.com \
    --cc=f4grx@f4grx.net \
    --cc=tuhs@tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).