Add a CDEV target for the Merlin assembler

This commit is contained in:
Jeremy Rand 2019-07-17 20:33:08 -05:00
parent 5fec9448c5
commit 05f3fc3f65
7 changed files with 733 additions and 0 deletions

View File

@ -161,6 +161,7 @@ $(BINTARGET): $(BUILD_OBJS)
# resources # also.
$(BINTARGET): $(BUILD_OBJS) $(ASM_SRCS)
$(MERLIN_BIN) -V $(MERLIN_LIB) linkscript.s
$(MV) $(PGM) $(BINTARGET)
endif

View File

@ -0,0 +1,209 @@
<?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>linkscript.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-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>linkscript.s</key>
<dict>
<key>Path</key>
<string>linkscript.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-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.apple2gsMerlinCDev</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 Merlin code project to build a control panel. The project starts with a single assembly file which you can modify. You can also add more assembly 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)=""
extended=double
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,110 @@
<?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 = "TARGET_BUILD_DIR=$TARGET_BUILD_DIR"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "DERIVED_SOURCES_DIR=$DERIVED_SOURCES_DIR"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "OBJECT_FILE_DIR=$OBJECT_FILE_DIR"
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,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

View File

@ -0,0 +1,147 @@
/*
* ___FILENAME___
* ___PROJECTNAME___
*
* Created by ___FULLUSERNAME___ on ___DATE___.
* ___COPYRIGHT___
*/
#include "types.rez"
#define CDEV_RESOURCE 0x1
#define MAIN_RESOURCE 0x100
#define HELP_RESOURCE 0x101
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___"
};
/* This is the required resource to tell the control panel about the CDev */
resource rCDEVFlags (CDEV_RESOURCE) {
0x00C0, /* This sets the wantCreate and wantAbout bits */
/* Set more bits if you want other messages */
1,
1,
1,
0,
{0, 0, 110, 200},
"___PROJECTNAME___",
"___FULLUSERNAME___",
"0.1"
};
/* Code resource; the executable part of the CDev */
read rCDevCode (CDEV_RESOURCE,convert) BINTARGET;
/* This is the icon displayed by the control panel */
resource rIcon (CDEV_RESOURCE) {
0x8000, /* color icon */
20, /* height in pixels */
28, /* width in pixels */
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FF888888888888888888888888FF"
$"FF888888888888888888888888FF"
$"FF888888888888888888888888FF"
$"FF888888888888888888888888FF"
$"FF888888888888888888888888FF"
$"FF888888888888888888888888FF"
$"FF888888888888888888888888FF"
$"FF888888888888888888888888FF"
$"FF888888888888888888888888FF"
$"FF888888888888888888888888FF"
$"FF888888888888888888888888FF"
$"FF888888888888888888888888FF"
$"FF888888888888888888888888FF"
$"FF888888888888888888888888FF"
$"FF888888888888888888888888FF"
$"FF888888888888888888888888FF"
$"FF888888888888888888888888FF"
$"FF888888888888888888888888FF"
$"FF888888888888888888888888FF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFF",
$"0000000000000000000000000000"
$"00FFFFFFFFFFFFFFFFFFFFFFFF00"
$"00FFFFFFFFFFFFFFFFFFFFFFFF00"
$"00FFFFFFFFFFFFFFFFFFFFFFFF00"
$"00FFFFFFFFFFFFFFFFFFFFFFFF00"
$"00FFFFFFFFFFFFFFFFFFFFFFFF00"
$"00FFFFFFFFFFFFFFFFFFFFFFFF00"
$"00FFFFFFFFFFFFFFFFFFFFFFFF00"
$"00FFFFFFFFFFFFFFFFFFFFFFFF00"
$"00FFFFFFFFFFFFFFFFFFFFFFFF00"
$"00FFFFFFFFFFFFFFFFFFFFFFFF00"
$"00FFFFFFFFFFFFFFFFFFFFFFFF00"
$"00FFFFFFFFFFFFFFFFFFFFFFFF00"
$"00FFFFFFFFFFFFFFFFFFFFFFFF00"
$"00FFFFFFFFFFFFFFFFFFFFFFFF00"
$"00FFFFFFFFFFFFFFFFFFFFFFFF00"
$"00FFFFFFFFFFFFFFFFFFFFFFFF00"
$"00FFFFFFFFFFFFFFFFFFFFFFFF00"
$"00FFFFFFFFFFFFFFFFFFFFFFFF00"
$"0000000000000000000000000000"
};
/* The following resources define the various controls in the main display */
resource rControlList (MAIN_RESOURCE) {
{
MAIN_RESOURCE,
};
};
resource rControlTemplate (MAIN_RESOURCE) {
0x00000001, /* control id */
{38,5,49,205}, /* control rectangle */
statTextControl {{ /* control type */
0x0000, /* flags */
0x1002, /* more flags */
0, /* ref con */
MAIN_RESOURCE, /* text reference */
13 /* text length */
}};
};
resource rTextForLETextBox2 (MAIN_RESOURCE) {
"Hello, world!"
};
/* The following resources define the controls for the help screen */
resource rControlList (HELP_RESOURCE) {
{
HELP_RESOURCE,
};
};
resource rControlTemplate (HELP_RESOURCE) {
0x00000002, /* control id */
{38,5,49,205}, /* control rectangle */
statTextControl {{ /* control type */
0x0000, /* flags */
0x1002, /* more flags */
0, /* ref con */
HELP_RESOURCE, /* text reference */
19 /* text length */
}};
};
resource rTextForLETextBox2 (HELP_RESOURCE) {
"Put help info here."
};

