P-machine source for PDP8/12?

16 views
Skip to first unread message

Nick Moffitt

unread,
Dec 3, 2021, 3:05:06 PM12/3/21
to PDP-12 Restoration Project (pdp@d.umn.edu)
I know this list has been quiet for some time, but I've been following the rumours of a possible full 32k for the UMN 12 at some point, and my little gears started turning.

I am looking for an example of a bytecode VM for the 8, and I have seen tantalising rumours of a PASCAL-P that would be just the thing. Does such a program exist in source form?

I'd like to learn how someone would implement such a thing efficiently on the 8, with an eye to seeing if I could use whatever clever techniques they used to hack up a mostly-z3-compatible z-machine interpreter. I'm sure this is foolhardy in the extreme, and I have no illusions of ever becoming fully compatible, but even producing something equivalent-yet-incompatible would be worthwhile.

Peter Peterson

unread,
Dec 6, 2021, 3:41:54 PM12/6/21
to Nick Moffitt, PDP-12 Restoration Project (pdp@d.umn.edu)
In case folks don't know, the z-machine is an interpreter for Infocom-style text adventures:


It ran on a lot of systems with low memory, so it seems plausible that a z-machine interpreter could be written for the PDP-8/12, if there's a bytecode VM for the 8.

Does anyone know if there's anything like a PASCAL bytecode machine for the 8 or 12?

Thanks,

Peter
--
Peter A. H. Peterson, Ph.D. (he/him)
Assistant Professor
Department of Computer Science
University of Minnesota Duluth

Vincent Slyngstad

unread,
Mar 27, 2022, 2:56:28 AM3/27/22
to UMD PDP-12 Restoration Project, Peter Peterson, Nick Moffitt
I know that Ethan Dicks has thought and worked extensively on the Infocom VM for various machines including the PDP-8.

The most space efficient VM I've ever seen implemented for the PDP-8 is the Algol one that packs two instructions per word (when it can).

And I'd argue that space efficiency is the key -- it is more important that it fit than that it be blazing fast.

Vince

Nick Moffitt

unread,
Mar 27, 2022, 10:34:55 AM3/27/22
to UMD PDP-12 Restoration Project
On 26Mar2022 11:56pm (-0700), Vincent Slyngstad wrote:
> I know that Ethan Dicks has thought and worked extensively on the Infocom
> VM for various machines including the PDP-8.

Oh, really? Do you have any links for this?

> The most space efficient VM I've ever seen implemented for the PDP-8 is the
> Algol one that packs two instructions per word (when it can).

That's neat. The trouble with this is that the bytecode spec is already nailed down, but there's room for

> And I'd argue that space efficiency is the key -- it is more important that
> it fit than that it be blazing fast.

Agreed. The Z-machine has read-only paging, so we need as much RAM as possible to allow more pages to be kept resident.

I went down a design rabbit hole over the holidays, and came up with notes on how to handle the byte packing, opcode argument loading, and the LRU ring for the page translation table. It's all pretty hairy stuff and I feel like mere months away from the project means most of this has fallen on the floor in terms of my ability to remember how it works. I did take extensive paper notes, however.

Vincent Slyngstad

unread,
Mar 27, 2022, 11:20:46 AM3/27/22
to UMD PDP-12 Restoration Project, Nick Moffitt, UMD PDP-12 Restoration Project
On Sunday, March 27, 2022 at 7:34:55 AM UTC-7 Nick Moffitt wrote:
On 26Mar2022 11:56pm (-0700), Vincent Slyngstad wrote:
> I know that Ethan Dicks has thought and worked extensively on the Infocom
> VM for various machines including the PDP-8.

Oh, really? Do you have any links for this?

Not offhand, but I did send a query to Ethan.

> The most space efficient VM I've ever seen implemented for the PDP-8 is the
> Algol one that packs two instructions per word (when it can).

That's neat. The trouble with this is that the bytecode spec is already nailed down, but there's room for

Worse, the bytecode spec is version dependent, with I think an older integer only VM used in the cross compiler.  Showed a lot of power for the memory size, though.  Most other systems can't even fit the cross compiled compiler into memory.
 
> And I'd argue that space efficiency is the key -- it is more important that
> it fit than that it be blazing fast.

