c2t/makeheader

79 lines
1.2 KiB
Plaintext
Raw Permalink Normal View History

2014-11-24 00:26:22 +00:00
#!/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 ..
2014-11-24 11:48:59 +00:00
cat <<EOF >c2t.h.2
//DOS 3.3
unsigned char dosboot1[] = {
EOF
cat mon/dos33.boot1.mon | \
2014-11-24 11:48:59 +00:00
perl -pi -e 's/ /,0x/g' | \
perl -pi -e 's/$/,/' | \
perl -pi -e 's/^....../\t/' >>c2t.h.2
cat <<EOF >>c2t.h.2
};
//DOS 3.3
unsigned char dosboot2[] = {
EOF
cat mon/dos33.boot2.mon | \
2014-11-24 11:48:59 +00:00
perl -pi -e 's/ /,0x/g' | \
perl -pi -e 's/$/,/' | \
perl -pi -e 's/^....../\t/' >>c2t.h.2
echo "};" >>c2t.h.2
2014-11-24 00:26:22 +00:00
cat c2t.h.[012] > c2t.h