~vdupras/duskos

32-bit Forth OS mixed with C
rpi: add "to" words and fix broken lblimmwr
Change CALLSZ to DOESSZ
rpi: local vars and does words

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~vdupras/duskos
read/write
git@git.sr.ht:~vdupras/duskos

You can also use your local clone with git send-email.

#Dusk OS

Dusk OS is a 32-bit Forth and big brother to Collapse OS. Its primary purpose is to be maximally useful during the first stage of civilizational collapse, that is, when we can't produce modern computers anymore but that there's still many modern computers still around.

It does so by aggressively prioritizing simplicity at the cost of unorthodox constraints, while also aiming to make power users happy.

Dusk OS innovates by having an ["almost C" compiler][duskcc] allowing it to piggy-back on UNIX C code, through a modest porting effort, to reach its goals and stay true to its design constraints with a minimal effort.

This is Dusk OS' source code and the rest of the README assumes that you want to run it. To read more about why this OS exists, see its website.

#Build and run Dusk

Dusk is designed to run on bare metal and to build itself from itself. However, it's also possible to build Dusk from any POSIX platform using Dusk's C VM from posix/vm.c. This VM implements a Forth that can interpret the whole of Dusk's Forth code, but this VM is CPU-agnostic and has its own simplistic bytecode.

That is enough to generate bare metal images for any of its target platforms, so that's why it exists. To build this VM, you need:

  • GNU Make
  • A C compiler

Running make will yield a ./dusk binary which if opened, provides an interactive prompt.

Documentation lives in fs/doc. You can begin with doc/index. Type bye to quit.

Dusk OS expects a non-canonical raw input. With a regular TTY, your input will be buffered and echoed twice and reads to it will be blocking. We don't want that. To avoid that, you can invoke it like this:

(stty -icanon -echo min 0; ./dusk; stty icanon echo)

make run does this for you.

#Running on QEMU or bare metal

Running Dusk under the POSIX VM is fine, but severly limited: the filesystem is read-only and there is no Grid (text UI system) or Screen (graphical system).

To see a fully-featured Dusk, it's better to run it on an actual machine or, if you're in a hurry, under QEMU. You can do the latter with make pcrun.

To deploy Dusk on a real machine, it's a bit more involving and you should read doc/deploy.txt.

#See what it can do

Dusk OS on the PC has graphical capabilities as well as varvara bindings for it. If you have QEMU installed, you can try a few little things on it. First, start the QEMU VM with make pcrun. Then, enter this:

f<< tests/manual/uxn/sprite.fs

This will:

  1. Compile DuskCC (in forth)
  2. Compile uxn (in C)
  3. Compile uxntal (the uxn assembler) (in C)
  4. Compile varvara (in forth)
  5. Compile tests/manual/uxn/sprite.tal (a copy of the official screen.tal)
  6. Put the system in graphical mode
  7. Run the compiled sprite.tal

You now have it running. There is also a mouse cursor that you can move around. Press Escape to return to prompt. You can try the same thing with:

  • tests/manual/uxn/mandel.fs
  • tests/manual/uxn/ctrl.fs
  • tests/manual/uxn/mouse.fs
  • text/left.fs