TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Resurrecting Infocom's Unix Z-Machine with Cosmopolitan

157 pointsby ChristopherDrumabout 1 month ago
I recently brought Infocom&#x27;s original UNIX z-machine source code back to life on modern systems. The modified source code, instructions on usage, a build of the z-machine, and examples of embedded game executables are available.<p>There is also a detailed write-up about the state of the original source code, the porting process, and the invaluable role Justine Tunney&#x27;s Cosmpolitan project played in bringing the Zork trilogy (and more) to Windows&#x2F;Mac&#x2F;Linux&#x2F;bsd for arm&#x2F;x86 machines over the course of a lazy Sunday.

9 comments

wyldfireabout 1 month ago
Funny coincidental timing - I just played HHGTTG a couple of times last night for the first time in thirty+ years or so.<p>I first played the game, way back - prior to having read the novel. It was mind-blowing. I had no idea what was going on but I got a real sense that it could be pretty funny if I did. So I read the novel eventually, and it was as good as I expected. I don&#x27;t think I&#x27;d gone back to play the game until this week, though.
评论 #43678283 未加载
o11cabout 1 month ago
In case anyone needs to do the sort of &quot;fix up scattered declarations and move them to headers&quot;, you <i>really</i> want to use:<p><pre><code> gcc -Werror=missing-declarations -Werror=redundant-decls </code></pre> (last I checked, Clang&#x27;s implementation of this was buggy and half-useless, but I&#x27;ll admit I stopped using Clang)<p>I recommend this for well-maintained code too, just as another way to keep the code smells away. For a lot of projects this will only require adding a bit of `static` that you were too lazy to write.
评论 #43679177 未加载
bruce511about 1 month ago
Its interesting to see how developers get into a mindset, based on their life experience.<p>What we&#x27;re seeing here is 40 year old code compile and run with minimal effort. Largely because the C language has respected backwards compatibility.<p>Yes, there were breaking changes along the way, but they were trivial to resolve in hours. And (more interesting) the author believed that to be true and so persevered.<p>I saw this recently as well. I run a lot of programs on Windows. Many are 32 bit, written in the 90s for Windows 95, or 98. They all still run. Microsoft bends over backwards to keep things compatible.<p>I also get to write a lot of web API clients. I tell customers that it won&#x27;t work forever. Web APIs are constantly changing. The service (especially Google) will change something soon to break it.<p>The people building those APIs are <i>expecting</i> only currently-maintained apps to run. They have no concept (or experience) of 40 or 30 year old code &quot;just running&quot;. Crumbs, if you get 5 years out an API client you&#x27;re doing well.
评论 #43678309 未加载
评论 #43678684 未加载
评论 #43679713 未加载
gamacheabout 1 month ago
Cool project! But one nitpick.<p>K&amp;R C has no concept of THEN. That&#x27;s a peculiarity of the ZIP source code, defined as a pure no-op:<p><pre><code> #define THEN </code></pre> <a href="https:&#x2F;&#x2F;github.com&#x2F;ChristopherDrum&#x2F;pez&#x2F;blob&#x2F;main&#x2F;zip&#x2F;infocom_source&#x2F;phg_zipdefs.h#L170">https:&#x2F;&#x2F;github.com&#x2F;ChristopherDrum&#x2F;pez&#x2F;blob&#x2F;main&#x2F;zip&#x2F;infocom...</a>
评论 #43687131 未加载
评论 #43684674 未加载
joshuabout 1 month ago
i think ucsd p-system vm predates z-machine by a couple of years (re OP&#x27;s origin of vm use comment)
评论 #43682390 未加载
评论 #43678260 未加载
fredsmith219about 1 month ago
Absolutely amazing. Good work. It downloaded and ran on Arch with no problem.
评论 #43679443 未加载
user3939382about 1 month ago
This is somewhat tangential to the precise topic but since it doesn’t come up often: if you’re into this genre I recommend a game called Vespers. Really well done and thick atmosphere.
评论 #43678650 未加载
评论 #43683072 未加载
PaulHouleabout 1 month ago
(1) The UCSD p-Machine was contemporaneous and made it feasible to compile Pascal for machines like the 6502 which were terrible targets for conventional compilers. It was atrocious in every way, particularly atrociously slow. At the time many CS professors with Microsoft BASIC being the dominant teaching languages but UCSD plus the inability to do systems programming in ISO Pascal made a generation of young programmers hate Pascal with passion.<p>(2) Scott Adams made an adventure interpreter was was similar but less sophisticated than the z-machine but similarly portable, in fact you could write a Scott Adams interpreter in BASIC [1] but he also wrote interpreters in assembly for the most popular platforms<p><a href="https:&#x2F;&#x2F;6502disassembly.com&#x2F;a2-scott-adams&#x2F;interp.html" rel="nofollow">https:&#x2F;&#x2F;6502disassembly.com&#x2F;a2-scott-adams&#x2F;interp.html</a><p>(3) Infocom developed the games on a PDP-10 machine which might be the last general purpose computer that survived with other than the 8-bit byte. (Though it had bitwise addressing which helped it cope with the industry going in that direction).<p>[1] Notably if you tried to write an adventure game in straight up BASIC you&#x27;d struggle. It&#x27;s not like you could look up a verb in a hashtable and dispatch to subroutine. You&#x27;d be writing incredibly long if-then-else ladders nested inside if-then-else ladders which is bad enough in a civilized language.
评论 #43681255 未加载
评论 #43687960 未加载
评论 #43682859 未加载
评论 #43683195 未加载
hans_0l0about 1 month ago
What is going on here?<p>[~&#x2F;Downloads] $ chmod +x zork*<p>[~&#x2F;Downloads] $ .&#x2F;zork1<p>Cannot open assembly &#x27;.&#x2F;zork1&#x27;: File does not contain a valid CIL image.
评论 #43682889 未加载
评论 #43680082 未加载
评论 #43680218 未加载