Commit Graph

269 Commits

Author SHA1 Message Date
Virgil Dupras 64a54c72f8 Fix broken recipes 2020-02-26 21:44:37 -05:00
Virgil Dupras 92ddc7ebc1 recipes/trs80: use grid module
Not much of a gain in terms of usability (a bit of a loss in fact, things are
a bit slow and glitchy), but it's a necessary move if we want to use upcoming
grid-enabled userspace apps, such as a visual text editor.
2020-02-26 16:27:27 -05:00
Virgil Dupras 247b200dcc New kernel module: grid 2020-02-24 20:36:08 -05:00
Virgil Dupras 434c8d5c0d recipes/trs80: add ed 2020-02-23 20:52:44 -05:00
Virgil Dupras c3213e1e8c recipes/trs80: can now run zasm! 2020-02-23 14:51:19 -05:00
Virgil Dupras 2860a10f71 recipes/trs80: add CFS support 2020-02-22 20:06:59 -05:00
Virgil Dupras ec6df3087d recipes/trs80: add "recv" command
This allows us to write contents from RS-232 directly to floppy! it works!
2020-02-22 14:43:07 -05:00
Virgil Dupras 049f2cf222 Reverse ttysafe escaping order
Sending the escape after its target made things complicated for upcoming
stuff I want to add. Although it makes `recv.asm` slightly larger, it's really
worth it.
2020-02-22 14:11:43 -05:00
Virgil Dupras 69f0c6dafd trs80/floppy: implement write 2020-02-22 12:09:43 -05:00
Virgil Dupras 438c71ad3d trs80/floppy: new module
Read-only support for now, hardcoded on drive :1. But it seems to work.

Can't wait to get a CFS running on this!
2020-02-21 19:30:57 -05:00
Virgil Dupras bd38d46892 recipes/trs80: fix double line feeds
Lines should be terminated only with a CR on this system, not CRLF.
2020-02-21 08:40:42 -05:00
Virgil Dupras 9515d63d47 recipes/trs80: Collapse OS runs on the TRS-80 Model 4P! 2020-02-12 11:23:49 -05:00
Virgil Dupras bab18216aa recipes/trs80: add instructions to save recv program to floppy 2020-02-10 11:25:05 -05:00
Virgil Dupras a74ee81822 recipes/trs80: new recipe (WIP) 2020-01-11 23:01:28 -05:00
Virgil Dupras fb2117dc2e sms/vdp: use fonts from kernel/fnt
Instead of its own version of one. Additionally, add a 7x7 font to
the collection.
2020-01-07 22:15:35 -05:00
Virgil Dupras c7ef8bf915 recipes: add "make emul" targets where appropriate 2020-01-02 16:59:38 -05:00
Virgil Dupras 9216057db8 emul/hw: add TI-84+ emulator
I implement the screen using XCB which is much more friendly
than z80e's SDL+CMake for development machines that want to install
minimal dependencies (for example, a port-less OpenBSD rig).
2020-01-01 22:48:01 -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 dcb96aefe9 lib/parse: remove parseHexPair
Also, make parseHexadecimal "tail" (HL). Soon, all routines in lib/parse
will do that, making the life of lib/expr easier.
2019-12-29 21:56:56 -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 0fb7995166 recipes/sms/romasm: add missing sentinel in .mycmds 2019-12-02 23:00:03 -05:00
Virgil Dupras 270ad926c9 recipes/sms: use BASIC shell 2019-12-02 20:18:41 -05:00
Virgil Dupras 15e44ec524 doc: add TI83+/TI84+ doc page 2019-12-02 13:51:36 -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 39f3637c60 recipes/ti84: TI-84+ base recipe is complete!
ref #41
2019-11-12 20:32:56 -05:00
Virgil Dupras 17cc28e211 recipes/ti84: use a 3x5 font instead of a 5x7 one
This allow a lot more characters to fit on that tiny screen...

ref #41
2019-11-11 13:26:24 -05:00
Virgil Dupras a4190f9984 recipes/ti84: document usage
ref #41
2019-11-09 14:20:01 -05:00
Virgil Dupras c896b77143 ti/kbd: implement A-Lock
ref #41
2019-11-08 20:27:43 -05:00
Virgil Dupras dca6ce4e8e ti/kbd: begin GetC implementation
For now, only digits are scanned. Lifted from my "tiseg7" example.

