Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Original Challenge: *FAST* Joystick Library for QB!! ;*) !
#11
15 pins, and since the PC gameport is designed for analog joysticks, there's more to it than that:

Quote:1. Normally on idle state the capacitor C1 is fully charged (5V) and multivibator output gives out logic 1.
2. Computer writes to I/O address 201h to reset the multivibrators. The multivibrator get a triggger pulse from I/O write signal and it discharged capacitor C1. The multivibrator output goes to logic 0 because the capacitor is discharged (0V).
2. The capacitor starts to charge form the current which goes through R1 and the joystick potentiometer.
3. When the capacitor voltage reaches certain oltage threshold level, the multivibrator output goes back to logic 1.
The bigger the potentiometer resistance value is, the loger it takes from the capacitor to reach the threshold voltage. The time how long it take for each multivibator to reach the logic 1 after the triggering is measued using software and that value tells the resistance of the potentiometer (and the stick position as well because the potentiometer is connected to the stick). This simple method for measuring the resistance value is quite cheap, but not very accurate.
This simple joystick port hardware implementation (originally designed for 4.7 MHz IBM PC) causes many headaches to game programmers (problems of different computer speeds, joycitck port differences, problems in multitasking operating systems etc.). Big tolerances in joysticks and joystick ports mean that the every game must have an option to cablibrate the joystick (which actually means that the program adapts to accept the values in th range which the joystick reading routine does and then converts the values to it's internal format using the values measured in joystick calibration process).
Reply
#12
To Plasma357:

As for what you wrote, which was:

______________________________________________
1. Normally on idle state the capacitor C1 is fully charged (5V) and multivibator output gives out logic 1.
2. Computer writes to I/O address 201h to reset the multivibrators. The multivibrator get a triggger pulse from I/O write signal and it discharged capacitor C1. The multivibrator output goes to logic 0 because the capacitor is discharged (0V).
2. The capacitor starts to charge form the current which goes through R1 and the joystick potentiometer.
3. When the capacitor voltage reaches certain oltage threshold level, the multivibrator output goes back to logic 1.
The bigger the potentiometer resistance value is, the loger it takes from the capacitor to reach the threshold voltage. The time how long it take for each multivibator to reach the logic 1 after the triggering is measued using software and that value tells the resistance of the potentiometer (and the stick position as well because the potentiometer is connected to the stick). This simple method for measuring the resistance value is quite cheap, but not very accurate.
This simple joystick port hardware implementation (originally designed for 4.7 MHz IBM PC) causes many headaches to game programmers (problems of different computer speeds, joycitck port differences, problems in multitasking operating systems etc.). Big tolerances in joysticks and joystick ports mean that the every game must have an option to cablibrate the joystick (which actually means that the program adapts to accept the values in th range which the joystick reading routine does and then converts the values to it's internal format using the values measured in joystick calibration process).

______________________________________________

.........WOW, you sure know a lot more about joysticks in PCs than I do, because I’ll tell you something to get straight and to the point here, Plasma357:

You are MOST truly correct. Wink !

I mean, back in my 80’s/90’s days, I **NEVER** even had an actual joystick for an IBM (or compatible) PC, much less even used one myself. And that was _apparently_ part of the rather reason why I never knew much about joysticks/gamepads interfacing with those kinds of PCs, sadly. Sad But hey, at least your interesting answer is definitely ***QUITE*** a learning experience in how to tame such a intensified crash course in joysticks/gamepads as this. Big Grin !

So, **EXCELLENT** point, man, and thank you for your brutally honest insights, too! ;*) !!



GETTING YOUR POINT ACROSS IN SUCH A SERIOUS WAY,

[Image: AAPMini.gif]
Adigun Azikiwe Polack
One of the Founders of “Aura Flow”
Webmaster of the AAP Official Homepage
Official Founder of the “QuickBASIC Caliber Programming Compo”



P.S. You don’t have to enter this challenge if you don’t want to. I mean, I PLAIN refuse to even force you to enter, my man, especially since I love you with all of my heart, really! Wink !
url=http://dhost.hopto.org/aapproj/][Image: file.php?id=194][/url]
Your *official* home of the FreeBasic GFX Demo Central, now holding over 150 FB graphics demos so far!!! Big Grin !
Reply
#13
The qb joystick commands... they are as rigid as INKEY$?
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#14
Quote:The qb joystick commands... they are as rigid as INKEY$?
I've heard that they're as bad as ON KEY(x) GOSUB.
size=9]"To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public." -- Theodore Roosevelt[/size]
Reply
#15
When "Nibbles" first came out, my brother-in-law liked the game, but thought it would be better with a joystick. I thought, "No problem." I used STICK, but everytime the snake got a number, the computer beeped, the joystick reading went off, and the snake went out of control.
hrist Jesus came into the world to save sinners, of whom I am first.(I Timothy 1:15)

For God so loved the world, that He gave His only begotten Son,
that whoever believes in Him should not perish, but have eternal life.(John 3:16)
Reply
#16
So, a joystick routine in a realtime game is a bad idea?
nd remember kids, only you can provoke forest fires!
Reply
#17
Who says so. It's a great way to allow multiplayer games in QB with a higher range of keys and buttons to choose from.
Reply
#18
Yeah, but the game I'm trying to make will be quick paced and if a gamepad/joystick is unresponsive then it won't be worth the trouble use, much less program. I'll just stick to the 2 players on one keyboard idea.
nd remember kids, only you can provoke forest fires!
Reply
#19
The joystick won't make your game unresponsive if you use it wisely. Just don't poll it every screen update. (Poll it every 4th, or something like that.)
Reply
#20
That makes sense. I'm gonna have my game get input from the keyboard, and then I'm gonna see how it works with a joystick.
nd remember kids, only you can provoke forest fires!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)