I have never attempted to write a Z-Machine interpreter, and I doubt I ever will; but I’m toying with the idea of commissioning a Z-machine interpreter for an old 80s computer. Before I go any further with that project, though, I need more information on it; and I don’t recall reading anywhere, SPAG or other, the perspective of people who create interpreters. So, I have a few questions, but feel free to just talk about it generally
For anyone who has done so, how hard is it to write a Z-machine interpreter? What are the steps involved? Being comfortable with the target platform, reading the Z-Machine spec, following it page by page and writing the functions as you go? Or is there another way? (A general structure for an interpreter, that floats around somewhere?) How do you do it?
I feel like people, some with not a lot of experience in IF, write Z-machines in whatever language as an exercice; Github is absolutely full of implementations in lots of different languages or for different targets. Yet, for me, the task feels daunting; I don’t even know my way around the I6 library after 13 years of playing with it, so an interpreter… But Infocom’s interpreters from the 80s are, like, 12kb of code, no more. So, how hard is it really?
Is there any traps? Do you have to know your target really well in order to have acceptable performance? Is just-in-time compilation a must-have, or just an optional, advanced trick?
I’m thinking of commissioning a V3 implementation, which should be enough for my needs; am I right in thinking that V5 is much harder, since you have time-based events, text styles, etc? Or is it just a dozen more opcodes to support, which is easy once you have the structure?
And finally, an impossible question: any idea of how many hours of work are involved in creating a Z-Machine v3 interpreter?
Thank you all for your input