Commit Graph

25 Commits

Author SHA1 Message Date
Virgil Dupras 019d05f64c Make the shell a userspace app
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.
2019-11-15 15:37:49 -05:00
Virgil Dupras d74b85f146 zasm: allow .org to be specified from command line
Also important for upcoming mega commit...
2019-11-15 09:57:53 -05:00
Virgil Dupras 7cf3ed38da Extract str.asm from core.asm and make core included by userspace
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.
2019-11-14 10:14:15 -05:00
Virgil Dupras 7274dccbe7 Move ASCII consts to ascii.h
And made them shorter in name. The new ascii.h file allow reuse in userspace
code.
2019-11-13 20:38:06 -05:00
Virgil Dupras cbc6fb5931 zasm: clean up jump table requirements
There was a little bit of cruft.
2019-11-11 20:21:13 -05:00
Virgil Dupras 2a55bfd375 stdio: remove a layer of indirection in GetC/PutC
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.
2019-11-04 09:55:12 -05:00
Virgil Dupras b745f49186 Rename blockdev's API routines to GetB/PutB
The goal is to avoid mixing those routines with "character devices"
(acia, vpd, kbd) which aren't block devices and have routines that
have different expectations.

This is a first step to fixing #64.
2019-10-30 16:59:35 -04:00
Virgil Dupras f4b6c7637d zasm: rename #inc to .inc
scas, it's not needed any more.
2019-10-06 14:32:23 -04:00
Virgil Dupras 7cdc288ef2 zasm: print progress indicator while assembling 2019-06-19 11:42:39 -04:00
Virgil Dupras 3e7d181d3c zasm: properly raise error on bas ioPutC calls 2019-06-15 20:01:17 -04:00
Virgil Dupras c18d42f08b fs: further adjust to previous blkdev refactoring
Previous refacoring broke all seek/tell within fs. fs handles now lost
the responsibility to keep track of current position. It's blkdev's job.
2019-06-04 20:45:01 -04:00
Virgil Dupras ae028e3a86 blockdev: make implementors "random access"
This huge refactoring remove the Seek and Tell routine from blockdev
implementation requirements and change GetC and PutC's API so that they
take an address to read and write (through HL/DE) at each call.

The "PTR" approach in blockdev implementation was very redundant from
device to device and it made more sense to generalize. It's possible
that future device aren't "random access", but we'll be able to add more
device types later.

Another important change in this commit is that the "blockdev handle" is
now opaque. Previously, consumers of the API would happily call routines
directly from one of the 4 offsets. We can't do that any more. This
makes the API more solid for future improvements.

This change forced me to change a lot of things in fs, but overall,
things are now simpler. No more `FS_PTR`: the "device handle" now holds
the active pointer.

Lots, lots of changes, but it also feels a lot cleaner and solid.
2019-06-04 15:36:20 -04:00
Virgil Dupras 63473cc2e3 blockdev: make selection structure opaque
I'm about to change that structure and I don't want fs to be messed up
by this. I'm proceeding step by step...
2019-06-04 09:56:36 -04:00
Virgil Dupras 21c677a950 Make parseArgs not expect a leading space 2019-06-02 14:46:07 -04:00
Virgil Dupras f8bd8eeaaf Make userspace parse args the same way the shell does 2019-06-02 14:05:20 -04:00
Virgil Dupras 83771b538f fs: check for file size bounds in GetC 2019-05-31 11:12:29 -04:00
Virgil Dupras 328f44814e Make blockdev pointers 32 bits
This allows us to break through the 64K limit for includes CFS in zasm,
a limit we were dangerously close to breaking. In fact, this commit
makes us go over that limit. Right in time!
2019-05-28 19:42:35 -04:00
Virgil Dupras fa3b86a5c1 zasm now bootstraps itself without scas! 2019-05-19 20:44:19 -04:00
Virgil Dupras bc1496a7e3 zasm emul: bring back kernel/user distinction
It was a bad idea to remove it. Now that I'm introducing the concept of
a per-app glue file, it becomes much easier to build emulated zasm as a
userspace app.
2019-05-19 12:57:59 -04:00
Virgil Dupras d9fff16157 zasm emul: get rid of the kernel/user distinction
Made things complicated for nothing.
2019-05-19 09:14:40 -04:00
Virgil Dupras 98695f9912 zasm: de-index symRegister
Make symRegister's logic pointer-based so we can break through the 0x100
limit.
2019-05-19 09:06:24 -04:00
Virgil Dupras f44c3e5413 zasm: fix 3-digit hex parsing 2019-05-17 23:00:57 -04:00
Virgil Dupras 807bd70b63 zasm emul: add dumpSymbolTable debug routine
Very helpful...
2019-05-17 13:22:45 -04:00
Virgil Dupras 013a3b74c8 Add the concept of unit tests
Will be much much easier to tests new core routines without having to
re-create their context first.

Also, extract parse.asm from core.asm
2019-05-17 09:33:20 -04:00
Virgil Dupras def6c2123d tools/emul: clean up the place a bit 2019-05-17 07:23:59 -04:00