Jump to content
lord_mike

Right Driving Controller

Recommended Posts

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 by lord_mike

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 by BigO

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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 by lord_mike

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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!!! :cool: 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!! :cool:

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...