1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-06 03:40:54 +11:00
Commit Graph

392 Commits

Author SHA1 Message Date
Virgil Dupras
495d2819d2 recipes/rc2014/sdcard: make spi relay design multi-devices
Also, fix the SPI relay driver to properly AND-away the result of
the CTL read.

Tested with a real prototype, works fine.
2020-09-18 19:22:56 -04:00
Virgil Dupras
1a6a549857 Make the SPI Relay protocol support multiple devices
Working on programming AVR chips exposes a glaring omission in my
first design of the SPI Relay: not allowing multiple devices make
this task hard. I constantly have to unplug my SD card before, plug
the AVR chip holder, then play a bit, then unplug the AVR holder,
then replug the SD card...

My prototype for a SPI relay design is built, but I haven't tested
it yet. I need to adapt the code first, which is what I do here.

When the prototype is tested, I'll update the SDC recipe with a new
schema.
2020-09-17 09:48:55 -04:00
Virgil Dupras
5b4917dbe9 avr: allow writing to flash 2020-09-05 14:07:13 -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
9c36885503 Fix doc innacuracies 2020-08-30 16:53:27 -04:00
Virgil Dupras
85f8543e17 avrspi: first steps
After having done my initial handshaking, I thought the rest of the
job was only a matter of implementing the protocol, but I was wrong.
There were many issues to fix before I could reliably communicate
with my 328P, mostly timing.

Now, I seem to be able to reliably extract fuse information, but
only in batch mode (that is, run "asp$ aspfl@" directly, then
running "(spid)" before running the next command). If I try to
interact with the chip in a single asp$ session, I sometimes get
wrong values (but no sync error! that's worrying...).
2020-08-30 08:01:09 -04:00
Virgil Dupras
7359717000 z80: add missing chkPS, calls
chkPS, used to be only for words that pushed back to PS, but I've
recently removed underflow checks from next and I forgot to add
missing chkPS, calls that go with this change.
2020-08-23 08:43:51 -04:00
Virgil Dupras
46676547d9 spi: add SPI_DELAY decl
AVR chips often run at less than z80's system clock. This means that
our SPI relay needs to have its own clock to properly communicate
with it. This means that the delay between OUT and IN can't be
hardcoded to 2 NOPs anymore. It needs to be configurable.
2020-08-23 07:55:17 -04:00
Virgil Dupras
5f9fccfa8c rc2014: make SIO actually work on real hardware
my previous commit was only tested in emulation, I had init wrong.
2020-08-18 15:33:15 -04:00
Virgil Dupras
124da6adec Move SD Card subsystem outside of RC2014 recipe and add protocols
Although the SPI Relay driver is RC2014-specific, the SD Card driver
is generic enough to be a subsystem. That's the second subsystem we
add and this warrants, I think, the formalization of a new concept:
protocols.
2020-08-16 14:30:33 -04:00
Virgil Dupras
44a4c59525 Indicate unused blocks in master index
It gives a better idea of where stuff can be moved/added to.
2020-08-16 09:38:50 -04:00
Virgil Dupras
007252e459 Move SIO driver into RC2014 recipe 2020-08-16 09:31:02 -04:00
Virgil Dupras
ab72a4f383 doc: take bootstrap guide out of blkfs 2020-08-16 08:33:02 -04:00
Virgil Dupras
fd69195799 doc: take dictionary out of blkfs 2020-08-16 08:22:41 -04:00
Virgil Dupras
d03d93668f doc: take implementation notes out of blkfs 2020-08-16 08:08:23 -04:00
Virgil Dupras
5c4bbaabf4 doc: move usage documention out of the system 2020-08-15 19:40:36 -04:00
Virgil Dupras
31a58d00f1 z80: fix tricky memory initialization issue
Among random "better safe than sorry" changes, the real fix is in
changing "4" for "5" above _find declaration. This off-by-one error
had that word, which is the root word in z80, have a 0x01 prev field
instead of a 0x00 one.

When all memory was initialized to zero, it didn't matter, we ended
up hitting 0 prev and considered ourselves properly at the end of
dict.

When memory wasn't initialized, however, we would end up jumping at
all kinds of places, leading to random behavior.
2020-08-15 16:37:58 -04:00
Virgil Dupras
ddb934813e sio: new driver 2020-08-15 09:44:19 -04:00
Virgil Dupras
7ace3032ef zasm: complete mnemonic argspecs harmonization 2020-08-15 08:11:48 -04:00
Virgil Dupras
a9ed8da0b2 acia: simplify driver
The previous approach of maintaining R> and W> pointers was
conceptually simple, but made INT handler code actually quite
complex.

Now, we maintain indexes instead. It's much easier to perform
bounds checks and to compare for equality, something we have to
do quick in the INT handler.
2020-08-14 22:58:05 -04:00
Virgil Dupras
73623fff53 zasm: rename LDdd(n) to LDd(n)
it seems I left my asm argument harmonization half done here.

Instructions list at B208 doesn't correspond to many actual
mnemonics. This mnemonic here was the worst offender.
2020-08-14 21:45:25 -04:00
Virgil Dupras
c4db9d4420 8086: implement stack overflow error condition
Also, remove RSP underflow check from next for the same reason as
in the previous commit in z80.
2020-08-08 10:18:43 -04:00
Virgil Dupras
5adbf88591 z80: move lbluflw code around
with uflw checks not being in next anymore, we can save ourselves
a forward jump.
2020-08-08 08:19:31 -04:00
Virgil Dupras
d1de99d8c9 z80: implement stack overflow error condition
Also, remove underflow checks from next: it's taxing and useless
because underflow check already takes place in each relevant native
word.
2020-08-08 08:08:05 -04:00
Virgil Dupras
78d4d15fcf cvm: implement stack overflow error condition 2020-08-07 21:57:25 -04:00
Virgil Dupras
e4a4a9800d z80: Use BC as IP register instead of IY
It's a bit more inconvenient in terms of register protection (BC
is much more generally useful than IY), but it makes tight spots
such as next and execute much faster, so I think it's worth it.
2020-07-06 23:31:00 -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
bf4ab0f1b4 z80: protect or avoid BC wherever it's used
For the IY->BC move, of course.
2020-07-05 23:12:17 -04:00
Virgil Dupras
a6e987b5f7 z80: protect BC in _find
In preparation for the IY->BC move
2020-07-05 22:43:32 -04:00
Virgil Dupras
6fab30b164 z80: inline lblfind's routine into _find word 2020-07-05 22:35:54 -04:00
Virgil Dupras
b9fb6a6226 z80: move boot code around
Bring native words together, make the next/exec/does/compiled
cluster be at the beginning.

