Make a shell in Rust
The shell of "Make a shell", in Rust: it starts the built-in program hello and gives it the whole screen and the keyboard.
The program
myshell.rs:
#![no_std]
#![no_main]
use terse::*;
entry!(main);
fn main() {
let hello = mach_start_named(&[0; 32], "hello");
mach_place(hello, 0, 0, 640, 480);
mach_focus(hello);
loop {
wait_frame();
}
}
The runtime has three calls of device 8, the ones a first shell needs, with the C library's names: mach_start_named (the key, 32 zero bytes for a built-in program, and the name), mach_place and mach_focus. The other calls of the device (listing the built-in programs, a machine's state, snapshots) are not wrapped; a program reaches them with the runtime's call, which takes the call's number, (8 << 8) | function, and its arguments, as The Machines device lists them.
Build it and run it
terse build myshell.rs --device 8:0 terse run --shell myshell.terse --frames 30 --dump terse-host --shell myshell.terse
The headless run prints what the C shell's does: -- machine 1 running 0 0 640 480 hello -- and hello's screen.
What you have now
A shell in Rust. It is examples/program/rust/myshell.rs in the Tersenet sources; the full shell, programs/shell/shell.c, is in C. Next, a device of your own: Invent a device.
Panels, the 3D view and input routing are in Screens, panels and input.