You might wonder what ‘Zork‘ is? Zork is one of the first and earlist fictive computer games, written around 1977 and 1979, written in MDL on a DEC PDP-10 by members of the MIT Dynamic Modelling group (see https://en.wikipedia.org/wiki/Zork). I believe the first time I have played Zork was around 1984 on a Commodore 64.
The idea was to run that game on a ‘normal’ ARM Cortex, and I selected the NXP FRDM-K64F board for this: the board is powerful enough and has an SD card socket so the game can load from the SD card.
I started my port of Zork for the NXP FRDM-K64F board using the port from Thomas Shane. You can find my port for the FRDM-K64F on GitHub (links at the end of this article). It should be fairly simple to port it to any other board.
The game code has been converted to C using a converter (so the code looks rather ugly with lots of goto statements). All the game files are in a single folder:
The Zork game loads the game data from a file (dtext.dat). I have ported the game so it can load the game data in three different ways:
- Loading the data from a SD card using FatFS
- Loading the data from the host using Semihosting
- Loading the data from the on-chip FLASH memory
Which variant is used can be configured in Zork/zork_config.h:
- If using the file system/SD card with FatFS: copy the file dtext.dat to the root folder of the SD card.
- If using Semihosting: this requires an active debugging session, so you have to start the program with the debugger. The program then accesses the dtext.dat from the host PC.
- The easiest way is to use the game data from FLASH memory (at least 128 KByte required). The game data gets loaded into FLASH as dtext.dat (file in the Zork folder).
Communication to the board is by default using the OpenSDA UART (USB CDC) over a virtual COM port. The application runs FreeRTOS with a shell task where I can start the game:
With ‘Zork play’ at any time you can start the game and play:
‘help’ gives a description of the commands, and quit can be used to leave the game:
Have fun playing the game and exploring the dungeon! And if you don’t know how to solve one of the puzzles, there are plenty of hints online :-).
Happy Zorking 🙂
- Wikipedia: https://en.wikipedia.org/wiki/Zork
- Port of Zork by Thomas Shane: https://github.com/devshane/zork
- Kinetis Design Studio port: https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/KDS/FRDM-K64F120M/FRDM-K64F_Zork
- MCUXpresso IDE port: https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/MCUXpresso/FRDM-K64F/FRDM-K64F_Zork
Whatever floats your boat ! ;-)))
You can find the source code for the predecessor to Zork (Crowther and Woods’s Adventure game) at http://mirror.ifarchive.org/if-archive/games/source/adv350-pdp10.tar.gz
Of course, it is in fortran, which makes porting to an ARM difficult.
https://github.com/Quuxplusone/Advent claims to have an ANSI C port of the game.
thank you for these links!