Advertisement
Guest User

Untitled

a guest
May 15th, 2017
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.89 KB | None | 0 0
  1. **************************************************
  2. * Build steps:
  3. * mac desk
  4. * apple+6
  5. **************************************************
  6. REL
  7. DSK DESK.L
  8.  
  9. LST OFF
  10. USE DESK.MACROS
  11.  
  12. JMP Init
  13.  
  14. **************************************************
  15. * Data
  16. **************************************************
  17. mmID ds 2 ;Memory Manager's user ID
  18.  
  19. **************************************************
  20. * Events...
  21. EventRecord ;The event record.
  22. evtWhat ds 2
  23. evtMsg ds 4
  24. evtWhen ds 4
  25. evtWhere ds 4
  26. evtMods ds 2
  27.  
  28. **************************************************
  29. StartStopRef ds 4 ;reference to StartStopRec
  30.  
  31. StartStopRec
  32. dw 0 ;flag word - must be 0
  33. dw $80 ;video mode for QD - $00 = 320, $80 = 640
  34. ds 2 ;resFileID for ShutDownTools
  35. ds 4 ;dPageHandle for ShutDownTools
  36. dw 4 ;Number of tools to start
  37.  
  38. ToolsList
  39. dw 3,$0100 ;Misc Tools
  40. dw 11,$0100 ;Integer Math
  41. dw 9,$0100 ;ADB
  42. dw 6,$0100 ;Event Manager
  43.  
  44. **************************************************
  45. * Program
  46. **************************************************
  47. Init
  48. M65816 1 ;Enable 16-bit and GS native mode
  49.  
  50. PHK
  51. PLB ;Data bank = Program bank
  52.  
  53. _TLStartUp ;start the tool locator...
  54. ~MMStartUp mmID ;...and the memory manager.
  55.  
  56. * Start our required tools.
  57. PushLong #0
  58. PushWord mmID
  59. pea #0
  60. PushLong #StartStopRec
  61. _StartupTools
  62.  
  63. * Check that the startup was OK.
  64. Check1
  65. CMP #0
  66. BNE Check2
  67. JMP ToolsAreStarted
  68. Check2
  69. CMP #$1E12 ;Resource Manager already loaded
  70. BEQ ToolCheck
  71. JMP ToolError
  72.  
  73. **************************************************
  74. * OK, program is started...
  75. **************************************************
  76.  
  77. ToolCheck
  78. PushWord #0
  79. _EMStatus
  80. pla
  81. cmp #0
  82. bne ToolsAreStarted
  83. JMP EMNotStarted
  84.  
  85. ToolsAreStarted
  86. ~WriteCString #strToolsStarted
  87.  
  88. EventLoop
  89.  
  90. * Look for keydown and mouse btn 0 down
  91. ~GetNextEvent #$000A;#EventRecord
  92.  
  93. pla ;A = 0 if not our event
  94. cmp #0
  95. beq EventLoop ;loop if we're not interested
  96.  
  97. ~WriteCString #strGotEvent
  98.  
  99. jmp EventLoop ;go back to the event loop otherwise
  100.  
  101. OrderlyQuit
  102. pea #0
  103. PushLong #StartStopRec
  104. _ShutdownTools
  105.  
  106. _MMShutDown mmID
  107. _TLShutDown
  108.  
  109. _QUIT QuitParms
  110.  
  111. QuitParms adrl $0
  112. ds 2
  113.  
  114. **************************************************
  115. * Strings
  116. **************************************************
  117. strToolsStarted ASC 'Tools are started. OK.',0D0A00
  118. strGotEvent ASC 'Got an event.',0D0A00
  119.  
  120. **************************************************
  121. * Error handler
  122. **************************************************
  123. ToolError
  124. PHA ;push the error code
  125. PushLong #FailMsg ;push the failure msg
  126. _SysFailMgr
  127.  
  128. MiscToolsetFail
  129. LDA #0
  130. PHA
  131. PushLong #MTFailMsg
  132. _SysFailMgr
  133.  
  134. EMNotStarted
  135. ~SysFailMgr #$1234;#EMFailMsg
  136.  
  137. LoopForever
  138. JMP LoopForever
  139.  
  140. FailMsg STR "ToolStartup returned error $"
  141. MTFailMsg STR "Misc Toolset failed to start. "
  142. EMFailMsg STR "Event Manager isn't started. "
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement