Question on Z-Machine Reference Implementations


(Jeff Nyman) #1

Greetings all.

Is there a reference implementation of the Z-Machine that folks would recommend? By reference implementation, I mean one that is about as feature complete relative to the 1.0 specification as possible.

This would mean it has to support all z-code versions: 1 through 6 for Infocom, 7 and 8 for Inform. (Supporting 1 and 2 is necessary for this regardless of their rarity. I have two Zork games that are both v1 and v2.) This implementation would have to support timed input. (This is something I find gets left off a lot.) This implementation would have to support the specific character handling with Beyond Zork and the real-time input of Border Zone.

I realize version 6 is a thorny topic all on its own so ideally a reference implementation is as complete as possible, being able to show the images on, say, Zork Zero.

The reason I’m asking about this is because there is a class that is considering using the Z-Machine as a practice for writing interpreters. A previous class did the CHIP-8 which is an extremely easy implementation to do and now there is a desire to level up. Key to those classes is having a specification and, ideally, a reference implementation of the specification, hence this question.


(David Kinder) #2

Frotz is the closest to what you describe, in terms of the source code. For actual runnable executables, DOS Frotz and Windows Frotz implement everything you menion, as far as I know.


(David Griffith) #3

On the Unix side, SDL Frotz will also do V6 games.

Sidenote: As I get the SDL interface more integrated with Unix Frotz, I’ve come to the conclusion that it’s needlessly fiddly and lacks some important features – like being able to copy and paste in the text window. Therefore I’ve renewed my interest in creating a GTK-based Frotz interface that closely resembles that of Windows Frotz.


(Jeff Nyman) #4

Interesting on that. I also came across Grotz (http://kevinboone.net/README_grotz.html). That seems to have been based on Frotz but does use GTK. That said, I don’t think it’s using the most recent versions of GTK which, as I understand it, changed quite a bit and getting it to build cross-platform has been a little annoying.

For these classes I’m potentially looking at using something that’s easily cross-platform in terms of building it. It seems like the C-based implementations provide the best references but they are also the most troublesome to sometimes get working across all operating systems.

I’ve found references to Python versions that, while obviously slower, do have the benefit of working pretty much out of the box on whatever operating system you try them on. I would just have to update them to actually be more complete in terms of a reference implementation. I was considering JavaScript as well but most of the implementations I can see are incomplete in various ways.


(David Griffith) #5

Grotz uses GTK2 whereas GTK3 is the current major version. The way it does audio output is strange. It completely unpacks Blorb files. Then it calls a shell script that uses mplayer to play the unpacked Blorb contents.