Commit Graph

147 Commits

Author SHA1 Message Date
Virgil Dupras
372524fd19 Move xcomp to blocks 2020-04-21 20:30:14 -04:00
Virgil Dupras
4967c2add2 Merge z80c.fs and boot.fs into boot.z80 2020-04-20 21:27:34 -04:00
Virgil Dupras
bf49ca2ed2 recipes/rc2014: fix Makefile
It didn't have z80a anymore.
2020-04-20 19:22:43 -04:00
Virgil Dupras
98191d0b0d recipes/rc2014/sdcard: now works under Forth! 2020-04-19 16:56:37 -04:00
Virgil Dupras
dfaa1dc101 link: add "offset" argument to RLDICT
As long as our target was the first word of the "user" dict, using
target's prev to compute offset was fine, but when the target is not
the first word, this system breaks down.

This is the case when, instead of including source code in our boot
binary, we paste it in Collapse OS' prompt.

Also, adjust RC2014 recipe to include stage 3 assembling instructions
with the "paste into prompt" method.
2020-04-19 16:28:40 -04:00
Virgil Dupras
a2d89de557 drv/sdc: implement core words in z80
In addition to making the driver significantly faster, it allows us
to make SDC port configuration opaque to sdc.fs.
2020-04-18 20:33:51 -04:00
Virgil Dupras
287213fc68 recipes/rc2014/eeprom: remove old stuff 2020-04-17 21:10:20 -04:00
Virgil Dupras
733aff7b7a rc2014: adjust bootstrapping instructions 2020-04-16 09:27:49 -04:00
Virgil Dupras
b536d3bfd6 rc2014: complete the EEPROM recipe 2020-04-13 14:41:02 -04:00
Virgil Dupras
d0545d555f upload: use A! instead of C!
It makes the tool much more versatile. I'll have adev being included
in all recipes, so it can be assumed.
2020-04-13 12:00:56 -04:00
Virgil Dupras
d08a9711c5 boot: make HERE point to RAMEND instead of CURRENT
The former was only used in the peculiar context of "/emul". The
regular case is actually HERE pointing to RAMEND on boot.
2020-04-13 11:43:15 -04:00
Virgil Dupras
d4f65911c0 rc2014: add notes about stage3.bin 2020-04-12 14:15:06 -04:00
Virgil Dupras
9548514ff0 rc2014: dictionary relinking now works! 2020-04-12 10:24:53 -04:00
Virgil Dupras
bf447f58c5 link: handle doesWord 2020-04-11 16:38:45 -04:00
Virgil Dupras
13cf294201 rc2014/acia: adjust to latest developments 2020-04-11 15:11:36 -04:00
Virgil Dupras
c515720e23 Revert "Remove link.fs"
Let's revisit the relinking approach, with LITA this time.
This reverts commit 6652125d47.
2020-04-11 13:31:17 -04:00
Virgil Dupras
6368cc3bac Remove (sysv)
Replace its usages with direct RAM+ offsets. The (sysv) mechanism was
incompatible with cross-compilation of a full interpreter.
2020-04-10 14:57:00 -04:00
Virgil Dupras
05c38424c7 recipes/rc2014: stage2 WIP 2020-04-08 09:13:46 -04:00
Virgil Dupras
79527976ab recipes/rc2014: stage2 WIP 2020-04-07 22:36:59 -04:00
Virgil Dupras
6652125d47 Remove link.fs
This was a dead end.
2020-04-07 21:23:42 -04:00
Virgil Dupras
521ff84ca4 Reserve some RAM for future features 2020-04-07 17:32:04 -04:00
Virgil Dupras
7390cb18ed rc2014: a little cleanup 2020-04-05 09:29:03 -04:00
Virgil Dupras
58e88119ec rc2014: Forth Collapse OS, fully operational! 2020-04-05 09:09:00 -04:00
Virgil Dupras
e5f22c7d91 rc2014: update README 2020-04-04 18:10:00 -04:00
Virgil Dupras
edb2771488 rc2014: bingo!
Interpreter is functional in the emulator!
2020-04-04 17:43:00 -04:00
Virgil Dupras
7b42bbde27 rc2014: aaalmost there...
Red 5 standing by.
2020-04-04 17:07:35 -04:00
Virgil Dupras
d1f4dc0ca3 rc2014: aaaalmost there.... 2020-04-04 14:27:23 -04:00
Virgil Dupras
5be9b9cd3e rc2014: we're almost getting there... 2020-04-04 10:31:22 -04:00
Virgil Dupras
c56386af02 wip 2020-04-02 23:21:53 -04:00
Virgil Dupras
64a54c72f8 Fix broken recipes 2020-02-26 21:44:37 -05:00
Virgil Dupras
c7ef8bf915 recipes: add "make emul" targets where appropriate 2020-01-02 16:59:38 -05:00
Virgil Dupras
097c677641 emul/zasm: use libcfs
This allows us to get rid of the zasm.sh wrapper.
2019-12-31 15:07:39 -05:00
Virgil Dupras
5b155a5c15 tools: use BASIC's new while loop
Also, increase STDIO_BUFSIZE to 0x40 so that those while loops work.
2019-12-12 12:04:56 -05:00
Virgil Dupras
25d25d017c Replace old shell with BASIC shell
fixes #80
2019-12-11 14:05:34 -05:00
Virgil Dupras
20151a97f8 recipes/rc2014/zasm: use BASIC shell
Also made Makefile actually portable.
2019-12-11 13:01:51 -05:00
Virgil Dupras
880775ae69 recipes/rc2014/sdcard: use BASIC shell 2019-12-11 11:18:32 -05:00
Virgil Dupras
fb93fcd6e6 recipes/rc2014/eeprom: add usr.asm
A little life saver if your target shell doesn't have a proper at28w.
2019-12-09 21:03:31 -05:00
Virgil Dupras
b9292eb8d0 recipes/rc2014/ps2: Use BASIC shell 2019-12-06 20:00:29 -05:00
Virgil Dupras
08392fee60 recipes/rc2014/eeprom: use BASIC shell 2019-12-02 23:00:35 -05:00
Virgil Dupras
10864afa96 recipes/ti84: use the BASIC shell 2019-12-01 20:11:13 -05:00
Virgil Dupras
aad8efeff7 recipes/rc2014/basic: new recipe 2019-11-23 21:22:31 -05:00
Virgil Dupras
019d05f64c Make the shell a userspace app
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.
2019-11-15 15:37:49 -05:00
Virgil Dupras
cdd0b64570 Modify userspace .org and RAMSTART expectations
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... :)
2019-11-15 10:33:13 -05:00
Virgil Dupras
7cf3ed38da Extract str.asm from core.asm and make core included by userspace
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.
2019-11-14 10:14:15 -05:00
Virgil Dupras
7274dccbe7 Move ASCII consts to ascii.h
And made them shorter in name. The new ascii.h file allow reuse in userspace
code.
2019-11-13 20:38:06 -05:00
Virgil Dupras
9344c4b961 doc: minor improvements 2019-11-04 14:45:10 -05:00
Virgil Dupras
2a55bfd375 stdio: remove a layer of indirection in GetC/PutC
We use zasm's ability to use labels in .equ directive.

We didn't do it before because for a while, we were in between scas
and zasm (scas was used in automated tests) so we needed to use the
lowest common denominator: zasm doesn't have macros and scas can't
use labels in .equ directives.

This forced us to add this layer of indirection. But now that we are
completely cut from scas' dependency, we can use this nice zasm's
ability.
2019-11-04 09:55:12 -05:00
Virgil Dupras
20c0ba3dd0 Clarify recipes structure
Drop the "{pre,post}-collapse" thing and specify that the rc2014 recipes
are canonical.
2019-11-03 16:09:11 -05:00
Virgil Dupras
b745f49186 Rename blockdev's API routines to GetB/PutB
The goal is to avoid mixing those routines with "character devices"
(acia, vpd, kbd) which aren't block devices and have routines that
have different expectations.

This is a first step to fixing #64.
2019-10-30 16:59:35 -04:00
Virgil Dupras
f4b6c7637d zasm: rename #inc to .inc
scas, it's not needed any more.
2019-10-06 14:32:23 -04:00
Virgil Dupras
0c0db41477 recipes/sms/kbd: add schematic 2019-07-20 14:51:34 -04:00
Virgil Dupras
57e7b3ca05 recipes/sms/kbd: PS/2 keyboard adapter for the SMS! 2019-07-20 12:42:55 -04:00
Virgil Dupras
2efe887434 recipes/rc2014/ps2: add schema 2019-06-30 17:37:18 -04:00
Virgil Dupras
e3eea8839b recipes/rc2014/ps2: works rather well now! 2019-06-30 14:16:00 -04:00
Virgil Dupras
2c6ab08d51 recipes/rc2014/ps2: add "resend" requests on parity check failures 2019-06-30 11:17:12 -04:00
Virgil Dupras
0f82ebe02d recipes/rc2014/ps2: add parity checks
Also, add timer to reset reception status after 100us.
2019-06-29 20:45:08 -04:00
Virgil Dupras
360446e731 recipes/rc2014/ps2: don't alter SREG in hdlPCINT 2019-06-29 15:47:02 -04:00
Virgil Dupras
e44ebb08b2 recipes/rc2014/ps2: drive a shell with ps/2 kbd! 2019-06-29 14:26:03 -04:00
Virgil Dupras
3cdb25bfda recipes/rc2014/ps2: implement scan code buffer 2019-06-29 11:18:37 -04:00
Virgil Dupras
20a7ad231f recipes/rc2014/pc2: new recipe (WIP) 2019-06-28 22:54:57 -04:00
Virgil Dupras
6df77ddef3 recipes/rc2014/zasm: we can now assemble the recipe's kernel 2019-06-18 22:07:44 -04:00
Virgil Dupras
0a36ea0815 recipes/rc2014/zasm: add unpack + verification 2019-06-17 15:35:14 -04:00
Virgil Dupras
95b658897a recipes/rc2014/zasm: add instructions to assemble kernel 2019-06-17 14:19:49 -04:00
Virgil Dupras
3e437747c2 recipes/rc2014: add missing calls to fsInit
Also, tighten RAM addresses. They were unecessarily loose.
2019-06-17 13:46:33 -04:00
Virgil Dupras
92a04f4627 sdc: support 24-bit addressing
Needed if we want to compile the kernel and zasm from within a SD card.
I didn't go straight for 32-bit because it was significantly more
complex and 24-bit give us 16M. Enough to go on for a while...
2019-06-15 13:41:20 -04:00
Virgil Dupras
e7c07cdd9a apps/at28w: fix argument byte order 2019-06-14 21:11:45 -04:00
Virgil Dupras
c613f7b0ee recipes/rc2014/eeprom: fix broken a28w args passing
That's why the command seemed slow! It's much faster than I thought.
2019-06-14 16:30:01 -04:00
Virgil Dupras
817636242a Add at28w app and recipe
This allows us to write to an AT28 EEPROM from within collapse os.
2019-06-14 14:15:30 -04:00
Virgil Dupras
145b48efb7 Add apps/sdct
A new app to stress test the SD card driver. Also, accompanying this
commit, changes solidifying the SD card driver so that stress tests
actually pass :)
2019-06-10 15:54:15 -04:00
Virgil Dupras
9bb2194fb0 recipes/rc2014/zasm: zasm can now assemble *and* write to file 2019-06-07 19:53:50 -04:00
Virgil Dupras
e046081900 sdc: add second buffer 2019-06-06 22:16:57 -04:00
Virgil Dupras
ae028e3a86 blockdev: make implementors "random access"
This huge refactoring remove the Seek and Tell routine from blockdev
implementation requirements and change GetC and PutC's API so that they
take an address to read and write (through HL/DE) at each call.

