A2Z Machine Update: TinyUSB and Snakes!

The A2Z Machine is a Z Machine emulator I ported to the Adafruit ItsyBitsy M4 Express. It plays interactive fiction games like Zork, which I wrote about last October. I recently made a few enhancements that I would like to share.

Beginning of Zork game using the Compaq Green theme.

TinyUSB support – TinyUSB is big (no pun intended). TinyUSB allows the ItsyBitsy to act as a thumb drive so now you can simply drag and drop Z game files to the ItsyBitsy. Previously, this required installing a CircuitPython boot image, install the Z game files, then reloading the A2Z Machine sketch back onto the board. This was tedious, to say the least, and you needed to use a PC with the Arduino IDE installed in order to reload the sketch. Now you can add files anytime on any computer with a USB port, even when a game is currently running. You can also manage saved game files too.

Faster game saving – The original version of the A2Z Machine was quite slow when saving games. The save speed has been improved dramatically through buffering the disk writes in the save game routine.

Added timeout to read_char() routine – This may sound like a dull or unimportant enhancement, but let me put it to you simply: You can now play the classic Snake game on the A2Z Machine! The classic Snake game was ported to the Z Machine by Zach Matley , however, it required a timeout feature in the read_char() routine to advance the snake during the game. The timeout feature was in the Z Machine specification but was not implemented in the Z Machine code used in the A2Z Machine. So, this was added starting with version 2.1 and now Snake can be played at 10 different speed levels. Like Zork, Snake uses the curses library to manipulate the text screen, so you may need to modify your terminal settings. In particular, select the “Implicit CR for every LF” option in your terminal settings. Fortunately, this change also works with Zork so you can use the same terminal settings for both games. The option to change the snake color does not work, however, the A2Z Machine has 4 color themes to choose from. The Snake game has been added to the GitHub repository for the project.

Leave a Reply

Your email address will not be published. Required fields are marked *