diff --git a/.gitmodules b/.gitmodules index 1a3fac8..7b7d24f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "tools/emul/libz80"] - path = tools/emul/libz80 +[submodule "emul/libz80"] + path = emul/libz80 url = https://github.com/ggambetta/libz80.git diff --git a/README.md b/README.md index a66151a..c87b30e 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,10 @@ path to giving Collapse OS a try. * `recipes`: collection of recipes that assemble parts together on a specific machine. * `doc`: User guide for when you've successfully installed Collapse OS. -* `tools`: Tools for working with Collapse OS from "modern" environments. Mostly - development tools, but also contains emulated zasm, which is - necessary to build Collapse OS from a non-Collapse OS machine. +* `tools`: Tools for working with Collapse OS from "modern" environments. For + example, tools for facilitating data upload to a Collapse OS machine + through a serial port. +* `emul`: Emulated applications, such as zasm and the shell. * `tests`: Automated test suite for the whole project. ## Status diff --git a/tools/emul/.gitignore b/emul/.gitignore similarity index 100% rename from tools/emul/.gitignore rename to emul/.gitignore diff --git a/tools/emul/Makefile b/emul/Makefile similarity index 94% rename from tools/emul/Makefile rename to emul/Makefile index 79b1342..102f543 100644 --- a/tools/emul/Makefile +++ b/emul/Makefile @@ -1,10 +1,10 @@ -CFSPACK = ../cfspack/cfspack +CFSPACK = ../tools/cfspack/cfspack TARGETS = shell/shell zasm/zasm runbin/runbin -KERNEL = ../../kernel -APPS = ../../apps +KERNEL = ../kernel +APPS = ../apps ZASMBIN = zasm/zasm AVRABIN = zasm/avra -ZASMSH = ../zasm.sh +ZASMSH = ./zasm.sh SHELLAPPS = zasm ed SHELLTGTS = ${SHELLAPPS:%=cfsin/%} CFSIN_CONTENTS = $(SHELLTGTS) cfsin/user.h @@ -52,7 +52,7 @@ emul.o: emul.c $(CC) -c -o emul.o emul.c $(CFSPACK): - $(MAKE) -C ../cfspack + $(MAKE) -C ../tools/cfspack # -o in sync with USER_CODE in shell/user.h $(SHELLTGTS): $(ZASMBIN) diff --git a/tools/emul/README.md b/emul/README.md similarity index 98% rename from tools/emul/README.md rename to emul/README.md index d555bb1..51c692d 100644 --- a/tools/emul/README.md +++ b/emul/README.md @@ -8,7 +8,7 @@ emulator. 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. +After that, you can run `make` and it builds all applications. ## shell diff --git a/tools/emul/bin2c.sh b/emul/bin2c.sh similarity index 100% rename from tools/emul/bin2c.sh rename to emul/bin2c.sh diff --git a/tools/emul/cfsin/count.bas b/emul/cfsin/count.bas similarity index 100% rename from tools/emul/cfsin/count.bas rename to emul/cfsin/count.bas diff --git a/tools/emul/cfsin/hello.asm b/emul/cfsin/hello.asm similarity index 100% rename from tools/emul/cfsin/hello.asm rename to emul/cfsin/hello.asm diff --git a/tools/emul/cfsin/readme.txt b/emul/cfsin/readme.txt similarity index 100% rename from tools/emul/cfsin/readme.txt rename to emul/cfsin/readme.txt diff --git a/tools/emul/emul.c b/emul/emul.c similarity index 100% rename from tools/emul/emul.c rename to emul/emul.c diff --git a/tools/emul/emul.h b/emul/emul.h similarity index 100% rename from tools/emul/emul.h rename to emul/emul.h diff --git a/tools/emul/libz80 b/emul/libz80 similarity index 100% rename from tools/emul/libz80 rename to emul/libz80 diff --git a/tools/emul/runbin/runbin.c b/emul/runbin/runbin.c similarity index 100% rename from tools/emul/runbin/runbin.c rename to emul/runbin/runbin.c diff --git a/tools/emul/shell/glue.asm b/emul/shell/glue.asm similarity index 100% rename from tools/emul/shell/glue.asm rename to emul/shell/glue.asm diff --git a/tools/emul/shell/shell.c b/emul/shell/shell.c similarity index 100% rename from tools/emul/shell/shell.c rename to emul/shell/shell.c diff --git a/tools/emul/shell/user.h b/emul/shell/user.h similarity index 100% rename from tools/emul/shell/user.h rename to emul/shell/user.h diff --git a/tools/zasm.sh b/emul/zasm.sh similarity index 80% rename from tools/zasm.sh rename to emul/zasm.sh index f3d274a..e196b61 100755 --- a/tools/zasm.sh +++ b/emul/zasm.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Calls tools/emul/zasm/zasm in a convenient manner by wrapping specified +# Calls emul/zasm/zasm in a convenient manner by wrapping specified # paths to include in a single CFS file and then pass that file to zasm. # Additionally, it takes a "-o" argument to set the initial ".org" of the # binary. For example, "zasm.sh -o 4f < foo.asm" assembles foo.asm as if it @@ -12,7 +12,7 @@ # so, if we can't get readlink -f to work, try python with a realpath implementation ABS_PATH=$(readlink -f "$0" || python -c "import os; print(os.path.realpath('$0'))") DIR=$(dirname "${ABS_PATH}") -ZASMBIN="${DIR}/emul/zasm/zasm" +ZASMBIN="${DIR}/zasm/zasm" usage() { echo "Usage: $0 [-a] [-o ] ..." 1>&2; exit 1; } @@ -20,7 +20,7 @@ org='00' while getopts ":ao:" opt; do case "${opt}" in a) - ZASMBIN="${DIR}/emul/zasm/avra" + ZASMBIN="${DIR}/zasm/avra" ;; o) org=${OPTARG} @@ -32,8 +32,8 @@ while getopts ":ao:" opt; do done shift $((OPTIND-1)) -# wrapper around ./emul/zasm/zasm that prepares includes CFS prior to call -CFSPACK="${DIR}/cfspack/cfspack" +# wrapper around ./zasm/zasm that prepares includes CFS prior to call +CFSPACK="${DIR}/../tools/cfspack/cfspack" INCCFS=$(mktemp) "${CFSPACK}" -p "*.h" -p "*.asm" -p "*.bin" "$@" > "${INCCFS}" diff --git a/tools/emul/zasm/glue.asm b/emul/zasm/glue.asm similarity index 100% rename from tools/emul/zasm/glue.asm rename to emul/zasm/glue.asm diff --git a/tools/emul/zasm/kernel.bin b/emul/zasm/kernel.bin similarity index 100% rename from tools/emul/zasm/kernel.bin rename to emul/zasm/kernel.bin diff --git a/tools/emul/zasm/user.h b/emul/zasm/user.h similarity index 100% rename from tools/emul/zasm/user.h rename to emul/zasm/user.h diff --git a/tools/emul/zasm/zasm.bin b/emul/zasm/zasm.bin similarity index 100% rename from tools/emul/zasm/zasm.bin rename to emul/zasm/zasm.bin diff --git a/tools/emul/zasm/zasm.c b/emul/zasm/zasm.c similarity index 100% rename from tools/emul/zasm/zasm.c rename to emul/zasm/zasm.c diff --git a/runtests.sh b/runtests.sh index 9ff61e1..fd755da 100755 --- a/runtests.sh +++ b/runtests.sh @@ -4,9 +4,9 @@ git submodule init git submodule update git clean -fxd -make -C tools/emul +make -C emul make -C tests # let's try again with an updated zasm -make -C tools/emul updatebootstrap all +make -C emul updatebootstrap all make -C tests diff --git a/tests/Makefile b/tests/Makefile index 5bacf33..2d24c16 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,4 +1,4 @@ -EMULDIR = ../tools/emul +EMULDIR = ../emul CFSPACK = ../tools/cfspack/cfspack .PHONY: run diff --git a/tests/avra/runtests.sh b/tests/avra/runtests.sh index 6a047f7..1ea6e59 100755 --- a/tests/avra/runtests.sh +++ b/tests/avra/runtests.sh @@ -1,6 +1,6 @@ #!/bin/sh -e -ZASM=../../tools/zasm.sh +ZASM=../../emul/zasm.sh AVRINC=../../avr cmpas() { diff --git a/tests/shell/runtests.sh b/tests/shell/runtests.sh index 8a961c6..0b962eb 100755 --- a/tests/shell/runtests.sh +++ b/tests/shell/runtests.sh @@ -1,6 +1,6 @@ #!/bin/sh -e -EMULDIR=../../tools/emul +EMULDIR=../../emul SHELL="${EMULDIR}/shell/shell" replay() { diff --git a/tests/unit/runtests.sh b/tests/unit/runtests.sh index 5f3dedb..1a42d16 100755 --- a/tests/unit/runtests.sh +++ b/tests/unit/runtests.sh @@ -3,9 +3,8 @@ set -e # TODO: find POSIX substitute to that PIPESTATUS thing BASE=../.. -TOOLS="${BASE}/tools" -ZASM="${TOOLS}/zasm.sh" -RUNBIN="${TOOLS}/emul/runbin/runbin" +ZASM="${BASE}/emul/zasm.sh" +RUNBIN="${BASE}/emul/runbin/runbin" KERNEL="${BASE}/kernel" APPS="${BASE}/apps" diff --git a/tests/zasm/errtests.sh b/tests/zasm/errtests.sh index ae3d152..741afa7 100755 --- a/tests/zasm/errtests.sh +++ b/tests/zasm/errtests.sh @@ -2,7 +2,7 @@ # no "set -e" because we test errors -ZASM=../../tools/zasm.sh +ZASM=../../emul/zasm.sh chkerr() { echo "Check that '$1' results in error $2" diff --git a/tests/zasm/runtests.sh b/tests/zasm/runtests.sh index 3e1f48b..832b972 100755 --- a/tests/zasm/runtests.sh +++ b/tests/zasm/runtests.sh @@ -3,8 +3,7 @@ BASE=../.. KERNEL="${BASE}/kernel" APPS="${BASE}/apps" -ZASM="${BASE}/tools/zasm.sh" -ASMFILE="${APPS}/zasm/instr.asm" +ZASM="${BASE}/emul/zasm.sh" cmpas() { FN=$1