added missing makeheader script

This commit is contained in:
Egan Ford 2017-04-08 21:45:39 -06:00
parent 8938ce1ef5
commit eb79dc7b43
2 changed files with 46 additions and 0 deletions

View File

@ -21,6 +21,7 @@
| README.md | This File |
| c2d.c | Source File |
| c2d.h.0 | Source File |
| makeheader | c2d.h build script |
| text2page.c | Source File |
| Makefile | c2d Makefile |
| asm/loader.s | c2d loader source |

45
makeheader Executable file
View File

@ -0,0 +1,45 @@
#!/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