Difference between revisions of "VDU 21"

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

Revision as of 01:13, 8 March 2015

Disables the screen drivers, or erases the current line of input.

VDU 21
Syntax VDU 21
Keyboard equivalent CTRL U
Character stream (hex) 15
Description When NAK is sent to OSWRCH, it prevents subsequent characters affecting the display.
When CTRL U is typed during OSWORD &00, the current line of input is reset to the empty string.

Description

Disable display drivers

VDU 21 disables the display drivers. The screen is not blanked, but characters printed from this point onward do not appear on the screen. They may still go to the printer or other enabled output devices. This is often used to hide passwords as they are typed.

In this state the VDU 2 printer feed remains active or inactive, but cannot be toggled.

While the display is turned off with VDU 21, VDUCHR continues to parse incoming VDU sequences. The only commands still acted upon are VDU 1 and VDU 6; all others are discarded. As usual if a stream of binary characters is printed, it may create a VDU sequence (a queue) that must be cleared with nine NULs before issuing the next command.

Under MOS 1.20 while the display has been disabled in this way, characters 8 to 13 (including newlines and carriage returns) will be sent to the printer regardless of VDU 2/3 state, and VDU 1,n will send two copies of n to the printer. See VDUCHR.

To re-enable the display, use VDU 6.

This mechanism is separate from OSBYTE &03, which can disable the display by blocking the flow of characters to VDUCHR.

Erase current line of input

The other function of code 21, to erase the current line of input, is a feature of OSWORD &00. While the computer is waiting for a command, or a line of INPUT to be completed, pressing CTRL U makes it 'forget' all the characters typed so far so that the user can start again. This key binding probably originated from Unix.

During INKEY($) and GET($) the code has no effect and is returned to the program like any other character.

The code can be inserted into the keyboard buffer with OSBYTE &8A and will clear the INPUT line, but it is better to use the dedicated buffer flushing commands OSBYTE &0F or OSBYTE &15.

A CTRL U keypress does not turn off the display, unless a program indiscriminately prints the result of INKEY($) or GET($).

-- beardo 00:15, 24 September 2007 (BST)