Technical information
CHAPTER 3
The PC Interface Driver
50 Passing Messages
Parameter block
→ ioCompletion long Pointer to the completion routine
← ioResult word
→ ioRefNum word
→ csCode word Equals rsInstallMsgHandler
→ csParam+0 long Pointer to MsgRecElem
When your message handler procedure is called, D0.w contains the message command,
D1.l contains the msgParam1 value, D2.l contains the msgParam2 value, and 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 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.
On the PC 3
For a program on the PC, the MsgRecElem data structure has the following format.
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
To install a message handler on the PC, build a MsgRecElem record and call INT 5Fh
with AH = 2 and ES:BX containing a pointer to the MsgRecElem structure.
When your message handler is called, AX contains the message command, ECX contains
msgParam1, EDX contains msgParam2, and ES:DI contain a pointer to the MsgRecElem
record. Your program 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 called at interrupt
time with interrupts turned off. It can use registers AX, BX, CX,DX, DI, SI, ES, and DS.
The completion routine for the MsgPBlk structure returned by the receive procedure is
called at interrupt time and can use registers AX, BX, CX,DX, DI, SI, ES, and DS. You
must save all other registers. Also, ES:BX contain a pointer to the MsgPBlk structure.