View File

@ -0,0 +1,247 @@
*
* ___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/Ctl.Macs
* Resource numbers
cdevResource = $1
mainResource = $100
helpResource = $101
* CDEV Message Numbers
machineCDev = 1
bootCDev = 2
reservedCDev = 3
initCDev = 4
closeCDev = 5
eventsCDev = 6
createCDev = 7
aboutCDev = 8
rectCDev = 9
hitCDev = 10
runCDev = 11
editCDev = 12
* Edit menu actions
undoAction = 5
cutAction = 6
copyAction = 7
pasteAction = 8
clearAction = 9
* Offsets in direct page from the stack
message = $0c
data1 = $08
data2 = $04
main
tsc
phd
tcd
lda message
cmp #machineCDev
bne notMachine
* Return zero if you cannot be opened on this machine
* (and maybe display an alert explaining why).
lda $02
sta $0c
lda $01
sta $0b
pld
tsc
clc
adc #$a
tcs
lda #$1
rtl
notMachine
cmp #bootCDev
bne notBoot
jsl doBoot
bra done
notBoot
cmp #initCDev
bne notInit
jsl doInit
bra done
notInit
cmp #closeCDev
bne notClose
jsl doClose
bra done
notClose
cmp #eventsCDev
bne notEvents
jsl doEvents
bra done
notEvents
cmp #createCDev
bne notCreate
jsl doCreate
bra done
notCreate
cmp #aboutCDev
bne notAbout
jsl doAbout
bra done
notAbout
cmp #rectCDev
bne notRect
jsl doRect
bra done
notRect
cmp #hitCDev
bne notHit
jsl doHit
bra done
notHit
cmp #runCDev
bne notRun
jsl doRun
bra done
notRun
cmp #editCDev
bne notEdit
jsl doEdit
bra done
notEdit
done
lda $02
sta $0c
lda $01
sta $0b
pld
tsc
clc
adc #$a
tcs
lda #$1
rtl
doBoot
* data1 is a pointer to a flag. Set bit 0 to 1 in this flag if you want to
* draw an X through the icon at boot time to indicate that this CDev will not
* load.
rtl
doInit
* data1 is a pointer to the grafport.
rtl
doClose
* data1 is a pointer to the grafport.
rtl
doEvents
* data1 is a pointer to the event record.
* data2 is a pointer to the grafport.
rtl
doCreate
* data1 is a pointer to the grafport.
pha
pha
PushLong data1
PushWord #9
PushLong #mainResource
_NewControl2
pla
pla
rtl
doAbout
* data1 is a pointer to the grafport.
pha
pha
PushLong data1
PushWord #9
PushLong #helpResource
_NewControl2
pla
pla
rtl
doRect
* data1 is a pointer to the grafport.
rtl
doHit
* data1 is a handle to the control which was hit
* data2 is the controlID of the control which was hit
rtl
doRun
* data1 is a pointer to the grafport.
rtl
doEdit
* The lower 16 bits of data1 is the edit action
* data2 is a pointer to the grafport.
lda data1
cmp #undoAction
bne notUndo
* Handle undo here
bra doneEdit
notUndo
cmp #cutAction
bne notCut
* Handle cut here
bra doneEdit
notCut
cmp #copyAction
bne notCopy
* Handle copy here
bra doneEdit
notCopy
cmp #pasteAction
bne notPaste
* Handle paste here
bra doneEdit
notPaste
cmp #clearAction
bne notClear
* Handle clear here
bra doneEdit
notClear
doneEdit
rtl

View File

@ -14,6 +14,7 @@ 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
cdev:merlin:Merlin Control Panel:0:0
desktop:orca:ORCAC Desktop Application:1:1
desktop:orca:ORCAM Desktop Application:1:0
shell:gno:ORCAC GNO Shell Command:0:0