Two-Button Inputs

vanderblade

Active member
I'm never sure where to put helpful tidbits that I learn through tinkering and asking members of the community, so I'm putting it here for prosperity.

I tried to find a two-button input discussion on the forums, but it may either not be here or be buried. So I'm posting the information on how to implement a two-button player action. Special thanks to Joe for helping me out on Facebook.

As Joe says:
LDA gamepad
AND #PAD_B
BEQ +skip
;do things because b was down while A was pressed.
RTS
+skip
;; don't do the thing, or only do A button things,
;; because B was not pressed.
Note: the #PAD_B is no longer valid. You can just use the bit #%00000010 instead.

Also, even though many know this already, here are the bits and how they correspond to the buttons on the controller.

#%10000000 -- right on d-pad
#%01000000 -- left on d-pad
#%00100000 -- d-pad direction, up or down, check
#%00010000 -- d-pad direction, up or down, check
#%00001000 -- select
#%00000100 -- start
#%00000010 -- B
#%00000001 -- A
 
Last edited:
Top Bottom