Commit Graph

29 Commits

Author SHA1 Message Date
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
Virgil Dupras 95f1a8ddaf blkdev: make load command stop and the end of the stream
This allows us to reliably and easily load a file until the end of it.
2019-06-02 11:18:06 -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 5e5c7e6592 sdc: add sdcPutC
Wriiiiiite!
2019-06-01 19:53:42 -04:00
Virgil Dupras 3bc7cec03a sdc: allow the read of 0xff
That took an embarrasingly large amount of time to debug for something,
in the end, so obvious...
2019-05-31 21:33: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 7c191fd978 fs: standardize file handle routine argument to IX
Using HL/DE was awkward and error-prone.
2019-05-31 14:28:06 -04:00
Virgil Dupras 83771b538f fs: check for file size bounds in GetC 2019-05-31 11:12:29 -04:00
Virgil Dupras a641a94853 sdc: make sector swapping more robust
It would previously only work when GetC-ing our way into a new sector.
Seeking into one would not work. Now it's much more robust and this
paves the way for write support.
2019-05-30 14:55:38 -04:00
Virgil Dupras 83e375936c shell: make seek cmd init DE to 0
So that blkdev not supporting 32-bit aren't messed up.
2019-05-30 14:54:28 -04:00
Virgil Dupras 328f44814e Make blockdev pointers 32 bits
This allows us to break through the 64K limit for includes CFS in zasm,
a limit we were dangerously close to breaking. In fact, this commit
makes us go over that limit. Right in time!
2019-05-28 19:42:35 -04:00
Virgil Dupras 312e95479e sdc: fix bug preventing us from reading beyond first sector 2019-05-28 13:12:08 -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 d2c6e21c64 Fix broken shell
When I zasm-ified the shell a couple of dozens of commits ago, I
inverted push and pops...
2019-05-20 07:38:15 -04:00
Virgil Dupras c586c0d63c Make the shell emulator be built by zasm 2019-05-20 07:29:19 -04:00
Virgil Dupras bc1496a7e3 zasm emul: bring back kernel/user distinction
It was a bad idea to remove it. Now that I'm introducing the concept of
a per-app glue file, it becomes much easier to build emulated zasm as a
userspace app.
2019-05-19 12:57:59 -04:00
Virgil Dupras 7fad3b0c90 Move /parts/z80 to /kernel
Let go of that "meta os" thing. it's not as meta as I made it sound
like. It's a kernel.
2019-05-19 11:19:41 -04:00