Stable Joystick routine for Qbasic 4.5? 
Author Message
 Stable Joystick routine for Qbasic 4.5?

: If I use the Stick(n) commands from Qbasic I get very unstable readings in
: the higher regions of the joystick values.I know it is not my joystick

: Is there a better way to do this? I was thinking of a routine that will
: trigger the monostables at address 0x201 in bios like they do in C/C++. This
: way I can send a trigger when I want to take a reading. Any routine or LIB
: file for Qbasic that can do it for me? Or can anybody tell me how I can
: read/write to address 0x201 with Qbasic?

Hi,
You'll find Phillip's routine in MISC.ABC in abc97mm.zip :)
Alright, here I'll save you the trouble:

SUB FastJoy (JoyX%, JoyY%, JoyNum%)
' Fast joystick routines by Phillip Jay Cohen

' JoyX% returns vertical postion of specified joystick
' JoyY% returns horizontal postion of specified joystick
' JoyNum% specifies whether joystick number one or two is to be read

SELECT CASE JoyNum% ' Choose appropriate bitmasks
CASE 1
XMask% = 1
YMask% = 2
CASE 2
XMask% = 4
YMask% = 8
CASE ELSE
EXIT SUB
END SELECT
JoyX% = 1: JoyY% = 1
OUT &H201, 0 ' Reset joystick port
DO
  Joy% = INP(&H201) ' Poll joystick port
  IF Joy% AND XMask% THEN JoyX% = JoyX% + 1
  IF Joy% AND YMask% THEN JoyY% = JoyY% + 1
LOOP UNTIL (Joy% AND XMask%) = 0 AND (Joy% AND YMask%) = 0
END SUB

--
William Yu
http://www.*-*-*.com/ ~voxel/



Sun, 17 Dec 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Qbasic 4.5 vs Qbasic 7.1PDS

2. Looking on information for Qbasic and Qbasic 4.5!

3. Writing ASSEMBLY routines for QB 4.5

4. Qbasic 4.5: Get Filename from Directory

5. Incorporating non-QBasic graphics into QB 4.5 programs

6. QBasic 4.5

7. QBasic 4.5 Subs

8. QBasic 4.5

9. QBasic 4.5 LIBS

10. Qbasic 4.5 Help

11. How to read and write an ini file with Qbasic 4.5

12. Accessing database files from QBasic 4.5, Visual Basic for DOS

 

 
Powered by phpBB® Forum Software