Add support for cc65 2.17.

This commit is contained in:
Jeremy Rand 2018-10-17 23:26:19 -04:00
parent 1726987a2f
commit 8339c67440
10 changed files with 381 additions and 122 deletions

View File

@ -7,6 +7,7 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
9D3A3E882178322500BE74C7 /* bastokenizer-tools-bt-0.2.0.jar in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D3A3E862178322500BE74C7 /* bastokenizer-tools-bt-0.2.0.jar */; };
9D3B394020E082580055431C /* mouseWrapper.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D3B393E20E082580055431C /* mouseWrapper.c */; }; 9D3B394020E082580055431C /* mouseWrapper.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D3B393E20E082580055431C /* mouseWrapper.c */; };
9D3FF4AF20DA05C2006A5F8A /* AppleCommander.jar in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D3FF4AE20DA05C2006A5F8A /* AppleCommander.jar */; }; 9D3FF4AF20DA05C2006A5F8A /* AppleCommander.jar in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D3FF4AE20DA05C2006A5F8A /* AppleCommander.jar */; };
9D3FF4B120DA05C2006A5F8A /* createDiskImage in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9D3FF4B020DA05C2006A5F8A /* createDiskImage */; }; 9D3FF4B120DA05C2006A5F8A /* createDiskImage in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9D3FF4B020DA05C2006A5F8A /* createDiskImage */; };
@ -45,6 +46,8 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
9D3A3E862178322500BE74C7 /* bastokenizer-tools-bt-0.2.0.jar */ = {isa = PBXFileReference; lastKnownFileType = archive.jar; name = "bastokenizer-tools-bt-0.2.0.jar"; path = "make/bastokenizer-tools-bt-0.2.0.jar"; sourceTree = "<group>"; };
9D3A3E872178322500BE74C7 /* bt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = bt; path = make/bt; sourceTree = "<group>"; };
9D3B393D20E0821B0055431C /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; }; 9D3B393D20E0821B0055431C /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
9D3B393E20E082580055431C /* mouseWrapper.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mouseWrapper.c; sourceTree = "<group>"; }; 9D3B393E20E082580055431C /* mouseWrapper.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mouseWrapper.c; sourceTree = "<group>"; };
9D3B393F20E082580055431C /* mouseWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mouseWrapper.h; sourceTree = "<group>"; }; 9D3B393F20E082580055431C /* mouseWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mouseWrapper.h; sourceTree = "<group>"; };
@ -79,6 +82,7 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
9D3FF4AF20DA05C2006A5F8A /* AppleCommander.jar in Frameworks */, 9D3FF4AF20DA05C2006A5F8A /* AppleCommander.jar in Frameworks */,
9D3A3E882178322500BE74C7 /* bastokenizer-tools-bt-0.2.0.jar in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -126,6 +130,8 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
9D3FF4AE20DA05C2006A5F8A /* AppleCommander.jar */, 9D3FF4AE20DA05C2006A5F8A /* AppleCommander.jar */,
9D3A3E862178322500BE74C7 /* bastokenizer-tools-bt-0.2.0.jar */,
9D3A3E872178322500BE74C7 /* bt */,
9D3FF4B020DA05C2006A5F8A /* createDiskImage */, 9D3FF4B020DA05C2006A5F8A /* createDiskImage */,
9D3FF4B220DA05C2006A5F8A /* DevApple.vii */, 9D3FF4B220DA05C2006A5F8A /* DevApple.vii */,
9D3FF4B420DA05C2006A5F8A /* dos33_template.dsk */, 9D3FF4B420DA05C2006A5F8A /* dos33_template.dsk */,

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string>Original</string>
</dict>
</plist>

View File

