Specifications
CHAPTER 4
Software Support
74 Passing Messages
After the message has been sent, the msgResult field is set to 0 (no error) or -3
(MsgTimeout). The msgActCount field contains the number of bytes actually sent. If
you have specified a completion routine, it is then called.
Sending a Message From the Mac OS 4
To send a message on the Mac OS, build a MsgPBlk data structure and then pass the
pointer to the interface driver in an rsSendMessage control call.
The MsgPBlk data structure for applications on the Mac OS has the following format:
Parameter block
—> indicates input to the driver
<— indicates output from the driver
Your completion routine is called at deferred time and can use registers D0–D2 and
A0–A2. You must save all other registers. Upon return, A0 contains a pointer to the
MsgPBlk structure.
MsgPBlk RECORD 0
msgQLink DS.1 1 ; Next queue element
msgQType DS.w 1 ; Queue flag
msgCmd DS.w 1 ; The message type or command
msgParam1 DS.1 1 ; Message parameter 1
msgParam2 DS.1 1 ; Message parameter 2
msgBuffer DS.1 1 ; Pointer to the message data buffer
msgReqCount DS.1 1 ; Requested data length
msgActCount DS.1 1 ; Actual data length
msgCompletion DS.1 1 ; Pointer to completion routine or
NULL
msgResult DS.w 1 ; The result of any message operation
msgFlags DS.w 1 ; Message flags (Swap, and Shared);
set to zero!
msgUserData DS.1 1 ; For the caller’s use
MsgPBlkcSize Equ * ; Size of record
ENDR
—> ioCompletion long Pointer to the completion routine.
<— ioResult word Device driver’s result code.
—> ioRefNum word Device driver’s reference number.
—> csCode word Equals rsSendMessage.
—> csParam+0 long Pointer to MsgBlk.