How do I port a .z8 to a .com?

I’ve wanted to make a text adventure that can be played on MS-DOS. I saw that Zork (a text adventure that’s packaged in a .COM file) was made on the Z-Machine engine, so I wanted to try porting a text adventure

Does anyone know how I could do this? How I could port a Z-Machine game (.z8) to MS-DOS (.com)?

You need a Z-code interpreter that runs in DOS. That’s probably Frotz: Index: if-archive/infocom/interpreters/frotz . There’s a couple of DOS binaries there.

I don’t know if they can be packaged up with the game file as a single DOS executable. You might need a batch file.


What exactly would the batch file do? I actually have a batch file converter that allows me to turn it into an MS-DOS application, so that might work well.

(Also, I have no idea how to get Frotz running by itself.)

Start with from the link Zarf sent you. “Frotz 2.53 for 16-bit MS-DOS, with old-style graphics and sound support, by David Griffith.”

Inside, you’ll find frotz.exe, which is 108KB. Provide frotz.exe and a .z8 file to your users. If your users have a real vintage MS-DOS machine, you could provide them on a floppy disk.

Otherwise, if you just want to get them to work in an emulator like DOSBox, you’d presumably just provide both frotz.exe and your .z8 file in a zip, and trust that your users know how to extract a zip and MOUNT it in DOSBox.

On my macOS machine running DOSBox, I was able to put LostPig.z8 from in the same directory as frotz.exe, then launch DOSBox and run

MOUNT C /Users/dfabulich/Downloads/frotz253
frotz lostpig.z8

If you want to provide a single command to run, you could write a batch script, lostpig.bat, like this:

@frotz lostpig.z8

Then the user could run this:

MOUNT C /Users/dfabulich/Downloads/frotz253

… but I figure that anybody who can figure out the MOUNT command can figure out the frotz command, too.

If you want to write your own .z8 file, and if you want to keep your .z8 small, you might enjoy PunyInform.


It worked! Is there a way to make it to where I can get rid of the blue background? If it depends on my editor, I use Inform 7.

frotz -b 0 lostpig.z8

You might enjoy frotz --help for a list of other options. (Also I think your .z8 game can control background colors somehow, like Photopia does, but I don’t remember how.)

You can also run frotz outside of DOSBox on Windows in the Command Prompt, or install it on macOS via Homebrew.

1 Like

Yes, you can, using the @set_colour opcode described in section 42 of the DM4. Just keep in mind that not all interpreters support it and not all monitors can display it.

1 Like

I parse the question as “how do an self-executable story file”, akin to TADS2 executable files.

on this, I seriously doubt that a .com file (max. 64K size) can accomodate a .z8 capable 'terp and a .z8 story file.

But I note that the original Infocom .z3 'terp (written in that hellish 8086 assembler…) was a .com of 11402 bytes, so, theoretically one can wrote an opensource 8086 'terp in ~12/16k (depend on his/her prowess in .asm coding…) and bundle it with a ~48k .z3 story file, that is, roughly the size of library of horror

Feasible, provided that someone is both an excellent coder and a strong masochist for coding a compact .z3 'terp in 8086 assembler…

Best regards from Italy,
dott. Piergiorgio.

Infocom packaged their games for the IBM PC (and compatibles) as two parts: the interpreter and the game file (eg ZORK1.COM and ZORK1.DAT. For the V6 games, three graphics files (for CGA, EGA, and MCGA) would also be included. To play an Infocom game on a PC, you’d boot your DOS floppy in drive A. Then you could remove that floppy and insert the Infocom game floppy. Your saves would go on a blank formatted floppy in drive B. Make sure you’re on drive A and type the name of the game you want, say, ZORK1.

.z3 and .z4 games were shipped with a .com interpreter. For .z5 and higher, they were .exe. For .z4, an interpreter would push the limits of the .com format of cramming everything into a single 64k segment, so they had some as .com and some as .exe. There were no .com interpreters for .z5 games as far as I can tell.


Usually the interpreter supplied by Infocom can be edited with the DEBUG command or a hex editor to load some other Z-code file.


Jzip for DOS contains a tool to package the interpreter with a game. Get to do this. However, this compiled version may not be compatible with modern Windows versions.

1 Like

Ah, I didn’t know that. Useful info!

Seems like it’s exactly what I’m looking for; I’ll try it out.

1 Like

It did work, but the only issue I encountered is that it’s only in the color blue. I tried to find a solution, but I couldn’t get anything.

I don’t understand this. Is this related to a specific editor of any sort, or is it universal for all .z8 games, because I’ve never seen anything like that in Inform 7 (my editor).

I don’t use Inform 7, but I’m sure it has a better way of changing foreground and background colours. I’m guessing that you can either use Inform 6 code or use an extension such as ‘Basic Screen Effects’. See example 69 ‘Garibaldi 2’ in the documentation for an example of changing text colour with the latter.

A Z-code game version 8 can set the screen colours, or it can not set the screen colours. If it doesn’t set them, the Z-code interpreter will use the default colours for that interpreter. So a game may be shown with black text on a white background in one interpreter but with say white text on a blue background in another interpreter. Most interpreters allow you to change the default colours, either in a config file or with a commandline option.

A few years ago I updated jzip to work on modern windows as a console application:
You can find a binary in (link valid for a month or so). I haven’t touched it for quite some time, but if it is close to what you want I can update it.

1 Like