That's my mega-commit you've all been waiting for.
The code for the shell share more routines with userspace apps than with kernel
units, because, well, its behavior is that of a userspace app, not a device
driver.
This created a weird situation with libraries and jump tables. Some routine
belonging to the `kernel/` directory felt weird there.
And then comes `apps/basic`, which will likely share even more code with the
shell. I was seeing myself creating huge jump tables to reuse code from the
shell. It didn't feel right.
Moreover, we'll probably want basic-like apps to optionnally replace the shell.
So here I am with this huge change in the project structure. I didn't test all
recipes on hardware yet, I will do later. I might have broken some...
But now, the structure feels better and the line between what belongs to
`kernel` and what belongs to `apps` feels clearer.
Most of register fiddling routines (which is now the only thing contained
in care.asm) are used by almost all userspace apps, often in inner loops.
That makes the penalty of using jump tables for those a bit too high.
Moreover, it burdens jump tables needlessly.
Because this unit is very small (now that string routines are out), it makes
sense to always include it in binaries.
We use zasm's ability to use labels in .equ directive.
We didn't do it before because for a while, we were in between scas
and zasm (scas was used in automated tests) so we needed to use the
lowest common denominator: zasm doesn't have macros and scas can't
use labels in .equ directives.
This forced us to add this layer of indirection. But now that we are
completely cut from scas' dependency, we can use this nice zasm's
ability.
Move load/save to blkdev_cmds and add a new "poke" builtin shell cmd
that is the mirror of "peek" and strictly uses stdio (no blkdev
involved).
This allows us to slim the minimal OS size but, more importantly, change
the behavior of "load" so that we don't expect GetC to block until Z is
set. This way, using "load X" with X being larger than the blkdev size
won't block forever.
This also brings our RC2014 minimal kernel below the 1K mark again.
The pgm module implements a shell hook so that when an unknown command
is typed, we look into the mounted filesystem and look for a file with
the same name as the command. If we find one, we load it in memory and
run it.