ON COM defines a routine to be executed when data is received into the communications buffer.
ON COM GOSUB line number
10 ON COM GOSUB 100 20 COM ON 100 'SUBROUTINE TO READ 110 'INCOMING DATA 190 RETURN
This statement is used in conjunction with the COM statement. It tells Basic where to jump to in the event of a communications interrupt.
Data may be left in the communications buffer for as long as is necessary.
On an interrupt an automatic
COM STOP is executed so interrupts are
never nested. The RETURN from the trap routine performs
COM ON, so re-activating the interrupt routine, unless
COM OFF statement was executed before the RETURN.