Pages: [1]   Go Down
Author Topic: ZORK for the Arduino  (Read 4087 times)
0 Members and 1 Guest are viewing this topic.
Austin, TX
Offline Offline
God Member
*****
Karma: 12
Posts: 524
carpe diem
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Boston Suburbs
Offline Offline
God Member
*****
Karma: 14
Posts: 955
I am above your silly so-called "Laws", Mister Ohm.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Beyond cool.
Logged

When the testing is complete there will be... cake.

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 71
Posts: 3510
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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..

Abysmal
Logged

Thailand
Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-sad
Any ideas What I might be doign wroung ?
« Last Edit: May 29, 2012, 01:25:27 am by talofer99 » Logged

Austin, TX
Offline Offline
God Member
*****
Karma: 12
Posts: 524
carpe diem
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Thailand
Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley
Logged

Thailand
Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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).

« Last Edit: June 04, 2012, 12:25:39 pm by talofer99 » Logged

Austin, TX
Offline Offline
God Member
*****
Karma: 12
Posts: 524
carpe diem
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

talofer99,

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.
Logged

Thailand
Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:

Logged

Thailand
Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

code attachd ...

* azip_recv_glcd.pde (9.58 KB - downloaded 11 times.)
Logged

Thailand
Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
http://www.arduino.cc/playground/Main/PS2Keyboard



** TV - OUT **
Video - D29
Sync - D11
You can download the library (fonts included) & schematics here:
http://code.google.com/p/arduino-tvout/
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.68 KB - downloaded 10 times.)
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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















Logged

Thailand
Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.68 KB - downloaded 7 times.)
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 87
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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. smiley
« Last Edit: October 14, 2013, 11:19:20 pm by sjheiss » Logged

Pages: [1]   Go Up
Jump to: