Commit Graph

1503 Commits

Author SHA1 Message Date
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
bcf04f441d arduinouno: add schema to at28wr recipe 2020-08-21 20:25:06 -04:00
Virgil Dupras
0b39a975fe doc: add doc about editing text 2020-08-19 17:43:54 -04:00
Virgil Dupras
11f8843a16 rc2014: add sio recipe 2020-08-18 16:02:47 -04:00
Virgil Dupras
8788379aac Flatten recipes 2020-08-18 15:46:14 -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
dcab047302 cvm: use return code indicated by Collapse OS
Always returning zero caused test failures not to be properly
detected.
2020-08-17 17:48:41 -04:00
Virgil Dupras
6d2a0f749a recipes/rc2014: fix out-of-date information 2020-08-16 20:54:06 -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
a3a83ae49b doc: improve primer 2020-08-15 18:57:03 -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
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
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
ffcd93699e doc: out-of-system documentation
I've changed my mind about having documentation in-system. It doesn't
serve much of a purpose and make blkfs significantly heavier.

This commit is the first step in writing a documentation outside of
the blkfs.
2020-08-10 10:02:10 -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
25f4312523 cvm: improve comments
They were a bit terse.
2020-08-07 21:03:28 -04:00
Virgil Dupras
fc7971d64f tools: improve stty-related advices in README 2020-08-02 16:21:31 -04:00
Virgil Dupras
4632b3c157 tools/exec: exec specified file instead of hardcoding on stdin
Under OpenBSD, stdin is already used by the device itself because of
the whole "stty has no memory" situation.
2020-08-02 16:11:19 -04:00
Virgil Dupras
939a1da9e6 recipes/arduinouno/at28: add companion at28dump program 2020-07-28 16:29:10 -04:00
Virgil Dupras
b8e52707e9 recipes/arduinouno/at28: improve reliability
Previously, it could never write more than a few bytes before pingpong
getting a mismatch error. Now, I can pingpong Collapse OS binary
without a mismatch.
2020-07-28 15:23:10 -04:00
Dustin Rawlings
bc1cc591ce Replace "-ansi" with "-std=c89" in emul/Makefile
"-ansi" is not supported by tcc, but according to gcc
documentation, "-std=c89" produces identical behavior.

See: https://gcc.gnu.org/onlinedocs/gcc-3.4.2/gcc/Standards.html
2020-07-23 20:10:30 -04:00
Virgil Dupras
3607eefa55 Add arduinouno/at28 recipe 2020-07-22 17:26:06 -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
293a561ab2 Fix SDC tests 2020-07-05 15:01:59 -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