collapseos/tools/emul
Virgil Dupras c40bc329d5 zasm: fix expr returning wrong values on first pass
To run a parseExpr on first pass would always return a false success
with dummy value because symbols are configured to always succeed on
first pass. This would make expressions like ".fill 0x38-$" so bad
things to labels because "0x38-$" wouldn't return the same thing on
first and second pass.

Revert to parsing literals and symbols after having scanned for
expressions and add a special case specifically for char literals (which
is why we scanned for literals and symbols first in the first place).
2019-05-20 10:46:27 -04:00
..
libz80@8a1f935daa Add tools/emul 2019-05-09 12:58:41 -04:00
runbin Add the concept of unit tests 2019-05-17 09:33:20 -04:00
shell Make the shell emulator be built by zasm 2019-05-20 07:29:19 -04:00
zasm zasm: fix expr returning wrong values on first pass 2019-05-20 10:46:27 -04:00
.gitignore Add the concept of unit tests 2019-05-17 09:33:20 -04:00
bin2c.sh Add tools/emul 2019-05-09 12:58:41 -04:00
Makefile tools/emul: add "make rescue" command 2019-05-20 08:58:53 -04:00
README.md zasm now bootstraps itself without scas! 2019-05-19 20:44:19 -04:00
user.h zasm: add support for "$" symbol 2019-05-20 09:17:50 -04:00

emul

This is an emulator for a virtual machine that is suitable for running Collapse OS. The goal of this machine is not to emulate 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.

Bootstrapped binary

The file zasm/zasm.bin is a compiled binary for apps/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.

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

Usage

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

The Makefile in this folder has multiple targets that all use libz80 as its core. For example, make shell will build ./shell, a vanilla Collapse OS shell. make zasm will build a ./zasm executable, and so on.

See documentation is corresponding source files for usage documentation of each target.