These routines read the current positions of the two joysticks. The joystick enable flags (C81F-C822) must be initialized to one of the following values:
0 - ignore; return no value.
1 - return state of console 1 left/right position.
3 - return state of console 1 up/down position.
5 - return state of console 2 left/right position.
7 - return state of console 2 up/down position.
The joystick values are returned in $C81B-$C81E, where the value returned in $C81B corresponds to the mask set in in $C81F, and so on and so forth.
The joystick conversion is dependent on which routine is called. Results for each routine are:
The return value will be:
< 0 if joystick is left of down of center.
= 0 if joystick is centered.
> 0 if joystick is right or up of center.
A successive approximation algorithm is used to read the actual value of the joystick pot, a signed value. In this case, $C81A must be set to a power of 2, to to control conversion resolution; 0x80 is least accurate, and 0x00is most accurate.
DP = $D0
D-reg, X-reg trashed