Factor mount/ directory population into separate script

This commit is contained in:
Joshua Bell 2018-04-25 20:59:49 -07:00
parent dd38940fe0
commit f3ac302764
6 changed files with 54 additions and 39 deletions

View File

@ -10,7 +10,7 @@ HEADERS = $(wildcard ../*.inc) $(wildcard ../inc/*.inc) $(wildcard *.inc)
DAS = calculator show.text.file date puzzle sort.directory \
show.image.file this.apple eyes
TARGETS = $(patsubst %,$(OUTDIR)/%.$$F1,$(DAS))
TARGETS = $(patsubst %,$(OUTDIR)/%.built,$(DAS))
.PHONY: clean all
all: $(OUTDIR) $(TARGETS)
@ -22,21 +22,15 @@ clean:
rm -f $(OUTDIR)/*.o
rm -f $(OUTDIR)/*.list
rm -f $(OUTDIR)/*.built
rm -f $(OUTDIR)/*.\$$F1
rm -f $(OUTDIR)/*.sys
$(OUTDIR)/%.o: %.s $(HEADERS)
$(CC65)/ca65 $(CAFLAGS) --listing $(basename $@).list -o $@ $<
# Built DeskTop segments
$(OUTDIR)/%.built: $(OUTDIR)/%.o asm.cfg
# Desk Accessory Files
$(OUTDIR)/%.built: $(OUTDIR)/%.o
$(CC65)/ld65 $(CCFLAGS) -o '$@' $<
# Desk Accessories .$F1
$(OUTDIR)/%.$$F1: $(OUTDIR)/%.o
$(CC65)/ld65 $(CCFLAGS) -o '$@' $<
xattr -wx prodos.AuxType '40 06' '$@'
# System Files .SYS
$(OUTDIR)/%.SYS: $(OUTDIR)/%.o
$(CC65)/ld65 $(CCFLAGS) -o '$@' $<

View File

@ -28,9 +28,9 @@ New desk accessories:
On Unix-like systems (including Mac OS X) `make all` should build
build the desk accessory files (original and new) into `out/`
output with a `.$F1` suffix, representing the $F1 file type required.
output with a `.built` suffix.
For the original DAs, the `.$F1` and `.bin` files can be compared
For the original DAs, the `.built` and `.bin` files can be compared
using `diff` to ensure that no changes have been introduced by the
disassembly process.
@ -67,21 +67,25 @@ below.
If you use [Virtual \]\[](http://www.virtualii.com/) as your emulator,
you can skip creating a disk image.
With `desk.acc` as your current directory, create a `mount` folder,
run the `res/go.sh` script, and the built files will automatically be
copied in. Then run Virtual ]\[ and use the **Media** > **Mount Folder
as ProDOS Disk...** menu item. A new ProDOS volume called `/MOUNT` will
be available.
With `desk.acc` as your current directory, run the `res/mount.sh`
script. This will create a `desk.acc/mount` folder and the built files
will automatically be copied in. Then run Virtual ]\[ and use the
**Media** > **Mount Folder as ProDOS Disk...** menu item, then select
the `desk.acc/mount` folder. A new ProDOS volume called `/MOUNT` will
be available. (Tip: use the **Special** > **Check Drives** command in
A2D to make it appear.)
(The `res/go.sh` script will helpfully run `res/mount.sh`
automatically if the `mount` folder already exists.)
### Other
If you need to copy the files some other way (e.g. via
[CiderPress](http://a2ciderpress.com/)), you need to do the following:
Transfer the `.$F1` files in the `out` directory, ensuring you:
Transfer the `.built` files in the `out` directory, ensuring you:
* Drop the suffix
* Replace `.` in the name with spaces
* Drop the `.built` suffix
* Ensure they have ProDOS file type `$F1`
* Ensure they have start address `$800`
* Ensure they have auxtype `$0640` (to match the originals)

View File

@ -1,5 +1,7 @@
#!/bin/bash
# Run this from the desk.acc directory
set -e
function cecho {
@ -19,7 +21,7 @@ function do_make {
}
function verify {
diff "orig/$1.bin" "out/$1.\$F1" \
diff "orig/$1.bin" "out/$1.built" \
&& (cecho green "diff $1 good" ) \
|| (tput blink ; cecho red "DIFF $1 BAD" ; return 1)
}
@ -28,13 +30,6 @@ function stats {
echo "$(printf '%-20s' $1)""$(../res/stats.pl < $1)"
}
function mount {
uppercase=$(echo "$1" | tr /a-z/ /A-Z/)
cp "out/$1" "mount/$uppercase" \
&& (cecho green "mounted $uppercase" ) \
|| (cecho red "failed to mount $uppercase" ; return 1)
}
#do_make clean
do_make all
@ -54,10 +49,7 @@ stats "date.s"
stats "puzzle.s"
stats "sort.directory.s"
# Mountable directory
# Mountable directory for Virtual ][
if [ -d mount ]; then
echo "Copying files to mount/"
mount 'show.image.file.$F1'
mount 'this.apple.$F1'
mount 'eyes.$F1'
res/mount.sh
fi

31
desk.acc/res/mount.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
# Run this from the desk.acc directory
set -e
function cecho {
case $1 in
red) tput setaf 1 ;;
green) tput setaf 2 ;;
yellow) tput setaf 3 ;;
esac
echo -e "$2"
tput sgr0
}
function mount {
uppercase=$(echo "$1" | tr /a-z/ /A-Z/)
src="out/$1.built"
dst="mount/$uppercase.\$F1"
cp "$src" "$dst" \
&& xattr -wx prodos.AuxType '40 06' "$dst" \
&& (cecho green "mounted $dst" ) \
|| (cecho red "failed to mount $dst" ; return 1)
}
mkdir -p mount
echo "Copying files to mount/"
mount 'show.image.file'
mount 'this.apple'
mount 'eyes'

View File

@ -24,7 +24,7 @@ echo "" > "$FINFO"
for file in $DAS; do
ucfile=$(echo $file | tr a-z A-Z)
echo "$ucfile=Type(F1),AuxType(0640),VersionCreate(00),MinVersion(B9),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)" >> "$FINFO"
cp "out/$file.\$F1" "out/package/$ucfile"
cp "out/$file.built" "out/package/$ucfile"
done
# Create a new disk image.

View File

@ -22,7 +22,6 @@ clean:
rm -f $(OUTDIR)/*.o
rm -f $(OUTDIR)/*.list
rm -f $(OUTDIR)/*.built
rm -f $(OUTDIR)/*.\$$F1
rm -f $(OUTDIR)/*.sys
$(OUTDIR)/ovl34567.o: ovl34567.s $(HEADERS) ovl3.s ovl4.s ovl5.s ovl6.s ovl7.s
@ -35,11 +34,6 @@ $(OUTDIR)/%.o: %.s $(HEADERS)
$(OUTDIR)/%.built: $(OUTDIR)/%.o asm.cfg
$(CC65)/ld65 $(CCFLAGS) -o '$@' $<
# Desk Accessories .$F1
$(OUTDIR)/%.$$F1: $(OUTDIR)/%.o
$(CC65)/ld65 $(CCFLAGS) -o '$@' $<
xattr -w prodos.AuxType '@' '$@'
# System Files .SYS
$(OUTDIR)/%.SYS: $(OUTDIR)/%.o
$(CC65)/ld65 $(CCFLAGS) -o '$@' $<