flickertail Posted June 30, 2020 Share Posted June 30, 2020 I'm trying to read the Paddle Controllers, and I'm not sure I'm doing it correctly. Basically, if the pot is discharged before the scanline on which the pot is read, a variable is incremented by 1. I'm specifically trying to read the pots on scanlines 76 and 116. In order to determine a direction. If the discharge occurs before scanline 76, the variable value is set to 2 - indicating "right" or "down". If the discharge occurs after scanline 76, but before scanline 116, the variable value is set to 1 indicating "centered" And if the discharge occurs after scanline 116, the variable value is set to 0 - indicating "left" or "up". I understand a centered pot is actually around scanline 190. I am not expecting to use the full range of the pot. I just have a simple question. Am I reading the pots correctly? I based this code on Thomas Jentzsch's paddle reading example on the MiniDig. HV0 is memory address $80 HV1 is memory address $82 HV0, HV0+1, HV1, and HV1+1 get reset to zero at the end of the frame after the results get evaluated. getPotVals ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Check P0 Pot 0 - Horizontal lda INPT0 bmi IncH0 .byte $2c IncH0 inc HV0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Check P0 Pot 1 - Vertical lda INPT1 bmi IncV0 .byte $2c IncV0 inc HV0+1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Check P1 Pot 0 - Horizontal lda INPT2 bmi IncH1 .byte $2c IncH1 inc HV1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Check P1 Pot 1 - Vertical lda INPT3 bmi IncV1 .byte $2c IncV1 inc HV1+1 rts Thanks, Aaron Quote Link to comment Share on other sites More sharing options...
flickertail Posted July 2, 2020 Author Share Posted July 2, 2020 So I couldn't figure out why my code wasn't working, but I finally realized why. Stupidly, I didn't understand how the D7 bit on VBLANK works. But I've gotten it to work. A little hard to test it as the emulators don't support the paddles working as a self-centering joystick/gamepad hat. But my code works for my Broomsticks (Quidditch ripoff) game. (Under development for 15 years) My plan is to implement a hypothetical 2600 controller in the Mr. Boehm hardware to support it. See - Mr.Boehm The pots on each port will be used as the X,Y axis of a joystick. SWCHA (P0 - bits: 6,5,4; P1 - Bits: 2,1,0) will serve as 3 fire buttons per controller. SWACNT will be set to .byte #%10001000 - and will be used to activate/deactivate "rumble" on both left/right ports for all controllers that support vibration. Of course, this would only work with a homebrew game specifically designed to support it. I've attached some code. The only aspect of what is described above that's implemented, is just left right of P0. broomsticks-paddle-test.txt Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.