Commit Graph

66 Commits

Author SHA1 Message Date
Virgil Dupras
e01ee170cb stdio: add stdioReadC
A routine to conveniently read lines from TTY. Extracted from
shell. Will be used in other places.
2019-07-13 09:19:01 -04:00
Virgil Dupras
ade9b96d14 sms/pad: make B jump to the next selection "class" 2019-07-02 16:18:00 -04:00
Virgil Dupras
162e503291 sms/vdp: properly protect AF on PutC 2019-07-02 15:54:07 -04:00
Virgil Dupras
f41508725d sms/pad: handle return properly
That is, send current chr selection, and then, send LF.
2019-07-02 15:23:28 -04:00
Virgil Dupras
9c87734499 sms/vdp: clear cursor before CR or BS
This avoids having "ghost" chr selection sticking around.
2019-07-02 15:22:14 -04:00
Virgil Dupras
2679172edf sms/vdp: implement "chrsel" hook
This allows for outputting a character selection before it's given
through GetC. That allows a pad-oriented character selection scheme.
2019-07-02 13:14:02 -04:00
Virgil Dupras
74de1c92cf sms/pad: implement character selection mechanism
Still a bit rough around the edges, but still, works rather well.
2019-07-02 13:12:52 -04:00
Virgil Dupras
748d7347c8 shell: add "loop hook"
This hook is called during every iteration, allowing regular screen
refresh when video is involved.
2019-07-02 13:11:37 -04:00
Virgil Dupras
404dbd0ddd sms/vdp: handle CR and LF 2019-07-02 11:14:16 -04:00
Virgil Dupras
2da4a3a87b sms/vdp: new module allowing PutC to spit chars in the VDP 2019-07-02 10:48:38 -04:00
Virgil Dupras
c5a0a6ff54 sms/pad: easily detect change in button config 2019-07-02 10:47:59 -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
b7cda6ed14 shell: improve reliability
Make ASCII_BS (sent when driven through kbd) make the same thing as
ASCII_DEL. Also, don't crash on filling the buffer.
2019-06-30 13:25:14 -04:00
Virgil Dupras
ad31c7f7f5 kbd: make letters lowercase
We'll make them uppercase when we'll add support for shift.
2019-06-30 13:24:35 -04:00
Virgil Dupras
cd7743b3ae kbd: give the device a little breathing room in tight loops 2019-06-30 12:12:42 -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
9fb77054c0 Update docs w.r.t. its relationship with scas 2019-06-19 13:34:06 -04:00
Virgil Dupras
69fc2e3bf2 sdc: make sdcReadBlk return error on max retries
It previously returned success!
2019-06-19 13:22:07 -04:00
Virgil Dupras
66fbd20e21 sdc: tidy up 2019-06-19 09:24:16 -04:00
Virgil Dupras
d9ae82c81e sdc: enable CRC checks on blk write 2019-06-19 09:00:50 -04:00
Virgil Dupras
2ac16d4750 sdc: check CRC during sdcReadBlk
When there's a mismatch, retry up to a certain number of times.

This makes random problem related to assembling big kernels go away! But
it also make SD card reading much slower...
2019-06-18 22:03:48 -04:00
Virgil Dupras
cac9acca67 sdc: make some space in memory for buffer CRC 2019-06-18 15:21:58 -04:00
Virgil Dupras
34db493496 sdc: implement CRC7 computation on cmds
For now, this achieves nothing else than wasting cycles, but this is the
first step in enabling CRC verifications (CMD59).

I think that this is where my random problems with assembling large
kernels from SDC come from: bad data that isn't detected. If that
happens when PGM loads programs in memory, then anything can happen.

`sdct`, when ran often enough, will error out or corrupt away (go
crazy)...
2019-06-18 14:45:55 -04:00
Virgil Dupras
914c6d5abc Update comments 2019-06-17 13:42:53 -04:00
Virgil Dupras
00778f73e1 blockdev: fix bug recently introduced in load cmd
It would always load one byte less than told... This time it's right on
the money :)
2019-06-17 09:54:30 -04:00
Virgil Dupras
8cf9904f33 blockdev: fix load command over-loading a byte
Calling `load` would always read one more byte than specified. Also,
make `0` mean `0x100`.
2019-06-17 08:19:03 -04:00
Virgil Dupras
bd2877e012 shell: make arg in peek/poke mandatory
Also, make `0` mean `0x100`.
2019-06-17 08:18:28 -04:00
Virgil Dupras
7c23e5a9ef acia: protect DE during aciaInt
I don't know why I haven't noticed it wasn't protected. It must have
been behind many random problems I've been having...
2019-06-16 19:29:58 -04:00
Virgil Dupras
3e7d181d3c zasm: properly raise error on bas ioPutC calls 2019-06-15 20:01:17 -04:00
Virgil Dupras
4327153ffd zasm: fix include EOF detection
That was an interesting bug. It didn't cause a problem in emulation, but
in an RC2014 on an SD card, an include that didn't end with two newlines
would cause an infinite loop.
2019-06-15 15:50:27 -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
605c631dc0 shell: add support for backspace
It doesn't sound like much, but that backspace key is often useful...
2019-06-14 22:14:09 -04:00
Virgil Dupras
14cc2fb785 parse: fix option word default value
Previously, an optional word argument would only have its first byte set
to zero.
2019-06-14 21:10:18 -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
495d69c1cb sdc: make writing more solid
By not waiting until the SD card wan't busy any more after a write, we
exposed ourselves to errors if another operation was attempted right
after it.
2019-06-07 14:59:53 -04:00
Virgil Dupras
e046081900 sdc: add second buffer 2019-06-06 22:16:57 -04:00
Virgil Dupras
db24e21276 sdc: add layer of indirection to buffer system
Also, lay out the plan for adding a second buffer.
2019-06-06 15:57:32 -04:00
Virgil Dupras
fb99f4ad91 fs: grow file size on fsPutC, if appropriate 2019-06-05 16:34:14 -04:00
Virgil Dupras
fc81bce70f Fix error handling when writing to files in emulated shell 2019-06-05 16:13:15 -04:00
Virgil Dupras
2483ee699d fs: fix broken fopn on id > 0 2019-06-05 15:40:56 -04:00
Virgil Dupras
a7ce9f6fc6 pgm: adapt to recent blkdev change
With fsGetC becoming a "random address" API, it broke pgm. This commit
fixes it. To avoid adding the weight of a blkdev in pgm, I manage the
read offset directly in pgm.
2019-06-05 14:45:38 -04:00
Virgil Dupras
c18d42f08b fs: further adjust to previous blkdev refactoring
Previous refacoring broke all seek/tell within fs. fs handles now lost
the responsibility to keep track of current position. It's blkdev's job.
2019-06-04 20:45:01 -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
c85ed474d7 blockdev: remove _blkCall
The ability to specify "0" routines in blkdev table is not used anymore
now that stdio is a separate subsystem.

Also, I'm preparing a blockdev refactoring and this complicates my work.
2019-06-04 09:23:10 -04:00
Virgil Dupras
839ba91312 mmap: make zasm-friendly 2019-06-03 11:14:29 -04:00
Virgil Dupras
bed7032ee5 pgm: have its own file handle 2019-06-03 09:25:17 -04:00
Virgil Dupras
a48a91c8da pgm: properly pass shell args in HL 2019-06-03 08:56:39 -04:00
Virgil Dupras
21c677a950 Make parseArgs not expect a leading space 2019-06-02 14:46:07 -04:00
Virgil Dupras
f8bd8eeaaf Make userspace parse args the same way the shell does 2019-06-02 14:05:20 -04:00