diff --git a/Makefile b/Makefile
index ed3dff5..ca395ae 100644
--- a/Makefile
+++ b/Makefile
@@ -87,6 +87,10 @@ COPYDIRS=
# 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
diff --git a/make/system601.2mg b/make/system601.2mg
index 394d3a2..3db61b9 100644
Binary files a/make/system601.2mg and b/make/system601.2mg differ
diff --git a/pkg/Templates/Apple IIgs/ORCAC New Desk Accessory.xctemplate/main.c b/pkg/Templates/Apple IIgs/ORCAC New Desk Accessory.xctemplate/main.c
index 2ea7ea7..3234d04 100644
--- a/pkg/Templates/Apple IIgs/ORCAC New Desk Accessory.xctemplate/main.c
+++ b/pkg/Templates/Apple IIgs/ORCAC New Desk Accessory.xctemplate/main.c
@@ -29,7 +29,6 @@ static BOOLEAN ndaActive;
static GrafPortPtr winPtr;
static unsigned int userId;
static unsigned int resourceId;
-static Str255 gStrBuf;
void NDAClose(void)
@@ -73,7 +72,6 @@ void DrawContents(void)
GrafPortPtr NDAOpen(void)
{
- Pointer pathToSelf;
unsigned int oldResourceApp;
LevelRecGS levelDCB;
unsigned int oldLevel;
@@ -83,11 +81,6 @@ GrafPortPtr NDAOpen(void)
if (ndaActive)
return NULL;
- oldResourceApp = GetCurResourceApp();
- ResourceStartUp(userId);
-
- pathToSelf = LGetPathname2(userId, 1);
-
levelDCB.pCount = 2;
GetLevelGS(&levelDCB);
oldLevel = levelDCB.level;
@@ -100,7 +93,7 @@ GrafPortPtr NDAOpen(void)
prefsDCB.preferences = (prefsDCB.preferences & 0x1fff) | 0x8000;
SetSysPrefsGS(&prefsDCB);
- resourceId = OpenResourceFile(readEnable, NULL, pathToSelf);
+ oldResourceApp = OpenResourceFileByID(readEnable, userId);
winPtr = NewWindow2("\p ___PACKAGENAME___ ", 0, DrawContents, NULL, 0x02, windowRes, rWindParam1);
diff --git a/pkg/Templates/Apple IIgs/ORCAM New Desk Accessory.xctemplate/TemplateInfo.plist b/pkg/Templates/Apple IIgs/ORCAM New Desk Accessory.xctemplate/TemplateInfo.plist
new file mode 100644
index 0000000..72ae7b0
--- /dev/null
+++ b/pkg/Templates/Apple IIgs/ORCAM New Desk Accessory.xctemplate/TemplateInfo.plist
@@ -0,0 +1,210 @@
+
+
+
+
+ Nodes
+
+ main.s
+ main.rez
+ Makefile
+ make/config.txt
+ make/createDiskImage
+ make/head.mk
+ make/launchEmulator
+ make/orca-asm
+ make/orca-cc
+ make/orca-macgen
+ make/orca-rez
+ make/system601.2mg
+ make/tail.mk
+ ../___PACKAGENAME___.xcodeproj/xcshareddata/xcschemes/___PACKAGENAME___.xcscheme
+
+ Definitions
+
+ main.s
+
+ Path
+ main.s
+
+ main.rez
+
+ Path
+ main.rez
+
+ 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-macgen
+
+ Group
+ make
+ Path
+ make/orca-macgen
+
+ 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.apple2gsOrcaMNDA
+ Ancestors
+
+ com.apple.dt.unit.externalBuildSystem
+
+ Concrete
+
+ Description
+ This template creates an Apple IIgs ORCA/M code project to build a new desktop accessory. The project starts with a single assembly file which you can modify. You can also add more assembly or C 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)=""
+ 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/ORCAM New Desk Accessory.xctemplate/___PACKAGENAME___.xcscheme b/pkg/Templates/Apple IIgs/ORCAM New Desk Accessory.xctemplate/___PACKAGENAME___.xcscheme
new file mode 100644
index 0000000..61815a2
--- /dev/null
+++ b/pkg/Templates/Apple IIgs/ORCAM New Desk Accessory.xctemplate/___PACKAGENAME___.xcscheme
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pkg/Templates/Apple IIgs/ORCAM New Desk Accessory.xctemplate/main.rez b/pkg/Templates/Apple IIgs/ORCAM New Desk Accessory.xctemplate/main.rez
new file mode 100644
index 0000000..c7695d5
--- /dev/null
+++ b/pkg/Templates/Apple IIgs/ORCAM New Desk Accessory.xctemplate/main.rez
@@ -0,0 +1,43 @@
+/*
+ * ___FILENAME___
+ * ___PROJECTNAME___
+ *
+ * Created by ___FULLUSERNAME___ on ___DATE___.
+ * ___COPYRIGHT___
+ */
+
+
+#include "types.rez"
+
+
+#define windowRes 1001
+#define linedColors 1
+
+
+resource rWindParam1 (windowRes) {
+ $C0A5, /* wFrameBits */
+ nil, /* wTitle */
+ 0, /* wRefCon */
+ {0,0,0,0}, /* ZoomRect */
+ linedColors, /* wColor ID */
+ {0,0}, /* Origin */
+ {0,0}, /* data size */
+ {0,0}, /* max height-width */
+ {0,0}, /* scroll ver hors */
+ {0,0}, /* page ver horiz */
+ 0, /* winfoRefcon */
+ 0, /* wInfoHeight */
+ {50,50,62,200}, /* wposition */
+ infront, /* wPlane */
+ nil, /* wStorage */
+ $0800 /* wInVerb */
+};
+
+
+resource rWindColor (linedColors) {
+ 0x0000, /* frameColor */
+ 0x0F00, /* titleColor */
+ 0x020F, /* tbarColor */
+ 0xF0F0, /* growColor */
+ 0x00F0, /* infoColor */
+};
diff --git a/pkg/Templates/Apple IIgs/ORCAM New Desk Accessory.xctemplate/main.s b/pkg/Templates/Apple IIgs/ORCAM New Desk Accessory.xctemplate/main.s
new file mode 100644
index 0000000..2822d60
--- /dev/null
+++ b/pkg/Templates/Apple IIgs/ORCAM New Desk Accessory.xctemplate/main.s
@@ -0,0 +1,288 @@
+;
+; ___FILENAME___
+; ___PACKAGENAME___
+;
+; Created by ___FULLUSERNAME___ on ___DATE___.
+; Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved.
+;
+
+ mcopy main.macros
+ keep main
+
+windowRes gequ 1001
+
+main start
+ dc i4'NDAOpen' ; Open callback
+ dc i4'NDAClose' ; Close callback
+ dc i4'NDAAction' ; Action callback
+ dc i4'NDAInit' ; Init callback
+ dc i2'$ffff' ; Period
+ dc i2'$03ff' ; Event mask
+ dc c' ___PACKAGENAME___\\H**' ; Menu line
+ dc i1'0'
+
+ end
+
+
+NDAOpen start
+
+ phb
+ phk
+ plb
+
+ lda ndaActive
+ beq doOpen
+ plb
+ rtl
+
+doOpen anop
+
+ _getLevelGS levelDCB
+ lda level
+ sta oldLevel
+ stz level
+ _setLevelGS levelDCB
+
+ _getSysPrefsGS prefsDCB
+ lda prefs
+ sta oldPrefs
+ and #$1fff
+ ora #$8000
+ sta prefs
+ _setSysPrefsGS prefsDCB
+
+ pha
+ ~OpenResourceFileByID #1,userId
+ pl2 oldResApp
+
+ pha
+ pha
+ ~NewWindow2 #winName,#0,#DrawContents,#0,#2,#windowRes,#$800E
+ pl4 winPtr
+
+ ~SetSysWindow winPtr
+ ~ShowWindow winPtr
+ ~SelectWindow winPtr
+
+ lda #1
+ sta ndaActive
+
+ lda oldPrefs
+ sta prefs
+ _setSysPrefsGS prefsDCB
+ lda oldLevel
+ sta level
+ _setLevelGS levelDCB
+
+ ~SetCurResourceApp oldResApp
+
+ lda winPtr
+ sta 5,S
+ lda winPtr+2
+ sta 7,S
+
+ plb
+
+ rtl
+
+DrawContents entry
+ phb
+ phk
+ plb
+
+ ~PenNormal
+ ~MoveTo #7,#10
+ ~DrawString #message
+
+ plb
+
+ rtl
+
+NDAClose entry
+ phb
+ phk
+ plb
+
+ lda ndaActive
+ beq closeNotActive
+
+ ~CloseWindow winPtr
+
+ stz winPtr
+ stz winPtr+2
+ stz ndaActive
+
+closeNotActive anop
+ ~CloseResourceFile resourceId
+ ~ResourceShutdown
+
+ plb
+ rtl
+
+NDAAction entry
+
+ phb
+ phk
+ plb
+
+ cmp #1
+ bne notEvent
+ jsl HandleEvent
+ bra actionDone
+
+notEvent anop
+ cmp #2
+ bne notRun
+ jsl HandleRun
+ bra actionDone
+
+notRun anop
+ cmp #3
+ bne notCursor
+ jsl HandleCursor
+ bra actionDone
+
+notCursor anop
+ cmp #5
+ blt notEdit
+ cmp #10
+ bge notEdit
+ jsl HandleEdit
+ lda #1
+ bra actionDone
+
+notEdit anop
+actionDone anop
+ plb
+ rtl
+
+HandleEvent entry
+; The X register has the low 16 bits of the address of the event record.
+; We leave that there and use that in the memory move instruction to
+; copy that event record into our local event.
+;
+; The Y register has the high 16 bits of the address of the event record.
+; We need to get that into the upper 8 bits of the accumulator.
+ tya
+ xba
+; Now we need to or in the current bank register into the lower 8 bits
+; of the accumulator for the move instruction
+ pea $0
+ phb
+ ora 1,S
+; We have the source and destination banks in the accumulator now. Modify
+; the move instruction to have these banks and clean up the stack.
+ sta moveIns+1
+ plb
+ pla
+
+; X is already setup for the move. We need the low 16 bits of the destination
+; in the Y register and the count of bytes to copy minus one in the accumulator.
+ ldy #localEvent
+ lda #15 ; Copy 16 bytes
+moveIns mvn 0,0
+
+; Set the wmTaskData field to $1fffff
+ lda #$ffff
+ sta localEvent+20
+ lda #$001f
+ sta localEvent+22
+
+ pha
+ ~TaskMasterDA 0,#localEvent
+ pla
+
+ cmp #$6
+ bne notUpdate
+ ~BeginUpdate winPtr
+ jsl DrawContents
+ ~EndUpdate winPtr
+ bra eventDone
+
+notUpdate anop
+ cmp #$21
+ bne notControl
+ jsl HandleControl
+ bra eventDone
+
+notControl anop
+ cmp #$3
+ beq isKey
+ cmp #$5
+ beq isKey
+
+eventDone anop
+ rtl
+
+isKey anop
+ jsl HandleKey
+ bra eventDone
+
+
+HandleControl entry
+; Add code here if you need to handle controls in your NDA window
+ rtl
+
+HandleKey entry
+; Add code here if you need to handle keypresses
+ rtl
+
+HandleRun entry
+; Add code here if you need to execute something periodically from your NDA
+ rtl
+
+HandleCursor entry
+; Add code here if you need to do something to the cursor when over the NDA window
+ rtl
+
+HandleEdit entry
+; Add code here to handle undo, cut, copy, paste or clear. The A register holds
+; the action code.
+ rtl
+
+NDAInit entry
+ cmp #$00
+ beq toolShutdown
+
+ stz ndaActive
+
+ pha
+ ~MMStartUp
+ pla
+ sta userId
+
+ bra initReturn
+
+toolShutdown anop
+ lda ndaActive
+ beq initReturn
+ jsl NDAClose
+
+initReturn anop
+ rtl
+
+; Global data
+
+ndaActive dc i2'0'
+winPtr dc i4'0'
+userId dc i2'0'
+resourceId dc i2'0'
+winName dw ' ___PACKAGENAME___ '
+message dw 'Hello, world!'
+
+; Used by NDAOpen to access resources
+oldResApp dc i2'0'
+oldLevel dc i2'0'
+oldPrefs dc i2'0'
+
+levelDCB dc i2'2' ; GSOS control block to get/set level
+level dc i2'0'
+ dc i2'0'
+
+prefsDCB dc i2'1' ; GSOS control block to get/set preferences
+prefs dc i2'0'
+
+; Used by HandleEvent
+localEvent ds 46
+
+ end
diff --git a/pkg/createPackage b/pkg/createPackage
index ac7bdac..10fc60f 100755
--- a/pkg/createPackage
+++ b/pkg/createPackage
@@ -15,6 +15,7 @@ cdev:orca:ORCAC Control Panel
desktop:orca:ORCAC Desktop Application
shell:gno:ORCAC GNO Shell Command
nda:orca:ORCAC New Desk Accessory
+nda:orca:ORCAM New Desk Accessory
shell:orca:ORCAC Shell Command
shell:orca:ORCAM Shell Command
EOF