collapseos/tools/tests/zasm/runtests.sh
2019-05-16 21:15:00 -04:00

36 lines
580 B
Bash
Executable File

#!/bin/sh
set -e
TMPFILE=$(mktemp)
SCAS=scas
PARTS=../../../parts/z80
ZASM=../../emul/zasm
ASMFILE=../../../apps/zasm/instr.asm
cmpas() {
EXPECTED=$($SCAS -I ${PARTS} -o - "$1" | xxd)
ACTUAL=$(cat $1 | $ZASM | xxd)
if [ "$ACTUAL" == "$EXPECTED" ]; then
echo ok
else
echo actual
echo $ACTUAL
echo expected
echo $EXPECTED
exit 1
fi
}
for fn in *.asm; do
echo "Comparing ${fn}"
cmpas $fn
done
./geninstrs.py $ASMFILE | \
while read line; do
echo $line | tee "${TMPFILE}"
cmpas ${TMPFILE}
done