Skip to content

ESCOFF

Escape Trapping Off

This directive disables program escape trapping specified by the SETESC directive. After ESCOFF is executed, a SETESC directive successfully sets the program line number or label for an Escape key, but pressing the Escape key interrupts program execution rather than branch to that line number. The ESCON directive enables program escape trapping and reverses the effects of ESCOFF.

ESCOFF

The primary use of this directive is to enable a developer to debug programs that trap escapes. This is normally not found in the program code itself, but is used in Thoroughbred Basic Console Mode just prior to execution of a program so that the Escape key can be used to interrupt program execution for debugging purposes.

00100 BEGIN
00110 SETTRACE
00120 SETESC 01000
00130 ESCOFF
00140 WAIT 100; REM "Press Escape key"
00150 ESCON
00160 WAIT 100; REM "Press Escape key again"
00200 ESCOFF
00210 SETESC 02000
00220 ESCON
00230 WAIT 100; REM "Press Escape key one more time"
01000 PRINT "Escape trapped at 01000"
01010 GOTO 00200
02000 PRINT "Escape trapped at 02000"

shows how this directive functions:

  1. Pressing the Escape key when line 00140 lists to the screen causes a program interruption and places you in Thoroughbred Basic Console Mode even though line 00120 contains a SETESC directive.
  2. Type RUN and press the Enter key. The program continues at line 00150, where the ESCON directive turns on Escape key processing.
  3. Pressing the Escape key when line 00160 lists to the screen causes the program to branch to 01000, indicating that the SETESC is once again active and that the ESCOFF directive did not change the program line number or label set by the SETESC directive.
  4. Pressing the Escape key when line 00230 lists to the screen causes a branch to 02000, indicating that the SETESC directive at line 00210 (executed after the ESCOFF at line 00200) is still able to change the program line number or label for Escape key processing.

ESCON and SETESC directives

From the Thoroughbred Basic Language Reference, Volume I: A–E, version 8.9.1. Open this page in the PDF