diff --git a/audiotest/audiotest/make/AppleCommander.jar b/audiotest/audiotest/make/AppleCommander.jar new file mode 100644 index 0000000..4d61bfc Binary files /dev/null and b/audiotest/audiotest/make/AppleCommander.jar differ diff --git a/audiotest/audiotest/make/DevApple.vii b/audiotest/audiotest/make/DevApple.vii new file mode 100644 index 0000000..4f487a9 Binary files /dev/null and b/audiotest/audiotest/make/DevApple.vii differ diff --git a/audiotest/audiotest/make/V2Make.scpt b/audiotest/audiotest/make/V2Make.scpt new file mode 100644 index 0000000..2a8e119 Binary files /dev/null and b/audiotest/audiotest/make/V2Make.scpt differ diff --git a/audiotest/audiotest/make/bastokenizer-tools-bt-0.2.0.jar b/audiotest/audiotest/make/bastokenizer-tools-bt-0.2.0.jar new file mode 100644 index 0000000..93aa68f Binary files /dev/null and b/audiotest/audiotest/make/bastokenizer-tools-bt-0.2.0.jar differ diff --git a/audiotest/audiotest/make/bt b/audiotest/audiotest/make/bt new file mode 100755 index 0000000..ca521ba --- /dev/null +++ b/audiotest/audiotest/make/bt @@ -0,0 +1,34 @@ +#!/bin/sh + +if [ -z "$JAVA" ] +then + for item in "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home" /Library/Java/JavaVirtualMachines/*/Contents/Home /usr + do + if [ -x "$item/bin/java" ] + then + JAVA="$item/bin/java" + break + fi + done +fi + +if [ -z "$JAVA" ] +then + echo Cannot find a path to a Java runtime. + echo Go to https://java.com/download if you do not have Java. + echo If you do have Java, you may need to uncomment the JAVA + echo line in the Makefile and set it to the path for your + echo Java runtime binary. + exit 1 +fi + +INPUTFILE=$1 +shift + +tr -d '©' < "$INPUTFILE" > /tmp/bt_filtered.$$ + +"$JAVA" -jar make/bastokenizer-tools-bt-0.2.0.jar $* /tmp/bt_filtered.$$ +RESULT=$? + +rm /tmp/bt_filtered.$$ +exit $RESULT diff --git a/audiotest/audiotest/make/createDiskImage b/audiotest/audiotest/make/createDiskImage new file mode 100755 index 0000000..55e428a --- /dev/null +++ b/audiotest/audiotest/make/createDiskImage @@ -0,0 +1,373 @@ +#!/bin/sh + +merlinStartAddr() { + awk '$1 ~ /^[oO][rR][gG]$/{print $2}' linkscript.s | sed 's/^[0$]*//' +} + + +if [ $# -lt 5 ] +then + echo USAGE: $0 ' ' + exit 1 +fi + +if [ -z "$JAVA" ] +then + for item in "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home" /Library/Java/JavaVirtualMachines/*/Contents/Home /usr + do + if [ -x "$item/bin/java" ] + then + JAVA="$item/bin/java" + break + fi + done +fi + +if [ -z "$JAVA" ] +then + echo Cannot find a path to a Java runtime. + echo Go to https://java.com/download if you do not have Java. + echo If you do have Java, you may need to uncomment the JAVA + echo line in the Makefile and set it to the path for your + echo Java runtime binary. + exit 1 +fi + +APPLECOMMANDER=$1 +shift + +MACHINE=$1 +shift + +DISKIMAGE=$1 +shift + +PROGRAM=$1 +shift + +STARTADDR=`echo $1 | sed 's/^0*//'` +shift + +SOURCEFILE=$PROGRAM + +case "$MACHINE" in + apple2) + TEMPLATE="make/prodos_template.dsk" + DELETELOADER=1 + RENAMELOADER=0 + DELETEBASIC=0 + COPYBINARY=1 + HASHEADER=1 + FILETYPE="bin" + BASICFILETYPE="bas" + TARGETFILE=`basename $PROGRAM` + MAXFILENAMELEN=15 + ;; + + apple2enh) + TEMPLATE="make/prodos_template.dsk" + DELETELOADER=1 + RENAMELOADER=0 + DELETEBASIC=0 + COPYBINARY=1 + HASHEADER=1 + FILETYPE="bin" + BASICFILETYPE="bas" + TARGETFILE=`basename $PROGRAM` + MAXFILENAMELEN=15 + ;; + + apple2-dos33) + TEMPLATE="make/dos33_template.dsk" + DELETELOADER=0 + RENAMELOADER=0 + DELETEBASIC=0 + COPYBINARY=1 + HASHEADER=1 + FILETYPE="B" + BASICFILETYPE="A" + TARGETFILE=`basename $PROGRAM` + MAXFILENAMELEN=30 + ;; + + apple2enh-dos33) + TEMPLATE="make/dos33_template.dsk" + DELETELOADER=0 + RENAMELOADER=0 + DELETEBASIC=0 + COPYBINARY=1 + HASHEADER=1 + FILETYPE="B" + BASICFILETYPE="A" + TARGETFILE=`basename $PROGRAM` + MAXFILENAMELEN=30 + ;; + + apple2-system) + TEMPLATE="make/prodos_template.dsk" + DELETELOADER=1 + RENAMELOADER=0 + DELETEBASIC=1 + COPYBINARY=1 + HASHEADER=0 + FILETYPE="sys" + BASICFILETYPE="bas" + TARGETFILE=`basename $PROGRAM`.system + MAXFILENAMELEN=15 + ;; + + apple2enh-system) + TEMPLATE="make/prodos_template.dsk" + DELETELOADER=1 + RENAMELOADER=0 + DELETEBASIC=1 + COPYBINARY=1 + HASHEADER=0 + FILETYPE="sys" + BASICFILETYPE="bas" + TARGETFILE=`basename $PROGRAM`.system + MAXFILENAMELEN=15 + ;; + + apple2-loader) + TEMPLATE="make/prodos_template.dsk" + DELETELOADER=0 + RENAMELOADER=1 + DELETEBASIC=1 + COPYBINARY=1 + HASHEADER=1 + FILETYPE="bin" + BASICFILETYPE="bas" + TARGETFILE=`basename $PROGRAM` + MAXFILENAMELEN=15 + ;; + + apple2-reboot) + TEMPLATE="make/prodos_template.dsk" + DELETELOADER=0 + RENAMELOADER=1 + DELETEBASIC=1 + COPYBINARY=1 + HASHEADER=1 + FILETYPE="bin" + BASICFILETYPE="bas" + TARGETFILE=`basename $PROGRAM` + MAXFILENAMELEN=15 + ;; + + apple2enh-loader) + TEMPLATE="make/prodos_template.dsk" + DELETELOADER=0 + RENAMELOADER=1 + DELETEBASIC=1 + COPYBINARY=1 + HASHEADER=1 + FILETYPE="bin" + BASICFILETYPE="bas" + TARGETFILE=`basename $PROGRAM` + MAXFILENAMELEN=15 + ;; + + apple2enh-reboot) + TEMPLATE="make/prodos_template.dsk" + DELETELOADER=0 + RENAMELOADER=1 + DELETEBASIC=1 + COPYBINARY=1 + HASHEADER=1 + FILETYPE="bin" + BASICFILETYPE="bas" + TARGETFILE=`basename $PROGRAM` + MAXFILENAMELEN=15 + ;; + + apple2-basic) + TEMPLATE="make/prodos_template.dsk" + DELETELOADER=1 + RENAMELOADER=0 + DELETEBASIC=0 + COPYBINARY=0 + FILETYPE="bas" + BASICFILETYPE="bas" + TARGETFILE=`basename $PROGRAM` + SOURCEFILE=${PROGRAM}.tok + MAXFILENAMELEN=15 + ;; + + apple2-dos33-basic) + TEMPLATE="make/dos33_template.dsk" + DELETELOADER=0 + RENAMELOADER=0 + DELETEBASIC=0 + COPYBINARY=0 + FILETYPE="A" + BASICFILETYPE="A" + TARGETFILE=`basename $PROGRAM` + SOURCEFILE=${PROGRAM}.tok + MAXFILENAMELEN=30 + ;; + + apple2-merlin) + TEMPLATE="make/prodos_template.dsk" + DELETELOADER=1 + RENAMELOADER=0 + DELETEBASIC=0 + COPYBINARY=1 + HASHEADER=0 + FILETYPE="bin" + BASICFILETYPE="bas" + TARGETFILE=`basename $PROGRAM` + MAXFILENAMELEN=15 + + STARTADDR=`merlinStartAddr` + ;; + + apple2-dos33-merlin) + TEMPLATE="make/dos33_template.dsk" + DELETELOADER=0 + RENAMELOADER=0 + DELETEBASIC=0 + COPYBINARY=1 + HASHEADER=0 + FILETYPE="B" + BASICFILETYPE="A" + TARGETFILE=`basename $PROGRAM` + MAXFILENAMELEN=30 + + STARTADDR=`merlinStartAddr` + ;; + + *) + echo "Invalid machine type $MACHINE" + exit 1 + ;; +esac + +STARTARG="" +if [ ! -z "$STARTADDR" ] +then + STARTARG="0x$STARTADDR" +fi + +if [ ! -f "$SOURCEFILE" ] +then + echo "Cannot file executable $SOURCEFILE" + exit 1 +fi + + +if [ ${#TARGETFILE} -gt $MAXFILENAMELEN ] +then + echo "The filename $TARGETFILE exceeds the max name length of the filesystem ($MAXFILENAMELEN)" + exit 1 +fi + +if [ ! -f "$TEMPLATE" ] +then + echo "Cannot file template disk image $TEMPLATE" + exit 1 +fi + +cp "$TEMPLATE" "$DISKIMAGE" + +if [ $DELETELOADER -eq 1 ] +then + "$JAVA" -jar "$APPLECOMMANDER" -d "$DISKIMAGE" LOADER.SYSTEM +fi + +if [ $RENAMELOADER -eq 1 ] +then + LOADERFILE=${TARGETFILE}.system + if [ ${#LOADERFILE} -gt $MAXFILENAMELEN ] + then + echo "The filename $LOADERFILE exceeds the max name length of the filesystem ($MAXFILENAMELEN)" + rm -f "$DISKIMAGE" + exit 1 + fi + "$JAVA" -jar "$APPLECOMMANDER" -g "$DISKIMAGE" LOADER.SYSTEM | "$JAVA" -jar "$APPLECOMMANDER" -p "$DISKIMAGE" "$LOADERFILE" sys + "$JAVA" -jar "$APPLECOMMANDER" -d "$DISKIMAGE" LOADER.SYSTEM +fi + +if [ $DELETEBASIC -eq 1 ] +then + "$JAVA" -jar "$APPLECOMMANDER" -d "$DISKIMAGE" BASIC.SYSTEM +fi + +if [ $COPYBINARY -eq 1 ] +then + if [ "$CC65_SUPPORTS_APPLE_SINGLE" -eq 1 ] + then + "$JAVA" -jar "$APPLECOMMANDER" -as "$DISKIMAGE" "$TARGETFILE" < "$SOURCEFILE" + elif [ $HASHEADER -eq 1 ] + then + HDR_STARTADDR=`od -t x2 -N 2 < "$SOURCEFILE" | head -1 | awk '{print $2}' | sed 's/^0*//'` + if [ "$HDR_STARTADDR" = "$STARTADDR" ] + then + dd if="$SOURCEFILE" bs=4 skip=1 | "$JAVA" -jar "$APPLECOMMANDER" -p "$DISKIMAGE" "$TARGETFILE" $FILETYPE $STARTARG + else + "$JAVA" -jar "$APPLECOMMANDER" -p "$DISKIMAGE" "$TARGETFILE" $FILETYPE $STARTARG < "$SOURCEFILE" + fi + else + "$JAVA" -jar "$APPLECOMMANDER" -p "$DISKIMAGE" "$TARGETFILE" $FILETYPE $STARTARG < "$SOURCEFILE" + fi +fi + +for ITEM in $* +do + # If this is a file matching *.tok, then this is an Applesoft BASIC file + # to copy to the disk image. + if [ -f "$ITEM" ] && echo "$ITEM" | grep '\.tok$' > /dev/null + then + DESTFILE=`echo "$ITEM" | sed 's/\.tok$//'` + "$JAVA" -jar "$APPLECOMMANDER" -p "$DISKIMAGE" "$DESTFILE" "$BASICFILETYPE" 0x801 < "$ITEM" + continue + fi + + if [ ! -d "$ITEM" ] + then + echo Unable to find directory $ITEM + exit 1 + fi + + OLDPWD=`pwd` + cd $ITEM + + find . -type f -print | while read FILE + do + TRANSFERARG=-p + FILETYPE=bin + DESTFILE=`echo $FILE | sed 's/^\.\///'` + + if echo $FILE | egrep '\.as$' > /dev/null + then + # If the file ends with .as, this means the input is AppleSingle format. + # Strip the .as from the end of the file name and set the args to do + # an AppleSingle transfer. + TRANSFERARG=-as + FILETYPE="" + DESTFILE=`echo $DESTFILE | sed 's/\.as$//'` + elif echo $FILE | egrep '\.[ABITSRab]$' > /dev/null + then + # If the file ends with a single character DOS 3.3 file type, then use + # that as the file type. + FILETYPE=`echo $DESTFILE | awk -F. '{print $NF}'` + DESTFILE=`echo $DESTFILE | sed 's/\.[ABITSRab]$//'` + elif echo $FILE | egrep '\.[a-zA-Z][a-zA-Z][a-zA-Z]$' > /dev/null + then + # If the file ends with a three letter extension, use that as + # the file type. + FILETYPE=`echo $DESTFILE | awk -F. '{print $NF}'` + DESTFILE=`echo $DESTFILE | sed 's/\.[a-zA-Z][a-zA-Z][a-zA-Z]$//'` + fi + + # If the file type is text, convert the line feeds to carriage return + if [ $FILETYPE = txt ] || [ $FILETYPE = T ] + then + tr '\n' '\r' < $FILE | "$JAVA" -jar "$OLDPWD/$APPLECOMMANDER" $TRANSFERARG "$OLDPWD/$DISKIMAGE" "$DESTFILE" $FILETYPE + else + "$JAVA" -jar "$OLDPWD/$APPLECOMMANDER" $TRANSFERARG "$OLDPWD/$DISKIMAGE" "$DESTFILE" $FILETYPE < $FILE + fi + done + + cd "$OLDPWD" +done diff --git a/audiotest/audiotest/make/dos33_template.dsk b/audiotest/audiotest/make/dos33_template.dsk new file mode 100644 index 0000000..ef257aa Binary files /dev/null and b/audiotest/audiotest/make/dos33_template.dsk differ diff --git a/audiotest/audiotest/make/errorFilter.sh b/audiotest/audiotest/make/errorFilter.sh new file mode 100755 index 0000000..30259c1 --- /dev/null +++ b/audiotest/audiotest/make/errorFilter.sh @@ -0,0 +1,59 @@ +#!/bin/sh + +PWD=`pwd` + +$* 2> /tmp/errors.$$ +RESULT=$? + +if [ $RESULT -ne 0 ] +then + exec /usr/bin/perl -x $0 $RESULT /tmp/errors.$$ "$PWD" +fi +exit 0 + +#!/usr/bin/perl + +use strict; + +my $result = $ARGV[0]; +my $filename = $ARGV[1]; +my $pwd = $ARGV[2]; + +open(FILE, "<$filename") || die "$0: Unable to open file, $!"; + +my $unresolvedRefError = undef; + +while () { + chomp; + + if (defined $unresolvedRefError) { + if (m/^ ([^(]+)\(([0-9]+)\)/) { + my $file = $1; + my $lineno = $2; + + if (! -f "$pwd/$file") { + $file =~ s/\.s$/.c/; + } + + $_ = "$pwd/$file:$lineno:0: Error: $unresolvedRefError"; + } else { + $unresolvedRefError = undef; + } + } + + if (m/^(Unresolved external .* referenced) in:/) { + $unresolvedRefError = $1; + $_ = ""; + } elsif (m/^([^(]+)\(([0-9]+)\):(.*)$/) { + my $file = $1; + my $lineno = $2; + my $error = $3; + + $_ = "$pwd/$file:$lineno:0:$error"; + } + print STDERR "$_\n"; +} + +unlink($filename); + +exit($result); diff --git a/audiotest/audiotest/make/head.mk b/audiotest/audiotest/make/head.mk new file mode 100644 index 0000000..28ebc58 --- /dev/null +++ b/audiotest/audiotest/make/head.mk @@ -0,0 +1,56 @@ +# +# head.mk +# Apple2BuildPipelineSample +# +# Part of a sample build pipeline for Apple II software development +# +# Created by Quinn Dunki on 8/15/14. +# One Girl, One Laptop Productions +# http://www.quinndunki.com +# http://www.quinndunki.com/blondihacks +# + +CC65_BIN=/usr/local/bin + +ifneq ($(wildcard /usr/local/lib/cc65),) + export CC65_HOME := /usr/local/lib/cc65 +else + export CC65_HOME := /usr/local/share/cc65 +endif + +CL65=$(CC65_BIN)/cl65 +CA65=$(CC65_BIN)/ca65 +CC65=$(CC65_BIN)/cc65 +CO65=$(CC65_BIN)/co65 + +MERLIN_DIR=/usr/local +MERLIN_BIN=$(MERLIN_DIR)/bin/Merlin32 +MERLIN_LIB=$(MERLIN_DIR)/lib/Merlin + +AC=make/AppleCommander.jar + +SRCDIRS=. + +MACHINE=apple2 +CPU=6502 +CFLAGS= +ASMFLAGS= +LDFLAGS= +DRIVERS= +DRVDIR=drivers + +XCODE_PATH=/Applications/Xcode.app +XCODE_INFO=$(XCODE_PATH)/Contents/Info.plist + +CC65_PLUGIN_PATH=$(HOME)/Library/Developer/Xcode/Plug-ins/cc65.ideplugin +CC65_PLUGIN_INFO=$(CC65_PLUGIN_PATH)/Contents/Info.plist + +XCODE_PLUGIN_COMPATIBILITY=DVTPlugInCompatibilityUUID + + +.PHONY: all gen genclean + +all: + @make gen + @make build + diff --git a/audiotest/audiotest/make/prodos_template.dsk b/audiotest/audiotest/make/prodos_template.dsk new file mode 100644 index 0000000..c7b2a75 Binary files /dev/null and b/audiotest/audiotest/make/prodos_template.dsk differ diff --git a/audiotest/audiotest/make/tail.mk b/audiotest/audiotest/make/tail.mk new file mode 100644 index 0000000..fd961e5 --- /dev/null +++ b/audiotest/audiotest/make/tail.mk @@ -0,0 +1,285 @@ +# +# tail.mk +# Apple2BuildPipelineSample +# +# Part of a sample build pipeline for Apple II software development +# +# Created by Quinn Dunki on 8/15/14. +# One Girl, One Laptop Productions +# http://www.quinndunki.com +# http://www.quinndunki.com/blondihacks +# + +BUILD_TYPE := $(shell if echo $(MACHINE) | grep -q -- -basic; then echo basic; elif echo $(MACHINE) | grep -q -- -merlin; then echo merlin; else echo cc65; fi) + +CWD=$(shell pwd) + +DISKIMAGE=$(PGM).dsk + +EXECCMD= + +BASIC_SRCS=$(patsubst ./%, %, $(wildcard $(addsuffix /*.bas, $(SRCDIRS)))) +BASIC_OBJS=$(BASIC_SRCS:.bas=.tok) + +ifeq ($(BUILD_TYPE),cc65) + export PATH := $(PATH):$(CC65_BIN) + + # By default, use the a2 drivers. If the machine is one of the enhanced + # targets though, use the a2e drivers. + DRV_BASE_MACHINE=a2 + BASE_MACHINE = apple2 + ifneq ($(filter $(MACHINE), apple2enh apple2enh-dos33 apple2enh-system apple2enh-loader apple2enh-reboot),) + DRV_BASE_MACHINE=a2e + BASE_MACHINE = apple2enh + endif + + CC65_VERSION := $(shell $(CC65) --version 2>&1 | grep '^cc65 V') + + ifeq ($(CC65_VERSION),cc65 V2.13.3) + export CC65_SUPPORTS_APPLE_SINGLE=0 + CC65_CREATE_DEP_ARG=--create-dep + CC65_LIST_ARG=-l + CC65_DRV_DIR=$(CC65_HOME) + + MACHCONFIG= -t $(BASE_MACHINE) + ifeq ($(filter $(MACHINE), apple2 apple2enh),) + MACHCONFIG += -C $(MACHINE).cfg + endif + else + export CC65_SUPPORTS_APPLE_SINGLE=1 + CC65_CREATE_DEP_ARG=--create-dep $(@:.o=.u) + CC65_LIST_ARG=-l $(@:.o=.lst) + CC65_DRV_DIR=$(CC65_HOME)/target/$(BASE_MACHINE)/drv + + MACHCONFIG= -t $(BASE_MACHINE) + ifneq ($(filter $(MACHINE), apple2-system apple2enh-system),) + MACHCONFIG += -C $(BASE_MACHINE)-system.cfg + else + ifeq ($(PROJECT_TYPE),ca65) + MACHCONFIG += -C $(BASE_MACHINE)-asm.cfg + LDFLAGS += -u __EXEHDR__ + else + MACHCONFIG += -C $(BASE_MACHINE).cfg + endif + endif + endif + + ifneq ($(DRIVERS),) + SRCDIRS+=$(DRVDIR) + endif + + C_SRCS=$(patsubst ./%, %, $(wildcard $(addsuffix /*.c, $(SRCDIRS)))) + C_OBJS=$(C_SRCS:.c=.o) + C_DEPS=$(C_SRCS:.c=.u) + + ASM_SRCS=$(patsubst ./%, %, $(wildcard $(addsuffix /*.s, $(SRCDIRS)))) + ASM_OBJS=$(ASM_SRCS:.s=.o) + ASM_LSTS=$(ASM_SRCS:.s=.lst) + + MAPFILE=$(PGM).map + + ifneq ($(START_ADDR),) + # If the MACHINE is set to an option which does not support a variable + # start address, then error. + ifneq ($(filter $(MACHINE), apple2-system apple2enh-system),) + $(error You cannot change start address with this machine type) + endif + else + # If not set, then use the default for the config as per cc65 + # documentation + ifneq ($(filter $(MACHINE), apple2 apple2-dos33 apple2enh apple2enh-dos33),) + START_ADDR=803 + endif + ifneq ($(filter $(MACHINE), apple2-system apple2enh-system),) + START_ADDR=2000 + endif + ifneq ($(filter $(MACHINE), apple2-loader apple2-reboot apple2enh-loader apple2enh-reboot),) + START_ADDR=800 + endif + endif + + LDFLAGS += --start-addr 0x$(START_ADDR) + + ifneq ($(filter $(MACHINE), apple2 apple2enh apple2-dos33 apple2enh-dos33),) + EXECCMD=$(shell echo brun $(PGM) | tr '[a-z]' '[A-Z]') + endif +else + C_OBJS= + C_DEPS= + + ASM_OBJS= + ASM_LSTS= +endif + +ifeq ($(BUILD_TYPE),merlin) + ASM_SRCS=$(patsubst ./%, %, $(wildcard $(addsuffix /*.s, $(SRCDIRS)))) + MAPFILE=_Output.txt + EXECCMD=$(shell echo brun $(PGM) | tr '[a-z]' '[A-Z]') +endif + +ifeq ($(BUILD_TYPE),basic) + MAPFILE= + EXECCMD=$(shell echo run $(PGM) | tr '[a-z]' '[A-Z]') +endif + +OBJS=$(C_OBJS) $(ASM_OBJS) $(BASIC_OBJS) + +ALLTARGET=$(DISKIMAGE) + + +.PHONY: build execute clean cleandrivers xcodefix + +build: $(ALLTARGET) + +$(DISKIMAGE): $(PGM) + make/createDiskImage $(AC) $(MACHINE) "$(DISKIMAGE)" "$(PGM)" "$(START_ADDR)" $(BASIC_OBJS) $(COPYDIRS) + +execute: $(DISKIMAGE) + osascript make/V2Make.scpt "$(CWD)" "$(PGM)" "$(CWD)/make/DevApple.vii" "$(EXECCMD)" + +%.tok: %.bas + make/bt $< $(BASICFLAGS) -o $@ + +ifneq ($(DRIVERS),) +cleandrivers: + rm -Rf "$(DRVDIR)" + +else +cleandrivers: + +endif + +clean: genclean cleandrivers + rm -f "$(PGM)" $(OBJS) $(C_DEPS) $(MAPFILE) $(ASM_LSTS) "$(DISKIMAGE)" + +cleanMacCruft: + rm -rf pkg + +# Some gen phase stuff... +gen: xcodefix $(DRIVERS) + +xcodefix: + defaults write "$(CC65_PLUGIN_INFO)" $(XCODE_PLUGIN_COMPATIBILITY)s -array `defaults read "$(XCODE_INFO)" $(XCODE_PLUGIN_COMPATIBILITY)` || true + + +ifeq ($(BUILD_TYPE),basic) +# Build rules for BASIC projects + +$(PGM): $(OBJS) + cp $(PGM).tok $(PGM) + +$(OBJS): Makefile + + +endif + + +ifeq ($(BUILD_TYPE),merlin) +# Build rules for Merlin projects + +$(PGM): $(ASM_SRCS) Makefile + $(MERLIN_BIN) -V $(MERLIN_LIB) linkscript.s + rm -f _FileInformation.txt + +endif + + +ifeq ($(BUILD_TYPE),cc65) +# Build rules for cc65 projects + +$(PGM): $(OBJS) + make/errorFilter.sh $(CL65) $(MACHCONFIG) --mapfile $(MAPFILE) $(LDFLAGS) -o "$(PGM)" $(OBJS) + +$(OBJS): Makefile + +%.o: %.c + make/errorFilter.sh $(CL65) $(MACHCONFIG) $(CFLAGS) $(CC65_CREATE_DEP_ARG) -c -o $@ $< + sed -i .bak 's/\.s:/.o:/' $(@:.o=.u) + rm -f $(@:.o=.u).bak + +%.o: %.s + make/errorFilter.sh $(CL65) $(MACHCONFIG) --cpu $(CPU) $(ASMFLAGS) $(CC65_LIST_ARG) -c -o $@ $< + + +.PHONY: loresgr hiresgr auxmem joystick mouse serial +# Lores driver codegen +loresgr: $(DRVDIR)/a2_lores_drv.s $(DRVDIR)/a2_lores_drv.h + +$(DRVDIR)/a2_lores_drv.s: $(CC65_DRV_DIR)/tgi/$(DRV_BASE_MACHINE).lo.tgi + mkdir -p $(DRVDIR) + $(CO65) --code-label _a2_lores_drv -o $@ $(CC65_DRV_DIR)/tgi/$(DRV_BASE_MACHINE).lo.tgi + +$(DRVDIR)/a2_lores_drv.h: + mkdir -p $(DRVDIR) + echo '#include ' > $@ + echo 'extern char a2_lores_drv;' >> $@ + + +# Hires driver codegen +hiresgr: $(DRVDIR)/a2_hires_drv.s $(DRVDIR)/a2_hires_drv.h + +$(DRVDIR)/a2_hires_drv.s: $(CC65_DRV_DIR)/tgi/$(DRV_BASE_MACHINE).hi.tgi + mkdir -p $(DRVDIR) + $(CO65) --code-label _a2_hires_drv -o $@ $(CC65_DRV_DIR)/tgi/$(DRV_BASE_MACHINE).hi.tgi + +$(DRVDIR)/a2_hires_drv.h: + mkdir -p $(DRVDIR) + echo '#include ' > $@ + echo 'extern char a2_hires_drv;' >> $@ + + +# Auxmem driver codegen +auxmem: $(DRVDIR)/a2_auxmem_drv.s $(DRVDIR)/a2_auxmem_drv.h + +$(DRVDIR)/a2_auxmem_drv.s: $(CC65_DRV_DIR)/emd/$(DRV_BASE_MACHINE).auxmem.emd + mkdir -p $(DRVDIR) + $(CO65) --code-label _a2_auxmem_drv -o $@ $(CC65_DRV_DIR)/emd/$(DRV_BASE_MACHINE).auxmem.emd + +$(DRVDIR)/a2_auxmem_drv.h: + mkdir -p $(DRVDIR) + echo '#include ' > $@ + echo 'extern char a2_auxmem_drv;' >> $@ + + +# Joystick driver codegen +joystick: $(DRVDIR)/a2_joystick_drv.s $(DRVDIR)/a2_joystick_drv.h + +$(DRVDIR)/a2_joystick_drv.s: $(CC65_DRV_DIR)/joy/$(DRV_BASE_MACHINE).stdjoy.joy + mkdir -p $(DRVDIR) + $(CO65) --code-label _a2_joystick_drv -o $@ $(CC65_DRV_DIR)/joy/$(DRV_BASE_MACHINE).stdjoy.joy + +$(DRVDIR)/a2_joystick_drv.h: + mkdir -p $(DRVDIR) + echo '#include ' > $@ + echo 'extern char a2_joystick_drv;' >> $@ + + +# Mouse driver codegen +mouse: $(DRVDIR)/a2_mouse_drv.s $(DRVDIR)/a2_mouse_drv.h + +$(DRVDIR)/a2_mouse_drv.s: $(CC65_DRV_DIR)/mou/$(DRV_BASE_MACHINE).stdmou.mou + mkdir -p $(DRVDIR) + $(CO65) --code-label _a2_mouse_drv -o $@ $(CC65_DRV_DIR)/mou/$(DRV_BASE_MACHINE).stdmou.mou + +$(DRVDIR)/a2_mouse_drv.h: + mkdir -p $(DRVDIR) + echo '#include ' > $@ + echo 'extern char a2_mouse_drv;' >> $@ + + +# Serial driver codegen +serial: $(DRVDIR)/a2_serial_drv.s $(DRVDIR)/a2_serial_drv.h + +$(DRVDIR)/a2_serial_drv.s: $(CC65_DRV_DIR)/ser/$(DRV_BASE_MACHINE).ssc.ser + mkdir -p $(DRVDIR) + $(CO65) --code-label _a2_serial_drv -o $@ $(CC65_DRV_DIR)/ser/$(DRV_BASE_MACHINE).ssc.ser + +$(DRVDIR)/a2_serial_drv.h: + mkdir -p $(DRVDIR) + echo '#include ' > $@ + echo 'extern char a2_serial_drv;' >> $@ + +endif + + +-include $(C_DEPS)