Application Tasks
K
A
DAK
37
AMX uses message envelopes for parameter transmission. AMX gets a free envelope,
moves the caller's message parameters into it and adds the envelope to the task mailbox
or message exchange message queue.
If the sender requested to wait, AMX inserts information into the envelope which allows
AMX to remember that the sending task has been suspended waiting for
acknowledgement of the receipt of its message by some other task.
Note that when AMX returns from a call to send a message, the memory occupied by the
caller's message is available for reuse by the caller.
Note
AMX always copies MAXMSZ bytes from the sender's
message into the envelope. MAXMSZ is defined in your
AMX System Configuration Module and is >= 12.
Hence, the transmitted message will always be MAXMSZ
bytes in length even if your message is a single integer.
For assembly language programmers, procedure AASEND is used to send a message to a
task and to wait if desired.
USER_CODE SEGMENT BYTE 'CODE'
;ASSUME CS:USER_CODE
;
MSGA DB ? ;m1
DB ? ;m2
DW ? ;m3
DD ? ;m4
;
MSGAD DD MSGA ;pointer to MSGA
TASKID DW ? ;taskid
;
USERPROC PROC FAR
LES BX,CS:MSGAD ;ES:BX = A(MSGA)
MOV DX,CS:TASKID ;DX = task id
MOV CH,0 ;CH = 0 (no wait)
; ;CH = 80H (wait)
MOV CL,2 ;CL = priority (0,1,2 or 3)
CALL AASEND ;send the message
RET
;
USERPROC ENDP
;
USER_CODE ENDS