Collapse OS

Bootstrap post-collapse technology

Winter is coming and Collapse OS aims to soften the blow. It is a Forth (why Forth?) operating system and a collection of tools and documentation with a single purpose: preserve the ability to program micro-controllers through civilizational collapse. It is designed to:

Run on minimal and improvised machines. Interface through improvised means (serial, keyboard, display). Edit text files. Compile assembler source files for a wide range of MCUs and CPUs. Read and write from a wide range of storage devices. Assemble itself and deploy to another machine.

Additionally, the goal of this project is to be as self-contained as possible. With a copy of this project, a capable and creative person should be able to manage to build and install Collapse OS without external resources (i.e. internet) on a machine of her design, built from scavenged parts with low-tech tools.

Status

The project lives in Sourcehut and is progressing well! Highlights:

Can assemble Z80, AVR and 8086 binaries.

Self replicates: Can assemble itself from within itself, given enough RAM and storage.

Known to run on: A RC2014 through a serial link. It can also have a PS/2 keyboard directly plugged in. A Sega Master System or a MegaDrive (Genesis) with video output and D-Pad input and/or a PS/2 keyboard adapter. A TI-84+ with output on the LCD screen and input on the built-in keyboard. A TRS-80 Model 4P with builtin video and keyboard. A 8086 PC-compatible machine (including modern PCs). A Z80-MBC2 through serial link. Any POSIX environment, simulating a 80x32 screen through ncurses.

Exceedingly simple, as one can see by the size of the code (LOC counted in a coarse manner, doing "block count * 16", it's probably overestimated): Z80 boot code: ~830 lines of z80 assembly (lots of blank blocks in between, overestimated) 8086 boot code: ~250 lines of 8086 assembly (8086 is significantly terser than z80) Forth core: ~720 lines of Forth SD card subsystem: ~210 lines of Forth and z80 asm Z80 assembler: ~380 lines of Forth 8086 assembler: ~210 lines of Forth AVR assembler: ~200 lines of Forth Visual Editor: ~220 lines of Forth

Has the full power of a reasonably well-featured Forth interpreter.

Has mass storage support. Currently on: SD cards 5 1/4" floppies

Has a command line text editor similar to Forth's traditional editor as well as a visual text editor inspired by UNIX' VI.

Self assembles on tight ressources. Known to self assemble on: A RC2014 with a SD card adapter. A TRS-80 Model 4P with floppies.

Built from a POSIX environment with minimal tooling: only cc, make and ncurses are needed.

An exciting roadmap!

Getting started

Documentation is in text files in "doc/". Begin with "intro.txt".

Collapse OS can run on any POSIX platform and builds easily. Clone it, then see "/cvm/README.md" for instructions.

Alternatively, there's also Michael Schierl's JS Collapse OS emulator which is awesome and allows you to run Collapse OS from your browser, but it isn't always up to date. The "Javascript Forth" version is especially awesome: it's not a z80 emulator, but a javascript port of Collapse OS!

Discussion

The best place to discuss the project is on its mailing list.

I also stick around on IRC (#collapseos on freenode).

Collapse OS was previously hosted on Github and it has a few very interesting issues in it. Don't hesitate, if it hasn't been already, to start a new thread in the mailing list to continue a discussion from one of those issues.

There is also r/collapseos on Reddit, but be aware that I'm not in there. I've been a heavy redditor for nearly 10 years, but I've stopped.

A lot of questions that you might have may already have been anwered in a big discussion about it occurred on Reddit. I've answered many questions there.

There was also a nice conversation on Hacker News about Collapse OS, but I didn't participate because I don't have a HN account. Also, this community doesn't seem collapse-aware so the idea of participation into this discussion seemed tedious to me. But the user "yellowapple" did a good job of answering many questions in a way that is similar to what I would have.