Commit Graph

21 Commits

Author SHA1 Message Date
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 a348ee9106 Remove Extra words
The few extra bytes they save in the core aren't worth the extra
complexity. This was initially done in a context where I had
troubles keeping the RC2014 binary with SDC inside the 8K limit.

At this point, even with the few extra bytes we add here, we're at
7200 bytes, so I'd say we're fine.
2020-09-21 14:51:46 -04:00
Virgil Dupras b1a95648f1 De-stabilize EXIT
This marks the end of wordrefs in stable ABI. Nice.
2020-09-19 20:35:35 -04:00
Virgil Dupras 3aa681ceca Remove ";" word
The ":" now takes care of scanning for ";". Conceptually, having
";" as an immediate word is slightly simpler than the approach in
this commit, but when bootstrapping is involved, this simpler
approach gets murkier.

Moreover, it got even murkier-er when trying to de-stabilize EXIT,
so here we are.
2020-09-19 20:22:23 -04:00
Virgil Dupras 53239c8f84 De-stabilize (n) 2020-09-19 19:44:15 -04:00
Virgil Dupras 68dd800bd1 Remove LIT< in favor of LIT" exclusively
This duplicated feature existed because of bootstrapping issues
with LIT", but again, with careful threading, we can clean things
up.

We can now have a proper "Collapse OS" prompt :)
2020-09-19 18:51:29 -04:00
Virgil Dupras 0b11979b5e Fix LIT"
I've mistakenly broken it in previous commit.
2020-09-19 14:28:10 -04:00
Virgil Dupras eefbf66e95 De-stabilize (br), (?br), (loop), (s)
When writing the xcomp documentation, I realized that with careful
threading and by accepting a bit of code duplication in the xcomp
toolset, I could de-stabilize a couple of words.

(n) and EXIT are a bit trickier, but I think it can be done. It
would be nice to get rid of stable wordrefs...
2020-09-19 13:54:01 -04:00
Virgil Dupras 4910b9caef core: add AMOVEW 2020-08-31 12:11:17 -04:00
Virgil Dupras 3a84a3871b core: make parse and format words a bit tighter 2020-08-30 20:15:55 -04:00
Virgil Dupras 78d4d15fcf cvm: implement stack overflow error condition 2020-08-07 21:57:25 -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 ebf47a2ab5 Fix broken LIT" 2020-07-05 20:50:08 -04:00
Virgil Dupras f2f520cacc Extract (br), (?br) and (loop)'s code out of stable ABI zone
There is now no more actual code in stable ABI, only references.
This makes refactoring of this code much easier. For example,
changing IY to BC as the IP register.
2020-07-05 14:57:18 -04:00
Virgil Dupras daeb3b3c69 Extract (n) code from stable ABI 2020-07-05 14:16:24 -04:00
Virgil Dupras 5705cd5c31 Extract EXIT code from stable ABI zone 2020-07-05 13:41:12 -04:00
Virgil Dupras 4a91ee5c9c Extract (s) code from stable ABI zone
Only its jump addr remains.
2020-07-05 08:54:22 -04:00
Virgil Dupras 650481f849 z80/8086: extract 2>R code from stable ABI zone
Only its jump at 0x33 remains.

I've also fixed a strange offset oddity in 8086's (n) placement.
It was off by 2, but strangely, it ran properly. Anyway, now it's
fixed.
2020-07-05 08:03:15 -04:00
Virgil Dupras 94cb76520a Refer to stable wordref by direct offset in "hot zone" immediates
Previously, it was impossible to cross-compile Collapse OS from a
binary-offsetted Collapse OS because stable ABI wordrefs would have
a wrongly offsetted address.

This solves the problem by replacing those wordrefs by direct,
hardcoded stable ABI offset references.
2020-07-05 07:09:11 -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