Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- **************************************************
- * Build steps:
- * mac desk
- * apple+6
- **************************************************
- REL
- DSK DESK.L
- LST OFF
- USE DESK.MACROS
- JMP Init
- **************************************************
- * Data
- **************************************************
- mmID ds 2 ;Memory Manager's user ID
- **************************************************
- * Events...
- EventRecord ;The event record.
- evtWhat ds 2
- evtMsg ds 4
- evtWhen ds 4
- evtWhere ds 4
- evtMods ds 2
- **************************************************
- StartStopRef ds 4 ;reference to StartStopRec
- StartStopRec
- dw 0 ;flag word - must be 0
- dw $80 ;video mode for QD - $00 = 320, $80 = 640
- ds 2 ;resFileID for ShutDownTools
- ds 4 ;dPageHandle for ShutDownTools
- dw 4 ;Number of tools to start
- ToolsList
- dw 3,$0100 ;Misc Tools
- dw 11,$0100 ;Integer Math
- dw 9,$0100 ;ADB
- dw 6,$0100 ;Event Manager
- **************************************************
- * Program
- **************************************************
- Init
- M65816 1 ;Enable 16-bit and GS native mode
- PHK
- PLB ;Data bank = Program bank
- _TLStartUp ;start the tool locator...
- ~MMStartUp mmID ;...and the memory manager.
- * Start our required tools.
- PushLong #0
- PushWord mmID
- pea #0
- PushLong #StartStopRec
- _StartupTools
- * Check that the startup was OK.
- Check1
- CMP #0
- BNE Check2
- JMP ToolsAreStarted
- Check2
- CMP #$1E12 ;Resource Manager already loaded
- BEQ ToolCheck
- JMP ToolError
- **************************************************
- * OK, program is started...
- **************************************************
- ToolCheck
- PushWord #0
- _EMStatus
- pla
- cmp #0
- bne ToolsAreStarted
- JMP EMNotStarted
- ToolsAreStarted
- ~WriteCString #strToolsStarted
- EventLoop
- * Look for keydown and mouse btn 0 down
- ~GetNextEvent #$000A;#EventRecord
- pla ;A = 0 if not our event
- cmp #0
- beq EventLoop ;loop if we're not interested
- ~WriteCString #strGotEvent
- jmp EventLoop ;go back to the event loop otherwise
- OrderlyQuit
- pea #0
- PushLong #StartStopRec
- _ShutdownTools
- _MMShutDown mmID
- _TLShutDown
- _QUIT QuitParms
- QuitParms adrl $0
- ds 2
- **************************************************
- * Strings
- **************************************************
- strToolsStarted ASC 'Tools are started. OK.',0D0A00
- strGotEvent ASC 'Got an event.',0D0A00
- **************************************************
- * Error handler
- **************************************************
- ToolError
- PHA ;push the error code
- PushLong #FailMsg ;push the failure msg
- _SysFailMgr
- MiscToolsetFail
- LDA #0
- PHA
- PushLong #MTFailMsg
- _SysFailMgr
- EMNotStarted
- ~SysFailMgr #$1234;#EMFailMsg
- LoopForever
- JMP LoopForever
- FailMsg STR "ToolStartup returned error $"
- MTFailMsg STR "Misc Toolset failed to start. "
- EMFailMsg STR "Event Manager isn't started. "
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement