Contents / Reference section / BASIC keywords / Previous letter / Next letter / Index
This function takes a string which contains a number and produces the number. In other words it can convert a number represented by a string (eg A$="+24" ) into the number.
The string must start with a plus (+) or minus ( - ) sign or a number. If not then the function will return zero.
The opposite function is performed by STR$.
450 x=VAL (length$)
1560 date=VAL(DATE$)
A function which converts a character string representing a number into numeric form. If the argument is not a signed unary constant then zero will be returned.
<num-var>=VAL(<string>)
STR$
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 page 379 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 co-ordinates of the text area. The range of X is 0-39 and of Y is 0-31 in MODE 4. Thus
VDU 28 0,5,39,0
would define a 6 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.
The graphics area of the screen, on the other hand, uses co-ordinates 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 co-ordinates is sent as a double byte pair. Note that the graphics origin is bottom left whereas 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.
VDU 14 turn "auto-paging mode" on
VDU 15 turn "auto-paging mode" off
VDU 2 turn printer on
A statement which takes a list of numeric arguments and sends them to the operating system output character routine (OSWRCH). If the arguments are separated by commas then single bytes are sent. If any argument is followed by a semi-colon then that argument will be sent as two bytes. The Least Significant Byte will be sent first, followed by the Most Significant Byte. This is the order required by the VDU drivers.
VDU <numeric>{,|;<numeric>}[;]
CHR$
VPOS | vertical position of the cursor |
VPOS is used to find the vertical position of the text cursor on the screen.
670 V=VPOS
100 PRINT VPOS
A function returning the vertical position of the text cursor.
<num-var>=VPOS
POS
WIDTH is used to set the overall "page width" that the computer uses. Initially this is set to zero which the interpreter interprets as "unlimited width".
WIDTH n will cause the interpreter to force a new line after n characters have been printed by the PRINT statement.
WIDTH also affects all output to the printer.
670 WIDTH 60
WIDTH 35
A statement controlling the overall output field width. It is initally set to zero which disables auto newlines.
WIDTH <numeric>
COUNT