The end result was the Reconstruction of ZZT - a source tree whose build scripts create a ZZT.EXE byte-for-byte identical to the final official … It’s a scene that’s always been characterised by sheer imagination and now with potential barriers to entry about to be lifted, it’s very likely to usher in another “golden age” of ZZT creation, with a brace of new games to download from Dr Dos' excellent ZZT Museum.. Pascal’s var parameters (its way of doing “pass by reference”) turn into pointers in Go, but of course in Go you need to explicitly dereference them when you assign their values.
So there are a lot more explicit conversions in the Go version, such as this code from ELEMENTS.PAS: Ends up with a bunch of int16() conversions in Go: Once the semi-automated conversion was done, it still had dozens of Go compile errors. What I know is missing or broken: But I thought I’d release it as is – enjoy! Speaking of a game library, it may be better to use a proper graphics library for the rendering to get more control over the output (instead of having to install a DOS font and muck about with your terminal’s line spacing). To keep the converter simple, I’ve opted for a more literal translation of the Pascal, rather than trying to produce idiomatic Go – my thinking was that making it idiomatic Go is too hard to do programmatically, and I can always clean that up later. Once I had eliminated the major bugs, a surprising amount of the gameplay just worked. Initially this file had over 800 errors in it.
If nothing happens, download the GitHub extension for Visual Studio and try again. An open-source version of ZZT 3.2. Tim Sweeney’s creaky-but-brilliant 1991 classic ZZT – with its surprisingly robust, creative world editor – has been recreated in Turbo Pascal byte-for-byte by the developer of the terrific Zeta emulator, Adrian Siekierka. This means that many years after the source code for ZZT was lost, an exact recreation of the original executable is finally available, in the form of Reconstruction of ZZT, with Sweeney’s blessing and an MIT software license meaning it’s – at last – a truly open piece of software. I definitely had fun implementing the Pascal-to-Go converter and seeing the gameplay come to life. When I was riding the waves of IRC as a kid in the mid-00s, I discovered a small community centered around a then-obscure game engine named ZZT. Here’s what the original shareware “Town of ZZT” title screen looked like: The world editor had a scripting language called ZZT-OOP, where the “O” in OOP referred to ZZT’s “objects”, which are programmable game characters or robots. Hello. So people created thousands of their own worlds and shared them – hundreds of which are downloadable and even playable online at the Museum of ZZT, a kind of archive.org for ZZT worlds. In March 2020, Adrian published his Reconstruction of ZZT, a reverse-engineered recreation of the Pascal source code that, when compiled with the original Turbo Pascal 5.5 used by ZZT, compiles to a byte-for-byte identical .EXE file. And Adrian Siekierka is the author of Zeta, a specialized DOS emulator just for running ZZT. Note the use of Go named return values to match Pascal’s use of the function name as the return value. The Reconstruction of ZZT The Reconstruction of ZZT is a reverse-engineered recreation of the source code to the last official release of ZZT, ZZT 3.2. In particular, it mixes up trying to figure out types with outputting the Go source code – if building a real transpiler, I would separate these into two phases and build the “types” data structures first.

I did a diff between those two directories to determine whether my Turbo Pascal parser was correct. Most ZZT-OOP objects seems to work, but there are definitely some bugs, as evidenced by the. The original source code for ZZT was lost in a computer crash, but there have been various attempts over the years to recreate the game in other languages, including C++, a partial implementation in JavaScript, and even an accurate reimplementation in Rust. This article describes my Pascal-to-Go converter and my (not exactly complete) Go port of ZZT. Extremely accurate, being a byte-for-byte recreation of the original game's executable. Once I’d finished the parser, I moved on to the converter. I for one find that an amazing feat! I started by building the lexer and parser, and output the parsed original source (the orig directory) as pretty-printed Pascal to the parsed directory. I like every video game. So I wrote a not-very-complete Turbo Pascal parser, and a converter that takes the Pascal syntax tree and tries to write it out with Go types and syntax.