Difference between revisions of "VDU 27"

From BeebWiki
Jump to: navigation, search
m
 
m (1 revision)
(No difference)

Revision as of 23:58, 28 August 2013

The escape character.

VDU 27
Syntax VDU 27
Keyboard equivalent ESCAPE or CTRL [
Character stream (hex) 1B
Description Does nothing when sent to OSWRCH; causes an Escape error when typed.

Description

As output

VDU 27 prints the ASCII character ESC. It does nothing on the BBC Micro (equivalent to NUL) but begins an escape sequence which is recognised by ANSI terminals and many printers. (To ensure that the escape sequence is not corrupted en route to the printer see VDU 1 or OSBYTE &03.)

As input

On BBC series machines the ESCAPE key is a signal that the user wants control of the machine, to interrupt the current process and/or enter another command.

When the ESCAPE key is pressed, code 27 is inserted into the keyboard buffer. MOS-based input routines recognise this code and exit prematurely, setting the escape condition flag. The Escape error is not raised until OSBYTE &7E is called by the program requesting input (the MOS does this automatically during INPUT.) From time to time a machine code program may also poll OSBYTE &7E to see if ESCAPE has been pressed and thus interrupt the program at this point (again, BASIC does this automatically.)

An incoming ESC from the serial port can also generate an escape condition, see OSBYTE &B5.

The character that causes an escape condition can be changed from ESC, with OSBYTE &E5.

-- beardo 00:26, 8 November 2007 (UTC)