Re: Analog Gamepads




Richard Cooper wrote:
[snip]
> To investigate the problem, I used a program that displays a little dot on
> the screen showing where the joystick is pointed at, something like this:
[snip]
> I set up the program to leave points drawn where the stick has been, and
> then tried to draw a box in the upper-right corner. This is what I ended
> up with:

Did you write ASM code?? If so, why didn't you post it? :)

Under DOS, I believe INT 15 is our friend. Help PC shows this info:

:int 15,84
^INT 15,84 - Joy-Stick Support


AH = 84h
DX = 0 to read the current switch settings
= 1 to read the ~joystick~ position (resistive inputs)


on return (DX=0, read switch setting):
CF = 0 if successful
= 1 if error
AH = 80h error code if CF set on PC
= 86h error code if CF set on XT before 11/8/82
AL = switch settings in bits 7-4 (if read switch function)

on return (DX=1, read joystick position):
AX = A(X)
BX = A(Y)
CX = B(X)
DX = B(Y)

And RBIL has this:

INT 15 - BIOS - JOYSTICK SUPPORT (XT after 1982/11/8,AT,XT286,PS)
AH = 84h
DX = subfunction
0000h read joystick switches
Return: AL bits 7-4 = switch settings
0001h read positions of joysticks
Return: AX = X position of joystick A
BX = Y position of joystick A
CX = X position of joystick B
DX = Y position of joystick B
Return: CF set on error
AH = status (see #00496)
CF clear if successful
Notes: if no game port is installed, subfunction 0000h returns AL=00h
(all
switches open) and subfunction 0001h returns AX=BX=CX=DX=0000h
a 250kOhm joystick typically returns 0000h-01A0h
SeeAlso: AH=84h"V20-XT-BIOS"

----------P0200020F--------------------------
PORT 0200-020F - Game port reserved I/O address space
0200-0207 - Game port, eight identical addresses on some boards

0201 R- read joystick position and status (see #P0542)
0201 -W fire joystick's four one-shots
0201 RW gameport on mc-soundmachine, mc 03-04/1992: Adlib-compatible,
Covox 'voice master' & 'speech thing' compatible soundcard.
(enabled if bit1=1 in PORT 038Fh. Because it is disabled on
power-on, it cannot be found by BIOS) (see PORT 0388h-038Fh)

Bitfields for joystick position and status:
Bit(s) Description (Table P0542)
7 status B joystick button 2 / D paddle button
6 status B joystick button 1 / C paddle button
5 status A joystick button 2 / B paddle button
4 status A joystick button 1 / A paddle button
3 B joystick Y coordinate / D paddle coordinate
2 B joystick X coordinate / C paddle coordinate
1 A joystick Y coordinate / B paddle coordinate
0 A joystick X coordinate / A paddle coordinate

Under Windows, we have the DirectInput API:

joyConfigChanged
joyGetDevCaps
joyGetNumDevs
joyGetPos
joyGetPosEx
joyGetThreshold
joyReleaseCapture
joySetCapture
joySetThreshold

>>From my experience, not every joystick works with every game. There
seems to be so much deviation in the construction that your game will
only work with 1 out of the 5 different types that you try.

Nathan.

.