343 VDU Purpose The statement VDU is followed by one or more numbers and the ASCII characters corresponding to these numbers are sent to the screen. The function CHR$ can generate a single ASCII character from a given number. This character can be added to a string or printed. VDU on the other hand is used to generate a sequence of numbers that are then sent to the VDU drivers. VDU provides an easy way of sending, for example, control characters to the VDU drivers. See chapter 34 for a detailed list of the VDU control codes. Two examples will make the purpose of this statement clearer: when defining the text area of the screen four bytes have to follow the VDU 28 statement.
These four bytes represent the left X, bottom Y, right X and top Y coordinates of the text area. In MODE 4 the range of X is 0-39 and of Y is 0-31. Thus would define a six line text window at the top of the screen. If a different MODE is selected then the maximum screen width may be either 19, 39 or 79. VDU 28,0,5,39,0 The graphics area of the screen, on the other hand, uses coordinates up to 1279 points horizontally. Thus when defining the graphics area double byte numbers must be sent to the VDU drivers since the largest number that can be sent as a single byte is 255. VDU 24,0;0;1279;830 will define a graphics area at the bottom of the screen and 830 points high.
Each of the four coordinates is sent as a double byte pair. Note that the graphics origin is bottom left while the text origin is top left and that the graphics screen is always 1280 by 1024 regardless of MODE . VDU is equivalent to PRINT CHR$; except that it does not change the value of COUNT . Examples VDU 14 Turn auto-paging mode on. VDU 15 Turn auto-paging mode off. VDU 2 Turn printer on.