Page 1 of 1

How to rewrite the SGDK lightguns support module (src/joy.c) for BEX?

Posted: Mon Sep 20, 2021 4:14 pm
by Tomahomae
To be correct, is it possible at all? I'm not even sure, that BEX allows to work with a certain registers directly. There is an example of lightgun interaction for BEX, but it lets to move a "crosshair" only. How to make it to react on the trigger pull, is absolutely unclear. There is a no code of lightgun model recognising in this sample also.

Re: How to rewrite the SGDK lightguns support module (src/joy.c) for BEX?

Posted: Mon Oct 04, 2021 7:57 pm
by Chilly Willy
Getting a position from a lightgun is "easy" - all you do is enable the external interrupt and then in the int handler get the latched video beam position registers. Reading the buttons is harder as every gun uses a different method of toggling the port bits to read their gun buttons. The Menacer also needs very specific timing in addition. That's where all the inline assembly in joy.c comes in - getting that Menacer timing right.