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

System Specification for C65Fred BowenMarch 1, 1991

INSTR - Get the location of one string inside another string

    INSTR (string_1, string_2 [,starting_position])

This function searches for the first occurrence of string 2 in string 1 and returns its location. A value of zero (0) ii returned if no match is found, if either string is null (empty), or if string__2 is longer than string_1.

If the starting_position is given, the search begins at that location, otherwise the search begins at the first character of string_1.

The strings can be literals, variables, or string expressions.

    X = INSTR("123456","4")     Result is X=4
    X = INSTR("123456","X")     Result is X=0
    X = INSTR("123123","2")     Result is X=2
    X = INSTR("123123","2",3)   Result is X=5

INT - Greatest integer function

    INT (expression)

This function returns the greatest integer less than or equal to the numeric expression.

    X = INT( .123)              Result is X= 0
    X = INT(-.123)              Result is X= -1
    X = INT( 123.456)           Result is X= 123
    X = INT(-123.456)           Result is X=-124

JOY - Joystick function

    JOY (port)

This function returns the staie of a joystick controller in the specified port.

When port=1 returns position of joystick 1 When port=2 returns position of joystick 2

The value returned is encoded as follows:

    Fire = 128 +                        1
    
                                     8      2
    
                                  7     0      3
    
                                     6      4
    
                                        5

A value of zero (0) means that the joystick is not being manipulated. A value of 128 or more means that the fire button is being pressed. The possible vales returned are:

    0   No activity             128 fire
    1   up                      129 fire + up
    2   up + right              130 fire + up + right
    3   right                   131 fire + right
    4   right + down            132 fire + right + down
    5   down                    133 fire + down
    6   down + left             134 fire + down + left
    7   left                    135 fire + left
    8   left + up               136 fire + left + up


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