ref #41
2019-11-08 14:04:56 -05:00
Virgil Dupras fda9c9826e ti/lcd: add linefeed support
There's no scrolling yet...

ref #41
2019-11-07 20:53:15 -05:00
Virgil Dupras f4871d4d58 recipes/ti84: add upload instructions
ref #41
2019-11-07 13:42:40 -05:00
Virgil Dupras ca84b5dac8 recipes/ti84: first step
This was mostly lifted from my "tihello" example, but it required significant
adjustments.

This commit also introduces a font management system. A lot of fonts are
available online, but sources aren't always clear so to avoid copyright
landmines, I re-created my first 5x7 font from scratch.

As it is now, this resulting ROM gets "Collapse OS>" to be displayed on the
LCD screen. Much work still left to do.

ref #41
2019-11-07 11:52:29 -05:00
Virgil Dupras 69daf49920 doc: fix mis-wording 2019-11-05 17:59:29 -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 16bf8e28c0 Remove SHELL_LOOPHOOK
It was a bad idea and having sms/pad interact directly with sms/vdp
is much simpler.

ref #64
2019-11-03 19:13:01 -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
luz.paz 6a635fddd9 Fix misc. source comment typos
Found via `codespell -q 3 -S ./tools -L splitted`
2019-10-09 11:12:08 -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 c839703682 recipes/sms/romasm: ed and zasm, fully functional! 2019-07-25 14:24:18 -04:00
Virgil Dupras 13028d431e recipes/sms/romasm: limit mmap size
Otherwise, we overflow into the RAM mirror, which means we
overwrite the beginning of the RAM.
2019-07-23 23:01:17 -04:00
Virgil Dupras 1c6a7caeae recipes/sms/romasm: make zasm's memory usage fit the SMS 2019-07-23 16:50:19 -04:00
Virgil Dupras af0b6231ca recipes/sms/romasm: make ed's memory usage fit the SMS
Yup, that's ultimately why I've just made this whole big zasm
refactoring in the previous commits. To allow for this.

But also, zasm is in much better shape now...
2019-07-23 16:13:52 -04:00
Virgil Dupras ffa28195b1 recipes/sms/romasm: adjust glue to zasm changes
Forward reference of SHELL_MEM_PTR wasn't working (nor should it
have been...).
2019-07-23 15:42:52 -04:00
Virgil Dupras 87d794d426 recipes/sms/romasm: adjust ed/zasm offsets 2019-07-22 10:11:59 -04:00
Virgil Dupras 77d805ea0f shell: allow cmds to be shorter than 4 chars 2019-07-21 15:57:55 -04:00
Virgil Dupras 70a42e8c4d recipes/sms/romasm: first steps 2019-07-21 15:37:03 -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 8cc5bbb110 recipes/sms: update README 2019-07-02 16:31:58 -04:00
Virgil Dupras dd84c11905 recipes/sms: Add pad-oriented character selection 2019-07-02 13:15:24 -04:00
Virgil Dupras bd003829e8 recipes/sms: plug shell in!
Now this is getting eminently exciting!
2019-07-02 11:14:30 -04:00
Virgil Dupras 767db17252 recipes/sms: hitting a button now adds a char on the screen 2019-07-02 10:49:30 -04:00
Virgil Dupras 9eb80d5eac sms/pad: new module to manage Megadrive controller in SMS 2019-07-02 09:02:19 -04:00
Virgil Dupras ca5bc07a75 recipes/sms: show all letters in font when Start is pressed 2019-07-01 16:15:46 -04:00
Virgil Dupras ba2804a255 recipes/sms: add controller support 2019-07-01 15:46:10 -04:00
Virgil Dupras 95fa473641 recipes/sms: New section for Sega Master System 2019-07-01 11:05:25 -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
Virgil Dupras 461c09f1e5 Decouple shell from acia 2019-04-14 14:24:29 -04:00
Virgil Dupras 21168f6c4e shell: implement seek and peek
This introduces `core.asm` which includes routines used by other parts.
2019-04-14 11:17:38 -04:00
Virgil Dupras 6bb454232a Extract "acia.asm" from shell
Also, come up with a way to make parts play well together memory-wise.
2019-04-13 16:01:20 -04:00
Virgil Dupras 89e4edfa52 Add parts/platforms 2019-04-12 15:53:05 -04:00
Virgil Dupras 7bf3e2f71e Let's get the ball rolling! 2019-04-12 15:16:12 -04:00