mirror of https://git.cro.wtf/kip.git
26 lines
844 B
Bash
Executable File
26 lines
844 B
Bash
Executable File
#/bin/sh
|
|
AS=../b/as
|
|
echo "Testing assembler..."
|
|
for f in as/*.kmm; do
|
|
n="${f%%.*}"; txt=$(cat $f)
|
|
echo -n " $n? "
|
|
|
|
inpbuf="${txt%%\{-8<-\}*}" expbuf="${txt#*\{-8<-\}}"
|
|
inpinf="$n.inp.kmm"; expinf="$n.exp.kmm"
|
|
inpouf="$n.inp.rom"; expouf="$n.exp.rom"
|
|
inphex="$n.inp.hex"; exphex="$n.exp.hex"
|
|
inplog="$n.inp.log"; outlog="$n.out.log"
|
|
echo "$inpbuf" > $inpinf; echo "$expbuf" > $expinf
|
|
$AS $inpinf $inpouf > $inplog; $AS $expinf $expouf > $outlog
|
|
inpres=$(hexdump -C $inpouf); expres=$(hexdump -C $expouf)
|
|
echo "$inpres" > $inphex; echo "$expres" > $exphex
|
|
|
|
if [ "$inpres" == "$expres" ]
|
|
then echo "OK"
|
|
else echo "FAIL"; diff --color "$inphex" "$exphex"
|
|
fi
|
|
|
|
rm $inpinf $expinf $inpouf $expouf $inphex $exphex $inplog $outlog
|
|
done
|
|
echo "Assembler OK"
|