GOOD COMPUTER: Z-machine

2020-06-22 15:09

GOOD COMPUTER continues!

I got bored with BASIC, and I’m waiting for parts to arrive, so I started something new: a Z-machine implementation, in AVR assembly, so we can play Zork!

https://gitlab.com/good-computer/zap https://twitter.com/robn/status/1267645875855060993


2020-06-22 15:20

my typical workspace layout for this stuff, if you’re interested. code and test setup on one, data inspection and other fiddling on another, and CPU docs on another. it’s not complicated


2020-06-24 16:18

enough stuff in place to get initialisation and opening description on screen and ready for input. there’s A LOT under here. next up, the input handler and tokeniser, which seems like it should be massively complicated, but might end up being quite easy 🤷‍♂️


2020-06-28 22:20

turns out it was massively complicated, at around 250 instructions. then a day of bug squashing, and there’s actually quite a lot of game running behind the scenes, though you can’t see it yet. next up is object tree management, so we can actually manipulate the environment


2020-06-28 22:24

I’m not kidding about “a day of bug squashing”. not helped by the various bits of z-machine docs around the place being incomplete or misleading. eventually, in despair, I added instrumentation to a bunch of ops in my code and in frotz and compared their output. bit cheaty but eh


2020-07-02 23:37

object management (mostly the INSERT_OBJ instruction) now in place, and we can actually sorta play the game! the remaining unimplemented instructions are all in fairly specific game situations, which is gonna make testing a bit awkward, but its nice to make it this far!


2020-07-03 15:08

fair play to the troll, creative way to take me down


2020-07-03 18:28

random number generator probably works, infinite lives cheat not so much

(unimplemented here is DEC, which I guess is trying to reduce my hitpoints)


2020-07-03 23:02

this troll will not take no for an answer

(my guess at this late hour is that objects aren’t being properly removed from their parent, so after death the troll remains in the room, and so the room update function allows it to continue to bludgeon me)


originally posted on twitter at: https://twitter.com/robn/status/1274932574771490816