___ _ ___ _ _
/ __| _ _ _ ___(_) __|__ _ _| |_| |_
| (_| || | ' \/ -_) | _/ _ \ '_| _| ' \
\___\_,_|_||_\___|_|_|\___/_| \__|_||_|
--=[ A programming puzzle ]=--
You and your team of 23rd century archaeologists have been digging for
days with no result, but it seems your efforts have finally been
rewarded. You stand before what looks to be a rusty shipping container
with large letters scratched into its side. The letters read:
"The Archive of Late 20th Century Computing"
Giddy with excitement, you wrench open the door and step inside.
The container is filled with crumbling plastic boxes. Inspecting a
few, they appear to be packed full of optical disks of some
kind. Picking one such disk out at random, you see that it has a label
affixed to the front. Happily you find that you can understand the
text - your study of the languages of the ancients has paid off,
it seems.
Roughly translated, the label reads as follows...
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"This disk contains FORTH, an early interactive environment for
writing and running computer programs.
"The data on this disk is engraved as a series of bits, or zeros (0)
and ones (1), in a clockwise spiral, starting from the outer rim, and
can be read with an optical microscope.
"The first 350'208 bits on this disk contain a document, encoded as a
black and white bitmap image, 684 pixels in width and 512 pixels in
height. The bits correspond to pixels as follows:
bits: 0 1 683
v v v
+--------------------------+
| | | ... ... | |
|--------------------------|
684->| | ... |
|--------------------------|
| |
| |
| |
| |
|--------------------------|
349524->| | ... ... | |<-350207
+--------------------------+
"That document explains how to interpret the rest of the bits."
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Intrigued, you immediately take the disk back to your field office
and, using your trusty OptoScanner 5000 (tm) you extract the bits
from the disk:
Disk image
You decide to spend the rest of the afternoon getting this ancient
software running again!
--=[ What is this? ]=--
Cuneiforth is my attempt to write a self-contained FORTH computing
environment for the "single page" Chifir computer conceived by Nguyen
and Kay [1] as part of their Cuneiform system for software
preservation. With the information above, it should hopefully be
possible for someone with a modest amount of programming experience to
extract the bitmap document from the binary disk image (linked above),
program an emulator to emulate the Chifir machine it describes, and
use it to get the FORTH system contained in the image running.
If this sounds at all like fun to you, I'd love it if you gave this
a try! The Chifir machine is explicitly designed to be easy to
describe and emulate, but that doesn't necessarily mean that it is.
The proof of the pudding is in the eating, as they say.
As additional motivation, Cuneiforth is designed to be extensible and
programmable from within. It has a small built-in help system, a
built-in editor, and built-in instructions for setting up persistent
storage. It's far from perfect, but you might find it's a fun toy to
mess around with and write programs for, even after you've solved the
puzzle.
That said, Cuneiforth is only a hobby project and I not a professional
programmer. If you are looking for a well-designed VM-based computer
to build real things, Uxn/Varvara [6] or DuskOS [5], are _far_ more
likely to be what you want.
Anyway, if you do give this puzzle a go, please let me know how you
get on! You can either leave a comment in the guestbook below or just
email me at plugd@thelambdalab.xyz. I'm very curious to learn whether
it's even possible for you to get this running with only the
disk image and the "label" text above!
Post to guestbook
View recent posts
--=[ !!Warning!! !!Spoilers Ahead!! !!Warning!! ]=--
Beware: if you plan to attempt the programming puzzle above, do not
continue reading! And definitely don't open the repositories below.
The disk image and the description above is meant to be enough on its
own to get Cuneiforth running.
--=[ Source Code ]=--
The following repositories contain the source code I've written
as part of this project. To build the disk image above you'll
need the first two (ChASM and Cuneiforth). The last is the Chifir
emulator I've been using to test the system so far. For details on
how to use these, refer to the README file in each repository.
ChASM: An assembler targeting the Chifir machine
Cuneiforth: The assembly source and build files for Cuneiforth itself.
ChiVM: An SDL2-based Chifir emulator
--=[ Note to Chifir Purists ]=--
To my knowledge, the one way the machine I describe in the above disk
image differs from the original Chifir description is that the codes
its getkey operation produces are ASCII standard character codes. In
contrast, the codes returned by the getkey operation in Nguyen and
Kay's Chifir, while very similar to ASCII for alphanumeric keys, are
slightly different for other keys.
I've taken this liberty because it feels like make-work to force
emulator authors to deal with using a slightly different set of 7-bit
character codes. This wouldn't provide a meaningful challenge (I'm
very confident that anybody capable of writing an emulator can easily
implement the mapping between ASCII codes and the codes listed in the
original Chifir description) but would increase the tedium of doing
so, making the process less fun. Further, the Chifir description I've
included in the disk image - which is otherwise essentially identical
to the original - lists these modified codes out in full, so this
choice shouldn't impact the effectiveness of the system as a software
preservation tool.
--=[ Credits and inspiration ]=--
I found Devine Lu Linvega's talk [2] at the 2023 Strange Loop
conference absolutely fascinating. This talk is where I first learned
of the Nguyen and Kay paper and Chifir. More recently I encountered
Virgil Dupras' CollapseOS [4] and DuskOS [5] projects, both of which
reminded me that FORTH can be - and originally was, of course - a
self-contained computing environment. Not only that, it can be a
computing environment that can be understood from the ground up by a
non-specialist like me.
--=[ References ]=--
[1]: Nguyen and Kay, "The Cuneiform Tablets of 2015"
[2]: Devine's Strange Loop 2023 talk
[3]: 100 Rabbits' Uxn/Varvara system
[4]: CollapseOS
[5]: DuskOS