Skip to main content

Crate ternaria_os

Crate ternaria_os 

Source
Expand description

A command-line operating system running on tryte code.

The operating system itself is SOURCE, written in Ternaria assembly. This crate is the harness around it: it lays out the data segment, generates the constants the assembly needs, assembles it, and boots it against a bus.

§Why the data lives here

The assembler emits instructions, and an instruction stream is a poor place to hide strings: every word in it must decode. Rather than add a data directive that would then need its own alignment and addressing rules, the host writes the strings into guest memory before the machine starts and passes their addresses in as .equ names. The guest sees ordinary memory at ordinary addresses.

§What it can do

ls, cd, cat and mkdir, against a TFS image on the block device.

Modules§

cli
The command-line front end: boots the operating system against a real terminal.
exec
The executable format (D-20).

Structs§

Session
What a completed run produced.

Enums§

BootError
Something that stopped the machine before the shell finished.

Constants§

DATA_BASE
Where the data segment begins.
SOURCE
The operating system, in assembly.

Functions§

assemble
Assembles the operating system without running it.
boot
Boots the operating system against image, feeding it input.
data_placement
Where each string is placed in guest memory, and its text.
prepare
A Cpu and [Bus] ready to step, for a caller that wants to drive the machine itself rather than run it to completion.
source
The complete assembler source: every prelude, then the operating system.