+grafixbmp Posted October 19, 2023 Share Posted October 19, 2023 So been working on a project and wanted some feedback on what I came up with. Just wanting second opinions if my logic is sound. This gives controller directions and debounce data. it could also be expanded to include any action buttons if single player or all cardinal directions for 2 players. Call either once per frame or just between usage of control inputs. ; 1 = off 0 = on ;previous poll active poll debounce ; 1 1 and 1 then answer xor previous 0 then invert 1 ; 1 0 and 0 then answer xor previous 1 then invert 0 ; 0 0 and 0 then answer xor previous 0 then invert 1 ; 0 1 and 0 then answer xor previous 0 then invert 1 ; ram variables for controls ; current_poll ; debounce ; temp_1 control_check/reset ; uses inverted logic 1=off 0=on lda SWCHA and #$F0 ;keep only player 0 data. omit if using both players sta temp_1 and current_poll eor current_poll eor #$FF sta debounce lda temp_1 sta current_poll ; for the rest of the game code check the debounce for trigger activation of any direction ; or check current poll for continued activation of any direction rts Quote Link to comment Share on other sites More sharing options...
+grafixbmp Posted October 19, 2023 Author Share Posted October 19, 2023 <edited previous post> 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.