I discovered propeller recently and decided to do a small project to get familiar with it.
It seemed that noone implemented Z-machine to to run Zork and similarinteractive fiction games yet (I only found the catalina version on the forum, but that requires extra hardware).
So attached is a simple Z-machine which I call ProZ [noparse]:)[/noparse]
It it writen in Spin and runs on one cog using standard Keyboard and TV_Text/VGA_Text driver (but could use any terminal output).
Zork data files are about 100K in size so they won't in memory. I am reading them off an SD card using fsrw.
Zork game file can be downloaded from http://www.infocom-if.org/downloads/downloads.html
It should not be hard to use a different storage that has at least 128K instead (hydra EEPROM etc).
Smaller game files which fit in memory can run in a standard demo board set-up with no extra storage.
E.g. here is a couple of nice little games:
Give it a try and let me know if it works for you or if you encounter any bugs.
This version is configured for demo board with TV driver and SD card on base pin 0.
Some implementation notes:
1. Only version 3 of the Z-machine specification is currently supported. This is the version Zork trilogy uses, but many later games use versions 5-8. It may be possible to add version 5 support, but others may be too difficult to fit due to the memory limitations...
2. Z machine specification assumes that the whole game file is loaded in memory and can be accessed quickly. With an SD card this is not possible so I have to use virtual memory by accessing it one page at a time. This makes the large game a bit sluggish due to constant paging (though definitely playable). Perhaps a more clever caching algorithm can be used.
There also seems to be no way to seek to a particular location with fsrw so I have to read the file from the beginning each time I need to fetch some data.
3. Game file name is defined at the end of the file (storyFile). Alternatively you could load the file direcltly into the mem array provided it is under 12K (see commented out code). There are a few constants at the top of the file defining memory, stack and cache page allocations. The ones that are there work well with Zork I. They may need to be tweaked for other games.
4. User interface is somehwat limited. You can enter text from keyboard and do basic edits using backspace key,but that's about it.
5. You can save and restore games. Game is saved in savegame.bin file on the SD card.
Post Edited (unixoid) : 8/3/2010 6:27:55 AM GMT