zasm: includes CFS is now built on-the-fly by zasm.sh
This makes for a much more usable zasm linux binary that doesn't have to be rebuilt every time apps or kernel change.
This commit is contained in:
parent
02954af570
commit
9a72f10221
@ -1,7 +1,8 @@
|
|||||||
TARGET = os.bin
|
TARGET = os.bin
|
||||||
ZASM = ../../tools/zasm.sh
|
ZASM = ../../tools/zasm.sh
|
||||||
|
KERNEL = ../../kernel
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
$(TARGET): glue.asm
|
$(TARGET): glue.asm
|
||||||
$(ZASM) < $< > $@
|
$(ZASM) $(KERNEL) < $< > $@
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
TARGETS = os.bin cfsin/helo
|
TARGETS = os.bin cfsin/helo
|
||||||
TOOLS = ../../../tools
|
TOOLS = ../../../tools
|
||||||
ZASM = $(TOOLS)/zasm.sh
|
ZASM = $(TOOLS)/zasm.sh
|
||||||
|
KERNEL = ../../../kernel
|
||||||
CFSPACK = $(TOOLS)/cfspack/cfspack
|
CFSPACK = $(TOOLS)/cfspack/cfspack
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
@ -8,7 +9,7 @@ all: $(TARGETS) sdcard.cfs
|
|||||||
os.bin: glue.asm
|
os.bin: glue.asm
|
||||||
cfsin/helo: helo.asm
|
cfsin/helo: helo.asm
|
||||||
$(TARGETS):
|
$(TARGETS):
|
||||||
$(ZASM) < $< > $@
|
$(ZASM) $(KERNEL) < $< > $@
|
||||||
|
|
||||||
$(CFSPACK):
|
$(CFSPACK):
|
||||||
make -C $(TOOLS)/cfspack
|
make -C $(TOOLS)/cfspack
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
TARGETS = shell/shell zasm/zasm runbin/runbin
|
|
||||||
CFSPACK = ../cfspack/cfspack
|
CFSPACK = ../cfspack/cfspack
|
||||||
|
TARGETS = shell/shell zasm/zasm runbin/runbin
|
||||||
KERNEL = ../../kernel
|
KERNEL = ../../kernel
|
||||||
APPS = ../../apps
|
APPS = ../../apps
|
||||||
ZASMBIN = zasm/zasm
|
ZASMBIN = zasm/zasm
|
||||||
INCCFS = zasm/includes.cfs
|
ZASMSH = ../zasm.sh
|
||||||
SRCPATTERN = *.+(asm|h)
|
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: $(TARGETS)
|
all: $(TARGETS)
|
||||||
|
|
||||||
shell/kernel.h: shell/shell_.asm $(ZASMBIN) $(INCCFS)
|
shell/kernel.h: shell/shell_.asm $(ZASMBIN)
|
||||||
$(ZASMBIN) $(INCCFS) < $< | ./bin2c.sh KERNEL | tee $@ > /dev/null
|
$(ZASMSH) $(KERNEL) < $< | ./bin2c.sh KERNEL | tee $@ > /dev/null
|
||||||
|
|
||||||
zasm/kernel.h: zasm/kernel.bin
|
zasm/kernel.h: zasm/kernel.bin
|
||||||
./bin2c.sh KERNEL < $< | tee $@ > /dev/null
|
./bin2c.sh KERNEL < $< | tee $@ > /dev/null
|
||||||
@ -18,13 +17,8 @@ zasm/kernel.h: zasm/kernel.bin
|
|||||||
zasm/user.h: zasm/zasm.bin
|
zasm/user.h: zasm/zasm.bin
|
||||||
./bin2c.sh USERSPACE < $< | tee $@ > /dev/null
|
./bin2c.sh USERSPACE < $< | tee $@ > /dev/null
|
||||||
|
|
||||||
$(INCCFS): $(CFSPACK)
|
shell/shell: shell/shell.c libz80/libz80.o shell/kernel.h
|
||||||
$(CFSPACK) $(KERNEL) "$(SRCPATTERN)" > $@
|
$(ZASMBIN): zasm/zasm.c libz80/libz80.o zasm/kernel.h zasm/user.h $(CFSPACK)
|
||||||
$(CFSPACK) $(APPS) "$(SRCPATTERN)" >> $@
|
|
||||||
$(CFSPACK) user.h >> $@
|
|
||||||
|
|
||||||
shell/shell: shell/shell.c libz80/libz80.o shell/kernel.h $(CFSPACK)
|
|
||||||
$(ZASMBIN): zasm/zasm.c libz80/libz80.o zasm/kernel.h zasm/user.h
|
|
||||||
runbin/runbin: runbin/runbin.c libz80/libz80.o
|
runbin/runbin: runbin/runbin.c libz80/libz80.o
|
||||||
$(TARGETS):
|
$(TARGETS):
|
||||||
$(CC) $< libz80/libz80.o -o $@
|
$(CC) $< libz80/libz80.o -o $@
|
||||||
@ -38,8 +32,8 @@ $(CFSPACK):
|
|||||||
|
|
||||||
.PHONY: updatebootstrap
|
.PHONY: updatebootstrap
|
||||||
updatebootstrap: $(ZASMBIN) $(INCCFS)
|
updatebootstrap: $(ZASMBIN) $(INCCFS)
|
||||||
$(ZASMBIN) $(INCCFS) < zasm/glue.asm > zasm/kernel.bin
|
$(ZASMSH) $(KERNEL) < zasm/glue.asm > zasm/kernel.bin
|
||||||
$(ZASMBIN) $(INCCFS) < $(APPS)/zasm/glue.asm > zasm/zasm.bin
|
$(ZASMSH) $(KERNEL) $(APPS) user.h < $(APPS)/zasm/glue.asm > zasm/zasm.bin
|
||||||
|
|
||||||
# Sometimes, when developing zasm, stuff get messed up and it's hard to unmess
|
# Sometimes, when developing zasm, stuff get messed up and it's hard to unmess
|
||||||
# because zasm's brake-up ends up in its bootstrap bins. Sure, we can revert
|
# because zasm's brake-up ends up in its bootstrap bins. Sure, we can revert
|
||||||
|
@ -3,12 +3,16 @@
|
|||||||
set -e
|
set -e
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
ZASM=../../zasm.sh
|
BASE=../../..
|
||||||
RUNBIN=../../emul/runbin/runbin
|
TOOLS=../..
|
||||||
|
ZASM="${TOOLS}/zasm.sh"
|
||||||
|
RUNBIN="${TOOLS}/emul/runbin/runbin"
|
||||||
|
KERNEL="${BASE}/kernel"
|
||||||
|
APPS="${BASE}/apps"
|
||||||
|
|
||||||
for fn in *.asm; do
|
for fn in *.asm; do
|
||||||
echo "Running test ${fn}"
|
echo "Running test ${fn}"
|
||||||
if ! ${ZASM} < ${fn} | ${RUNBIN}; then
|
if ! ${ZASM} "${KERNEL}" "${APPS}" < ${fn} | ${RUNBIN}; then
|
||||||
echo "failed with code ${PIPESTATUS[1]}"
|
echo "failed with code ${PIPESTATUS[1]}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -10,8 +10,10 @@ ZASM=../../zasm.sh
|
|||||||
ASMFILE=${APPS}/zasm/instr.asm
|
ASMFILE=${APPS}/zasm/instr.asm
|
||||||
|
|
||||||
cmpas() {
|
cmpas() {
|
||||||
EXPECTED=$($SCAS -I ${KERNEL} -I ${APPS} -o - "$1" | xxd)
|
FN=$1
|
||||||
ACTUAL=$(cat $1 | $ZASM | xxd)
|
shift 1
|
||||||
|
EXPECTED=$($SCAS -I ${KERNEL} -I ${APPS} -o - "${FN}" | xxd)
|
||||||
|
ACTUAL=$(cat ${FN} | $ZASM "$@" | xxd)
|
||||||
if [ "$ACTUAL" == "$EXPECTED" ]; then
|
if [ "$ACTUAL" == "$EXPECTED" ]; then
|
||||||
echo ok
|
echo ok
|
||||||
else
|
else
|
||||||
@ -25,7 +27,7 @@ cmpas() {
|
|||||||
|
|
||||||
for fn in test*.asm; do
|
for fn in test*.asm; do
|
||||||
echo "Comparing ${fn}"
|
echo "Comparing ${fn}"
|
||||||
cmpas $fn
|
cmpas $fn "${KERNEL}" "${APPS}"
|
||||||
done
|
done
|
||||||
|
|
||||||
./geninstrs.py $ASMFILE | \
|
./geninstrs.py $ASMFILE | \
|
||||||
|
@ -3,5 +3,14 @@
|
|||||||
# wrapper around ./emul/zasm/zasm that prepares includes CFS prior to call
|
# wrapper around ./emul/zasm/zasm that prepares includes CFS prior to call
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||||
ZASMBIN="${DIR}/emul/zasm/zasm"
|
ZASMBIN="${DIR}/emul/zasm/zasm"
|
||||||
INCCFS="${DIR}/emul/zasm/includes.cfs"
|
CFSPACK="${DIR}/cfspack/cfspack"
|
||||||
|
INCCFS=$(mktemp)
|
||||||
|
|
||||||
|
for p in "$@"; do
|
||||||
|
"${CFSPACK}" "${p}" "*.+(asm|h)" >> "${INCCFS}"
|
||||||
|
done
|
||||||
|
|
||||||
"${ZASMBIN}" "${INCCFS}"
|
"${ZASMBIN}" "${INCCFS}"
|
||||||
|
RES=$?
|
||||||
|
rm "${INCCFS}"
|
||||||
|
exit $RES
|
||||||
|
Loading…
Reference in New Issue
Block a user