Sending the escape after its target made things complicated for upcoming
stuff I want to add. Although it makes `recv.asm` slightly larger, it's really
worth it.
Instead of going left and right, finding operators chars and replacing them
with nulls, we parse expressions in a more orderly manner, one chunk at a
time. I think it qualifies as "recursive descent", but I'm not sure.
This allows us to preserve the string we parse and should also make the
implementation of parens much easier.
This should make tests a bit more convenient to write and debug.
Moreover, begin de de-IX-ization of parseExpr. I have, in a local WIP, a
parseExpr implemented using a recursive descent algo, it passes all tests, but
it unfortunately assembles a faulty zasm. I have to find the expressions that
it doesn't parse properly.
But before I do that, I prefer to commit these significant improvements I've
been making to tests harness in parallel of this development.
Also, add a "real world" example in AVRA tests, a blink program on
a ATtiny45. Some instructions are commented out because they aren't
implemented yet, but not many.
The output of the program has been verified against AVRA's own
output.
Use IX directly for argspec rows instead of going through DE. It saves a bit
of processing. The code was this way because I initially didn't use IX at all,
so as code evolved, that DE translation stayed as an artifact.
We now treat the block device as fixed-size rather than trying to grow it in response
to kernel activity.
Previously, if you tried to create 2 files in a row, only the first 1 would actually appear,
because the device only ever got larger when a byte was written immediately past the end of
the device.
Now we just let the kernel write bytes to the disk anywhere, so new files can be created even
when the previous file is not completely full.
Also, fix buffer overrun in reading filesystem image, and use a more idiomatic fgetc loop.
By uploading a BASIC loop and then run it, we can reduce the serial
communication to pure content which greatly reduces the overhead and make
the process much much faster.
I know, this is silly, but I'm moving tools to something a bit closer to the
system. I consider perl to be more system-like than python for a simple reason:
perl is part of the OpenBSD base system and python is not.
Also, I'm learning perl and using this as an opportunity.
This gives the maximum size of the stack at any given moment during the
execution of the program. It's useful to figure out if the stack gets
dangerously close to the heap.
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.
Instead of expecting a `USER_CODE` symbol to be set, we expect `.org` to be
set in all userspace glue code. This gives us more flexibility with regards to
how we manage that.
Moreover, instead of making `USER_RAMSTART` mandatory, we make it default to
the end of the binary, which is adequate in a majority of cases.
Will be useful for my upcoming mega-commit... :)
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.