Skip to content

Commit

Permalink
added missing makeheader script
Browse files Browse the repository at this point in the history
  • Loading branch information
datajerk committed Apr 9, 2017
1 parent 8938ce1 commit eb79dc7
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
45 changes: 45 additions & 0 deletions makeheader
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit eb79dc7

Please sign in to comment.