The "PTR" approach in blockdev implementation was very redundant from
device to device and it made more sense to generalize. It's possible
that future device aren't "random access", but we'll be able to add more
device types later.

Another important change in this commit is that the "blockdev handle" is
now opaque. Previously, consumers of the API would happily call routines
directly from one of the 4 offsets. We can't do that any more. This
makes the API more solid for future improvements.

This change forced me to change a lot of things in fs, but overall,
things are now simpler. No more `FS_PTR`: the "device handle" now holds
the active pointer.

Lots, lots of changes, but it also feels a lot cleaner and solid.
2019-06-04 15:36:20 -04:00
Virgil Dupras
63473cc2e3 blockdev: make selection structure opaque
I'm about to change that structure and I don't want fs to be messed up
by this. I'm proceeding step by step...
2019-06-04 09:56:36 -04:00
Virgil Dupras
50a26f6e39 recipe/rc2014/zasm: new recipe 2019-06-03 13:35:21 -04:00
Virgil Dupras
9a72f10221 zasm: includes CFS is now built on-the-fly by zasm.sh
This makes for a much more usable zasm linux binary that doesn't have to
be rebuilt every time apps or kernel change.
2019-06-02 19:57:40 -04:00
Virgil Dupras
22e990ed89 Parametrize zasm linux bin's include CFS file
... instead of embedding it in the binary itself. Additionally, add a
"zasm.sh" wrapper to faciliate zasm calls on a linux machine.
2019-06-02 15:50:59 -04:00
Virgil Dupras
57356e47b4 recipes/rc2014/sdcard: add instructions to write to SD card 2019-06-02 12:04:11 -04:00
Virgil Dupras
73c3fc7947 shell/stdio: decouple from blkdev (again)
Move load/save to blkdev_cmds and add a new "poke" builtin shell cmd
that is the mirror of "peek" and strictly uses stdio (no blkdev
involved).

