From 61d28aadacef4ced9f2c50b4cbbf8da2d421d958 Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Wed, 17 Jul 2019 23:11:44 -0500 Subject: [PATCH] Add a NDA and desktop target for the Merlin assembler --- make/tail.mk | 2 +- .../TemplateInfo.plist | 227 ++++++++++++ .../___PACKAGENAME___.xcscheme | 110 ++++++ .../linkscript.s | 18 + .../main.rez | 292 +++++++++++++++ .../main.s | 280 ++++++++++++++ .../TemplateInfo.plist | 209 +++++++++++ .../___PACKAGENAME___.xcscheme | 110 ++++++ .../linkscript.s | 18 + .../main.rez | 47 +++ .../main.s | 344 ++++++++++++++++++ .../main.s | 6 +- pkg/createPackage | 2 + 13 files changed, 1663 insertions(+), 2 deletions(-) create mode 100644 pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/TemplateInfo.plist create mode 100644 pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/___PACKAGENAME___.xcscheme create mode 100644 pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/linkscript.s create mode 100644 pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/main.rez create mode 100644 pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/main.s create mode 100644 pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/TemplateInfo.plist create mode 100644 pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/___PACKAGENAME___.xcscheme create mode 100644 pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/linkscript.s create mode 100644 pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/main.rez create mode 100644 pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/main.s diff --git a/make/tail.mk b/make/tail.mk index 5d4032b..5f03635 100644 --- a/make/tail.mk +++ b/make/tail.mk @@ -136,7 +136,7 @@ $(TARGETDIR)/$(PGM): $(BUILD_OBJS) $(ASM_SRCS) $(MERLIN_BIN) -V $(MERLIN_LIB) linkscript.s $(MV) $(PGM) $(TARGETDIR)/$(PGM) ifneq ($(REZ_OBJS),) - $(CP) $(REZ_OBJS)/rsrc $(TARGETDIR)/$(PGM)/rsrc + $(CP) $(REZ_OBJS)/..namedfork/rsrc $(TARGETDIR)/$(PGM)/..namedfork/rsrc endif $(CHTYP) -t $(FILETYPE) $(AUXTYPE) $(TARGETDIR)/$(PGM) diff --git a/pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/TemplateInfo.plist b/pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/TemplateInfo.plist new file mode 100644 index 0000000..f11fef3 --- /dev/null +++ b/pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/TemplateInfo.plist @@ -0,0 +1,227 @@ + + + + + Nodes + + main.s + linkscript.s + main.rez + 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 + + 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-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.apple2gsMerlinDesktopApp + Ancestors + + com.apple.dt.unit.externalBuildSystem + + Concrete + + Description + This template creates an Apple IIgs Merlin code project to build desktop application. The project starts with a single assembly file which you can modify. You can also add more assembly files as you may like. + Options + + + Identifier + RESOLUTIONMODE + Name + Desktop Resolution + Description + Specify 640x200 or 320x200 resolution desktop enviroment. + Type + popup + Default + 640 + Values + + 640 + 320 + + + + 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 Desktop Application.xctemplate/___PACKAGENAME___.xcscheme b/pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/___PACKAGENAME___.xcscheme new file mode 100644 index 0000000..ef0c34f --- /dev/null +++ b/pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/___PACKAGENAME___.xcscheme @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/linkscript.s b/pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/linkscript.s new file mode 100644 index 0000000..55ac440 --- /dev/null +++ b/pkg/Templates/Apple IIgs/Merlin Desktop Application.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 Desktop Application.xctemplate/main.rez b/pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/main.rez new file mode 100644 index 0000000..899d4c2 --- /dev/null +++ b/pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/main.rez @@ -0,0 +1,292 @@ +/* + * ___FILENAME___ + * ___PROJECTNAME___ + * + * Created by ___FULLUSERNAME___ on ___DATE___. + * ___COPYRIGHT___ + */ + + +#include "types.rez" + + +#define menuBar 1 + +#define appleMenu 3 +#define fileMenu 4 +#define editMenu 5 + +#define editUndo 250 +#define editCut 251 +#define editCopy 252 +#define editPaste 253 +#define editClear 254 + +#define fileNew 401 +#define fileOpen 402 +#define fileClose 255 +#define fileQuit 256 + +#define appleAbout 301 + +#define aboutAlertString 1 + +#define windowRes 1001 + +#define toolStartup 1 + + +resource rVersion (1) { + { + 0, /* Major version number in BCD */ + 1, /* Minor version number in BCD */ + 0, /* Bug version number in BCD */ + development,/* Development phase */ + 0 /* Release number */ + }, + verUS, + "___PROJECTNAME___", + "Copyright \$A9 ___YEAR___ ___FULLUSERNAME___" +}; + + +resource rMenuBar (menuBar) { + { + appleMenu, + fileMenu, + editMenu + }; +}; + + +resource rMenu (appleMenu) { + appleMenu, + refIsResource * menuTitleRefShift + + refIsResource * itemRefShift + + fAllowCache, + appleMenu, + { + appleAbout + }; +}; + + +resource rMenu (fileMenu) { + fileMenu, + refIsResource * menuTitleRefShift + + refIsResource * itemRefShift + + fAllowCache, + fileMenu, + { + fileNew, + fileOpen, + fileClose, + fileQuit + }; +}; + + +resource rMenu (editMenu) { + editMenu, + refIsResource * menuTitleRefShift + + refIsResource * itemRefShift + + fAllowCache, + editMenu, + { + editUndo, + editCut, + editCopy, + editPaste, + editClear + }; +}; + + +resource rMenuItem (editUndo) { + editUndo, + "Z", "z", + 0, + refIsResource * itemTitleRefShift + + fDivider, + editUndo +}; + + +resource rMenuItem (editCut) { + editCut, + "X", "x", + 0, + refIsResource * itemTitleRefShift, + editCut +}; + + +resource rMenuItem (editCopy) { + editCopy, + "C", "c", + 0, + refIsResource * itemTitleRefShift, + editCopy +}; + + +resource rMenuItem (editPaste) { + editPaste, + "V", "v", + 0, + refIsResource * itemTitleRefShift, + editPaste +}; + + +resource rMenuItem (editClear) { + editClear, + "", "", + 0, + refIsResource * itemTitleRefShift, + editClear +}; + + +resource rMenuItem (fileNew) { + fileNew, + "N", "n", + 0, + refIsResource * itemTitleRefShift, + fileNew +}; + + +resource rMenuItem (fileOpen) { + fileOpen, + "O", "o", + 0, + refIsResource * itemTitleRefShift + + fDivider, + fileOpen +}; + + +resource rMenuItem (fileClose) { + fileClose, + "W", "w", + 0, + refIsResource * itemTitleRefShift + + fDivider, + fileClose +}; + + +resource rMenuItem (fileQuit) { + fileQuit, + "Q", "q", + 0, + refIsResource * itemTitleRefShift, + fileQuit +}; + + +resource rMenuItem (appleAbout) { + appleAbout, + "", "", + 0, + refIsResource * itemTitleRefShift + + fDivider, + appleAbout +}; + + +resource rPString (appleMenu, noCrossBank) {"@"}; +resource rPString (fileMenu, noCrossBank) {" File "}; +resource rPString (editMenu, noCrossBank) {" Edit "}; + +resource rPString (editUndo, noCrossBank) {"Undo"}; +resource rPString (editCut, noCrossBank) {"Cut"}; +resource rPString (editCopy, noCrossBank) {"Copy"}; +resource rPString (editPaste, noCrossBank) {"Paste"}; +resource rPString (editClear, noCrossBank) {"Clear"}; + +resource rPString (fileNew, noCrossBank) {"New"}; +resource rPString (fileOpen, noCrossBank) {"Open"}; +resource rPString (fileClose, noCrossBank) {"Close"}; +resource rPString (fileQuit, noCrossBank) {"Quit"}; + +resource rPString (appleAbout, noCrossBank) {"About ___PROJECTNAME___..."}; + + +resource rAlertString (aboutAlertString) { + "0" /* Custom size */ +#if DESKTOP_RES_MODE == 320 + "\$38\$00" /* Upper Y coordinate at 56 */ + "\$10\$00" /* Left X coordinate at 16 */ + "\$90\$00" /* Lower Y coorinate at 144 */ + "\$30\$01" /* Right X coordinate at 304 */ +#else + "\$38\$00" /* Upper Y coordinate at 56 */ + "\$90\$00" /* Left X coordinate at 144 */ + "\$90\$00" /* Lower Y coorinate at 144 */ + "\$F0\$01" /* Right X coordinate at 496 */ +#endif + "3/" + "___PROJECTNAME___\n" + " by ___FULLUSERNAME___\n" + "\n" + "Copyright \$A9 ___YEAR___ ___FULLUSERNAME___\n" + "\n" + "Contains libraries from ORCAC,\n" + "Copyright \$A9 1991, Byte Works Inc." + "/^#0\$00"; +}; + + +resource rWindParam1 (windowRes) { + $DDA5, /* wFrameBits */ + nil, /* wTitle */ + 0, /* wRefCon */ + {0, 0, 0, 0}, /* ZoomRect */ + $07FF0001, /* wColor ID */ + {0, 0}, /* Origin */ + {1, 1}, /* data size */ + {0, 0}, /* max height-width */ + {8, 8}, /* scroll ver hors */ + {0, 0}, /* page ver horiz */ + 0, /* winfoRefCon */ + 10, /* wInfoHeight */ +#if DESKTOP_RES_MODE == 320 + {30, 10, 183, 300}, /* wposition */ +#else + {30, 10, 183, 602}, /* wposition */ +#endif + infront, /* wPlane */ + nil, /* wStorage */ + $0800 /* wInVerb */ +}; + + +resource rToolStartup (toolStartup) { +#if DESKTOP_RES_MODE == 320 + mode320, +#else + mode640, +#endif + { + 3,$0100, /* Misc Tool */ + 4,$0100, /* Quickdraw */ + 5,$0100, /* Desk Manager */ + 6,$0100, /* Event Manager */ + 11,$0100, /* Int Math */ + 14,$0300, /* Window Manager */ + 15,$0300, /* Menu Manager */ + 16,$0300, /* Control Manager */ + 18,$0200, /* QD Aux */ + 19,$0100, /* Print Manager */ + 20,$0100, /* LineEdit Tool */ + 21,$0100, /* Dialog Manager */ + 22,$0100, /* Scrap Manager */ + 23,$0100, /* Standard File */ + 27,$0100, /* Font Manager */ + 28,$0100, /* List Manager */ + 30,$0100, /* Resource Manager */ + 34,$0100 /* TextEdit */ + } +}; diff --git a/pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/main.s b/pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/main.s new file mode 100644 index 0000000..f7f68f4 --- /dev/null +++ b/pkg/Templates/Apple IIgs/Merlin Desktop Application.xctemplate/main.s @@ -0,0 +1,280 @@ +* +* ___FILENAME___ +* ___PACKAGENAME___ +* +* Created by ___FULLUSERNAME___ on ___DATE___. +* Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved. +* + +]XCODESTART ; Keep this at the start and put your code after this + + mx %00 + + use 4/Util.Macs + use 4/Mem.Macs + use 4/Locator.Macs + use 4/Qd.Macs + use 4/Window.Macs + use 4/Menu.Macs + use 4/Desk.Macs + use 4/Dos.16.Macs + +menuBar = 1 + +appleMenu = 3 +fileMenu = 4 +editMenu = 5 + +editUndo = 250 +editCut = 251 +editCopy = 252 +editPaste = 253 +editClear = 254 + +fileNew = 401 +fileOpen = 402 +fileClose = 255 +fileQuit = 256 + +appleAbout = 301 + +aboutAlertString = 1 + +windowRes = 1001 + +toolStartup = 1 + +refIsHandle = 1 +refIsResource = 2 + +wInMenuBar = $11 +wInGoAway = $16 +wInSpecial = $19 + + + phb + phk + plb + + pha + _MMStartUp + PullWord userid + + _TLStartUp + + pha + pha + PushWord userid + PushWord #refIsResource + PushLong #toolStartup + _StartUpTools + PullLong toolStartupRef + + jsl InitMenus + _InitCursor + +loop + pha + PushWord #$ffff + PushLong #eventRec + _TaskMaster + pla + + cmp #wInMenuBar + bne notInMenuBar + jsl HandleMenu + bra loop + +notInMenuBar + cmp #wInSpecial + bne notInSpecial + jsl HandleMenu + bra loop + +notInSpecial + cmp #wInGoAway + bne notInGoAway +* Put the low word of the grafport pointer to close in X and the high word in Y + ldx wmTaskData + ldy wmTaskData+2 + jsl CloseDocument + +notInGoAway + bra loop + + +InitMenus + + pha + pha + PushWord #refIsResource + PushLong #menuBar + PushLong #0 + _NewMenuBar2 + _SetSysBar + PushLong #0 + _SetMenuBar + PushWord #appleMenu + _FixAppleMenu + + pha + _FixMenuBar + pla + + _DrawMenuBar + + rtl + + +HandleMenu +; The low word of the wmTaskData has the menu item number + lda wmTaskData + + cmp #appleAbout + bne notAbout + jsl DoAbout + bra menuDone + +notAbout + cmp #fileNew + bne notNew + jsl NewDocument + bra menuDone + +notNew + cmp #fileOpen + bne notOpen + jsl NewDocument + bra menuDone + +notOpen + cmp #fileClose + bne notClose + pha + pha + _FrontWindow + plx + ply + jsl CloseDocument + bra menuDone + +notClose + cmp #fileQuit + bne notQuit + jsl DoQuit + bra menuDone + +notQuit + cmp #editUndo + bne notUndo +* Handle undo here + bra menuDone + +notUndo + cmp #editCut + bne notCut +* Handle cut here + bra menuDone + +notCut + cmp #editCopy + bne notCopy +* Handle copy here + bra menuDone + +notCopy + cmp #editPaste + bne notPaste +* Handle paste here + bra menuDone + +notPaste + cmp #editClear + bne notClear +* Handle clear here + bra menuDone + +notClear +menuDone + PushWord #0 + PushWord wmTaskData+2 + _HiliteMenu + + rtl + + +CloseDocument +* X has the low word of the grafport pointer, Y has the high word + phy + phx + _CloseWindow + + rtl + + +NewDocument + pha + pha + PushLong #winName + PushLong #0 + PushLong #0 + PushLong #0 + PushWord #2 + PushLong #windowRes + PushWord #$800E + _NewWindow2 + pla + pla + + rtl + + +DoAbout + pha + PushWord #4 + PushLong #0 + PushLong #aboutAlertString + _AlertWindow + pla + rtl + + +DoQuit + PushWord #refIsHandle + PushLong toolStartupRef + _ShutDownTools + _TLShutDown + PushWord userid + _MMShutDown + + plb + + _QUIT quitDCB + rtl + +* Global data + +userid dw 0 +toolStartupRef adrl 0 +winName str 'MyWindow' + +eventRec +what dw 0 +message adrl 0 +when adrl 0 +where_vert dw 0 +where_horiz dw 0 +modifiers dw 0 +wmTaskData adrl 0 +wmTaskMask adrl $001f7fff +wmLastClickTick adrl 0 +wmClickCount dw 0 +wmTaskData2 adrl 0 +wmTaskData3 adrl 0 +wmTaskData4 adrl 0 +wmLastClickPt_vert dw 0 +wmLastClickPt_horiz dw 0 + +* Used by doQuit +quitDCB dw 0 + diff --git a/pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/TemplateInfo.plist b/pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/TemplateInfo.plist new file mode 100644 index 0000000..31d2b07 --- /dev/null +++ b/pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/TemplateInfo.plist @@ -0,0 +1,209 @@ + + + + + Nodes + + main.s + linkscript.s + main.rez + 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 + + 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-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.apple2gsMerlinNDA + Ancestors + + com.apple.dt.unit.externalBuildSystem + + Concrete + + Description + This template creates an Apple IIgs Merlin 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 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 New Desk Accessory.xctemplate/___PACKAGENAME___.xcscheme b/pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/___PACKAGENAME___.xcscheme new file mode 100644 index 0000000..ef0c34f --- /dev/null +++ b/pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/___PACKAGENAME___.xcscheme @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/linkscript.s b/pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/linkscript.s new file mode 100644 index 0000000..55ac440 --- /dev/null +++ b/pkg/Templates/Apple IIgs/Merlin New 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 New Desk Accessory.xctemplate/main.rez b/pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/main.rez new file mode 100644 index 0000000..d264aad --- /dev/null +++ b/pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/main.rez @@ -0,0 +1,47 @@ +/* + * ___FILENAME___ + * ___PROJECTNAME___ + * + * Created by ___FULLUSERNAME___ on ___DATE___. + * ___COPYRIGHT___ + */ + + +#include "types.rez" + + +#define windowRes 1001 + + +resource rVersion (1) { + { + 0, /* Major version number in BCD */ + 1, /* Minor version number in BCD */ + 0, /* Bug version number in BCD */ + development,/* Development phase */ + 0 /* Release number */ + }, + verUS, + "___PROJECTNAME___", + "Copyright \$A9 ___YEAR___ ___FULLUSERNAME___" +}; + + +resource rWindParam1 (windowRes) { + $C0A5, /* wFrameBits */ + nil, /* wTitle */ + 0, /* wRefCon */ + {0,0,0,0}, /* ZoomRect */ + $07FF0001, /* 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 */ +}; diff --git a/pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/main.s b/pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/main.s new file mode 100644 index 0000000..5cafe67 --- /dev/null +++ b/pkg/Templates/Apple IIgs/Merlin New Desk Accessory.xctemplate/main.s @@ -0,0 +1,344 @@ +* +* ___FILENAME___ +* ___PACKAGENAME___ +* +* Created by ___FULLUSERNAME___ on ___DATE___. +* Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved. +* + +]XCODESTART ; Keep this at the start and put your code after this + + mx %00 + + use 4/Util.Macs + use 4/Mem.Macs + use 4/Qd.Macs + use 4/Window.Macs + use 4/Desk.Macs + use 4/Resource.Macs + use 4/GsOs.Macs + +windowRes = 1001 + +eventAction = $0001 +runAction = $0002 +cursorAction = $0003 +undoAction = $0005 +cutAction = $0006 +copyAction = $0007 +pasteAction = $0008 +clearAction = $0009 + +updateEvt = $0006 +wInControl = $0021 +keyDownEvt = $0003 +autoKeyEvt = $0005 + +setSysPrefs = $0c +getSysPrefs = $0f +setLevel = $1a +getLevel = $1b + + + adrl NDAOpen + adrl NDAClose + adrl NDAAction + adrl NDAInit + dw $ffff + dw $03ff + asc ' ___PACKAGENAME___ \H**' + dw $0 + + +NDAOpen + phb + phk + plb + + lda ndaActive + beq doOpen + plb + rtl + +doOpen + iGSOS getLevel;levelDCB;1 + lda level + sta oldLevel + stz level + iGSOS setLevel;levelDCB;1 + + iGSOS getSysPrefs;prefsDCB;1 + lda prefs + sta oldPrefs + and #$1fff + ora #$8000 + sta prefs + iGSOS setSysPrefs;prefsDCB;1 + + pha + PushWord #1 + lda userId + pha + _OpenResourceFileByID + PullWord oldResApp + + pha + pha + PushLong #winName + PushLong #0 + PushLong #DrawContents + PushLong #0 + PushWord #2 + PushLong #windowRes + PushWord #$800E + _NewWindow2 + PullLong winPtr + + PushLong winPtr + _SetSysWindow + PushLong winPtr + _ShowWindow + PushLong winPtr + _SelectWindow + + lda #1 + sta ndaActive + + lda oldPrefs + sta prefs + iGSOS setSysPrefs;prefsDCB;1 + lda oldLevel + sta level + iGSOS setLevel;levelDCB;1 + + PushWord oldResApp + _SetCurResourceApp + + lda winPtr + sta 5,S + lda winPtr+2 + sta 7,S + + plb + + rtl + +DrawContents + phb + phk + plb + + _PenNormal + PushWord #7 + PushWord #10 + _MoveTo + PushLong #messageStr + _DrawString + + plb + + rtl + +NDAClose + phb + phk + plb + + lda ndaActive + beq closeNotActive + + PushLong winPtr + _CloseWindow + + stz winPtr + stz winPtr+2 + stz ndaActive + +closeNotActive + _ResourceShutDown + + plb + rtl + +NDAAction + phb + phk + plb + + cmp #eventAction + bne notEvent + jsl HandleEvent + bra actionDone + +notEvent + cmp #runAction + bne notRun + jsl HandleRun + bra actionDone + +notRun + cmp #cursorAction + bne notCursor + jsl HandleCursor + bra actionDone + +notCursor + cmp #undoAction + blt notEdit + cmp #clearAction+1 + bge notEdit + jsl HandleEdit + lda #1 + bra actionDone + +notEdit +actionDone + plb + rtl + +HandleEvent +* 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 + + pha + PushWord #0 + PushLong #localEvent + _TaskMasterDA + pla + + cmp #updateEvt + bne notUpdate + PushLong winPtr + _BeginUpdate + jsl DrawContents + PushLong winPtr + _EndUpdate + bra eventDone + +notUpdate + cmp #wInControl + bne notControl + jsl HandleControl + bra eventDone + +notControl + cmp #keyDownEvt + beq isKey + cmp #autoKeyEvt + beq isKey + +eventDone + rtl + +isKey + jsl HandleKey + bra eventDone + + +HandleControl +* Add code here if you need to handle controls in your NDA window + rtl + +HandleKey +* Add code here if you need to handle keypresses + rtl + +HandleRun +* Add code here if you need to execute something periodically from your NDA + rtl + +HandleCursor +* Add code here if you need to do something to the cursor when over the NDA window + rtl + +HandleEdit +* Add code here to handle undo, cut, copy, paste or clear. The A register holds +* the action code. + rtl + +NDAInit + phb + phk + plb + + cmp #$00 + beq toolShutdown + + stz ndaActive + + pha + _MMStartUp + pla + sta userId + + bra initReturn + +toolShutdown + lda ndaActive + beq initReturn + jsl NDAClose + +initReturn + plb + rtl + +* Global data + +ndaActive dw 0 +winPtr adrl 0 +userId dw 0 +winName str ' ___PACKAGENAME___ ' +messageStr str 'Hello, world!' + +* Used by NDAOpen to access resources +oldResApp dw 0 +oldLevel dw 0 +oldPrefs dw 0 + +levelDCB dw 2 ; GSOS control block to get/set level +level dw 0 + dw 0 + +prefsDCB dw 1 ; GSOS control block to get/set preferences +prefs dw 0 + +* Used by HandleEvent +localEvent +what dw 0 +message adrl 0 +when adrl 0 +where_vert dw 0 +where_horiz dw 0 +modifiers dw 0 +wmTaskData adrl 0 +wmTaskMask adrl $001fffff +wmLastClickTick adrl 0 +wmClickCount dw 0 +wmTaskData2 adrl 0 +wmTaskData3 adrl 0 +wmTaskData4 adrl 0 +wmLastClickPt_vert dw 0 +wmLastClickPt_horiz dw 0 + 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 index f18bf5a..2b592ef 100644 --- a/pkg/Templates/Apple IIgs/ORCAM New Desk Accessory.xctemplate/main.s +++ b/pkg/Templates/Apple IIgs/ORCAM New Desk Accessory.xctemplate/main.s @@ -197,7 +197,7 @@ HandleEvent entry moveIns mvn 0,0 pha - ~TaskMasterDA 0,#localEvent + ~TaskMasterDA #0,#localEvent pla cmp #updateEvt @@ -249,6 +249,9 @@ HandleEdit entry rtl NDAInit entry + phb + phk + plb cmp #$00 beq toolShutdown @@ -267,6 +270,7 @@ toolShutdown anop jsl NDAClose initReturn anop + plb rtl ; Global data diff --git a/pkg/createPackage b/pkg/createPackage index d05b368..359bbc9 100755 --- a/pkg/createPackage +++ b/pkg/createPackage @@ -17,9 +17,11 @@ cdev:orca:ORCAM Control Panel:0:0 cdev:merlin:Merlin Control Panel:0:0 desktop:orca:ORCAC Desktop Application:1:1 desktop:orca:ORCAM Desktop Application:1:0 +desktop:merlin:Merlin Desktop Application:1:0 shell:gno:ORCAC GNO Shell Command:0:0 nda:orca:ORCAC New Desk Accessory:0:0 nda:orca:ORCAM New Desk Accessory:0:0 +nda:merlin:Merlin New Desk Accessory:0:0 shell:orca:ORCAC Shell Command:0:0 shell:orca:ORCAM Shell Command:0:0 EOF