supermario/bin/MPW-3.2.3/Examples/CExamples/DAEntry.a
2019-06-29 22:17:03 +08:00

66 lines
2.1 KiB
Plaintext

***************************************************************************
****
**** DESK ACCESSORY and DEVICE DRIVER Entry Code/Data
****
***************************************************************************
STRING PASCAL
INCLUDE 'ToolEqu.a'
INCLUDE 'SysEqu.a'
CASE OBJ
**************************** DESK ACCESSORY ENTRY **************************
IMPORT %DRVRMain
DAEntry Proc Export ; See Device Manager IM:2
;
; First we need to set the drvrFlags (IM II-188), choose from
;
; dReadEnable enable driver for read operations (drivers only)
; dWritEnable enable driver for writing (drivers only)
; dCtlEnable enable driver/da for control operations
; dStatEnable enable driver/da for status operations (drivers only)
; dNeedGoodBye driver/da needs a "goodbye kiss"
; dNeedTime driver/da needs "main thread" time
; dNeedLock driver will be accessed at interrupt level (drivers only)
;
DC.B (1<<dCtlEnable) + (1<<dNeedTime) ; periodic, control flags set
DC.B 0 ; Lower byte is unused
;
; Next is the the drvrDelay (IM II-188), set only if dNeedTime flag set above
;
DC.W 5*60 ; 5 sec periodic update
;
; Next is the the drvrEMask (IM I-444), which events DA can respond to...
; Must be NIL for drivers, for DA's choose from
; mButDwnEvt mouse button down is event 1
; keyDwnEvt key down is event 3
; keyUpEvt key up is event 4
; autoKeyEvt auto-repeated key is event 5
; updatEvt update event
; activateEvt activate/deactive event
;
DC.W (1<<updatEvt) ; Handle activate, update events
;
; Next is the the drvrMenu (IM I-444), Menu ID of DA's menu, or NIL
;
DC.W 0 ; No associated menu
;
; Next are the offsets to the main routines of the driver/DA
;
DC.W %DRVRMain - DAEntry ; Open routine
DC.W %DRVRMain - DAEntry +4 ; Prime - unused for DA's
DC.W %DRVRMain - DAEntry +8 ; Control
DC.W %DRVRMain - DAEntry +12 ; Status - unused for DA's
DC.W %DRVRMain - DAEntry +16 ; Close
;
; Next are the offsets to the main routines of the driver/DA
;
DAName
DC.B 'Memory' ; DA/DRVR Name
ORG DAName+32 ; Pad string out to 32 bytes
END