This allows us to slim the minimal OS size but, more importantly, change
the behavior of "load" so that we don't expect GetC to block until Z is
set. This way, using "load X" with X being larger than the blkdev size
won't block forever.

This also brings our RC2014 minimal kernel below the 1K mark again.
2019-06-02 11:06:38 -04:00
Virgil Dupras
88bf98321e fs: adjust to DE->IX change in recipe/emul glue code 2019-06-02 10:18:03 -04:00
Virgil Dupras
5e5c7e6592 sdc: add sdcPutC
Wriiiiiite!
2019-06-01 19:53:42 -04:00
Virgil Dupras
2e8af376e3 pgm: new kernel module
The pgm module implements a shell hook so that when an unknown command
is typed, we look into the mounted filesystem and look for a file with
the same name as the command. If we find one, we load it in memory and
run it.
2019-05-31 14:54:15 -04:00
Virgil Dupras
6b1679c811 recipes/rc2014/sdcard: mount filesystem! 2019-05-28 13:13:34 -04:00
Virgil Dupras
8cfe834edb recipes/rc2014/sdcard: use "sdci" and blockdev rather than user prog 2019-05-28 11:01:17 -04:00
Virgil Dupras
ed19c6afc1 Use zasm in recipes 2019-05-20 11:00:14 -04:00
Virgil Dupras
013a3b74c8 Add the concept of unit tests
Will be much much easier to tests new core routines without having to
re-create their context first.

Also, extract parse.asm from core.asm
2019-05-17 09:33:20 -04:00
Virgil Dupras
45b8e84e2a shell: de-macro-ize 2019-05-17 08:21:37 -04:00
Virgil Dupras
56760b5aba stdio: de-macro-ize 2019-05-17 08:14:19 -04:00
Virgil Dupras
34ee91a0d7 zasm: use blkdev IDs as input and output
This will soon allow use to seek and tell on input, which is necessary
for a second pass which is necessary for forward symbol references.

This require making `blkSel` a bit more flexible. Rather than having one
global selected blkdev, each app can select its own, in its own memory
space.
2019-05-10 19:33:34 -04:00
Virgil Dupras
d8bc9c2bdd parts/z80/sdc: implement blockdev's GetC 2019-05-09 10:47:57 -04:00
Virgil Dupras
54d0286486 parts/z80/sdc: add sdcSetBlkSize and sdcReadBlk 2019-05-08 20:08:17 -04:00
Virgil Dupras
12ca2bd53e parts/z80/sdc: add sdcInitialize
Also, adjust SD card recipe. Straightforward initialization and read!
2019-05-08 16:03:54 -04:00
Virgil Dupras
3d82d7fb30 recipe/rc2014/sdcard: we read data! 2019-05-07 17:28:07 -04:00
Virgil Dupras
beeb40eb93 recipe/rc2014/sdcard: we got out of initialization! 2019-05-07 16:38:08 -04:00
Virgil Dupras
c9f164a510 recipe/rc2014/sdcard: Make sdinit program output readable text
Makes for a more straightforward test.
2019-05-07 16:20:28 -04:00
Virgil Dupras
e80888555f recipe/rc2014/sdcard: new recipe 2019-05-07 15:47:49 -04:00
Virgil Dupras
055e0d7a31 Split parts in two: z80 and avr
Also, clarify the role of recipes.
2019-04-25 16:03:45 -04:00
Virgil Dupras
ff99062d5b Move RC2014 recipe in its own folder
Also, remove `parts/platforms`. It makes no sense. Only recipes make
sense.
2019-04-16 11:50:16 -04:00