From f3ac3027640d8dd63c2d09347f498ee732cd2ad7 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Wed, 25 Apr 2018 20:59:49 -0700 Subject: [PATCH] Factor mount/ directory population into separate script --- desk.acc/Makefile | 12 +++--------- desk.acc/README.md | 24 ++++++++++++++---------- desk.acc/res/go.sh | 18 +++++------------- desk.acc/res/mount.sh | 31 +++++++++++++++++++++++++++++++ desk.acc/res/package.sh | 2 +- desktop/Makefile | 6 ------ 6 files changed, 54 insertions(+), 39 deletions(-) create mode 100755 desk.acc/res/mount.sh diff --git a/desk.acc/Makefile b/desk.acc/Makefile index f5ddb97..1b093cb 100644 --- a/desk.acc/Makefile +++ b/desk.acc/Makefile @@ -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 '$@' $< diff --git a/desk.acc/README.md b/desk.acc/README.md index 27f3328..a0bf0d3 100644 --- a/desk.acc/README.md +++ b/desk.acc/README.md @@ -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) diff --git a/desk.acc/res/go.sh b/desk.acc/res/go.sh index 6aec795..34231e3 100755 --- a/desk.acc/res/go.sh +++ b/desk.acc/res/go.sh @@ -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 diff --git a/desk.acc/res/mount.sh b/desk.acc/res/mount.sh new file mode 100755 index 0000000..63636af --- /dev/null +++ b/desk.acc/res/mount.sh @@ -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' diff --git a/desk.acc/res/package.sh b/desk.acc/res/package.sh index 581194b..065113f 100755 --- a/desk.acc/res/package.sh +++ b/desk.acc/res/package.sh @@ -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. diff --git a/desktop/Makefile b/desktop/Makefile index 09cc0b3..7fee5c0 100644 --- a/desktop/Makefile +++ b/desktop/Makefile @@ -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 '$@' $<