@ -18,10 +18,6 @@ include make/head.mk
# The name of your system or binary file to build goes here: # The name of your system or binary file to build goes here:
PGM=a2sudoku PGM=a2sudoku
# Set the config you are building for. See these pages for details:
# http://cc65.github.io/cc65/doc/apple2.html#s4
# http://cc65.github.io/cc65/doc/apple2enh.html#s4
#
# Uncomment the one you want below (the first one is the default): # Uncomment the one you want below (the first one is the default):
# MACHINE = apple2 # MACHINE = apple2
# MACHINE = apple2-dos33 # MACHINE = apple2-dos33
@ -34,6 +30,13 @@ MACHINE = apple2-loader
# MACHINE = apple2enh-loader # MACHINE = apple2enh-loader
# MACHINE = apple2enh-reboot # MACHINE = apple2enh-reboot
# Uncomment the appropriate project type. If your entry point is
# main() in a .c file, then your project type is cc65. If your
# entry point is in an assembly file, then you project type is
# ca65:
PROJECT_TYPE = cc65
# PROJECT_TYPE = ca65
# Uncomment and set this to your starting address in Apple II memory # Uncomment and set this to your starting address in Apple II memory
# if necessary: # if necessary:
START_ADDR = 4000 START_ADDR = 4000
@ -54,8 +57,12 @@ SRCDIRS+=
# If you have a non-standard cc65 install, you may need to change # If you have a non-standard cc65 install, you may need to change
# some of these. Uncomment the following line and change it to the # some of these. Uncomment the following line and change it to the
# correct path to CC65_HOME if the default is not correct: # correct path to CC65_HOME if the default is not correct. If you
# export CC65_HOME := /usr/local/lib/cc65 # are using cc65 v2.13.3, the default is:
# /usr/local/lib/cc65
# If you are using cc65 v2.17, the default is:
# /usr/local/share/cc65
# export CC65_HOME := /path/to/your/cc65/directory
# #
# If the path to the cc65 binaries is not correct, uncomment this # If the path to the cc65 binaries is not correct, uncomment this
# line and change it: # line and change it:
@ -73,6 +80,10 @@ SRCDIRS+=
# this variable: # this variable:
# LDFLAGS += -v # LDFLAGS += -v
# If you want to add arguments to the BASIC tokenizer commandline,
# add them to this valiable:
# BASICFLAGS += --optimize
# If you want to link the lores graphics driver with your executable, # If you want to link the lores graphics driver with your executable,
# uncomment the next line. # uncomment the next line.
# DRIVERS += loresgr # DRIVERS += loresgr
@ -89,9 +100,9 @@ SRCDIRS+=
# tgi_uninstall(); # tgi_uninstall();
# } # }
# #
# Read the /usr/local/lib/cc65/include/tgi.h file to see what the # Read the $CC65_HOME/include/tgi.h file to see what the
# driver interface provides. Also check out # driver interface provides. Also check out
# /usr/local/lib/cc65/include/apple2.h to see the colour definitions. # $CC65_HOME/include/apple2.h to see the colour definitions.
# If you want to link the hires graphics driver with your executable, # If you want to link the hires graphics driver with your executable,
# uncomment the next line. # uncomment the next line.
@ -109,9 +120,9 @@ DRIVERS += hiresgr
# tgi_uninstall(); # tgi_uninstall();
# } # }
# #
# Read the /usr/local/lib/cc65/include/tgi.h file to see what the # Read the $CC65_HOME/cc65/include/tgi.h file to see what the
# driver interface provides. Also check out # driver interface provides. Also check out
# /usr/local/lib/cc65/include/apple2.h to see the colour definitions. # $CC65_HOME/include/apple2.h to see the colour definitions.
# If you want to link the extended memory driver with your executable, # If you want to link the extended memory driver with your executable,
# uncomment the next line. # uncomment the next line.
@ -128,7 +139,7 @@ DRIVERS += hiresgr
# em_uninstall(); # em_uninstall();
# } # }
# #
# Read the /usr/local/lib/cc65/include/em.h file to see what the # Read the $CC65_HOME/include/em.h file to see what the
# driver interface provides. # driver interface provides.
# If you want to link the joystick driver with your executable, # If you want to link the joystick driver with your executable,
@ -146,7 +157,7 @@ DRIVERS += hiresgr
# joy_uninstall(); # joy_uninstall();
# } # }
# #
# Read the /usr/local/lib/cc65/include/joystick.h file to see what the # Read the $CC65_HOME/include/joystick.h file to see what the
# driver interface provides. # driver interface provides.
# If you want to link the mouse driver with your executable, # If you want to link the mouse driver with your executable,
@ -164,7 +175,7 @@ DRIVERS += mouse
# mouse_uninstall(); # mouse_uninstall();
# } # }
# #
# Read the /usr/local/lib/cc65/include/mouse.h file to see what the # Read the $CC65_HOME/include/mouse.h file to see what the
# driver interface provides. # driver interface provides.
# If you want to link the serial driver with your executable, # If you want to link the serial driver with your executable,
@ -182,7 +193,7 @@ DRIVERS += mouse
# ser_uninstall(); # ser_uninstall();
# } # }
# #
# Read the /usr/local/lib/cc65/include/serial.h file to see what the # Read the $CC65_HOME/include/serial.h file to see what the
# driver interface provides. # driver interface provides.
# If you have java installed in a non-standard location, you can set # If you have java installed in a non-standard location, you can set
@ -224,6 +235,10 @@ COPYDIRS=tocopy
# commands are called here, if any. You can generate .c, .s or .h # commands are called here, if any. You can generate .c, .s or .h
# files for example. You can generate data files. Whatever you # files for example. You can generate data files. Whatever you
# might need. # might need.
#
# All of your commands associated with a rule _must_ start with a tab
# character. Xcode makes it a bit tough to type a tab character by
# default. Press option-tab within Xcode to insert a tab character.
gen: genfiles gen: genfiles
genfiles: puzzles.txt genfiles: puzzles.txt

