The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Adam Thornton <athornton@gmail.com>
To: Gabriel Diaz <gdiaz@qswarm.com>,
	The Eunuchs Hysterical Society <tuhs@tuhs.org>
Subject: Re: [TUHS] Gaming on early Unix
Date: Fri, 6 Dec 2019 18:22:47 -0700	[thread overview]
Message-ID: <CAP2nic0S-rP4kq=sAyut-Qr5M5kyoHcCj=PZL07Xis=rv1uB3Q@mail.gmail.com> (raw)
In-Reply-To: <ltHJoDDEOs5-xEO89I41fL1EtqGSVAQBplC23ejqb4QSevDcIaP-Iu-SEf66ZXYoTZfwcHe_CF9JwJ_Ypdj_qpazTGhqo7feaGau_POndD4=@qswarm.com>

[-- Attachment #1: Type: text/plain, Size: 2550 bytes --]

There was not a Z-Machine interpreter for Unix machines, as far as I know,
until the release of the ITF interpreter in the early 90s.

However....

Zork was developed under ITS (when it was "mainframe Zork" and an MIT
student project), and the later Infocom games were developed under TOPS-20.

As it happens, I've fairly recently ported the "Frotz" Z-Machine
interpreter to TOPS-20.  https://github.com/athornton/tops20-frotz and
https://github.com/athornton/gnusto-frotz-tops20

This was not all _that_ hard.  KCC on TOPS-20 is an ANSI C compiler, so
there were basically two classes of problems to solve.

The first one is that the linker requires all symbols that are linked
between modules to be six characters or shorter (and case is folded), so I
wrote a transmogrifier (gnusto-frotz) to extract those symbols and create a
mapping for them so that the object code would link.

The second problem was that the Frotz source assumes 8-bit bytes and that
your word length is a multiple of 8 bits.  Since the Z-machine is a 16-bit
virtual machine, that meant there was a whole lot of bit masking necessary
in the opcodes and memory references in order to represent the Z-machine
memory correctly within the TOPS-20 address space.  That's done with stuff
like:

https://github.com/athornton/tops20-frotz/blob/0130a67fc44e0c7de1faa8f882cbc28faee76756/frotz.h#L488

So the idea is, gnusto-frotz-tops20 is semantically equivalent to regular
Frotz, but with macros changed so if you build it with -DWEIRD_WORDSIZE it
would build on a 36-bit system.  Then once you've modified the source, you
run it through the transmogrifier (which really just generates a sed
script) to get something that will _link_ on a 36-bit system.

I have vague plans to port Frotz to ITS but the problem there is that the C
compiler is pre-K&R rather than ANSI, so there's a lot of deprotoization
work to be done, and _then_ I need to fix the things like += being =+ and
so forth, and I think I have to chop another character off the symbols,
which may mean I need smarter collision detection.  So it's nontrivial.

Maybe a good first step would be unprotoizing Frotz and getting it to build
on v7 or so...

Adam

On Fri, Dec 6, 2019 at 3:52 AM Gabriel Diaz <gdiaz@qswarm.com> wrote:

> Hello,
>
>
> Source code has been published of some early games.
>
> Were those games playable on Unix machines at the time? What was your
> favourite game?
>
>
>
> https://kryptonradio.com/2019/04/18/zork-source-code-presumed-lost-forever-has-been-uploaded-to-github/
>
>
> Gabi
>
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 3658 bytes --]

  parent reply	other threads:[~2019-12-07  1:23 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-06 10:45 Gabriel Diaz
2019-12-06 11:01 ` Steve Nickolas
2019-12-06 14:23 ` A. P. Garcia
2019-12-06 14:48   ` A. P. Garcia
2019-12-08  7:48   ` arnold
2019-12-08 19:54     ` Clem Cole
2019-12-06 16:19 ` ron
2019-12-06 16:39   ` Richard Salz
2019-12-06 16:54     ` Dan Cross
2019-12-09  0:05     ` Steve Johnson
2019-12-09  0:35       ` Ken Thompson via TUHS
2019-12-09  0:46         ` Adam Thornton
2019-12-09  2:03           ` Rob Pike
2019-12-09  2:10             ` Ken Thompson via TUHS
2019-12-09  2:15               ` Rob Pike
2019-12-09  2:19                 ` Ken Thompson via TUHS
2019-12-09  8:41                   ` Gabriel Diaz
2019-12-09 11:17               ` Angelo Papenhoff
2019-12-09  8:40         ` Naveen Nathan
2019-12-06 17:24   ` Arthur Krewat
2019-12-06 17:58   ` Dr Iain Maoileoin
2019-12-06 22:12     ` ron
2019-12-07  0:04       ` Rob Pike
2019-12-07  1:22 ` Adam Thornton [this message]
2019-12-07  1:28   ` Adam Thornton
2019-12-10  0:30 Doug McIlroy
2019-12-10  5:08 ` Adam Thornton

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='CAP2nic0S-rP4kq=sAyut-Qr5M5kyoHcCj=PZL07Xis=rv1uB3Q@mail.gmail.com' \
    --to=athornton@gmail.com \
    --cc=gdiaz@qswarm.com \
    --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).