Commit Graph

17 Commits

Author SHA1 Message Date
Virgil Dupras 532bcc7e78 cvm: split stage and forth xcomp units
I wanted to make CVM's forth use the Grid subsystem, but doing so
would break the stage binary. Hence, this split.
2020-11-14 15:00:03 -05:00
Virgil Dupras f7ad84adae cvm: guard against segfaults
I've noticed that under certain conditions, such as a stack overflow,
I would segfault, something I though was impossible because my memory
size is 0x10000 and all my integer variables are uint16_t.

After having re-read my C handbook, it seems I wasn't sufficiently
knowledgeable about type conversion rules.
2020-11-08 20:20:01 -05:00
Virgil Dupras e31527f5ac Add word ROT>
There are many situations where it can be useful. Worth it.
2020-10-29 12:41:08 -04:00
Virgil Dupras adea75e50a Add alias and switch word types
I'm pretty happy about how lightweight the implementation turns
out to be.
2020-10-28 15:02:06 -04:00
Virgil Dupras 8bf6258673 Add word TICKS
Adding a delay such as the 20ms one we have in AVR programmer's
initialization routine is tricky without a word like TICKS.

This implementation is highly inaccurate, but more accurate and
reliable than a "ballpark" DO..LOOP...
2020-09-25 17:31:06 -04:00
Virgil Dupras 8e624034bf recipes/sms: move recipe blocks into local overlay 2020-09-20 10:21:21 -04:00
Virgil Dupras fd69195799 doc: take dictionary out of blkfs 2020-08-16 08:22:41 -04:00
Virgil Dupras ba8a9c2647 cvm: initialize memory with random garbage
This should help spot bugs due to bad initialization.
2020-08-15 14:24:02 -04:00
Virgil Dupras 78d4d15fcf cvm: implement stack overflow error condition 2020-08-07 21:57:25 -04:00
Virgil Dupras 25f4312523 cvm: improve comments
They were a bit terse.
2020-08-07 21:03:28 -04:00
Virgil Dupras a7dcb522c2 Make br cells 1 byte wide
The 1 byte limitation has been effective for a while now, but I
hadn't made the move yet, I wanted to see if the limitation would
cause me problems. It doesn't.

Doing this now slightly facilitates the IY->BC move in z80.

Bootstrapping: if you try to recreate the CVM binary from the
previous commit with this code, you'll have bootstrapping problems.
The first bootstrap will compile a binary with 2-bytes wide cells
but branching conditionals that yields 1-byte cells. That's bad.

I got around the issue by temporarily inserting a "397 399 LOADR"
instruction in cvm/xcomp.fs, right before the xcomp overrides. This
way, I force 1-byte cells everywhere on the first compiliation,
which then allows me to apply the logic change in cvm/vm.c and have
a properly running binary.
2020-07-06 07:27:50 -04:00
Virgil Dupras 5705cd5c31 Extract EXIT code from stable ABI zone 2020-07-05 13:41:12 -04:00
Virgil Dupras 5a2612a9c5 Add HERESTART xcomp config 2020-06-28 19:45:28 -04:00
Virgil Dupras 8a7fa77163 cvm: bootstraps itself! 2020-06-26 18:58:02 -04:00
Virgil Dupras fc3919863f cvm: implement stack underflow errors 2020-06-26 17:55:10 -04:00
Virgil Dupras 9021e5f6e0 cvm: fix does 2020-06-26 17:35:21 -04:00
Virgil Dupras 36cb1389e6 Add a C implementation of native words
This will soon replace the libz80 based "forth" and
"stage" executables. This is much, much faster.
2020-06-26 15:50:13 -04:00