#!/bin/bash

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

#cp configs/help3demo.gier default.gier


do_hsf2()
{
  drum=$1
  address=$2
  count=$3
  dir=hsf2_${drum}_${address}_${count}
  cd /home/mk/gier/20220106/
  rm -rf $dir
  mkdir $dir
  cd $dir
  cp ../configs/drum3bufga4.gier default.gier
  printf "drum_address\t%16.16X\n" $address >>default.gier
  printf "drum_count\t%s\n" `../d2hex $count` >>default.gier
echo drum: $drum $address $count
export DRUM_SPEED=$drum
cat >hsf2.demo <<EOF
SOUND 0
LOADREADER ../tapes/mk/hsf2.asc
WAITINPUT
$(../maketext.sh 'r<')
WAITINPUT
DEBUG D01
$(../maketext.sh ' ')
WAITINPUT
QUIT
EOF
timeout -v 3s ../GIER ./hsf2.demo
}

export -f do_hsf2

parallel do_hsf2 ::: `seq 50 50 350` ::: `seq 0 40` ::: `seq 0 230`

kill $xpid
