-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathcpcscr.sh
executable file
·56 lines (50 loc) · 1.74 KB
/
cpcscr.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# cpcscr.sh - Amstrad CPC screen maker
# Puny BuildTools, (c) 2024 Stefan Vogt
echo "cpcscr 1.0 - Amstrad CPC screen maker"
echo -e "Puny BuildTools, (c) 2024 Stefan Vogt\n"
while getopts ':c:h' opts
do
case $opts in
c)
if ! [ -f ${OPTARG} ] ; then
echo -e "File ${OPTARG} not found. Aborting operation.\n"
exit 1;
fi
cp ${OPTARG} SCREEN.PNG
mkdir tempcpcscr
mv SCREEN.PNG tempcpcscr
cd tempcpcscr
martine -in SCREEN.PNG -mode 0
cp *.BAS ../SCREEN.BAS
cp *.PAL ../SCREEN.PAL
cp *.SCR ../SCREEN.SCR
cd ..
rm -rf tempcpcscr
if [ -f SCREEN.SCR ] ; then
echo -e "\nCPC loading screen, palette and loader successfully created."
echo -e "You can safely ignore any errors you might see in the build log.\n"
else
echo
exit 1
fi
exit 0
;;
h)
echo -e "synopsis: $(basename $0) [-c myimage.png]\n"
echo "cpcscr.sh converts a .PNG image file to an Amstrad CPC"
echo -e "loading screen, a colour palette file and a BASIC loader.\n"
echo -e "Output will be: 'SCREEN.SCR', 'SCREEN.PAL' and 'SCREEN.BAS'.\n"
;;
:)
echo -e "Option [-${OPTARG}] requires an argument.\nType: $(basename $0) [-h] for help.\n"
exit 1
;;
*)
echo -e "Wrong argument passed.\nType: $(basename $0) [-h] for help.\n"
exit 0
;;
esac
done
if [ $OPTIND -eq 1 ]; then echo -e "Nothing to be done. No options passed. Use [-h] for help.\n"; fi
shift "$(($OPTIND -1))"