mirror of
https://github.com/datajerk/c2d.git
synced 2025-01-14 23:30:34 +00:00
46 lines
557 B
Plaintext
46 lines
557 B
Plaintext
|
#!/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 loader loadercode 8
|
||
|
) > ../c2d.h.1
|
||
|
|
||
|
cd ..
|
||
|
|
||
|
cat c2d.h.[01] > c2d.h
|