2019-04-17 21:03:20 -04:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
TMPFILE=$(mktemp)
|
|
|
|
SCAS=scas
|
2019-05-09 14:09:40 -04:00
|
|
|
ZASM=../../../tools/emul/zasm
|
2019-04-30 15:51:39 -04:00
|
|
|
ASMFILE=../instr.asm
|
2019-04-17 21:03:20 -04:00
|
|
|
|
2019-04-30 15:51:39 -04:00
|
|
|
cmpas() {
|
|
|
|
EXPECTED=$($SCAS -o - "$1" | xxd)
|
|
|
|
ACTUAL=$(cat $1 | $ZASM | xxd)
|
2019-04-17 21:03:20 -04:00
|
|
|
if [ "$ACTUAL" == "$EXPECTED" ]; then
|
|
|
|
echo ok
|
|
|
|
else
|
|
|
|
echo actual
|
|
|
|
echo $ACTUAL
|
|
|
|
echo expected
|
|
|
|
echo $EXPECTED
|
|
|
|
exit 1
|
|
|
|
fi
|
2019-04-30 15:51:39 -04:00
|
|
|
}
|
|
|
|
|
2019-05-14 13:53:12 -04:00
|
|
|
for fn in *.asm; do
|
|
|
|
echo "Comparing ${fn}"
|
|
|
|
cmpas $fn
|
|
|
|
done
|
|
|
|
|
2019-04-30 15:51:39 -04:00
|
|
|
./geninstrs.py $ASMFILE | \
|
|
|
|
while read line; do
|
|
|
|
echo $line | tee "${TMPFILE}"
|
|
|
|
cmpas ${TMPFILE}
|
|
|
|
done
|
|
|
|
|