[stella] Auto detecting paddles in port 1 or port 2
stella at casperkitty.com
stella at casperkitty.com
Mon Jan 29 20:16:28 CST 2007
>>
I don't think it's possible to detect all controller
types. What about the light gun for instance?
<<
It's not possible to detect a light gun when it's not being "fired" because
it doesn't do anything. When fired, however, the lightgun will just
trigger briefly. If one checks for the trigger input at the end of the
normal kernel (with latching enabled), notices it's fired, resets the
latch, and observes that it's still triggered, the user is pushing a
joystick fire button. Otherwise, figure it's probably a lightgun and flash
the screen white. If the input triggers again, note the position. Then at
the next vblank, reset the trigger and recheck. If still triggered, it's a
fire button (it just happened to "bounce" during the first vblank);
otherwise it's a light gun.
For detecting paddles, it's necessary to enable the paddle drain (probably
once every four frames or so) and then disable it; check the paddle input
sometime later (most likely just before the next time it's drained). I
didn't see Thomas' code doing both paddle writes.
--------------------------------------------------------------------
myhosting.com - Premium Microsoft® Windows® and Linux web and application
hosting - http://link.mail2web.com/myhosting
More information about the Stella
mailing list