34 lines
989 B
Bash
Executable File
34 lines
989 B
Bash
Executable File
#!/bin/bash
|
|
|
|
SITE=https://bisqwit.iki.fi/jutut/kuvat/programming_examples/dcpu16/
|
|
FILES=(
|
|
ins_test_v1_dat.dasm16
|
|
ins_test_v2.dasm16 ins_test_v2_dat.dasm16 ins_test_v2_doc.txt
|
|
ins_test_v3_dat.dasm16 ins_test_v3_doc.txt
|
|
ins_test_v4.dasm16 ins_test_v4_dat.dasm16 ins_test_v4_doc.txt
|
|
ins_test_v5.dasm16 ins_test_v5_dat.dasm16 ins_test_v5_doc.txt
|
|
)
|
|
|
|
for f in ${FILES[*]} ; do
|
|
if [ \! -f ${f} ] ; then
|
|
echo "Downloading ${f}"
|
|
wget -4 --quiet "${SITE}${f}"
|
|
fi
|
|
done
|
|
|
|
for f in *_dat.dasm16 ; do
|
|
hd="${f}.xxd"
|
|
if [ \! -f ${hd} ] ; then
|
|
echo "Creating ${hd}"
|
|
awk 'BEGIN {printf("%08d: ", 0)} {printf("%04x ", $2)} NR%8==0 {printf("\n%08x: ", 2*NR)} END {printf("\n")}' <${f} >${hd}
|
|
fi
|
|
done
|
|
|
|
for hd in *_dat.dasm16.xxd ; do
|
|
bin=$(echo "${hd}" | sed 's/_dat.dasm16.xxd$/.bin/')
|
|
if [ \! -f ${bin} ] ; then
|
|
echo "Creating ${bin}"
|
|
xxd -r <${hd} | dd if=/dev/stdin of=${bin} bs=2 conv=swab >${bin}
|
|
fi
|
|
done
|