lord_mike #1 Posted December 19, 2007 (edited) Hey all! Looking for instructions on how to use the driving controller, I saw this following post by Batari (which is also used in his zombie chase example in the BB 1.0 package). I'm wondering if there's a way to also use the right controller. I imagine that the bits in: SWCHA & %00110000)/16 would need to be changed and it would work??? Any help would be greatly appreciated! Thanks a million! Mike Paddle support is planned, but with sacrifices as it requires kernel time. But you can use the left driving controller now with a little routine I wrote. It's not very short or efficient, but I was not able to get the assembly routines written by Thomas Jentzsch to work. This will read the left DC. Until I figure out the problem, you can use this. Just insert this into your program, and place your code after "left" or "right": temp1=(SWCHA & %00110000)/16 on last goto d00 d01 d10 d11 d00 on temp1 goto nomove left right nomove d01 on temp1 goto right nomove nomove left d11 on temp1 goto nomove right left nomove d10 on temp1 goto left nomove nomove right left rem DC has been turned left goto nomove right rem DC has been turned right nomove last=temp1 It requires one free variable to hold "last" - you choose which one by using dim. Edited December 19, 2007 by lord_mike Quote Share this post Link to post Share on other sites
Rybags #2 Posted December 19, 2007 Kind of. The driving controller is like a mouse or trackball, except only one axis. Similarly, you have to continually sample it, as it cascades through a series of bit patterns as it's moved. Quote Share this post Link to post Share on other sites
BigO #3 Posted December 20, 2007 (edited) If it helps, the driving controller uses two of the same pins as the joystick. Pins 1 and 2 are alternately connected to ground as you turn the driving controller. In theory, it's the same as checking the joystick for Up and Down. See the schematics here: http://www.atariage.com/2600/archives/sche...sories_Low.html So, to attempt to answer your question without specific knowledge of bB, if you compare how the left joystick usage (bits used) compares to the left driving controller usage, I think you could look at how the right joystick is read (which bits represent Up & Down) and determine how you'd use the right driving controller. Edited December 20, 2007 by BigO Quote Share this post Link to post Share on other sites
+batari #4 Posted December 20, 2007 Hey all! Looking for instructions on how to use the driving controller, I saw this following post by Batari (which is also used in his zombie chase example in the BB 1.0 package). I'm wondering if there's a way to also use the right controller. I imagine that the bits in: SWCHA & %00110000)/16 would need to be changed and it would work??? Any help would be greatly appreciated! Yep, just change that line to SWCHA & %00000011. The code can certainly be improved, I just haven't done it yet. I've seen some very short asm examples before but I've never got them to work. Quote Share this post Link to post Share on other sites
lord_mike #5 Posted December 21, 2007 (edited) It didn't work! Actually, the left controller code didn't work too well, either.... it would work for a few seconds then crash the machine something awful... It worked when I put it in a standalone program, but didn't like it in mine... I think it may be 'cos I'm using bank switching???? I don't know... I couldn't get the right controller to work at all, even in a standalone program... But, I guess the original quesiton is moot, since I can't get either controller to work in my program without crashing... Any thoughts off the top of your head? Is bankswitching a possible cause? It's not crucial... I'm doing a driving game using pfcolors, and since I can't use paddles with pfcolors (or can I?), I thought driving controllers would be a nice touch! Thanks for replying to my post, Batari! I do appreciate it very much! Mike Edited December 21, 2007 by lord_mike Quote Share this post Link to post Share on other sites
+batari #6 Posted December 21, 2007 It didn't work! Actually, the left controller code didn't work too well, either.... it would work for a few seconds then crash the machine something awful... It worked when I put it in a standalone program, but didn't like it in mine... I think it may be 'cos I'm using bank switching???? I don't know... I couldn't get the right controller to work at all, even in a standalone program... But, I guess the original quesiton is moot, since I can't get either controller to work in my program without crashing... Any thoughts off the top of your head? Is bankswitching a possible cause? It's not crucial... I'm doing a driving game using pfcolors, and since I can't use paddles with pfcolors (or can I?), I thought driving controllers would be a nice touch! Thanks for replying to my post, Batari! I do appreciate it very much! Mike The code should work, so my guess is that you have modified temp1 during your left and right rotation routines, and therefore "last" is getting assigned with something other than 0-3. Some things like user functions will overwrite temp1. One way around this (aside from using something other than temp1) is to place "last=temp1" in three locations instead of one, i.e. right after the left and right labels. Quote Share this post Link to post Share on other sites
lord_mike #7 Posted December 21, 2007 The code should work, so my guess is that you have modified temp1 during your left and right rotation routines, and therefore "last" is getting assigned with something other than 0-3. Some things like user functions will overwrite temp1. One way around this (aside from using something other than temp1) is to place "last=temp1" in three locations instead of one, i.e. right after the left and right labels. AHA!!! Your reply made me think, and I didn't do any bounds checking and was overwriting memory locations!!!! That was the problem, methinks!!! Right now it isn't crashing the emulator (knock on wood), I'll try it on a krok cart tomorrow... Thank you very much, your reply made me think more about what happened and gave me the impetus to fix it... I had totally given up! Thanks again! I figured out the right controller, too! Instead of temp1=(SWCHA & %00000011)/16 it should just be temp1=(SWCHA & %00000011) So, a great way to end the evening! Thanks, Batari!! Quote Share this post Link to post Share on other sites