mirror of
https://github.com/RevCurtisP/C02.git
synced 2024-11-30 23:50:04 +00:00
35377b5807
commit ed00e1d1b5a9783a72dade3f3676b161a9cfe287 Author: Curtis F Kaylor <revcurtis@gmail.com> Date: Sun Sep 9 22:20:49 2018 -0400 Documented joystk, paddle, and lgtpen modules commit ec0a5ede8d1b043fcf0094ea653255a808dbf8d3 Author: Curtis F Kaylor <revcurtis@gmail.com> Date: Sun Sep 9 20:31:11 2018 -0400 Added joystick, paddle, and lightpen test programs commit 7b787f432e2f4f7ae5d7f0053ade1d3586a4fad1 Author: Curtis F Kaylor <revcurtis@gmail.com> Date: Sun Sep 9 20:30:03 2018 -0400 Updated Apple II and VIC-20 Batch Files commit 50568294349d7e3c6b7d0d364aeaece73c9e4ab6 Author: Curtis F Kaylor <revcurtis@gmail.com> Date: Sun Sep 9 20:28:09 2018 -0400 Separated light pen code into separate files commit d45e59f73d55eef1d30c591d19a043ad79cfd81a Author: Curtis F Kaylor <revcurtis@gmail.com> Date: Sun Sep 9 19:28:56 2018 -0400 Moved code for paddles into separate include files commit fc5c5472d758c960332ea14105d5ec4a7c8cbbfb Author: Curtis F Kaylor <revcurtis@gmail.com> Date: Sun Sep 9 16:15:32 2018 -0400 Added system specific module 'joystk'
74 lines
3.5 KiB
Plaintext
74 lines
3.5 KiB
Plaintext
Joystick Functions for C02 Programs
|
|
|
|
This module contains constants and a function for reading paddles and
|
|
analog joysticks. It can also be used with devices that emulate paddles,
|
|
such as the Koala Pad and some mice.
|
|
|
|
The constants and assembly code vary by system, so when invoking the
|
|
cross-compilers, the command line option -s must be used to ensure that
|
|
the correct header files are included.
|
|
|
|
At the beginning of the program use the directives
|
|
|
|
#include <paddle.h02>
|
|
|
|
The following constants are defined:
|
|
|
|
#PADDLS Maximum number of joysticks supported by system.
|
|
|
|
#BUTTNS Maximum number of paddle buttons supported by system.
|
|
|
|
For systems with no paddle support, both of these
|
|
will be 0
|
|
|
|
The following functions are defined:
|
|
|
|
p = paddle(n); Returns the current state of paddle n, the first
|
|
paddle having the number 0.
|
|
|
|
If n is greater than or equal to #PADDLS then 0
|
|
will be returned. Otherwise, a byte between 0 and
|
|
$FF representing the current paddle position will
|
|
be returned.
|
|
|
|
b = button(n); Returns the current state of button n, the first
|
|
paddle having the number 0. This number may or may
|
|
not correspond to a particular paddle number.
|
|
|
|
If n is greater than or equal to #BUTTNS then 0
|
|
will be returned. Otherwise, the number 255 (TRUE)
|
|
will be returned if the button is depressed, while
|
|
the number 0 (FALSE) will be returned if it is not.
|
|
|
|
System Specific Notes:
|
|
|
|
Atari Style Paddles These are used on Atari and Commodore 8-bit systems.
|
|
The paddles are grouped in pairs. Therefore, the
|
|
paddles in the first controller port will be
|
|
numbered 0 and 1, the paddles in the second port
|
|
will be numbered 2 and 3, and so on. The button
|
|
numbers directly correspond with the paddle numbers.
|
|
|
|
When using a Koala Pad, mouse in paddle emulation
|
|
mode, or similar device, two calls to the paddle()
|
|
and/or button() functions must be made. Using the
|
|
even paddle number (0 or 2) returns the horizontal
|
|
value, while the odd paddle number (1 or 3) returns
|
|
the vertical value. Likewise, using the even button
|
|
number reads the left button, while the odd button
|
|
reads the right button.
|
|
|
|
Apple II When using paddle controllers, the first paddle
|
|
and its button are both numbered 0 while the second
|
|
paddle and its button are both numbered 1.
|
|
|
|
When using joystick controllers, the first joystick's
|
|
horizontal and vertical positions are read using
|
|
paddle(0) and paddle(1) respectively, and its button
|
|
is read using button(0), while the second joystick's
|
|
horizontal and vertical positions are read using
|
|
paddle(2) and paddle(3) respectively, and its button
|
|
is read using button(1)
|
|
|
|
Note: This library has no external dependencies.
|