#!/bin/sh

# Dump an IBM formatted 3.5inch HD floppy disk using the Kryoflux
# Create a directory with the stream files and a sector image

RETRIES=20

if [ -n "$1" ]; then
   if [ -n "$2" ]; then
       mkdir -p $1/stream_$2
       echo "Dumping floppy using command: dtc -f$1/stream_$2/track -i0a -f$1/$1_$2.img -i4 -t$RETRIES"
       ./dtc -f$1/stream_$2/track -i0a -f$1/$1_$2.img -i4 -t$RETRIES 2>&1 | tee $1/$2.log
   else
       mkdir -p $1/stream
       echo "Dumping floppy using command: dtc -f$1/stream/track -i0a -f$1/$1.img -i4 -t$RETRIES"
       ./dtc -f$1/stream/track -i0a -f$1/$1.img -i4 -t$RETRIES 2>&1 | tee $1/$1.log
   fi
else
   echo "Usage: dump_ibm_144MB.sh <dump name> [disk label]"
fi