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.
I've tested RAM usage when self-assembling and there weren't as high
as I thought. zasm's defaults now use less than 0x1800 bytes of RAM,
making it possible, theoretically for now, for a Sega Master System
to assemble Collapse OS from within itself.
I'm about to split the global registry in two (labels and consts)
and the previous state of registry selection made things murky.
Now it's much better.
During expression parsing, if a local label was parsed, it would
select the local registry and keep that selection, making
subsequent global labels register in the wrong place.
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.
What used to be `tools/emul/user.h` was in fact specific to zasm, so I
moved it there.
To avoid name confusion, I renamed what used to be kernel.h and user.h
to kernel-bin.h and user-bin.h.
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!
To run a parseExpr on first pass would always return a false success
with dummy value because symbols are configured to always succeed on
first pass. This would make expressions like ".fill 0x38-$" so bad
things to labels because "0x38-$" wouldn't return the same thing on
first and second pass.
Revert to parsing literals and symbols after having scanned for
expressions and add a special case specifically for char literals (which
is why we scanned for literals and symbols first in the first place).
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.