Skip to content

Instantly share code, notes, and snippets.

@damieng

damieng/zx-font-publish.sh

Last active Jan 18, 2021
Embed
What would you like to do?
ZX Spectrum font publishing
#!/bin/bash
for i in "$@"
do
name="${i%.*}"
zip="${name}.zip"
rm -rf "${zip}"
# Folder cleanup
mkdir -p Spectrum
mkdir -p PC
mkdir -p BBC
mkdir -p C64
mkdir -p Atari8
mv *.fzx Spectrum/ 2> /dev/null
mv *.bdf PC/ 2> /dev/null
mv *.psf PC/ 2> /dev/null
mv *.ttf PC/ 2> /dev/null
# Preview creation
echo Creating previews
pw.exe preview "$i" . >> /dev/null
optipng -o7 "${name}.png" --quiet
# Spectrum creation
tap="${name}.tap"
echo Creating Spectrum ${tap}
cp *.ch8 Spectrum/
cd Spectrum
rm -f *.tap
for f in *.ch8 ; do pw.exe z80asmhex "$f" . ; done
for f in *.ch8 ; do blk="${f%.*}" ; bin2tap 49152 "${blk:0:10}" "$f" ; done
cat /mnt/d/ZXO/_Templates/Spectrum/Preview.tap *.tap > tap.tmp
rm -f *.tap
mv tap.tmp "${tap}"
cd ..
# BBC creation
ssd="${name}.ssd"
echo Creating BBC ${ssd}
cd PC
for f in *.psf ; do psf2bbc "$f" "../BBC/${f%.*}.bbc"; done
cd ../BBC
cp /mnt/d/ZXO/_Templates/BBC/filelist.txt filelist.txt
unique-names.js . '*.bbc' B. >> filelist.txt
unix2dos filelist.txt
mkimg.exe Preview-DFS.ssd -fs DFS -t ZXOrigins -opt 3 -pad -i@filelist.txt
cd ..
# C64 creation
echo Creating C64 binaries
for f in *.ch8 ; do pw.exe zxtocbm "$f" C64 ; done
# Atari creation
echo Creating Atari8 binaries
for f in *.ch8 ; do pw.exe zxtoa8 "$f" Atari8 ; done
# Clean-up
rm -f PC/*.vfb
rm -f BBC/filelist.txt
# ZIP creation
echo Packing $zip
rm -rf "${zip}"
7z a "${zip}" Spectrum/* BBC/* PC/* Atari8/* C64/* *.png >> /dev/null
7z a "${zip}" /mnt/d/ZXO/README.md >> /dev/null
# Upload
echo Uploading...
aws s3 cp "${zip}" "s3://damieng-downloads/fonts/zx-origins/${zip}"
aws s3 cp . s3://damieng-resources/fonts/zx-origins/ --recursive --exclude "*" --include "*.png"
aws s3 cp . s3://damieng-resources/fonts/zx-origins/ch8/ --recursive --exclude "*" --include "*.ch8"
# rm -rf "${zip}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment