Jump to content
IGNORED

Injecting an Infocom game into an ATR


The Usotsuki

Recommended Posts

Many moons ago (actually, back in February 2002) I created a program that allowed me to convert any "Z3" Infocom game (the majority of their text adventures) into an Apple ][ disk image along with the interpreter code.

I started to try to come up with a program that did the same thing on the Atari 800 but it only works on the game I extracted the interpreter from... so I guess I'm missing something...

All these "Z3" games come in two pieces: the game itself, which is system-agnostic, and a virtual machine or interpreter that executes the game. Tools exist to extract the game from the disk, but only on the Apple ][ and Commodore 64 do they seem to exist to put the game on a disk.

I wonder what I might be missing?

The current code is at http://naomi.hoshinet.org/~usotsuki/interlatr.c and should compile on anything (except 16-bit DOS since it uses a buffer the size of an ATR image). The interpreter was extracted from the "Hitchhiker's Guide to the Galaxy" version 56/841221 since I also have an Apple ][ 56/841221 image.

There's another possibility I may be overlooking and will check into when I've finished posting: that disk B is supposed to always contain 91428 bytes of the image. (ETA: no, that didn't work either x.x, but it's possible I'm getting somewhere...)

Edited by The Usotsuki
Link to comment
Share on other sites

It's a problem if you need the interpretor from the same game then since in effect you're just recreating something that already exists.

 

If a system for creating disks already exists on the other 2 machines then maybe the easiest solution would be to modify one of them.

Standard OS calls should be used for disk and screen I/O so it wouldn't be too much work.

 

Also remember if you're generating an ATR from scratch you'd need a valid header, that'd be easy enough to generate a template for, or just rip one from a new blank image.

 

It's not something I've looked into at all - I did create executable versions of a couple of Infocomm single-disk adventures that can run on large memory machines, but that was using a tricky Ram-based modified OS, the game code itself wasn't touched.

Link to comment
Share on other sites

Well, the Apple version works like so: Z3 games all fit on one disk, and there's just a 12K interpreter at the beginning, but all but one version of the interpreter need the sector interleave changed (this is why the filename stands partially for "interleave").

 

The interpreter should, theoretically, be the same for all games (and in fact, someone did release such a set for the Apple ][, using the "M" interpreter and the latest version of every game file).

 

What I did notice is there was no interleaving needed for H2G2, but the data was split unevenly, with most of it on disk 2.

Link to comment
Share on other sites

Writing such a tool should be straight forward enough, the games typically come on 2 * 720 sector disks.

 

This thread details a related question and I guess you are looking to put other (or your own) Z3 titles onto disk?

Tom Hunt had done many of the ones around at that time (e.g. the Inform sample 'Alice') so maybe track those first.

 

Also, many non-Infocom games aren't so big, so can fit on a single floppy (e.g. a 1040 sector disk size).

If you are not using a floppy, e.g. an SIO2PC solution, then the ATR size doesn't have to be constrained.

 

The second byte of the Z3 file has the determining bit of information as the 'bit 2' states if the game is split over two disks.

So in making the Deadline disk yesterday I had to change this bytes value from '2' to '6' (add '4').

The length of the section required from the file for the first disk is derived from other detail in the header.

The remainder can then go on the second disk.

  • Like 2
Link to comment
Share on other sites

  • 3 years later...

Not sure if this has already been done before but I've had some success concatenating an Infocom Z-machine interpreter program for the Atari and a non-Infocom story file (Z-code). What I've done applies to small-ish story files (ones that don't require spanning disks).


1. Starting with the ATR image for Zork 1 (Serial 830929 Release 75), it's possible to search for the serial number to find the start of the Z-code. In Linux, it'd be something like:

 

$ hexdump -C zork_i_830929_r75_z3.atr | grep 830929 -B3 -A2
00001bf0 85 e6 a9 20 85 e7 a2 24 20 62 1f 20 f7 1b 20 63 |... ...$ b. .. c|
00001c00 1c c9 9b d0 e6 4c c0 1b 00 00 00 00 00 00 00 00 |.....L..........|
00001c10 03 00 00 4b 4e 5b 4f 29 3b 3e 02 b0 22 6a 2e 60 |...KN[O);>.."j.`|
00001c20 00 00 38 33 30 39 32 39 01 f0 a5 c2 a3 86 00 00 |..830929........|
00001c30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|

 

Notice the serial number 830929 at file offset 0x1c22. 18 or 19 bytes before that (at 0x1c10) is an 03 (as in "version 3 Z-machine Interpreter Program"). That is the very beginning of the Z-code header. I've assumed everything before that to be the Infocom Z-machine Interpreter Program and boot code.

 

2. Extract the first 0x1c10 (7,184) bytes (offset 0x0000 thru 0x1c0f) from the ATR image, creating a file called info3a8.bin. This contains Infocom's Z-machine Interpreter Program for the Atari 8-bit.

 

$ head --bytes $((16#1c10)) zork_i_830929_r75_z3.atr > info3a8.bin
$ ls -l info3a8.bin
-rw-r--r-- 1 michael michael 7184 Nov 12 21:00 info3a8.bin

 

3. Concatenate info3a8.bin with Z3 code created using Inform 6.1.5 and the mInform 1.1 or Inform 6/2 parser libraries. As far as how the Z-code is organized on the diskette, there's no trickery like sector interleaving as found on, say, the Apple II. The Inform6 object code can be written verbatim to the Atari disk image.

 

$ cat info3a8.bin grue.z3 > grue_171019_r1_z3.atr
$ ls -l grue_171019_r1_z3.atr
-rw-r--r-- 1 michael michael 63504 Nov 12 21:01 grue_171019_r1_z3.atr

 

4. Fill the remainder of the disk image with zeros. A normal Atari ATR image is 92176 bytes.

 

$ head --bytes $((92176-63504)) /dev/zero >> grue_171019_r1_z3.atr
$ ls -l grue_171019_r1_z3.atr
-rw-r--r-- 1 michael michael 92176 Nov 12 21:03 grue_171019_r1_z3.atr

 

 

5. Boot it.

 

$ atari800 grue_171019_r1_z3.atr

 

Unfortunately, most of the Inform-created story files out there are written for Z5 or Z8 interpreters. The example grue.z3 file is my back-port of Charles Mangin's "Grue" from Inform7 to Inform6. Not as easy as it sounds but doable.

 

If you're sufficiently motivated to create your own Infocom-like text adventure for the Atari 8-bit, here are some resources:

 

http://www.ifarchive.org/if-archive/infocom/compilers/inform6/manuals/old/designers_manual.pdf

http://www.ifarchive.org/indexes/if-archiveXinfocomXcompilersXinform6Xexamples.html

https://www.kansasfest.org/wp-content/uploads/apple_ii_inform_paper.pdf

 

- Michael S.

post-41212-0-70758900-1510544967.png

zork_i_830929_r75_z3.atr

info3a8.bin

grue_z3.zip

grue_171019_r1_z3.atr

  • Like 5
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...