Hacker News new | past | comments | ask | show | jobs | submit login
Infocom-zcode-terps: Historical source code for Infocom's Z-machine interpreters (github.com/erkyrath)
176 points by m463 on Nov 19, 2023 | hide | past | favorite | 24 comments



Note that dungeon (the source port from the mainframe game that eventually became Zork) has been open sourced for much longer. At some point it was machine translated from F77 Fortran to C~90, and comprises some of the most terrifying code I have seen:

https://github.com/devshane/zork

http://mirrors.ibiblio.org/interactive-fiction/games/source/...


Everywhere the `goto` touches, is your kingdom.


The Republic of longjmp() isn't going to help you out much, though.


I first played it as dungeon on a vax, I believe it was the fortran version.

One detail I vividly remember is reading a listing deep in some cavern that said something about MEMQ


Replying to my own comment. I decoded it from the original dtextc.dat file:

  Object: 122: stack of listings
   There is an enormous stack of line-printer paper here.  It is barely
   readable and totally unintelligable.
  Initial:
   There is a gigantic pile of line-printer output here.  Although the
   paper once contained useful information, almost nothing can be
   distinguished now.
  Flag1: -8176 (burn take read visible)
  Size: 70
  Room: 137 (Tomb of the Unknown Implementer)
  Read:
   <DEFINE FEEL-FREE (LOSER)
    <TELL "FEEL FREE, CHOMPER!">
    <MEMQ ......
   The rest is, alas, unintelligable (as were the implementers).


Did Fortran programmers really use meaningless goto labels like that?


FORTRAN77 only allowed 5-digit numbers as labels. So people developed habits for numbering loops & ifs. Programs definitely lost readability if you renumbered them.

The labels were in fact numbers, not just numeric strings, since there was a computed GOTO that took an expression to jump to.


I'm pretty sure back then number labels didn't seem any worse than the memory addresses one would use in machine code.

I wonder what aspect of coding today will seem to coders a half-century from now to have been not, sympathy for the machine, but excessive kowtowing towards it?

(I would suggest order-dependent alternative trees, but Hope provides an example of starting with order independence and subsequently reverting to what programmers traditionally expect)


But was anyone actually coding in machine code without an assembler?

At least an assembler lets you set strings for all your jump points...


Good point; looking at MIXAL (ca.1968?) it looks like local symbols are single digit but global symbols are up to 10 character alphanumeric.


Computed GOTO was tricky, but not as bad as a computed COMEFROM.


See also Ryan C. Gordon’s (icculus) Multizork / Mojozork project: https://www.patreon.com/posts/54997062?utm_campaign=postshar...

https://github.com/icculus/mojozork


Something cool about reading code from the 1980s..


At least I could keep all Z80 opcodes on my head...


read.me…


I got the PDP-11/RT-11 version to build & run!

It's the real deal!

https://virtuallyfun.com/2023/11/21/zork-for-the-pdp-11-rt-1...


> #define THEN

Later:

> if (datname = init(argc,argv)) THEN > gamfile = datname;

The programmer apparently really hated this quirk of C syntax.

Me too.


The creator of this github repo is the same person who publicly called for the release of the infocom adventures after Microsoft acquired Activision. (HN discussion from a month ago: https://news.ycombinator.com/item?id=37893794)

I don't see mention of a license in the repo, but I wonder if informal permission was given to make the sources public?


And a few MS/ex-MS employees popped up in the comments, so it's likely something happened behind the scenes. Would love to know the story.


The license only matters if someone cares.

In this case, it is very unlikely no one cares and not wishes to see this in public.


My dumbass opened up this repo full of hope and then realized I can't read any of this XD, I trained in the early 2000s, my first language was Java, I'm pampered as all hell.

The last time I saw assembler was in a bloody history class :P

Mind you, old school game developers were absolute gangsters and gave 0 shits about anything except things working and that's what I appreciates about them.


Assembler isn't hard to write.

It's just bloody hard to read, unless you wrote it, and wrote it recently. You effectively have to have the state of the register set in your mind the whole time.

Lots of C code from back then is just as impenetrable though. It has structure but it's terse and mechanical. Everyone rolling their own lists and hash tables and string functions in every program, lots of unrolled loops, etc. Different constraints. Memory & CPU was expensive.


You can start by learning JVM bytecodes [0], and play around with Jasmine[1].

Even today many cool performance tricks require understanding the bytecodes of the underlying language runtimes.

[0] - https://docs.oracle.com/javase/specs/

[1] - https://jasmin.sourceforge.net/


Ahhh mate cheers! I had never seen Jasmin, I'll definitely take a look.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: