Cuneiforth: A Forth for Your Chifir

birdculture1 pts0 comments

Floodgap Gopher-HTTP gateway gopher://thelambdalab.xyz/1cuneiforth/

View in Gopher client |<br>HELP! with proxy |<br>www.floodgap.com

Return<br>to the main menu for thelambdalab.xyz:70

/ __| _ _ _ ___(_) __|__ _ _| |_| |_<br>| (_| || | ' \/ -_) | _/ _ \ '_| _| ' \<br>\___\_,_|_||_\___|_|_|\___/_| \__|_||_|

--=[ A programming puzzle ]=--

You and your team of 23rd century archaeologists have been digging for<br>days with no result, but it seems your efforts have finally been<br>rewarded. You stand before what looks to be a rusty shipping container<br>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<br>few, they appear to be packed full of optical disks of some<br>kind. Picking one such disk out at random, you see that it has a label<br>affixed to the front. Happily you find that you can understand the<br>text - your study of the languages of the ancients has paid off,<br>it seems.

Roughly translated, the label reads as follows...

"This disk contains FORTH, an early interactive environment for<br>writing and running computer programs.

"The data on this disk is engraved as a series of bits, or zeros (0)<br>and ones (1), in a clockwise spiral, starting from the outer rim, and<br>can be read with an optical microscope.

"The first 350'208 bits on this disk contain a document, encoded as a<br>black and white bitmap image, 684 pixels in width and 512 pixels in<br>height. The bits correspond to pixels as follows:

bits: 0 1 683<br>v v v<br>+--------------------------+<br>| | | ... ... | |<br>|--------------------------|<br>684->| | ... |<br>|--------------------------|<br>| |<br>| |<br>| |<br>| |<br>|--------------------------|<br>349524->| | ... ... | |<br>+--------------------------+

"That document explains how to interpret the rest of the bits."

Intrigued, you immediately take the disk back to your field office<br>and, using your trusty OptoScanner 5000 (tm) you extract the bits<br>from the disk:

Disk image

You decide to spend the rest of the afternoon getting this ancient<br>software running again!

--=[ What is this? ]=--

Cuneiforth is my attempt to write a self-contained FORTH computing<br>environment for the "single page" Chifir computer conceived by Nguyen<br>and Kay [1] as part of their Cuneiform system for software<br>preservation. With the information above, it should hopefully be<br>possible for someone with a modest amount of programming experience to<br>extract the bitmap document from the binary disk image (linked above),<br>program an emulator to emulate the Chifir machine it describes, and<br>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<br>a try! The Chifir machine is explicitly designed to be easy to<br>describe and emulate, but that doesn't necessarily mean that it is.<br>The proof of the pudding is in the eating, as they say.

As additional motivation, Cuneiforth is designed to be extensible and<br>programmable from within. It has a small built-in help system, a<br>built-in editor, and built-in instructions for setting up persistent<br>storage. It's far from perfect, but you might find it's a fun toy to<br>mess around with and write programs for, even after you've solved the<br>puzzle.

That said, Cuneiforth is only a hobby project and I not a professional<br>programmer. If you are looking for a well-designed VM-based computer<br>to build real things, Uxn/Varvara [6] or DuskOS [5], are _far_ more<br>likely to be what you want.

Anyway, if you do give this puzzle a go, please let me know how you<br>get on! You can either leave a comment in the guestbook below or just<br>email me at plugd@thelambdalab.xyz. I'm very curious to learn whether<br>it's even possible for you to get this running with only the<br>disk image and the "label" text above!

Post to guestbook<br>View recent posts

--=[ !!Warning!! !!Spoilers Ahead!! !!Warning!! ]=--

Beware: if you plan to attempt the programming puzzle above, do not<br>continue reading! And definitely don't open the repositories below.<br>The disk image and the description above is meant to be enough on its<br>own to get Cuneiforth running.

--=[ Source Code ]=--

The following repositories contain the source code I've written<br>as part of this project. To build the disk image above you'll<br>need the first two (ChASM and Cuneiforth). The last is the Chifir<br>emulator I've been using to test the system so far. For details on<br>how to use these, refer to the README file in each repository.

ChASM: An assembler targeting the Chifir machine<br>Cuneiforth: The assembly source and build files for Cuneiforth itself.<br>ChiVM: An SDL2-based Chifir emulator

--=[ Note to Chifir Purists ]=--

To my knowledge, the one way the machine I describe in the above disk<br>image differs from the original Chifir description is that the codes<br>its getkey operation produces are ASCII standard character codes. In<br>contrast, the codes returned by the getkey operation in Nguyen and<br>Kay's...

disk chifir cuneiforth image above bits

Related Articles