Jump to content
IGNORED

untessed controller code. feedback appreciated


grafixbmp

Recommended Posts

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

 

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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...