Skip to content

thwill1000/mmbasic-zmim

Repository files navigation

Z-MIM

A Z-machine interpreter for playing the classic Infocom works of interactive fiction.

Written in MMBasic v6.00 for the Colour Maximite 2, PicoMite VGA/HDMI, PicoCalc, MMBasic for Linux and MMBasic for Windows.

Copyright (c) 2019-2025 Thomas Hugo Williams

  • Z-machine technical advice was provided by Fredrik Ramsberg, co-author of Ozmoo.
  • PicoCalc testing by Chris Stoddard.

You can do what you like with this code subject to the LICENSE,
but if you use it then perhaps you would like to buy me a coffee?

Buy Me A Coffee

How do I run it?

Story files

The games/adventures for the Z-machine are called "story files" and come in several versions z1, z2, z3, ... z8

Z-MIM currently only supports .z3 format as used by the classic 1980's Infocom games.

Z-MIM is distributed with four free story files that were distributed by Infocom:

  • tutorial.z3 - Introduction to interactive fiction and a little bit of Zork I
  • minizork.z3 - A nice big chunk of Zork I that was given away with the British Commodore users’ magazine “Zzap! 64″ no. 67. in 1990.
  • sampler1.z3 - Samples of Planetfall, Infidel, and The Witness.
  • sampler2.z3 - Samples of Zork I, Leather Goddesses of Phobos, and Trinity

Additional .z3 files can be copied into the stories/ sub-directory of the Z-MIM installation.

The Infocom classic stories are currently available for download from https://eblong.com/infocom:

  • Ballyhoo
  • Cuthroats
  • Enchanter
  • Hollywood Hijinx
  • Infidel
  • Leather Goddesses of Phobos
  • Planetfall
  • Plundered Hearts
  • Seastalker
  • Sorcerer
  • Spellbreaker
  • The Lurking Horror
  • The Hitchhiker's Guide to the Galaxy
  • Wishbringer
  • Zork: The Great Underground Empire - Part I
  • Zork II: The Wizard of Frobozz
  • Zork III: The Dungeon Master

Note that only the .z3 file versions are compatible with Z-MIM.

Disclaimer the copyright of the files posted on the above site rests with Activision and I neither condone nor condem their usage. That said, to their credit, Activision does not appear to be acting to close down the above site, perhaps they accept the argument that "the historical value of these documents to the IF community outweighs the rights of the legal owner".

In addition many third-party story files are available, see the Interactive Fiction Database, and also:

Meta-Commands

The interpreter provides a number of internal meta-commands all prefixed with a *:

  • *break
    • Breaks currently running story into Z-MIM story debugger.
    • Once in the debugger type h for a list of debugger commands.
  • *credits
    • displays Z-MIM credits.
  • *font [small | medium]
    • Changes the font size.
    • Defaults to medium.
    • KNOWN BUG: using *FONT SMALL on the Colour Maximite 2 causes the prompt to "glitch" in a way I have been unable to reproduce in a small example.
  • *more [on | off]
    • on: enables output paging so that a [MORE] prompt is shown whenever more output than can be shown on a single screen is generated; this is only likely to happen when replaying a script, see *replay below.
    • off: disables output paging.
    • Defaults to on.
  • *record [on | off]
    • on: prompts the user to select and name one of 10 script file slots and then starts to echo every subsequent command into the selected file.
    • off: halts recording.
  • *replay [on | off]
    • on: prompts the user to select a script file slot and then replays the contents of that file as if the user was typing it at the prompt.
    • off: halts replaying.
      • Only makes sense if inserted manually into a script file to prevent it from replaying to its end.
  • *restore
    • NOTE: this is provided to support any stories that DO NOT provide their own restore command (without the * prefix) which should be used in preference.
    • Restores story progress previously saved with the *save command.
  • *save
    • NOTE: this is provided to support any stories that DO NOT provide their own save command (without the * prefix) which should be used in preference.
    • Saves story progress.
    • The save format is a naive dump of the story's stack and dynamic memory area, see src/zsave.inc.
    • WARNING! mixing the use of *save and *restore with any save and restore commands provided by the story may produce "odd" behaviour even though the same format is used by both.
  • *screenshot
    • Generates a .BMP screenshot.
    • Not available on all platforms.
  • *spin [on | off]
    • on: enables progress spinner when the Z-machine is "thinking".
    • off: disables progress spinner.
    • Defaults to on for PicoMite devices.
  • *status
    • Prints the current story status.

Limitations

Z-MIM currently has the following limitations:

  1. Only works with .z3 format stories.
  2. Non standard support for scripts:
    • type *record to start recording a script.
    • type *replay to play-back a script.
  3. No split screen, as used (optionally?) by Seastalker.
  4. No sound support, as used (optionally?) by The Lurking Horror.

FAQ

1. Will you be supporting .z4, .z5, etc. story formats ?

Perhaps. It depends on whether anyone finds this useful, or how bored I get.

2. What possessed you to write this in BASIC ?

This is currently the only option on the Colour Maximite 2 unless you want to rewrite/replace the firmware to include an ARM Z-machine implementation.

3. How do I play these games ?

Try playing "tutorial.z3" or read https://www.z-machine-matter.com/playing.html

4. How do I find out more about Interactive Fiction ?

Visit https://intfiction.org/

5. How do I find out more about the Z-machine ?

The Z-machine standard documents can be found at https://www.inform-fiction.org/zmachine/standards/

6. How do I contact the author ?

The author can be contacted via: