Chapter 7 - OS Control Characters

Screen Editor

Five keys on the ASCII keyboard allow cursor movement and editing anywhere on the VDU screen. These are

Control A	-	cursor left
Control S	-	cursor right
Control W	-	cursor up
Control Z	-	cursor down
Control Q	-	read character

Pressing the control key and the A, S, W or Z keys move the cursor around the screen but do not send any new characters down the input channel.

Once the cursor is positioned over the desired character, this character may be sent down the input channel using control Q, the cursor is then moved one space to the right automatically.

For example, suppose it is required to edit a BASIC line:

LIST
10	REM EXAMPLE
20	FOR I = 0 TO 50
30	PRINT "ORANGES AND LEMONS"
40	NEXT I
50	END
>

After listing the program the screen is as above with the cursor at the bottom following the BASIC prompt.

First move the cursor to the start of the line to be edited using control A, S, W and Z :

LIST
10	REM EXAMPLE
20	FOR I = 0 TO 60
30	PRINT "ORANGES AND LEMONS"
40	NEXT I
50	END
Now use control Q to re-enter the line number and first part of line 30:
LIST
10
20
30 PRINT "ORANGES AND LEMONS"
40
50
Next the new output required is typed:
LIST
10
20
30 PRINT "APPLE OR PLUM "MONS"
40
50

And as no more of the old line is required the return key is now pressed and the program may be listed again.

Printer and Screen Control

The following ASCII control characters affect the VDU screen when they are output. They are listed together with their keyboard key and decimal value. The operating system also provides for a printer which may be connected using an extra interface card. Control characters for this printer stream are also listed:

STX (ctrl B, 2)	Start Printer

This starts the printer output stream but is not sent out to the printer. It also sets alphanumerics green on the VDU.

ETX (ctrl C, 3)	End Printer
This ends printer output stream.  It also sets alphanumerics yellow on the VDU.
ACK (ctrl F, 6)	Start Screen

This starts the output stream to the VDU screen, which is the normal condition initially set by the COS.

BS (ctrl H, 8) Cursor Back

This moves the cursor back one character position

HT (ctrl I, 9) Cursor Forward

This moves the cursor forward one character position

LF (ctrl J, 10) Line Feed

This moves the cursor down one line.

VT (ctrl K, 11) Vertical Tab

This moves the cursor up one line.

FF (ctrl L, 12)	Form Feed

This clears the screen and moves the cursor to the top left hand corner.

CR (ctrl M, 13)	Carriage Return

This moves the cursor to the start of the current line.

NAK (ctrl U, 21)	End Screen

This ends the output stream to the VDU.

RS (ctrl ^, 30)	Home Cursor

This moves the cursor to the top left hand corner of the screen.

DEL (DEL, 127)	Delete

This backspaces the cursor and deletes the character at that position.

Printers connected to the system printer port will often respond to other control characters in the output stream so refer to the relevant printer manual. Note that some of these other control characters may produce a response on the VDU if its output stream is enabled.

Because some printers will initiate the printing of a line in response to either a carriage return or a line feed character in the output stream the operating system prevents the character specified by location 254 in zero page from reaching the printer. This character is initialised on reset to be a line feed but it may be changed by altering the contents of location 254. Thus it is possible to stop any one character from being printed but note that if neither line feed nor carriage return are specified some printers will do a double line feed after printing.