Agreed. The Z-machine has read-only paging, so we need as much RAM as possible to allow more pages to be kept resident.

I went down a design rabbit hole over the holidays, and came up with notes on how to handle the byte packing, opcode argument loading, and the LRU ring for the page translation table. It's all pretty hairy stuff and I feel like mere months away from the project means most of this has fallen on the floor in terms of my ability to remember how it works. I did take extensive paper notes, however.

It's a big project, but would be very cool.

I also looked at the LINC instruction set as being a possibly decent "VM".  In particular, I thought the addressing modes (and page size) to be better suited to stack frames and recursive programming.
(My specific thought was "wish I'd had this when I did my C compiler".

Ian modified my C compiler to output more PDP-8 code (which is not at all space efficient for a C implementation), and you can see his result in the PiDP project.

Vince

Nick Moffitt

unread,
Mar 27, 2022, 5:22:51 PM3/27/22
to UMD PDP-12 Restoration Project
On 27Mar2022 08:20am (-0700), Vincent Slyngstad wrote:
> On Sunday, March 27, 2022 at 7:34:55 AM UTC-7 Nick Moffitt wrote:
> > On 26Mar2022 11:56pm (-0700), Vincent Slyngstad wrote:
> > > I know that Ethan Dicks has thought and worked extensively on the Infocom
> > > VM for various machines including the PDP-8.
> > Oh, really? Do you have any links for this?
> Not offhand, but I did send a query to Ethan.

Thank you!

> > That's neat. The trouble with this is that the bytecode spec is already
> > nailed down, but there's room for
>
> Worse, the bytecode spec is version dependent, with I think an older
> integer only VM used in the cross compiler. Showed a lot of power for the
> memory size, though. Most other systems can't even fit the cross compiled
> compiler into memory.

I think that targeting v3 only is a reasonable requirement, as that was the version that aimed at the 32k micros. And yeah, it's about being able to *play* a hand-curated z3 game on the 12 rather than being able to build arbitrary games on the thing!

> I also looked at the LINC instruction set as being a possibly decent "VM".
> In particular, I thought the addressing modes (and page size) to be better
> suited to stack frames and recursive programming.
> (My specific thought was "wish I'd had this when I did my C compiler".

Hm, that's interesting. I don't think the Z machine did a lot of recursion, and focused mainly on table manipulation and text input/output.

Vincent Slyngstad

unread,
Mar 27, 2022, 5:59:11 PM3/27/22
to UMD PDP-12 Restoration Project, Nick Moffitt, UMD PDP-12 Restoration Project
I'll take your word for it on the Z machine.  I was sort of babbling about things that crossed my mind wrt virtual machines for high level language compilers, which is something I have more experience with.

Vince

Vincent Slyngstad

unread,
Mar 28, 2022, 9:59:25 AM3/28/22
to UMD PDP-12 Restoration Project, Vincent Slyngstad, Nick Moffitt, UMD PDP-12 Restoration Project
I got a reasonably detailed reply from Ethan.  He's clearly thought it through pretty far, but hasn't
written code yet.  I've invited him to read this thread -- I don't think he's a member so I doubt he can post a response.  I also asked about passing on his email address, so I'll also ask if you'd like me to provide him with yours.

Vince

Nick Moffitt

unread,
Mar 28, 2022, 10:36:38 AM3/28/22
to UMD PDP-12 Restoration Project, Vincent Slyngstad
Yeah, I'd love that! My goal is to get a game running on the UMN 12, and I've been playing with simh in 8 mode, but it's clear this isn't something I can do on my own. I'm still trying to get a basic heap implementation working in one page, as a start!

Peter Peterson

unread,
Apr 27, 2022, 5:22:12 PM4/27/22
to Nick Moffitt, UMD PDP-12 Restoration Project, Vincent Slyngstad
Hi all,

Anything we can do to help you on your quest, Nick, let us know!

Peter

--
You received this message because you are subscribed to the Google Groups "UMD PDP-12 Restoration Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pdp+uns...@d.umn.edu.
To view this discussion on the web visit https://groups.google.com/a/d.umn.edu/d/msgid/pdp/20220328143636.GO2969674%40zork.net.
Reply all
Reply to author
Forward
0 new messages