Binary file not shown.

Binary file not shown.

34
a2sudoku/make/bt Executable file
View File

@ -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

View File

@ -1,5 +1,10 @@
#!/bin/sh #!/bin/sh
merlinStartAddr() {
awk '$1 ~ /^[oO][rR][gG]$/{print $2}' linkscript.s | sed 's/^[0$]*//'
}
if [ $# -lt 5 ] if [ $# -lt 5 ]
then then
echo USAGE: $0 '<AppleCommander> <machine> <diskimage> <binary>' echo USAGE: $0 '<AppleCommander> <machine> <diskimage> <binary>'
@ -43,11 +48,7 @@ shift
STARTADDR=`echo $1 | sed 's/^0*//'` STARTADDR=`echo $1 | sed 's/^0*//'`
shift shift
if [ ! -f "$PROGRAM" ] SOURCEFILE=$PROGRAM
then
echo "Cannot file executable $PROGRAM"
exit 1
fi
case "$MACHINE" in case "$MACHINE" in
apple2) apple2)
@ -55,8 +56,10 @@ case "$MACHINE" in
DELETELOADER=1 DELETELOADER=1
RENAMELOADER=0 RENAMELOADER=0
DELETEBASIC=0 DELETEBASIC=0
COPYBINARY=1
HASHEADER=1 HASHEADER=1
FILETYPE="bin" FILETYPE="bin"
BASICFILETYPE="bas"
TARGETFILE=`basename $PROGRAM` TARGETFILE=`basename $PROGRAM`
MAXFILENAMELEN=15 MAXFILENAMELEN=15
;; ;;
@ -66,8 +69,10 @@ case "$MACHINE" in
DELETELOADER=1 DELETELOADER=1
RENAMELOADER=0 RENAMELOADER=0
DELETEBASIC=0 DELETEBASIC=0
COPYBINARY=1
HASHEADER=1 HASHEADER=1
FILETYPE="bin" FILETYPE="bin"
BASICFILETYPE="bas"
TARGETFILE=`basename $PROGRAM` TARGETFILE=`basename $PROGRAM`
MAXFILENAMELEN=15 MAXFILENAMELEN=15
;; ;;
@ -77,8 +82,10 @@ case "$MACHINE" in
DELETELOADER=0 DELETELOADER=0
RENAMELOADER=0 RENAMELOADER=0
DELETEBASIC=0 DELETEBASIC=0
COPYBINARY=1
HASHEADER=1 HASHEADER=1
FILETYPE="bin" FILETYPE="B"
BASICFILETYPE="A"
TARGETFILE=`basename $PROGRAM` TARGETFILE=`basename $PROGRAM`
MAXFILENAMELEN=30 MAXFILENAMELEN=30
;; ;;
@ -88,8 +95,10 @@ case "$MACHINE" in
DELETELOADER=0 DELETELOADER=0
RENAMELOADER=0 RENAMELOADER=0
DELETEBASIC=0 DELETEBASIC=0
COPYBINARY=1
HASHEADER=1 HASHEADER=1
FILETYPE="bin" FILETYPE="B"
BASICFILETYPE="A"
TARGETFILE=`basename $PROGRAM` TARGETFILE=`basename $PROGRAM`
MAXFILENAMELEN=30 MAXFILENAMELEN=30
;; ;;
@ -99,8 +108,10 @@ case "$MACHINE" in
DELETELOADER=1 DELETELOADER=1
RENAMELOADER=0 RENAMELOADER=0
DELETEBASIC=1 DELETEBASIC=1
COPYBINARY=1
HASHEADER=0 HASHEADER=0
FILETYPE="sys" FILETYPE="sys"
BASICFILETYPE="bas"
TARGETFILE=`basename $PROGRAM`.system TARGETFILE=`basename $PROGRAM`.system
MAXFILENAMELEN=15 MAXFILENAMELEN=15
;; ;;
@ -110,8 +121,10 @@ case "$MACHINE" in
DELETELOADER=1 DELETELOADER=1
RENAMELOADER=0 RENAMELOADER=0
DELETEBASIC=1 DELETEBASIC=1
COPYBINARY=1
HASHEADER=0 HASHEADER=0
FILETYPE="sys" FILETYPE="sys"
BASICFILETYPE="bas"
TARGETFILE=`basename $PROGRAM`.system TARGETFILE=`basename $PROGRAM`.system
MAXFILENAMELEN=15 MAXFILENAMELEN=15
;; ;;
@ -121,8 +134,10 @@ case "$MACHINE" in
DELETELOADER=0 DELETELOADER=0
RENAMELOADER=1 RENAMELOADER=1
DELETEBASIC=1 DELETEBASIC=1
COPYBINARY=1
HASHEADER=1 HASHEADER=1
FILETYPE="bin" FILETYPE="bin"
BASICFILETYPE="bas"
TARGETFILE=`basename $PROGRAM` TARGETFILE=`basename $PROGRAM`
MAXFILENAMELEN=15 MAXFILENAMELEN=15
;; ;;
@ -132,8 +147,10 @@ case "$MACHINE" in
DELETELOADER=0 DELETELOADER=0
RENAMELOADER=1 RENAMELOADER=1
DELETEBASIC=1 DELETEBASIC=1
COPYBINARY=1
HASHEADER=1 HASHEADER=1
FILETYPE="bin" FILETYPE="bin"
BASICFILETYPE="bas"
TARGETFILE=`basename $PROGRAM` TARGETFILE=`basename $PROGRAM`
MAXFILENAMELEN=15 MAXFILENAMELEN=15
;; ;;
@ -143,8 +160,10 @@ case "$MACHINE" in
DELETELOADER=0 DELETELOADER=0
RENAMELOADER=1 RENAMELOADER=1
DELETEBASIC=1 DELETEBASIC=1
COPYBINARY=1
HASHEADER=1 HASHEADER=1
FILETYPE="bin" FILETYPE="bin"
BASICFILETYPE="bas"
TARGETFILE=`basename $PROGRAM` TARGETFILE=`basename $PROGRAM`
MAXFILENAMELEN=15 MAXFILENAMELEN=15
;; ;;
@ -154,18 +173,89 @@ case "$MACHINE" in
DELETELOADER=0 DELETELOADER=0
RENAMELOADER=1 RENAMELOADER=1
DELETEBASIC=1 DELETEBASIC=1
COPYBINARY=1
HASHEADER=1 HASHEADER=1
FILETYPE="bin" FILETYPE="bin"
BASICFILETYPE="bas"
TARGETFILE=`basename $PROGRAM` TARGETFILE=`basename $PROGRAM`
MAXFILENAMELEN=15 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" echo "Invalid machine type $MACHINE"
exit 1 exit 1
;; ;;
esac 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 ] if [ ${#TARGETFILE} -gt $MAXFILENAMELEN ]
then then
echo "The filename $TARGETFILE exceeds the max name length of the filesystem ($MAXFILENAMELEN)" echo "The filename $TARGETFILE exceeds the max name length of the filesystem ($MAXFILENAMELEN)"
@ -203,29 +293,44 @@ then
"$JAVA" -jar "$APPLECOMMANDER" -d "$DISKIMAGE" BASIC.SYSTEM "$JAVA" -jar "$APPLECOMMANDER" -d "$DISKIMAGE" BASIC.SYSTEM
fi fi
if [ $HASHEADER -eq 1 ] if [ $COPYBINARY -eq 1 ]
then then
HDR_STARTADDR=`od -t x2 -N 2 < "$PROGRAM" | head -1 | awk '{print $2}' | sed 's/^0*//'` if [ "$CC65_SUPPORTS_APPLE_SINGLE" -eq 1 ]
if [ "$HDR_STARTADDR" = "$STARTADDR" ]
then then
dd if="$PROGRAM" bs=4 skip=1 | "$JAVA" -jar "$APPLECOMMANDER" -p "$DISKIMAGE" "$TARGETFILE" $FILETYPE 0x$STARTADDR "$JAVA" -jar "$APPLECOMMANDER" -as "$DISKIMAGE" "$TARGETFILE" < "$SOURCEFILE"
else elif [ $HASHEADER -eq 1 ]
"$JAVA" -jar "$APPLECOMMANDER" -p "$DISKIMAGE" "$TARGETFILE" $FILETYPE 0x$STARTADDR < "$PROGRAM" 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
else
"$JAVA" -jar "$APPLECOMMANDER" -p "$DISKIMAGE" "$TARGETFILE" $FILETYPE < "$PROGRAM"
fi fi
for DIR in $* for ITEM in $*
do do
if [ ! -d "$DIR" ] # 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 then
echo Unable to find directory $DIR 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 exit 1
fi fi
OLDPWD=`pwd` OLDPWD=`pwd`
cd $DIR cd $ITEM
find . -type f -print | while read FILE find . -type f -print | while read FILE
do do

View File

@ -10,15 +10,23 @@
# http://www.quinndunki.com/blondihacks # http://www.quinndunki.com/blondihacks
# #
export CC65_HOME := /usr/local/lib/cc65 CC65_BIN=/usr/local/bin
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 CL65=$(CC65_BIN)/cl65
CA65=$(CC65_BIN)/ca65 CA65=$(CC65_BIN)/ca65
CC65=$(CC65_BIN)/cc65 CC65=$(CC65_BIN)/cc65
CO65=$(CC65_BIN)/co65 CO65=$(CC65_BIN)/co65
MERLIN_DIR=/usr/local
MERLIN_BIN=$(MERLIN_DIR)/bin/Merlin32
MERLIN_LIB=$(MERLIN_DIR)/lib/Merlin
AC=make/AppleCommander.jar AC=make/AppleCommander.jar
SRCDIRS=. SRCDIRS=.

View File

@ -10,123 +10,204 @@
# http://www.quinndunki.com/blondihacks # http://www.quinndunki.com/blondihacks
# #
export PATH := $(PATH):$(CC65_BIN) 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) CWD=$(shell pwd)
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)
OBJS=$(C_OBJS) $(ASM_OBJS)
MAPFILE=$(PGM).map
DISKIMAGE=$(PGM).dsk DISKIMAGE=$(PGM).dsk
LINK_ARGS=
EXECCMD= EXECCMD=
ALLTARGET=$(DISKIMAGE) BASIC_SRCS=$(patsubst ./%, %, $(wildcard $(addsuffix /*.bas, $(SRCDIRS))))
BASIC_OBJS=$(BASIC_SRCS:.bas=.tok)
ifneq ($(START_ADDR),) ifeq ($(BUILD_TYPE),cc65)
# If the MACHINE is set to an option which does not support a variable start export PATH := $(PATH):$(CC65_BIN)
# address, then error.
ifneq ($(filter $(MACHINE), apple2-system apple2enh-system),) # By default, use the a2 drivers. If the machine is one of the enhanced
$(error You cannot change start address with this machine type) # 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 endif
else else
# If not set, then use the default for the config as per cc65 documentation C_OBJS=
ifneq ($(filter $(MACHINE), apple2 apple2-dos33 apple2enh apple2enh-dos33),) C_DEPS=
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),) 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]') EXECCMD=$(shell echo brun $(PGM) | tr '[a-z]' '[A-Z]')
endif endif
# By default, use the a2 drivers. If the machine is one of the enhanced ifeq ($(BUILD_TYPE),basic)
# targets though, use the a2e drivers. MAPFILE=
DRV_BASE_MACHINE=a2 EXECCMD=$(shell echo run $(PGM) | tr '[a-z]' '[A-Z]')
ifneq ($(filter $(MACHINE), apple2enh apple2enh-dos33 apple2enh-system apple2enh-loader apple2enh-reboot),)
DRV_BASE_MACHINE=a2e
endif endif
MACHCONFIG= -t apple2 OBJS=$(C_OBJS) $(ASM_OBJS) $(BASIC_OBJS)
ifneq ($(filter $(MACHINE), apple2enh apple2apple2enh-dos33 apple2enh-system apple2enh-loader apple2enh-reboot),) ALLTARGET=$(DISKIMAGE)
MACHCONFIG= -t apple2enh
endif
ifeq ($(filter $(MACHINE), apple2 apple2enh),)
MACHCONFIG += -C $(MACHINE).cfg
endif
.PHONY: build execute clean xcodefix loresgr hiresgr auxmem joystick mouse serial .PHONY: build execute clean cleandrivers xcodefix
build: $(ALLTARGET) build: $(ALLTARGET)
clean: genclean
rm -f "$(PGM)"
rm -f $(OBJS)
rm -f $(C_DEPS)
rm -f $(MAPFILE)
rm -f $(ASM_LSTS)
rm -f "$(DISKIMAGE)"
rm -Rf "$(DRVDIR)"
cleanMacCruft:
rm -rf pkg
$(PGM): $(OBJS)
make/errorFilter.sh $(CL65) $(MACHCONFIG) --mapfile $(MAPFILE) $(LDFLAGS) -o "$(PGM)" $(OBJS)
$(DISKIMAGE): $(PGM) $(DISKIMAGE): $(PGM)
make/createDiskImage $(AC) $(MACHINE) "$(DISKIMAGE)" "$(PGM)" "$(START_ADDR)" $(COPYDIRS) make/createDiskImage $(AC) $(MACHINE) "$(DISKIMAGE)" "$(PGM)" "$(START_ADDR)" $(BASIC_OBJS) $(COPYDIRS)
execute: $(DISKIMAGE) execute: $(DISKIMAGE)
osascript make/V2Make.scpt "$(CWD)" "$(PGM)" "$(CWD)/make/DevApple.vii" "$(EXECCMD)" osascript make/V2Make.scpt "$(CWD)" "$(PGM)" "$(CWD)/make/DevApple.vii" "$(EXECCMD)"
%.o: %.c %.tok: %.bas
make/errorFilter.sh $(CL65) $(MACHCONFIG) $(CFLAGS) --create-dep -c -o $@ $< make/bt $< $(BASICFLAGS) -o $@
sed -i .bak 's/\.s:/.o:/' $(@:.o=.u)
rm -f $(@:.o=.u).bak
%.o: %.s ifneq ($(DRIVERS),)
make/errorFilter.sh $(CL65) $(MACHCONFIG) --cpu $(CPU) $(ASMFLAGS) -l -c -o $@ $< cleandrivers:
rm -Rf "$(DRVDIR)"
$(OBJS): Makefile else
cleandrivers:
endif
clean: genclean cleandrivers
rm -f "$(PGM)" $(OBJS) $(C_DEPS) $(MAPFILE) $(ASM_LSTS) "$(DISKIMAGE)"
cleanMacCruft:
rm -rf pkg
# Some gen phase stuff... # Some gen phase stuff...
gen: xcodefix $(DRIVERS) gen: xcodefix $(DRIVERS)
xcodefix: xcodefix:
defaults write "$(CC65_PLUGIN_INFO)" $(XCODE_PLUGIN_COMPATIBILITY)s -array `defaults read "$(XCODE_INFO)" $(XCODE_PLUGIN_COMPATIBILITY)` 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 # Lores driver codegen
loresgr: $(DRVDIR)/a2_lores_drv.s $(DRVDIR)/a2_lores_drv.h loresgr: $(DRVDIR)/a2_lores_drv.s $(DRVDIR)/a2_lores_drv.h
$(DRVDIR)/a2_lores_drv.s: $(CC65_HOME)/tgi/$(DRV_BASE_MACHINE).lo.tgi $(DRVDIR)/a2_lores_drv.s: $(CC65_DRV_DIR)/tgi/$(DRV_BASE_MACHINE).lo.tgi
mkdir -p $(DRVDIR) mkdir -p $(DRVDIR)
$(CO65) --code-label _a2_lores_drv -o $@ $(CC65_HOME)/tgi/$(DRV_BASE_MACHINE).lo.tgi $(CO65) --code-label _a2_lores_drv -o $@ $(CC65_DRV_DIR)/tgi/$(DRV_BASE_MACHINE).lo.tgi
$(DRVDIR)/a2_lores_drv.h: $(DRVDIR)/a2_lores_drv.h:
mkdir -p $(DRVDIR) mkdir -p $(DRVDIR)
@ -137,9 +218,9 @@ $(DRVDIR)/a2_lores_drv.h:
# Hires driver codegen # Hires driver codegen
hiresgr: $(DRVDIR)/a2_hires_drv.s $(DRVDIR)/a2_hires_drv.h hiresgr: $(DRVDIR)/a2_hires_drv.s $(DRVDIR)/a2_hires_drv.h
$(DRVDIR)/a2_hires_drv.s: $(CC65_HOME)/tgi/$(DRV_BASE_MACHINE).hi.tgi $(DRVDIR)/a2_hires_drv.s: $(CC65_DRV_DIR)/tgi/$(DRV_BASE_MACHINE).hi.tgi
mkdir -p $(DRVDIR) mkdir -p $(DRVDIR)
$(CO65) --code-label _a2_hires_drv -o $@ $(CC65_HOME)/tgi/$(DRV_BASE_MACHINE).hi.tgi $(CO65) --code-label _a2_hires_drv -o $@ $(CC65_DRV_DIR)/tgi/$(DRV_BASE_MACHINE).hi.tgi
$(DRVDIR)/a2_hires_drv.h: $(DRVDIR)/a2_hires_drv.h:
mkdir -p $(DRVDIR) mkdir -p $(DRVDIR)
@ -150,9 +231,9 @@ $(DRVDIR)/a2_hires_drv.h:
# Auxmem driver codegen # Auxmem driver codegen
auxmem: $(DRVDIR)/a2_auxmem_drv.s $(DRVDIR)/a2_auxmem_drv.h auxmem: $(DRVDIR)/a2_auxmem_drv.s $(DRVDIR)/a2_auxmem_drv.h
$(DRVDIR)/a2_auxmem_drv.s: $(CC65_HOME)/emd/$(DRV_BASE_MACHINE).auxmem.emd $(DRVDIR)/a2_auxmem_drv.s: $(CC65_DRV_DIR)/emd/$(DRV_BASE_MACHINE).auxmem.emd
mkdir -p $(DRVDIR) mkdir -p $(DRVDIR)
$(CO65) --code-label _a2_auxmem_drv -o $@ $(CC65_HOME)/emd/$(DRV_BASE_MACHINE).auxmem.emd $(CO65) --code-label _a2_auxmem_drv -o $@ $(CC65_DRV_DIR)/emd/$(DRV_BASE_MACHINE).auxmem.emd
$(DRVDIR)/a2_auxmem_drv.h: $(DRVDIR)/a2_auxmem_drv.h:
mkdir -p $(DRVDIR) mkdir -p $(DRVDIR)
@ -163,9 +244,9 @@ $(DRVDIR)/a2_auxmem_drv.h:
# Joystick driver codegen # Joystick driver codegen
joystick: $(DRVDIR)/a2_joystick_drv.s $(DRVDIR)/a2_joystick_drv.h joystick: $(DRVDIR)/a2_joystick_drv.s $(DRVDIR)/a2_joystick_drv.h
$(DRVDIR)/a2_joystick_drv.s: $(CC65_HOME)/joy/$(DRV_BASE_MACHINE).stdjoy.joy $(DRVDIR)/a2_joystick_drv.s: $(CC65_DRV_DIR)/joy/$(DRV_BASE_MACHINE).stdjoy.joy
mkdir -p $(DRVDIR) mkdir -p $(DRVDIR)
$(CO65) --code-label _a2_joystick_drv -o $@ $(CC65_HOME)/joy/$(DRV_BASE_MACHINE).stdjoy.joy $(CO65) --code-label _a2_joystick_drv -o $@ $(CC65_DRV_DIR)/joy/$(DRV_BASE_MACHINE).stdjoy.joy
$(DRVDIR)/a2_joystick_drv.h: $(DRVDIR)/a2_joystick_drv.h:
mkdir -p $(DRVDIR) mkdir -p $(DRVDIR)
@ -176,9 +257,9 @@ $(DRVDIR)/a2_joystick_drv.h:
# Mouse driver codegen # Mouse driver codegen
mouse: $(DRVDIR)/a2_mouse_drv.s $(DRVDIR)/a2_mouse_drv.h mouse: $(DRVDIR)/a2_mouse_drv.s $(DRVDIR)/a2_mouse_drv.h
$(DRVDIR)/a2_mouse_drv.s: $(CC65_HOME)/mou/$(DRV_BASE_MACHINE).stdmou.mou $(DRVDIR)/a2_mouse_drv.s: $(CC65_DRV_DIR)/mou/$(DRV_BASE_MACHINE).stdmou.mou
mkdir -p $(DRVDIR) mkdir -p $(DRVDIR)
$(CO65) --code-label _a2_mouse_drv -o $@ $(CC65_HOME)/mou/$(DRV_BASE_MACHINE).stdmou.mou $(CO65) --code-label _a2_mouse_drv -o $@ $(CC65_DRV_DIR)/mou/$(DRV_BASE_MACHINE).stdmou.mou
$(DRVDIR)/a2_mouse_drv.h: $(DRVDIR)/a2_mouse_drv.h:
mkdir -p $(DRVDIR) mkdir -p $(DRVDIR)
@ -189,14 +270,16 @@ $(DRVDIR)/a2_mouse_drv.h:
# Serial driver codegen # Serial driver codegen
serial: $(DRVDIR)/a2_serial_drv.s $(DRVDIR)/a2_serial_drv.h serial: $(DRVDIR)/a2_serial_drv.s $(DRVDIR)/a2_serial_drv.h
$(DRVDIR)/a2_serial_drv.s: $(CC65_HOME)/ser/$(DRV_BASE_MACHINE).ssc.ser $(DRVDIR)/a2_serial_drv.s: $(CC65_DRV_DIR)/ser/$(DRV_BASE_MACHINE).ssc.ser
mkdir -p $(DRVDIR) mkdir -p $(DRVDIR)
$(CO65) --code-label _a2_serial_drv -o $@ $(CC65_HOME)/ser/$(DRV_BASE_MACHINE).ssc.ser $(CO65) --code-label _a2_serial_drv -o $@ $(CC65_DRV_DIR)/ser/$(DRV_BASE_MACHINE).ssc.ser
$(DRVDIR)/a2_serial_drv.h: $(DRVDIR)/a2_serial_drv.h:
mkdir -p $(DRVDIR) mkdir -p $(DRVDIR)
echo '#include <serial.h>' > $@ echo '#include <serial.h>' > $@
echo 'extern char a2_serial_drv;' >> $@ echo 'extern char a2_serial_drv;' >> $@
endif
-include $(C_DEPS) -include $(C_DEPS)