AT&T 6300 Programmer's Manual page 364

Gwbasic by microsoft
Hide thumbs Also See for 6300:
Table of Contents

Advertisement

ON COM(n) GOSUB
Statement
Remarks
Example
7-208
To avoid recursive traps a COM(n) STOP is
automatically executed when the trap occurs.
A RETURN from the trap routine
automatically performs a COM(n) ON (unless
a COM(n) OFF was performed within the trap
routine). The RETURN line form may also be
used. Use this form with care because any
other active GOSUB, WHILEs, or FORs
remain active and errors (such as "FOR
without NEXT") may result.
Typically, the COM trap routine reads an
entire message from the COM port before
returning. Do not use the COM trap for single
character messages since, at high baud rates,
the overhead of trapping and reading for each
individual character may cause the COM
interrupt buffer to overflow.
This example sets up a trap routine for the
second communications channel at line 1000.
When a communications event is trapped,
program flow branches to the subroutine
defined by the ON COM(n) GOSUB statement.
100 ON COM(2) GOSUB 1000
110 COM(2) ON
: : 1000 REM COM
activity
: 1050 RETURN 200

Advertisement

Table of Contents
loading

Table of Contents