Clean up the ORCA/C NDA template code. Add a ORCA/M NDA template. Add instructions on how to add gen rules, pointing out the trick for inserting tab characters in Xcode. Add GSBug and a couple other debug tools to the System 6 template image to make it easier to figure out what is wrong.

This commit is contained in:
Jeremy Rand 2018-08-02 23:28:17 -04:00
parent 684f1efb71
commit 6b56c7d818
8 changed files with 645 additions and 8 deletions

View File

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

Binary file not shown.

View File

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

View File

@ -0,0 +1,210 @@
<?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>Nodes</key>
<array>
<string>main.s</string>
<string>main.rez</string>
<string>Makefile</string>
<string>make/config.txt</string>
<string>make/createDiskImage</string>
<string>make/head.mk</string>
<string>make/launchEmulator</string>
<string>make/orca-asm</string>
<string>make/orca-cc</string>
<string>make/orca-macgen</string>
<string>make/orca-rez</string>
<string>make/system601.2mg</string>
<string>make/tail.mk</string>
<string>../___PACKAGENAME___.xcodeproj/xcshareddata/xcschemes/___PACKAGENAME___.xcscheme</string>
</array>
<key>Definitions</key>
<dict>
<key>main.s</key>
<dict>
<key>Path</key>
<string>main.s</string>
</dict>
<key>main.rez</key>
<dict>
<key>Path</key>
<string>main.rez</string>
</dict>
<key>make/config.txt</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/config.txt</string>
</dict>
<key>make/createDiskImage</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/createDiskImage</string>
</dict>
<key>make/head.mk</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/head.mk</string>
</dict>
<key>make/launchEmulator</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/launchEmulator</string>
</dict>
<key>make/orca-asm</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/orca-asm</string>
</dict>
<key>make/orca-cc</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/orca-cc</string>
</dict>
<key>make/orca-macgen</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/orca-macgen</string>
</dict>
<key>make/orca-rez</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/orca-rez</string>
</dict>
<key>make/system601.2mg</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/system601.2mg</string>
</dict>
<key>make/tail.mk</key>
<dict>
<key>Group</key>
<string>make</string>
<key>Path</key>
<string>make/tail.mk</string>
</dict>
<key>Makefile</key>
<dict>
<key>Path</key>
<string>Makefile</string>
</dict>
<key>../___PACKAGENAME___.xcodeproj/xcshareddata/xcschemes/___PACKAGENAME___.xcscheme</key>
<dict>
<key>Group</key>
<array>
<string>Supporting Files</string>
</array>
<key>Path</key>
<string>___PACKAGENAME___.xcscheme</string>
</dict>
</dict>
<key>Kind</key>
<string>Xcode.Xcode3.ProjectTemplateUnitKind</string>
<key>Identifier</key>
<string>com.halcyontouch.apple2gsOrcaMNDA</string>
<key>Ancestors</key>
<array>
<string>com.apple.dt.unit.externalBuildSystem</string>
</array>
<key>Concrete</key>
<true/>
<key>Description</key>
<string>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.</string>
<key>Options</key>
<array/>
<key>Targets</key>
<array>
<dict>
<key>TargetType</key>
<string>Legacy</string>
<key>TargetIdentifier</key>
<string>com.apple.dt.cocoaLegacyTarget</string>
<key>BuildToolPath</key>
<string>___VARIABLE_buildToolPath___</string>
<key>BuildToolArgsString</key>
<string>-C ___PACKAGENAME___ $(ACTION)</string>
<key>SharedSettings</key>
<dict>
<key>OTHER_CFLAGS</key>
<string></string>
<key>OTHER_LDFLAGS</key>
<string></string>
</dict>
<key>Configurations</key>
<dict>
<key>Debug</key>
<dict>
<key>DEBUGGING_SYMBOLS</key>
<string>YES</string>
<key>GCC_GENERATE_DEBUGGING_SYMBOLS</key>
<string>YES</string>
<key>GCC_OPTIMIZATION_LEVEL</key>
<string>0</string>
</dict>
<key>Release</key>
<dict/>
</dict>
</dict>
<dict>
<key>ProductType</key>
<string>com.apple.product-type.tool</string>
<key>TargetIdentifier</key>
<string>com.apple.dt.commandLineToolTarget</string>
<key>Name</key>
<string>doNotBuild</string>
<key>SharedSettings</key>
<dict>
<key>PRODUCT_NAME</key>
<string>doNotBuild</string>
<key>GCC_PREPROCESSOR_DEFINITIONS</key>
<string>inline(X,Y)=""
pascal=""</string>
<key>HEADER_SEARCH_PATHS</key>
<string>$GOLDEN_GATE/Libraries/ORCACDefs
~/Library/GoldenGate/Libraries/ORCACDefs
/Library/GoldenGate/Libraries/ORCACDefs
~/GoldenGate/Libraries/ORCACDefs</string>
</dict>
<key>BuildPhases</key>
<array>
<dict>
<key>Class</key>
<string>Sources</string>
</dict>
<dict>
<key>Class</key>
<string>Frameworks</string>
</dict>
<dict>
<key>Class</key>
<string>CopyFiles</string>
<key>DstPath</key>
<string>/usr/share/man/man1/</string>
<key>DstSubfolderSpec</key>
<string>0</string>
<key>RunOnlyForDeploymentPostprocessing</key>
<string>YES</string>
</dict>
</array>
</dict>
</array>
</dict>
</plist>

View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9D0B917C1F526C2D004D7E0B"
BuildableName = "___PACKAGENAME___"
BlueprintName = "___PACKAGENAME___"
ReferencedContainer = "container:___PACKAGENAME___.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<PathRunnable
runnableDebuggingMode = "0"
FilePath = "/usr/bin/make">
</PathRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9D0B917C1F526C2D004D7E0B"
BuildableName = "___PACKAGENAME___"
BlueprintName = "___PACKAGENAME___"
ReferencedContainer = "container:___PACKAGENAME___.xcodeproj">
</BuildableReference>
</MacroExpansion>
<CommandLineArguments>
<CommandLineArgument
argument = "-C"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "$PROJECT_DIR/___PACKAGENAME___"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "execute"
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9D0B917C1F526C2D004D7E0B"
BuildableName = "___PACKAGENAME___"
BlueprintName = "___PACKAGENAME___"
ReferencedContainer = "container:___PACKAGENAME___.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -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 */
};

View File

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

View File

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