Technical information
CHAPTER 3
The PC Interface Driver
48 Passing Messages
Parameter block
→ ioCompletion long Pointer to the completion routine
← ioResult word
→ ioRefNum word
→ csCode word Equals rsSendMessage
→ csParam+0 long Pointer to MsgPBlk
Your completion routine 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
The MsgPBlk data structure on the PC has the following format. Please note that the
sizes of some of the fields are different from the Mac OS equivalent.
MsgPBlk STRUCT
link DWORD ? ; Link to next Queue element
msgCmd WORD ? ; The message command or type
msgParam1 DWORD ? ; Param 1
msgParam2 DWORD ? ; Param 2
msgBuffer DWORD ? ; Pointer to the data buffer
msgReqCount DWORD ? ; Length of the data
msgActCount DWORD ? ; # of bytes actually transferred
msgCompletion DWORD ? ; Pointer to the completion routine
msgResult BYTE ? ; The error code after complete or 1
msgFlags BYTE ? ; Msg flags (Shared and Swapped)
Set to zero!
msgUserData DWORD ? ; For the callers use.
msgVXD DWORD ? ; Reserved for driver use
MsgPBlk ENDS
To send a message on the PC, build a MsgPBlk structure and call the PC Interface driver
with AH = 1 (rsSendMessage) and ES:BX = the pointer to the MsgPBlk structure.
When you execute an INT 5Fh, the message is queued, msgResult is set to 1 (busy),
and control returns to your program.
Your completion routine is called with a FAR call and it should return with an RETF.
Also, your routine may use registers AX, BX, CX,DX, DI,SI, ES, and DS. When your
completion routine is called, ES:BX is a pointer to the MsgPBlk structure.