11#! /bin/bash
2- # apple2.sh - Sinclair ZX Spectrum +3 disk builder
2+ # apple2.sh - Apple II disk builder
33# Puny BuildTools, (c) 2024 Stefan Vogt
44
55# read config file
66source config.sh
77
8- echo -e " \napple2.sh 2.5 - Apple II disk builder"
8+ echo -e " \napple2.sh 2.6 - Apple II disk builder"
99echo -e " Puny BuildTools, (c) 2024 Stefan Vogt\n"
1010
1111# story check / arrangement
@@ -14,28 +14,56 @@ if ! [ -f ${STORY}.z${ZVERSION} ] ; then
1414 exit 1;
1515fi
1616
17+ z3_hack_infocom ()
18+ {
19+ echo -e " applying Infocom interpreter hack [...]"
20+ interlz3 ~ /FictionTools/Templates/Interpreters/info3k.bin ${STORY} .z3 ${STORY} _apple2.dsk
21+ echo -e " Apple II disk with Infocom interpreter successfully built.\n"
22+ }
23+
24+ default_build ()
25+ {
26+ # copy resources
27+ cp ~ /FictionTools/Templates/Interpreters/apple2_boot.dsk .
28+ cp ~ /FictionTools/Templates/Interpreters/apple2_template.dsk .
29+
30+ # add files to disk
31+ cpmcp -f apple-do apple2_template.dsk ${STORY} .z${ZVERSION} 0:story.dat
32+
33+ # apply naming scheme
34+ mv apple2_boot.dsk ${STORY} _apple2_s1.dsk
35+ mv apple2_template.dsk ${STORY} _apple2_s2.dsk
36+
37+ # show disk contents
38+ cpmls -f apple-do ${STORY} _apple2_s2.dsk
39+
40+ echo -e " \nApple II disk Side 1 and Side 2 successfully built."
41+ echo -e " Boot in a system with CPM card installed.\n"
42+ }
43+
1744# cleanup
1845if [ -f ${STORY} _apple2_s1.dsk ] ; then
1946 rm ${STORY} _apple2_s1.dsk
2047fi
2148if [ -f ${STORY} _apple2_s2.dsk ] ; then
2249 rm ${STORY} _apple2_s2.dsk
2350fi
51+ if [ -f ${STORY} _apple2.dsk ] ; then
52+ rm ${STORY} _apple2.dsk
53+ fi
2454
25- # copy resources
26- cp ~ /FictionTools/Templates/Interpreters/apple2_boot.dsk .
27- cp ~ /FictionTools/Templates/Interpreters/apple2_template.dsk .
28-
29- # add files to disk
30- cpmcp -f apple-do apple2_template.dsk ${STORY} .z${ZVERSION} 0:story.dat
31-
32- # apply naming scheme
33- mv apple2_boot.dsk ${STORY} _apple2_s1.dsk
34- mv apple2_template.dsk ${STORY} _apple2_s2.dsk
55+ # is the Infocom interpreter hack set in config?
56+ if [[ -v APPLE2_Z3_INFOCOM ]] ; then
57+ buildWithHack=true
58+ else
59+ buildWithHack=false
60+ fi
3561
36- # show disk contents
37- cpmls -f apple-do ${STORY} _apple2_s2.dsk
62+ zvalue=" $ZVERSION "
63+ if [[ $zvalue == 3 && $buildWithHack == true ]] ; then
64+ z3_hack_infocom
65+ else
66+ default_build
67+ fi
3868
39- echo -e " \nApple II disk Side 1 and Side 2 successfully built."
40- echo -e " Boot in a system with CPM card installed.\n"
4169exit 0
0 commit comments