turnip



urnip is a forth operating system on top of a virtual machine

It's in its very early stages right now

Inspired by projects designed for virtual machines that have remained useable for decades, seeing if i can build a cozy nest of computer beeps and boops that can be stable for years to come



vm (diatom)

the virtual machine turnip runs on is called diatom.

it runs bytecode assembled from a custom assembly language, and interacts with the host system through a few different 'ports'

diatom is a 32-bit processor and uses two 512-cell stacks

tutorial

First you'll need ram and two stacks:

unsigned char RAM[RAMSIZE];
unsigned int PC = 0;

unsigned int WST[STACKSIZE];
int wp = 0;

unsigned int RST[STACKSIZE];
int rp = 0;

and functions to push and pop from the stacks

push(value) {
	WST[wp++] = value;
	if (wp == STACKSIZE) error("stack overflow!");
}

pop() {
	wp--; if (wp < 0) error("stack underflow!");
	return WST[wp];
}

forth (the turnip)

a small forth core is written in diatom assembly language, and once compiled and run it interprets / compiles all further forth code.