Next step: bring find code into _find word.
2020-07-05 22:23:40 -04:00
Virgil Dupras
3ea221d0eb z80: inline all uses of pushRS/popRS
I'm trying to move stuff around and it simplifies things. Will make
a lot more sense to inline when BC replaces IY.
2020-07-05 21:54:01 -04:00
Virgil Dupras
ebf47a2ab5 Fix broken LIT" 2020-07-05 20:50:08 -04:00
Virgil Dupras
8bb9230f49 z80a: make PUSH* macros use DE instead of BC
This is in preparation of using BC instead of IY for IP. I've
verified all PUSH* usage and none was problematic.
2020-07-05 17:36:31 -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
a2f880b145 z80: remove popRS from stable ABI 2020-07-05 13:44:38 -04:00
Virgil Dupras
5705cd5c31 Extract EXIT code from stable ABI zone 2020-07-05 13:41:12 -04:00
Virgil Dupras
84202da6a6 z80: prettify 2020-07-05 13:15:26 -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
b626944273 z80: move back R* words to native words section
This allows us to refer to pushRS/popRS routines by labels, allowing
us to get rid of the pushRS reference in the stable ABI zone.
2020-07-05 08:15:50 -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
2111f694f6 VE: 'g' becomes 'G' and 'g' selects line 2020-07-04 07:40:12 -04:00
Virgil Dupras
f09aa0603c rc2014: separate SPI relay and SDC drivers
My intention is to reuse the SPI relay to program AVR MCUs from a
RC2014.
2020-06-29 18:48:00 -04:00
Virgil Dupras
1ac7038863 avra: add TOC and instructions list 2020-06-29 08:01:39 -04:00
Virgil Dupras
74e211eeda Fix bugs in ed's U and VE's O/o
U didn't properly handle inserting on the last line and O's bounds
checks didn't make sense.
2020-06-28 20:34:39 -04:00
Virgil Dupras
5e01e6405a VE: add @ command 2020-06-28 20:19:42 -04:00
Virgil Dupras
5a2612a9c5 Add HERESTART xcomp config 2020-06-28 19:45:28 -04:00