Zork for the Microtouch.

When I was a boy I burned (and listened to) much midnight oil playing Zork and many other Infocom text adventures hunched over my Atari 800. I have never forgotten profound delights of the exploring the darker regions of the Great Underground Empire: clever puzzles, lurking grues and snarking 90k disk drives.

It is hard to believe it has been 30 years since I first played Zork. To mark the occasion I have ported a Z-machine interpreter to the Microtouch

Photo

Playing Zork 1 on a microtouch in the dark. I am likely to be eaten by a grue.

The Z-machine was created in 1979 to play large (100k!) adventure games on small (8K!) personal computers. Long before the Java the implementors at Infocom built a virtual machine capable of paging, loading and saving complete runtime state that ran on a wide variety of CPUs. Pretty sophisticated stuff for microcomputers 30 years ago.

Infocom published the most enduring works of interactive fiction; if you have not played one of these beginning to end you are really missing one of the great joys of computer gaming. Since building the microtouch version I have replayed the three Zorks, Trinity and Hitchhikers Guide and can’t understand why anyone would waste their time with the crap on facebook when these gems are out there.

The brilliant sprite ran Zork on an AVR the hard way; by implementing a CP/M emulator and running the Zork CP/M binary. His approach used an external 128k of DRAM, a luxury not available on the microtouch. Also UI (touchscreens, pixels etc) has progressed a bit since the days of CP/M so I took a slightly different approach: the code is based on a cut down version of frotz, the gold standard for z-machine interpreters. I was forced to remove support for the V6 “graphic” games to fit in the 32k flash limit of the microtouch. No great loss here, the text-only adventures were Infocom’s finest.

Because the microtouch only has 2.5k of memory, all Z-machine memory is virtual, including its stack. 3 layers of caching of different granularities were required to get reasonable performance. A page file on the microSD card (“p.pge”) acts as its backing store. By default the app loads “game.z5” game but will play most non v6 games: just change their name and copy to the microSD.

The bad news is that the code is too big to fit on microtouch with the bootloader. At 32k it needs to be programmed with an ISP. I will need to abandon frotz and reimplement with more AVR friendly code to shrink it to the size of a “normal” microtouch app. The hexfile, pagefile and a game are posted here. Copy “game.z5” and “p.pge” to microSD card, burn hex file with an ISP and enjoy. Remember the app supports save, restore and scrollback. Once you get to the barrow, you can find lots of other games here.

Until next time,

Rossum

 

Tardy update:

Finally posted source for Microtouch zork/frotz at https://github.com/rossumur/microtouch .

A 28k version with an icky fonts and a 31k with a nice font can be built with ‘make zork’ and ‘make zorkcleartype’. Enjoy.

 

6 thoughts on “Zork for the Microtouch.

  1. Anonymous

    This makes me wanna buy one.. but I don’t have the cash at the moment…
    Are you going to publish/release the source code so I can use my existing mcu’s?

    Reply
  2. Anonymous

    This is brilliant. Mine arrived last week. Everything works so far except Zork and the above post explains why (need to flash through an ISP). I, too, remember Zork from 30 years ago.

    Reply
  3. Anonymous

    I just pulled down the latest repo and tried out the ebook function. Works just fine. I also tried zork and no success, so a couple of questions:
    1) Am I right in assuming the ebook app has to be stand-alone? Can’t combine it with other stuff?
    2) I built zork with zorkcleartype and it flashed without error, but it just shows a red screen. I think I see a flash of a keyboard before it goes red. I’m using the USB rather than the ISP to flash, assuming that the smaller version is going to work for that. Am I doing something wrong?
    Thanks

    Reply
  4. Pingback: Running a Z-machine on an AVR | Sourcegate

  5. Pingback: Zorkduino | rossum

Leave a comment