4 ms·
One of the most complex games Starflight of the 80th's is written in Forth. I had a lot of fun decompiling it. https://github.com/s-macke/starflight-reverse ht
by s-macke 10y ago
One of the most complex games Starflight of the 80th's is written in Forth. I had a lot of fun decompiling it.
https://github.com/s-macke/starflight-reverse https://github.com/s-macke/starflight-reverse
It turns out to be very portable because the assembler code is only about 1000-2000 lines. The rest is implemented in Forth itself. They use indirect threading to produce very dense code. They kept even most of the debugging symbols inside the code and kept the forth interpreter itself in the code.
- qwertyuiop924 10y agoNeat. Rather akin to Infocom's Z-machine (or to the newer Glulx), although less task-specific.
- s-macke 10y agoIt is similar, but the compiled code here is not fully architecture independent like for the Z-machine. Each word in Forth is compiled to a function pointer. So the Forth code vary for another architecture or when you recompile. But thanks to debugging symbols this is easily reverse engineered and you can easily figure out what is "+" or "-" for example.
- dzdt 10y agoAt one point 10ish years ago the starflight source code was posted online by one of the authors, but it went back down pretty quickly. Someone might have a copy though. A few of the files are on archive.org, but not the main body. http://web.archive.org/web/20030214111810/http://www.sonic.net/~sage/sf/Development/TheMakingOfStarflight.htm http://web.archive.org/web/20030214111810/http://www.sonic.n...
- s-macke 10y agoThanks for posting the link. I found the archive a few month ago and downloaded the few documents that were left. The table here https://github.com/s-macke/starflight-reverse/blob/master/src/global.c#L7 https://github.com/s-macke/starflight-reverse/blob/master/sr... is based on these documents and I filled some gaps of the symbol table. To start the game they used the word "LET-THERE-BE-STARFLIGHT", in the binary you see only part of it: "LET-TH". I wish this "someone" would provide a full copy of the archive :)