| 22. POPCMD May Cause Crash | Index |
Modules Affected
GP 1.0 Build 11 and earlier, Moto 1.0 Build 3 and earlier.
Problem
If a module uses the POPCMD operand within a TEA program to send a command to itself, the command queue may become corrupted and crash the module. This bug is most likely to occur in multi-tasking applications that use the "aMulti.tea" library.
Using POPCMD to send a message to a different module bypasses the command queue and should be considered a safe operation.
Work-Around
Use a combination of TEA and reflexes when a module must send commands to itself. Reflexes queue commands differently than POPCMD and are not susceptible to this bug.
A TEA program can launch a reflex by writing to a raw input port (0x0300-0x037F). If one TEA program must launch another, it can do so by launching a reflex that issues a cmdVM_RUN command with an appropriate file ID and process ID. If one TEA program must kill another, it can do so by launching a reflex that issues a cmdVM_KILL command with an appropriate process ID.
Limited parameter passing is possible with raw inputs. Additional parameters may be passed via the scratchpad. If the reflex counters are not in use, they may also be used for parameter passing and common data.