ZORK for the Arduino

Here is a project that I have been working on that I wanted to share with anyone who is interested. It is a port of a Z-code interpreter that will allow you to play Z-code programs on the Arduino.

All source code can be found here: https://github.com/louismdavis/azip

README: Arduino Z-code Interpreter Program

This version of the Z-code interpreter is derived from Jzip created by John Holder. More information about Jzip, including the source code can by found here: http://jzip.sourceforge.net/

Software Dependencies: SDFAT library http://code.google.com/p/sdfatlib/

Hardware Dependencies: Formatted SD card I am using the SD card interface on the Arduino Ethernet Shield, but you should be able to use any Arduino compatible SD card interface. http://arduino.cc/en/Main/ArduinoEthernetShield

Getting Started Steps: 1. Copy a Z-Machine game file to the SD card and name it "GAME.DAT". 2. Compile and upload the sketch to the Arduino. 3. Open the Arduino Serial Monitor, set the baud rate to 9600 and the line ending to Newline. 4. The sketch will pause waiting for the return key. 5. After hitting the return key, within a few seconds you should see the welcome screen in the serial monitor. 6. You can begin typing commands in the top portion of the serial monitor, next to the Send button.

I have include a copy Mini-Zork I downloaded from here: http://www.ifarchive.org/indexes/if-archiveXinfocomXdemos.html

Game files can be found several places on the internet, a good source for games is The Interactive Fiction Archive: http://www.ifarchive.org/indexes/if-archiveXgamesXzcode.html

Zork I, II, and III can be downloaded here: http://www.infocom-if.org/downloads/downloads.html

Limitations: Due to the limits of RAM and FLASH, I removed most of the screen handling capability. I removed the game save and restore capability. I will continue to see if I can add some basic game save/restore capability.

Beyond cool.

Woot! It works! Very nice indeed. I did have to use SPI_HALF_SPEED (easy enough to find in the main module!), I just had an SD breakout on a breadboard, and wires everywhere.

Sure does bring back memories.

I gotta check this out when I get home.. the ultimate would be a hybrid of this and Rossmur's microtouch running on a chip with more resources with a touch screen and an sd card so that games could be loaded and saved as well as the ability to play more than 1..


Very nice
do u have any video of it working ?
did u try and have it all workign ONLY on the arduno ?
like for exampel connecting a TVout library to it and have a ps2 keyboard attached ?

I just gave ti a try and I can get the welcome screen to work. but nothign after that … its juts dosn’t do any thing :frowning:
Any ideas What I might be doign wroung ?

Did you make sure the Serial Monitor is set according to step three:

  1. Open the Arduino Serial Monitor, set the baud rate to 9600 and the line ending to Newline.

Your the best!! I missed the "line ending to Newline" ... That is soooo cool .... Defently will be great if it can be outputed on the TVout library ... I will take a look and see if I can find a way to do it ....

Way to go :)

It took me for ever …. But I made it. The original plan was to use one arduino with TV-out and PS2 keyboard. Due to lack of space and other tons of issues I ended up building a computer side, with GLCD (the TVout interrupters drove the serial communication crazy) and a PS2 keyboard using the PS2Keyboard library. This way all I needed to do is to connect the 2 arduinos with RX/TX lines.

Some photos …

I still need to work on it a bit, to make the delete work for example… But except that its working great. I ordered a new MEGA2560 and I will try to put them all on the same board with the TV-out (since I can then cancel the Serial communication).


Great work. I am glad you were able to add new functionality and capability to the project. That is what this whole community is all about. Keep up the good work.

Thank you for your kind words Louis. Since the text is longer then what the glcd screen can show on one page, I added pages (up to 6 – memory limitation), you can use the Page up / Down to move between them. Also if you are not on the CURRENT page and try to type (something else then pgup/pgdown) the screen will "jump" back to the current screen. The Backspace is working as well so you can fix a typo if u made one.

Connect a ps2 keyboard to the Arduino. GLCD screen, and then connect between the arduino that has the SD card (the brain) and this one using the Tx/Rx (pin 0/1). Note when doing so TX ? RX and RX ? TX so digt1 will go to digit2 on the other board and digt2 will go to digit1 on the other board.

I can not pass the code here as well (lenght limitation of the post) ... so I will post it in a new reply, would love to hear comments/suggestions:

code attachd …

azip_recv_glcd.pde (9.58 KB)

That was a very interesting challenge and I’m happy to say I got a BETA version.
Mega 2560 (only!!) , SD Card reader, PS2 connector and keyboard, TV out and screen = azipM2560.
It’s far from being perfect but I got it to work, I even added the logo

in the near future list is to get the page scrolling up to work which won’t be that hard since I got some of the logic from the receiver version I coded. probbly by the ned ofthe weekend.
The kb is “acting” strange; I can guess it has to do with the interrupters of both the SD and KB libraries. I’m not that knowledgeable in C, but I like learning new things
Hope you like it
Code attached in rar file

H/W connecting and libraries-

** SD CARD **
CS - D53
DI - D51
CLK - D52
DO - D50

** PS2 mouse **
Data - D2
CLK - D3
You can find information here

** TV - OUT **
Video - D29
Sync - D11
You can download the library (fonts included) & schematics here:
ONE NOTE: I had to change the “static void inline sp” to “sptvout” since is z-types has an SP void as well. You will need to apply the change to the TVout.h and TVout.cpp (drop me a line if you want the revised version I got).

Wish list for next versions:

  • Pages for scroll up/down - in the near future since I got this code ready from the azip-reciver that I build before.
  • Show Courser while typing.
  • Show sand watch while “thinking” (reading from sd).
  • Check kb presence on load (not just init)
  • get the Save/Load to work?
  • Start menu to allow change of font size (not sure it’s doable)
  • Start menu to choose game (I-II-III) - again not sure it’s doable.
  • check KB issues (interrupters?)

azipM2560.rar (80.7 KB)

Well this certainly brings back memories! Let's get the camera ...

After endless attempts I gave up on the TVout and revert back to the GLCD.
So here is a version with paging (up to 6 at the moment).
It will only work on Mega 2560 (memory).
I’m going to work on a better “scrolling” interface, to make it smoother and not “page” blocked.
Code attached.
Would love to hear some feedback

azipM2560.rar (81.7 KB)

I tried the example in the first post, but it doesn't appear to work, not with my files anyways. I tried adventure.zf (Adventure/Colossal Cave) and after the game loads it says ">I beg your pardon?" then typing something, it does nothing.

If anyone else ever uses this, you must use the December 2011 version of sdfatlib. The latest one as of writing does not work.

Was hoping to get the Lojban version working, but not big deal. :)