24 lines
695 B
Bash
Executable file
24 lines
695 B
Bash
Executable file
#!/bin/bash -ex
|
|
|
|
INC=$(pwd)/include
|
|
mkdir -p ${INC}
|
|
|
|
if [[ ! -d merlin ]]; then
|
|
git clone https://github.com/dwsJason/f256.git merlin-code
|
|
fi
|
|
|
|
pushd merlin-code/merlin32/jr
|
|
for FILE in $(ls *.asm); do
|
|
HEADER=${INC}/$(basename ${FILE} .asm).h
|
|
BLOCK=_$(basename ${FILE^^} .ASM)_H_
|
|
echo "#ifndef ${BLOCK}" > ${HEADER}
|
|
echo "#define ${BLOCK}" >> ${HEADER}
|
|
echo >> ${HEADER}
|
|
sed 's/;/\/\//' ${FILE} | \
|
|
sed 's/;;//' | \
|
|
sed 's/ = \$/ 0x/' | \
|
|
sed 's/\(^[[:alpha:]].*$\)/#define \1/' >> ${HEADER}
|
|
echo >> ${HEADER}
|
|
echo "#endif // ${BLOCK}" >> ${HEADER}
|
|
done
|
|
popd
|