collapseos/tools/emul
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
..
libz80@8a1f935daa Add tools/emul 2019-05-09 12:58:41 -04:00
runbin zasm: indicate include lineno in errors 2019-05-28 09:57:29 -04:00
shell shell/stdio: decouple from blkdev (again) 2019-06-02 11:06:38 -04:00
zasm fs: check for file size bounds in GetC 2019-05-31 11:12:29 -04:00
.gitignore Add the concept of unit tests 2019-05-17 09:33:20 -04:00
Makefile tools/emul: add "make rescue" command 2019-05-20 08:58:53 -04:00
README.md Update docs 2019-05-20 12:11:45 -04:00
bin2c.sh Add tools/emul 2019-05-09 12:58:41 -04:00
user.h fs: check for file size bounds in GetC 2019-05-31 11:12:29 -04:00

README.md

emul

This folder contains a couple of tools running under the [libz80][libz80] emulator.

Build

First, make sure that the libz80 git submodule is checked out. If not, run git submodule init && git submodule update.

After that, you can run make and it builds all tools.

shell

Running shell/shell runs the shell in an emulated machine. The goal of this machine is not to simulate real hardware, but rather to serve as a development platform. What we do here is we emulate the z80 part, the 64K memory space and then hook some fake I/Os to stdin, stdout and a small storage device that is suitable for Collapse OS's filesystem to run on.

Through that, it becomes easier to develop userspace applications for Collapse OS.

We don't try to emulate real hardware to ease the development of device drivers because so far, I don't see the advantage of emulation versus running code on the real thing.

zasm

zasm/zasm is apps/zasm wrapped in an emulator. It is quite central to the Collapse OS project because it's used to assemble everything, including itself!

The program takes no parameter. It reads source code from stdin and spits binary in stdout. It supports includes and had both apps/ and kernel folder packed into a CFS that was statically included in the executable at compile time.

The file zasm/zasm.bin is a compiled binary for apps/zasm/glue.asm and zasm/kernel.bin is a compiled binary for tools/emul/zasm/glue.asm. It is used to bootstrap the assembling process so that no assembler other than zasm is required to build Collapse OS.

This binary is fed to libz80 to produce the zasm/zasm "modern" binary and once you have that, you can recreate zasm/zasm.bin and zasm/kernel.bin.

This is why it's included as a binary in the repo, but yes, it's redundant with the source code.

Those binaries can be updated with the make updatebootstrap command. If they are up-to date and that zasm isn't broken, this command should output the same binary as before.

runbin

This is a very simple tool that reads binary z80 code from stdin, loads it in memory starting at address 0 and then run the code until it halts. The exit code of the program is the value of A when the program halts.

This is used for unit tests.