Reviewed and revised April 2024
xcall COMMON, send, msgnam, var
xcall COMMON, recv, msgnam, var
COMMON 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 (Bitmap 1) [in]
must be mapped as shown above. As the names imply, send is used for sending a packet and recv for receiving one.
recv (Structure) [in]
must be mapped as shown above. As the names imply, send is used for sending a packet and recv for receiving one.
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 (BLOB)
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).