#!/bin/bash

Xvfb :3 &
xpid=$!
export DISPLAY=:3

cp configs/drumtjek.gier default.gier
rm pi2binstat.dat

for((tracks=2; tracks<=30; tracks+=2))
do
sed "s/gulerod/$tracks/g" <tapes/mk/pi2bin.asc >/tmp/p.asc

cat >pi2.demo <<EOF
HIDE KB1
HIDE KB2
LOADREADER /tmp/p.asc
LOADPUNCH 00.flx
WAITINPUT
$(./maketext.sh 'r<')
WAITSTOP
SELECT 3 48
PRESS START
WAITINPUT
FINISHPUNCH
QUIT
EOF
./GIER ./pi2.demo

./flx2a <00.flx >/tmp/00_$tracks.asc
./pi2binstat.pl </tmp/00_$tracks.asc >>pi2binstat.dat
done

kill $xpid
