diff --git a/Makefile.merlin b/Makefile.merlin
new file mode 100644
index 0000000..2bd733d
--- /dev/null
+++ b/Makefile.merlin
@@ -0,0 +1,107 @@
+#
+# Makefile
+# Apple //GS Build Engine for ORCA
+#
+
+include make/head.mk
+
+# Customize this file to control what kind of project you are working on,
+# where to find files, etc.
+
+# The name of your system or binary file to build goes here:
+PGM=___PACKAGENAME___
+
+# This tells the build engine that your assembler is Merlin. You should
+# not change this (afterall, are you going to change all of your assembly
+# to ORCA/M also?)
+ASSEMBLER=merlin
+
+# Set the target type you would like to build. The options are:
+# shell - A shell command for ORCA, GNO or other GS shell
+# desktop - A full desktop application
+# cda - A classic desk accessory
+# cdev - A control panel device
+# nba - A HyperStudio new button action
+# nda - A new desk accessory
+# xcmd - A HyperCard XCMD or XCFN
+#
+# TARGETTYPE=shell
+# TARGETTYPE=desktop
+# TARGETTYPE=cda
+# TARGETTYPE=cdev
+# TARGETTYPE=nba
+# TARGETTYPE=nda
+# TARGETTYPE=xcmd
+
+# Add any other directories where you are putting C or assembly source
+# files to this list. Note that you must manually add all source files
+# to the linkscript.s file. All this does is help the build system
+# see what files it should consider important to deciding whether to do
+# a re-build.
+# SRCDIRS+=
+
+# Add any arguments you want passed to the resource compiler to this variable:
+REZFLAGS+=
+
+# Uncomment the following line if you have installed rlint as found here:
+# https://github.com/ksherlock/rlint/releases
+# Assuming that it is in the path that ORCA searches (the Utilities directory is
+# probably a good choice), you can just leave the value unchanged. If you have
+# put the rlint somewhere weird, you can set this to the correct path
+# RLINT_PATH=rlint
+
+# If you want to copy one or more files or directories to the target disk
+# image, add the root directory to this variable. Any directories under
+# the source directory which don't exist in the target disk image will be
+# created. All files will be copied from the source to the target using
+# the same path from the source.
+#
+# For example, if you set COPYDIRS to dir and in your project you have
+# the following files:
+# dir/System/mySystemFile
+# dir/newDir/anotherFile
+# Then, during the copy phase, mySystemFile will be copied into the System
+# folder and a folder newDir will be created and anotherFile will be copied
+# into there.
+COPYDIRS=
+
+# By default, the build expects that you have GSplus in the path:
+# /Applications/GSplus.app/Contents/MacOS/gsplus
+# If you have it in a different location, specify that here.
+# GSPLUS=/Applications/GSplus.app/Contents/MacOS/gsplus
+
+# By default, the build expects that you have GSport in the path:
+# /Applications/GSport/GSport.app/Contents/MacOS/GSport
+# If you have it in a different location, specify that here.
+# GSPORT=/Applications/GSport/GSport.app/Contents/MacOS/GSport
+
+# For a desktop application, it can operate in 640x200 or 320x200
+# resolution. This setting is used to define which horizontal
+# resolution you want to use for a desktop application. Other
+# target types ignore this value.
+# DESKTOP_RES_MODE=640
+
+# For a desktop application, it can support opening and printing
+# files based on paths sent to it by the message center. This
+# option controls if that is or is not supported in the
+# application (note: only the C desktop template supports message
+# center today)
+# MESSAGE_CENTER=0
+
+# Add any rules you want to execute before any compiles or assembly
+# commands are called here, if any. You can generate .c, .s or .h
+# files for example. You can generate data files. Whatever you
+# 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:
+
+# For any files you generated in the gen target above, you should
+# add rules in genclean to remove those generated files when you
+# clean your build.
+genclean:
+
+# Do not change anything else below here...
+include make/tail.mk
diff --git a/make/head.mk b/make/head.mk
index 71b7ec2..628bb1a 100644
--- a/make/head.mk
+++ b/make/head.mk
@@ -10,6 +10,12 @@ export ORCA=$(ORCA_BINDIR)/orca
TARGETTYPE=shell
+ASSEMBLER=orcam
+
+MERLIN_DIR=/usr/local
+MERLIN_BIN=$(MERLIN_DIR)/bin/Merlin32
+MERLIN_LIB=$(MERLIN_DIR)/lib/Merlin
+
SRCDIRS=.
# Check for Xcode build variables for the locations of build outputs and fall back
@@ -58,6 +64,7 @@ CHTYP=$(ORCA) chtyp
RM=rm -f
CP=cp
+MV=mv
MKDIR=mkdir -p
DESKTOP_RES_MODE=640
diff --git a/make/tail.mk b/make/tail.mk
index eef4610..ff999d5 100644
--- a/make/tail.mk
+++ b/make/tail.mk
@@ -19,9 +19,9 @@ ifeq ($(TARGETTYPE),shell)
else ifeq ($(TARGETTYPE),desktop)
FILETYPE=s16
ifeq ($(MESSAGE_CENTER),1)
- AUXTYPE=-a 0x0000db07
+ AUXTYPE=-a 0x0000db07
else
- AUXTYPE=-a 0x0000db03
+ AUXTYPE=-a 0x0000db03
endif
CFLAGS+=-dMESSAGE_CENTER=$(MESSAGE_CENTER)
REZFLAGS+=rez='-d DESKTOP_RES_MODE=$(DESKTOP_RES_MODE)'
@@ -45,20 +45,24 @@ else ifeq ($(TARGETTYPE),xcmd)
BUILDTARGET=$(TARGETDIR)/$(PGM)
endif
-ifeq ($(wildcard $(ROOTCFILE)),)
- ROOTCFILE=
-endif
-
-C_ROOTS=$(patsubst %.c, $(OBJDIR)/%.root, $(ROOTCFILE))
-C_SRCS+=$(filter-out $(ROOTCFILE), $(patsubst ./%, %, $(wildcard $(addsuffix /*.c, $(SRCDIRS)))))
-C_OBJS=$(patsubst %.c, $(OBJDIR)/%.a, $(C_SRCS))
-C_DEPS=$(patsubst %.c, $(OBJDIR)/%.d, $(ROOTCFILE)) $(patsubst %.c, $(OBJDIR)/%.d, $(C_SRCS))
ASM_SRCS=$(patsubst ./%, %, $(wildcard $(addsuffix /*.s, $(SRCDIRS))))
-ASM_MACROS=$(patsubst %.s, $(OBJDIR)/%.macros, $(ASM_SRCS))
-ASM_DEPS=$(patsubst %.s, $(OBJDIR)/%.macros.d, $(ASM_SRCS))
-ASM_ROOTS=$(patsubst %.s, $(OBJDIR)/%.ROOT, $(ASM_SRCS))
-ASM_OBJS=$(patsubst %.s, $(OBJDIR)/%.a, $(ASM_SRCS))
+
+ifeq ($(ASSEMBLER),orcam)
+ ASM_MACROS=$(patsubst %.s, $(OBJDIR)/%.macros, $(ASM_SRCS))
+ ASM_DEPS=$(patsubst %.s, $(OBJDIR)/%.macros.d, $(ASM_SRCS))
+ ASM_ROOTS=$(patsubst %.s, $(OBJDIR)/%.ROOT, $(ASM_SRCS))
+ ASM_OBJS=$(patsubst %.s, $(OBJDIR)/%.a, $(ASM_SRCS))
+
+ ifeq ($(wildcard $(ROOTCFILE)),)
+ ROOTCFILE=
+ endif
+
+ C_ROOTS=$(patsubst %.c, $(OBJDIR)/%.root, $(ROOTCFILE))
+ C_SRCS+=$(filter-out $(ROOTCFILE), $(patsubst ./%, %, $(wildcard $(addsuffix /*.c, $(SRCDIRS)))))
+ C_OBJS=$(patsubst %.c, $(OBJDIR)/%.a, $(C_SRCS))
+ C_DEPS=$(patsubst %.c, $(OBJDIR)/%.d, $(ROOTCFILE)) $(patsubst %.c, $(OBJDIR)/%.d, $(C_SRCS))
+endif
REZ_SRCS=$(patsubst ./%, %, $(wildcard $(addsuffix /*.rez, $(SRCDIRS))))
REZ_DEPS=$(patsubst %.rez, $(OBJDIR)/%.rez.d, $(REZ_SRCS))
@@ -107,10 +111,11 @@ cleanMacCruft:
ifeq ($(BINTARGET),)
+ ifeq ($(ASSEMBLER),orcam)
-# This is a standard build where we generate the resources if any and then link
-# the binary over that same file creating the resource fork first and the data
-# fork second.
+# This is a standard ORCA build where we generate the resources if any and
+# then link the binary over that same file creating the resource fork first
+# and the data fork second.
$(TARGETDIR)/$(PGM): $(BUILD_OBJS)
ifneq ($(REZ_OBJS),)
$(RM) $(TARGETDIR)/$(PGM)
@@ -119,15 +124,46 @@ endif
$(LINK) $(LDFLAGS) $(BUILD_OBJS_NOSUFFIX) --keep=$(TARGETDIR)/$(PGM)
$(CHTYP) -t $(FILETYPE) $(AUXTYPE) $(TARGETDIR)/$(PGM)
+ endif
+
+ ifeq ($(ASSEMBLER),merlin)
+# This is a standard Merlin build where we generate the resources if any and
+# then link the binary over that same file creating the resource fork first
+# and the data fork second.
+
+$(TARGETDIR)/$(PGM): $(BUILD_OBJS) $(ASM_SRCS)
+ $(RM) $(TARGETDIR)/$(PGM)
+ $(MERLIN_BIN) -V $(MERLIN_LIB) linkscript.s
+ $(MV) $(PGM) $(TARGETDIR)/$(PGM)
+ifneq ($(REZ_OBJS),)
+ $(CP) $(REZ_OBJS)/rsrc $(TARGETDIR)/$(PGM)/rsrc
+endif
+ $(CHTYP) -t $(FILETYPE) $(AUXTYPE) $(TARGETDIR)/$(PGM)
+
+ endif
+
else
-# This is a special build for CDevs (maybe others also?) where we build the binary
-# into a $(PGM).bin file and then build the resources into the $(PGM) target. The
-# resource compile will read the $(PGM).bin binary and load it into the resources
-# also.
+ ifeq ($(ASSEMBLER),orcam)
+# This is a special build for CDevs under ORCA where we build the binary into
+# a $(PGM).bin file and then build the resources into the $(PGM) target. The
+# resource compile will read the $(PGM).bin binary and load it into the
+# resources also.
$(BINTARGET): $(BUILD_OBJS)
$(LINK) $(LDFLAGS) $(BUILD_OBJS_NOSUFFIX) --keep=$(BINTARGET)
+ endif
+
+ ifeq ($(ASSEMBLER),merlin)
+# This is a special build for CDevs under Merlin where we build the binary into
+# a $(PGM).bin file and then build the resources into the $(PGM) target. The
+# resource compile will read the $(PGM).bin binary and load it into the
+# resources # also.
+$(BINTARGET): $(BUILD_OBJS) $(ASM_SRCS)
+ $(MERLIN_BIN) -V $(MERLIN_LIB) linkscript.s
+
+ endif
+
$(REZ_OBJS): $(BINTARGET)
$(TARGETDIR)/$(PGM): $(REZ_OBJS)
diff --git a/pkg/Templates/Apple IIgs/Merlin Classic Desk Accessory.xctemplate/TemplateInfo.plist b/pkg/Templates/Apple IIgs/Merlin Classic Desk Accessory.xctemplate/TemplateInfo.plist
new file mode 100644
index 0000000..f052a1f
--- /dev/null
+++ b/pkg/Templates/Apple IIgs/Merlin Classic Desk Accessory.xctemplate/TemplateInfo.plist
@@ -0,0 +1,203 @@
+
+
+
+
+ Nodes
+
+ main.s
+ linkscript.s
+ Makefile
+ make/config.txt
+ make/createDiskImage
+ make/head.mk
+ make/launchEmulator
+ make/orca-asm
+ make/orca-cc
+ make/orca-rez
+ make/system601.2mg
+ make/tail.mk
+ ../___PACKAGENAME___.xcodeproj/xcshareddata/xcschemes/___PACKAGENAME___.xcscheme
+
+ Definitions
+
+ main.s
+
+ Path
+ main.s
+
+ linkscript.s
+
+ Path
+ linkscript.s
+
+ make/config.txt
+
+ Group
+ make
+ Path
+ make/config.txt
+
+ make/createDiskImage
+
+ Group
+ make
+ Path
+ make/createDiskImage
+
+ make/head.mk
+
+ Group
+ make
+ Path
+ make/head.mk
+
+ make/launchEmulator
+
+ Group
+ make
+ Path
+ make/launchEmulator
+
+ make/orca-asm
+
+ Group
+ make
+ Path
+ make/orca-asm
+
+ make/orca-cc
+
+ Group
+ make
+ Path
+ make/orca-cc
+
+ make/orca-rez
+
+ Group
+ make
+ Path
+ make/orca-rez
+
+ make/system601.2mg
+
+ Group
+ make
+ Path
+ make/system601.2mg
+
+ make/tail.mk
+
+ Group
+ make
+ Path
+ make/tail.mk
+
+ Makefile
+
+ Path
+ Makefile
+
+ ../___PACKAGENAME___.xcodeproj/xcshareddata/xcschemes/___PACKAGENAME___.xcscheme
+
+ Group
+
+ Supporting Files
+
+ Path
+ ___PACKAGENAME___.xcscheme
+
+
+ Kind
+ Xcode.Xcode3.ProjectTemplateUnitKind
+ Identifier
+ com.halcyontouch.apple2gsMerlinCDA
+ Ancestors
+
+ com.apple.dt.unit.externalBuildSystem
+
+ Concrete
+
+ Description
+ This template creates an Apple IIgs Merlin code project to build a classic desk accessory. The project starts with a single assembly file which you can modify. You can also add more assembly files as you may like.
+ Options
+
+ Targets
+
+
+ TargetType
+ Legacy
+ TargetIdentifier
+ com.apple.dt.cocoaLegacyTarget
+ BuildToolPath
+ ___VARIABLE_buildToolPath___
+ BuildToolArgsString
+ -C ___PACKAGENAME___ $(ACTION)
+ SharedSettings
+
+ OTHER_CFLAGS
+
+ OTHER_LDFLAGS
+
+
+ Configurations
+
+ Debug
+
+ DEBUGGING_SYMBOLS
+ YES
+ GCC_GENERATE_DEBUGGING_SYMBOLS
+ YES
+ GCC_OPTIMIZATION_LEVEL
+ 0
+
+ Release
+
+
+
+
+ ProductType
+ com.apple.product-type.tool
+ TargetIdentifier
+ com.apple.dt.commandLineToolTarget
+ Name
+ doNotBuild
+ SharedSettings
+
+ PRODUCT_NAME
+ doNotBuild
+ GCC_PREPROCESSOR_DEFINITIONS
+ inline(X,Y)=""
+ extended=double
+ pascal=""
+ HEADER_SEARCH_PATHS
+ $GOLDEN_GATE/Libraries/ORCACDefs
+ ~/Library/GoldenGate/Libraries/ORCACDefs
+ /Library/GoldenGate/Libraries/ORCACDefs
+ ~/GoldenGate/Libraries/ORCACDefs
+
+ BuildPhases
+
+
+ Class
+ Sources
+
+
+ Class
+ Frameworks
+
+
+ Class
+ CopyFiles
+ DstPath
+ /usr/share/man/man1/
+ DstSubfolderSpec
+ 0
+ RunOnlyForDeploymentPostprocessing
+ YES
+
+
+
+
+
+
diff --git a/pkg/Templates/Apple IIgs/Merlin Classic Desk Accessory.xctemplate/___PACKAGENAME___.xcscheme b/pkg/Templates/Apple IIgs/Merlin Classic Desk Accessory.xctemplate/___PACKAGENAME___.xcscheme
new file mode 100644
index 0000000..ef0c34f
--- /dev/null
+++ b/pkg/Templates/Apple IIgs/Merlin Classic Desk Accessory.xctemplate/___PACKAGENAME___.xcscheme
@@ -0,0 +1,110 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pkg/Templates/Apple IIgs/Merlin Classic Desk Accessory.xctemplate/linkscript.s b/pkg/Templates/Apple IIgs/Merlin Classic Desk Accessory.xctemplate/linkscript.s
new file mode 100644
index 0000000..55ac440
--- /dev/null
+++ b/pkg/Templates/Apple IIgs/Merlin Classic Desk Accessory.xctemplate/linkscript.s
@@ -0,0 +1,18 @@
+*
+* ___FILENAME___
+* ___PROJECTNAME___
+*
+* Created by ___FULLUSERNAME___ on ___DATE___.
+* ___COPYRIGHT___
+*
+
+ dsk ___PROJECTNAME___
+ typ $B9
+ xpl
+
+ asm main.s
+ ds 0
+ knd #$1100
+ ali None
+ LNA ___PROJECTNAME___.S16
+ sna main
diff --git a/pkg/Templates/Apple IIgs/Merlin Classic Desk Accessory.xctemplate/main.s b/pkg/Templates/Apple IIgs/Merlin Classic Desk Accessory.xctemplate/main.s
new file mode 100644
index 0000000..f95a674
--- /dev/null
+++ b/pkg/Templates/Apple IIgs/Merlin Classic Desk Accessory.xctemplate/main.s
@@ -0,0 +1,93 @@
+*
+* ___FILENAME___
+* ___PROJECTNAME___
+*
+* Created by ___FULLUSERNAME___ on ___DATE___.
+* ___COPYRIGHT___
+*
+
+]XCODESTART ; Keep this at the start and put your code after this
+
+ mx %00
+
+ use 4/Util.Macs
+ use 4/Text.Macs
+
+ str '___PROJECTNAME___'
+ adrl startCda
+ adrl shutdownCda
+
+startCda
+ phb
+ phk
+ plb
+
+ pha
+ pha
+ pha
+ _GetInputDevice
+
+ pha
+ pha
+ _GetInGlobals
+
+ pha
+ pha
+ pha
+ _GetOutputDevice
+
+ pha
+ pha
+ _GetOutGlobals
+
+ PushLong #0
+ PushWord #3
+ _SetInputDevice
+
+ PushWord #$7f
+ PushWord #0
+ _SetInGlobals
+
+ PushLong #0
+ PushWord #3
+ _SetOutputDevice
+
+ PushWord #$ff
+ PushWord #$80
+ _SetOutGlobals
+
+ PushWord #0
+ _InitTextDev
+
+ PushWord #1
+ _InitTextDev
+
+ PushWord #$0c
+ _WriteChar
+
+ PushLong #message
+ _WriteCString
+
+ pha
+ PushWord #0
+ _ReadChar
+ pla
+
+ _SetOutGlobals
+ _SetOutputDevice
+ _SetInGlobals
+ _SetInputDevice
+ ~InitTextDev #0
+ ~InitTextDev #1
+
+ plb
+ rtl
+
+shutdownCda
+ rtl
+
+
+message
+ asc 'Hello, world!',0d,0d,' Press ENTER to quit...',00
+
+]XCODEEND ; Keep this at the end and put your code above this
diff --git a/pkg/createPackage b/pkg/createPackage
index d2760e8..f4e70cc 100755
--- a/pkg/createPackage
+++ b/pkg/createPackage
@@ -11,6 +11,7 @@ PROJECTS=/tmp/projects.$$
cat > $PROJECTS << EOF
cda:orca:ORCAC Classic Desk Accessory:0:0
cda:orca:ORCAM Classic Desk Accessory:0:0
+cda:merlin:Merlin Classic Desk Accessory:0:0
cdev:orca:ORCAC Control Panel:0:0
cdev:orca:ORCAM Control Panel:0:0
desktop:orca:ORCAC Desktop Application:1:1
@@ -30,9 +31,15 @@ do
SUPPORTS_RES_MODE=`echo $PROJECT | awk -F: '{print $4}'`
SUPPORTS_MESSAGE_CENTER=`echo $PROJECT | awk -F: '{print $5}'`
- sed "
- /^# TARGETTYPE=${PROJECT_TYPE}/s/^# //
- /^# export ORCA=.*\/${SHELL_TYPE}$/s/^# //" Makefile > "${TMPDIR}/Templates/Apple IIgs/${PROJECT_NAME}.xctemplate/Makefile"
+ if [ $SHELL_TYPE = merlin ]
+ then
+ sed "
+ /^# TARGETTYPE=${PROJECT_TYPE}/s/^# //" Makefile.merlin > "${TMPDIR}/Templates/Apple IIgs/${PROJECT_NAME}.xctemplate/Makefile"
+ else
+ sed "
+ /^# TARGETTYPE=${PROJECT_TYPE}/s/^# //
+ /^# export ORCA=.*\/${SHELL_TYPE}$/s/^# //" Makefile > "${TMPDIR}/Templates/Apple IIgs/${PROJECT_NAME}.xctemplate/Makefile"
+ fi
if [ "$SUPPORTS_RES_MODE" -eq 1 ]
then