[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]

System Specification for C65Fred BowenMarch 1, 1991

HEX$ - Hexadecimal value function

    HEX$ (decimal_expression)

This function returns a 4-character string that represents the hexadecimal value of the numeric decimal expression. The expression must be in the range (0-65535, $0000-$FFFF hex) or an 'ILLEGAL QUANTITY' error is reported.

        PRINT HEX$(10)              The string "000A" is printed.
        PRINT RIGHT$(HEX$(10),2)    The string "0A" is printed.

HIGHLIGHT - Set the text highlight color of the display

    HIGHLIGHT color

Sets the highlight color to the given color index. The color value must be in the range (0-15). See the Color Table. COLOR must be ON (see the COLOR command). The highlight color is used in HELP messages and FIND/CHANGE strings.

IF/THEN/GOTO/ELSE - Conditional program execution

    IF expression <GOTO line | THEN then clause> [:ELSE else clause]

IF ... THEN lets the computer analyze a BASIC expression preceded by IF and take one of two possible courses of action. If the expression is true, the statement following THEN is executed. This expression can be any BASIC statement. If the expression is false, the program goes directly to the next line, unless an ELSE clause is present. The ELSE clause, if present, must be in the same line as the IF-THEN part. When an ELSE clause is present, it is executed when the THEN clause isn't executed. In other words, the ELSE clause executes when the expression is FALSE. See BEGIN/BEND to spread the IF statement out over several lines. An ELSE statement is matched to the closest THEN statement in the case of nested IF/THEN statements. The expression being evaluated may be a variable or formula, in which case it is considered true if nonzero, and false if zero. Usually expressions involve relational operators =, <, >, <=, >=, <>.

    50 IF X>0 THEN PRINT 'X>0': ELSE PRINT 'X<=0'

If X is greater than 0, the THEN clause is executed, and the ELSE clause isn't. If X is less than or equal to 0, the ELSE clause is executed and the THEN clause isn't.

INPUT - Get input from the keyboard

    [LINE] INPUT ["prompt"<,j;>] variable_list

The INPUT statement pauses the BASIC program, prints the prompt string if present, prints a question mark and a space, and waits for data to be typed by the user, terminated by a return character. if the prompt string ends with a comma instead of a semicolon, a question mark and space is not printed.

Input is gathered and assigned to variables in the variable list. The type of variable must match the type of input typed or i 'TYPE MISMATCH' error is reported. Separate data items typed by the user must be separated with commas. String data with imbedded spaces or commas must be surrounded with quotas. If insufficent data to satisfy the variable_list is typed, two question marks are displayed by the computer to prompt for additional data to be input. If the computer does not understand the input (such as the user typing cursor up or down keys) the computer responds with the message 'REDO FROM START?' and waits for acceptable data to be entered. Input is limited to 160 characters (two screen lines in 80-column mode), which is the size of the input buffer.


[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated August 11, 2003.