Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 79 lines (62 sloc) 1.19 KB
#!/bin/bash
header()
{
FILE=$1
VAR=$2
EOL=$3
BYTES=$(hexdump -v $FILE | sed 's/^.......//' | wc -w | awk '{print $1}');
echo "/*"
expand ${FILE}.s
echo "*/"
printf "unsigned char $VAR[] = {\n\t"
for i in $(hexdump -v $FILE | sed 's/^.......//');
do
printf "0x%02X" 0x$i
BYTES=$((BYTES - 1))
if ((BYTES != 0))
then
printf ","
fi
EOL=$((EOL - 1))
if ((EOL == 0))
then
EOL=8
printf "\n\t"
fi
done
printf "\n};\n"
}
cd asm
make clean
make
(
header autoload autoloadcode 4
header inflate inflatecode 8
header fastload9600 fastload9600 4
header fastload8000 fastload8000 4
header fastloadcd fastloadcd 4
header diskload9600 diskload9600 4
header diskload8000 diskload8000 4
header diskload2 diskloadcode2 8
header diskload3 diskloadcode3 8
) > ../c2t.h.1
cd ..
cat <<EOF >c2t.h.2
//DOS 3.3
unsigned char dosboot1[] = {
EOF
cat mon/dos33.boot1.mon | \
perl -p -e 's/ /,0x/g' | \
perl -p -e 's/$/,/' | \
perl -p -e 's/^....../\t/' >>c2t.h.2
cat <<EOF >>c2t.h.2
};
//DOS 3.3
unsigned char dosboot2[] = {
EOF
cat mon/dos33.boot2.mon | \
perl -p -e 's/ /,0x/g' | \
perl -p -e 's/$/,/' | \
perl -p -e 's/^....../\t/' >>c2t.h.2
echo "};" >>c2t.h.2
cat c2t.h.[012] > c2t.h