To handle events the transputer starts an event handling routine (in OCCAM a piece of code starting with the line: event ? any). In the event handling routine the source(s) of the event(s) are determined by reading Statusregister 0 or 1.
The event flags should be reset and the events should be handled one at a time. The handling of events continues in this fashion until all event flags are found to be inactive, then the transputer leaves the event routine.
It is recommended to reset the event flag first and then to handle the particular event. If a new event from the same source arrives while the flag is NOT reset yet and the previous event is handled this new event might be lost when the flag is reset. Thus the chances of loosing events is decreased when the flag is reset immediately.
After handling the event the Statusregister MUST be read again, because the transputer may not exit from the event routine when there are pending events, i.e. the transputer may only leave the event routine when zero has been read from the event Statusregister.
The transputer will not be able to enter the event routine again if it leaves the routine without having read the event Statusregister being zero.
While handling a previous event a new event may have arrived (of the same type or a different type). By reading the event Statusregister after each handled event the user/programmer can easily implement an event priority scheme.
If VME interrupts are active at the time the transputer is booted the intl event flag in Statusregister 0 is set and because the transputer's EventIn input is reset when the transputer is booted it will not recognize the event and will not be able to enter the event routine at all.
If this situation can occur the user must initialize the 2TP-VME by checking the event-Statusregister for VME interrupts outside any event routine, acknowledge the VME interrupt if necessary, and reset the intl flag. These steps should be repeated until the intl flag is inactive.
In case there is some special reason the user wants to know the event sources before the actual event handling routine is called: it is allowed to read Statusregister 0 or 1 to determine event sources before an event handling routine is started.
See Appendix B for a template for an event handling routine (in OCCAM) implementing an event priority scheme.