QBasic 1.1: ON COM Statement

Syntax

COM(n%) ON
COM(n%) OFF
COM(n%) STOP
ON COM(n%) GOSUB line

Description / Parameter(s)

n% The number of a COM (serial) port (1 or 2).
COM(n%) ON Enables trapping of a communications event.
COM(n%) OFF Disables communications event trapping.
COM(n%) STOP Suspends communications event trapping. Events are processed once event trapping is enabled by COM ON.
line The label or number of the first line of the event-trapping subroutine.

Example

COM(1) ON 'Enable event trapping on port 1. ON COM(1) GOSUB ComHandler DO : LOOP WHILE INKEY$ = "" COM(1) OFF END ComHandler: PRINT "Something was typed at the terminal attached to COM1." RETURN