COMMON

xcall COMMON, send, msgnam, var

xcall COMMON, recv, msgnam, var

COMMON.SBR is a widely used (and widely modified) routine for sending a block of data from one program to another.

Parameters

MAP1 SEND,B,1,0

MAP1 RECV

MAP2 F'RCV,B,1,1

MAP2 RCVFLG,B,1,0

 

send, recv

must be mapped as shown above. As the names imply, send is used for sending a packet and recv for receiving one.

rcvflg  [out]

will be returned as 0 if the requested packet is not found, else it will be set to a non-zero value.

msgnam  (String, up to 6 characters)  [in]

specifies the name of the packet. This is how packets are identified if more than one is being stored at the same time.

var  (Raw)

supplies the data to send or returns the received data. Do not use a dynamic variable (X,0) variable.

Comments

Under AMOS, normal usage requires that you load COMMON into user memory, since it stores the data within itself. COMMON does not exist as a separate module under A-Shell; however, the command line .LOAD BAS:COMMON will have the same effect as under AMOS, in that all COMMON packets will be cleared.

The default packet set-up is 6 packets of 150 bytes. This may be changed by adding, for example, the following line to miame.ini:

SBR=MSGNUM:4,MSGSIZ:1024

This would decrease the number of packets to 4, with a size of 1024 bytes each. More information is given in the documentation for miame.ini.

As with the original version of COMMON, a read operation is destructive. That is, the packet is cleared upon reading it. Thus, if you want to read the packet and then pass it on to another program, you have to rewrite it after reading. Some people use a modified version of COMMON which has a non-destructive read. To support this variation, add SBR=COMMONNDR to your MIAME configuration file (the NDR stands for Non Destructive Read).