Log in

No account? Create an account


Andrew de Quincey's livejournal

Previous Entry Share Next Entry
KIF: an infocom text adventure interpreter for the kindle
Wow, this sort of  thing seems to be in the news these days!

Note: I've updated these instructions for KIF 0.5; please see here for the release notes..

My app is different however: it isn't web hosted, it runs natively on the kindle using the KDK APIs. As I don't have the official KDK, you'll need to jailbreak your kindle and install my developer keys; this is easy, but if it goes wrong, I can't accept any responsibility.

So, lets jailbreak: The kindle jailbreaking was developed over at the mobiread forums, here. The following is a very quick summary, see the mobiread thread for more information:
  1. Download kindle-jailbreak-0.3.N.zip from that thread.
  2. Extract it on your computer.
  3. Copy the correct update_*_install.bin to the root of the kindle over USB. See the thread for information on which. (For my UK Kindle 3 with 3g, I use update_jailbreak_k3gb_install.bin).
  4. Safely remove and disconnect the kindle.
  5. Go to [HOME] -> [MENU] > Settings -> [MENU] > Update Your Kindle.
  6. It'll take a wee while, and the update will fail with a U004 or a U006 error (this is expected).
tada, your kindle is rooted. Now, normally at this point you'd wonder what to do now... well, lets move on to stage 2:
  1. Download kindle-adqdevkeys-0.2.zip from here.
  2. Extract it on your computer.
  3. Copy the correct update_adqdevkeys_*_install.bin to the root of the kindle over USB. It'll be the same code as for the rooting.
  4. Safely remove and disconnect the kindle.
  5. Go to [HOME] -> [MENU] > Settings -> [MENU] > Update Your Kindle.
  6. This time, the update will succeed, and will install my developer keys into /var/local/java/keystore/developer.keystore. In case you already are an official KDK developer, any existing developer.keystore file will be backed up into that directory. 
At this point you should have escaped the maze of twisty updates; installing KIF can be done entirely by copying files over usb:
  1. Download KIF-0.5.zip from here.
  2. Extract it to your computer with the full directory structure.
  3. Copy the extracted directory structure onto the root of the kindle USB drive. (e.g. "kif.azw2 should end up in your kindle documents folder). 
  4. Disconnect, and wait for the home screen to refresh.
  5. "KIF" should appear as an option... click it! 
I still have a fair amount of work to do on it (e.g. styled text, lots of GUI improvements, auto-persistence when going to HOME....); consider this an alpha quality release. However, games should be playable, and I've implemented savegame support.

I have only tested this with the minizork and curses games (which will be installed when you decompressed KIF-0.1.zip). Others will very likely work, but I have been concentrating on getting the basics up and running first rather than game testing. Also, I've only  tried it on a UK Kindle 3. YMMV.

I'm using the excellent zmpp as the infocom virtual machine. I must get in touch with the author and contribute my patches back once I have the source in a more stable form.
I also use the KWT for  the items in the save menu.
Finally, all code is available here.

By the way, you can get many more Infocom adventures over at the IF archive. And of course there's the yearly Interactive Fiction competition.

Fantastic work - it runs without a hitch! You're missing the link to KIF-0.1.zip, however.


Fixed the link, ta.

It looks like this other one's made slashdot. An opportunity to point out a better alternative?

I'll try, but I don't tend to have much success at posting to such sites!

Just what I was looking for

I was wondering if there was a native client for Zork on the Kindle, great to see someone working on it!

Here's a patch to add some whitespace around the game text:


I'm thinking of adding word wrapping next. I see that the last couple of pixels of the last character on a line are sometimes clipped too.

Re: Just what I was looking for

Cool! thanks, just applied.

Please go ahead with word wrapping; means I can get on with the styled/coloured text support...

Delicious LiveJournal Links for 10-10-2010

User andrewducker referenced to your post from Delicious LiveJournal Links for 10-10-2010 saying: [...] KIF: an infocom text adventure interpreter for the kindle [...]

Without Jail Breaking

Does anyone know if someone is working on a solution so we don't have to jailbreak our Kindle?

Re: Without Jail Breaking

Well, the obvious one would be for Amazon to have deigned to reply to my request for a KDK beta account at www.amazon.com/kdk . Then (I assume) I'd just be able to publish it on Amazon's kindle store.

However, I never heard anything back from them and I didn't want to wait.

How'd you find out about the KDK APIs? Is there any documentation out there that I can get access to? (I've also applied for the kindle dev program, never heard back)

See http://adq.livejournal.com/106967.html for useful links (also later posts detail my progress). I simply pulled the Kindlet/KDK jars off my Kindle's filing system.

Amazon left the KDK API docs publically accessible. A quick google search found people linking to them; there's a link to them in that post.

you just made me lose my recently purchased kindle to my girlfriend, who was obsessed with zork.

i hate you.

(thanks) ;)

Re: thanks a bunch...

Heh; wait till I get nethack working on it :)


Thanks so much, this makes my Kindle complete :-)

Great job! The kindle is one of the best platforms for IF *ever*. Lightweight, great display for it, so-so keyboard, great battery.
I've tried some games with success, but I ran into a problem that if I install every game that comes with Masterpieces of Infocom, I cannot scroll down to see all games. Maybe a split-column would work...

Re: Too much games

Glad you agree!

Yeah, I need to implement multi-paging in the file selector views, its on my todo list.

Do just what the guide says

I tried to do everything at once, so I just copied all the files over at once. I also included the uninstall files.

Not sure where my mistake was, but it worked when I did exactly what the guide says. RTFM ;-)

BTW. It would be great if you could put the source code up on sourceforge or a similar place.

Re: Do just what the guide says

Heh :)

The source is already up, easy to miss the link in the original post: http://code.google.com/p/adqmisc/source/browse/#svn/trunk/kif


Is there help included? For example, a question mark would list the commands the interpreter understands.

I don't know if that is actually possible; its entirely up to the interpreter running in the Zcode VM what is supports.

(Deleted comment)
You have to type RESTORE Dude...

Awesome! Better than reading books

just wish that i could adjust the font size. and also support for scott adams games would be cool, can i buy you a beer ?

Re: Awesome! Better than reading books

Hmmm yeah, font size should be doable when I'm next in the mood for working on kif.

Scott Adams games do seem to be just infocom games; if you dig about in the source of the HTML (e.g. http://www.freearcade.com/Zplet.jav/Advland.html is ADVLAND.Z5) , you can find the filenames of them ... or are you seeing a specific issue?

As for beer, that'd be great! Transferring it over the internet might be tricky though :)

Additional Games

Thanks for doing this! Great to see this for the Kindle.

Can you walk me through adding a game from the IF archive? I tried downloading a file with a .z5 extension and putting it in the documents folder on my Kindle. I couldn't get that game to be recognized.

The two games in your download worked fine. I noticed your file was a .azw2 extension. Not sure what the difference is or if that matters.

Re: Additional Games

Ah, you need to put it in a specific folder on the kindle.

If you plug it into a PC and access the kindle's "drive", you put the z5 games in <kindle>/developer/kif/work/

If you've unzipped kif-0.5.zip with the full directory structure, it should have created those directories for you.

Edited at 2011-02-09 10:01 am (UTC)

Re: Additional Games (Anonymous) Expand