Polling Routine

The POLL.ASM assembly language file contains a single routine, Poll, that interrogates the joystick for button press and coordinate information. Poll sets four global variables, wXpos, wYpos, wZpos, and wButtons to the coordinate and button values. The Poll function either polls the x and y axes or polls the z axis; for a three-dimensional joystick, IBMJOY.C calls Poll twice.

The Poll function is defined as follows:

extern UINT PASCAL Poll(UINT id, int zOnly)
 

The id parameter identifies the joystick number. The zOnly parameter identifies whether the z axis is being polled and if so, which axis of the second joystick interface is acting as the z axis. The zOnly parameter has one of the following values:

Value Description
0 Poll x and y axes
-1 Poll z axis using the x axis of the second joystick interface
1 Poll z axis using the y axis of the second joystick interface