Commit Graph

17 Commits

Author SHA1 Message Date
James Stanley
1b8b113536 Fix filesystem in shell emulator
We now treat the block device as fixed-size rather than trying to grow it in response
to kernel activity.

Previously, if you tried to create 2 files in a row, only the first 1 would actually appear,
because the device only ever got larger when a byte was written immediately past the end of
the device.

Now we just let the kernel write bytes to the disk anywhere, so new files can be created even
when the previous file is not completely full.

Also, fix buffer overrun in reading filesystem image, and use a more idiomatic fgetc loop.
2019-12-12 16:58:17 -05:00
Virgil Dupras
9ab292a6d5 Add shell automated tests 2019-12-12 14:32:47 -05:00
Virgil Dupras
25d25d017c Replace old shell with BASIC shell
fixes #80
2019-12-11 14:05:34 -05:00
Virgil Dupras
66dacd1816 tools/emul: add "Min SP" debug value
This gives the maximum size of the stack at any given moment during the
execution of the program. It's useful to figure out if the stack gets
dangerously close to the heap.
2019-12-02 17:44:54 -05:00
Virgil Dupras
2f07d849a8 tools/emul: deduplicate a little bit of C code 2019-12-02 17:28:01 -05:00
James Stanley
7f7251d57f Fix buffer overrun in shell emulator (#51) 2019-10-15 21:21:40 -04:00
Virgil Dupras
252d71f1b8 Make tools/emul *BSD-friendly 2019-07-11 21:21:54 -04:00
Virgil Dupras
3dde51ae98 Allow file-to-file compilation in the emulated shell 2019-06-05 19:51:19 -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
7ae29015de tools/emul: add hex representation to debug output
My mind isn't so good at decimal -> hex translations. It helps to have
this...
2019-06-03 11:16:06 -04:00
Virgil Dupras
ecbb77072e tools/emul/shell: allow the growing of fsdev 2019-06-03 08:42:08 -04:00
Virgil Dupras
04bf2117b2 tools/emul: re-organize .h files
What used to be `tools/emul/user.h` was in fact specific to zasm, so I
moved it there.

To avoid name confusion, I renamed what used to be kernel.h and user.h
to kernel-bin.h and user-bin.h.
2019-06-03 08:12:44 -04:00
Virgil Dupras
cdc865f8c6 tools/emul/shell: add debug output 2019-05-30 14:55:16 -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
56760b5aba stdio: de-macro-ize 2019-05-17 08:14:19 -04:00
Virgil Dupras
def6c2123d tools/emul: clean up the place a bit 2019-05-17 07:23:59 -04:00