#
# First of all we define some convenient functions to check for BIOS
# strings.
#

#
# This copies the BIOS from the standard location (0xc0000) to a file
# called bios.
#

BIOSFILE="$ACBASEDIR/biosimg"

savebios ()
{
  if [ -r /dev/mem ] ; then
    dd if=/dev/mem bs=1024 count=32 skip=768 2>/dev/null > "$BIOSFILE"
  else
    echo "Cannot acces /dev/mem to detect BIOS."
    if [ -r $BIOSFILE ] ; then
      echo "Will use file '$BIOSFILE' instead."
    else
      echo "Please run autoconf again with sufficient permission."
    fi
  fi
}

#
# Check if a given ROM signature is found.
# We assume the BIOS is in a file called bios. This will be auto-created
# at startup, if we have the necessary permission.
#
# This takes position,size,signature as arguments. RC is 0 (o.k.) or 1.
#
checksignature ()
{ 
  TMPFILE="$ACBASEDIR/.help"
  if [ "$3" = "" ]
  then
	echo "$0: function checksignature 1:$1 2:$2 3:$3 .. need 3 arguments"
	exit 1
  fi
  echo -ne "$3" > "$TMPFILE"
  dd if="$BIOSFILE" bs=1 skip=$1 count=$2 2>/dev/null | cmp -s "$TMPFILE"
}

savebios

  #
  # S3 Cards
  #

  . $BIOSDIR/S3

  #
  # Tseng Cards
  #

  . $BIOSDIR/Tseng

  #
  # Cirrus Logic Cards
  #

  . $BIOSDIR/Cirrus

  #
  # Matrox Cards
  #

  . $BIOSDIR/Matrox


  #
  # nVidia Cards
  #

  . $BIOSDIR/nVidia


  #
  # Cards using the VGA driver
  #

  . $BIOSDIR/VGA
