Specifications

CHAPTER 4
Software Support
Passing Messages 77
Parameter block
—> indicates input to the driver
<— indicates output from the driver
When your message handler procedure is called, register D0.w contains the message
command, register D1.1 contains the msgParam1 value, register D2.1 contains the
msgParam2 value, and register A1 contains a pointer to the MsgRecElem record. Your
routine must pass back a pointer to a MsgPBlk structure in A0 if you wish to receive the
message data. Otherwise, return 0 in A0. The handler procedure is called at interrupt
time with interrupts masked at the slot interrupt level. It can use registers D0–D2 and
A0–A1.
The completion routine for the MsgPBlk structure returned by the receive procedure is
called at deferred time and can use registers D0–D2 and A0–A1. You must save all other
registers. Upon return, A0 contains a pointer to the MsgPBlk structure.
Installing a Message Handler on the PC System 4
To install a message handler on the PC system, build a MsgRecElem record and call
INT 5Fh with AH = 2 and ES:BX containing a pointer to the MsgRecElem structure.
For an application running on the PC system, the MsgRecElem data structure has the
following format:
When your message handler is called, AX contains the message command, ECX contains
msgParam1, EDX contains msgParam2, and ES:DI contains a pointer to the
MsgRecElem record. Your application must pass a pointer to a MsgPBlk structure in
ES:BX if you wish to receive the message data. Otherwise, return 0 in BX. The handler is
—> ioCompletion long Pointer to the completion routine.
<— ioResult word Device driver’s result code.
—> ioRefNum word Device driver’s reference number.
—> csCode word Equals rsInstallMesHandler.
—> csParam+0 long Pointer to MsgRecElem.
MsgRecElem STRUCT
Link DWORD ; Pointer to next link
Code DWORD ; Pointer to the code for this link
cmdBase WORD ; Base message number for this procedure
cmdCount WORD ; Number of message numbers for this
procedure
userData DWORD ; For caller’s use
msgVXD DWORD ; Reserved for driver use
MsgRecElem ENDS