Jump to content
IGNORED

Please help me with joystick button reading!


Recommended Posts

I am trying to read the left joystick button in my game vong, but it is not working out for me. This is what I have:

 

;; Writing a 1 into D3 of Movement_Status starts game, 0 stops it.

 bit   INPT4
 beq Button_Not_Pushed

 lda Movement_Status
 ora #%00001000
 sta Movement_Status

Button_Not_Pushed

;; ... latter on

 lda Movement_Status
 and #%00001000
 beq Dont_Adjust_Positions

;; Position adjustment code here

Dont_Adjust_Positions

 

I can not find anything wrong with this code. When 0 is written to D3 of Movement_Status at powerup, and nothing can move, and when i press the button on the left joystick, the screen stays motionless. Is there a problem with my button reading? When I change it so a 1 is written to D3 at powerup, the sprites move like the game has started.

Link to comment
Share on other sites

I am trying to read the left joystick button in my game vong, but it is not working out for me. This is what I have:

 

;; Writing a 1 into D3 of Movement_Status starts game, 0 stops it.

 bit   INPT4
 beq Button_Not_Pushed

 lda Movement_Status
 ora #%00001000
 sta Movement_Status

Button_Not_Pushed

;; ... latter on

 lda Movement_Status
 and #%00001000
 beq Dont_Adjust_Positions

;; Position adjustment code here

Dont_Adjust_Positions

 

I can not find anything wrong with this code. When 0 is written to D3 of Movement_Status at powerup, and nothing can move, and when i press the button on the left joystick, the screen stays motionless. Is there a problem with my button reading? When I change it so a 1 is written to D3 at powerup, the sprites move like the game has started.

You should change the "beq Button_Not_Pushed" to "bmi Button_Not_Pushed." Or if you wanted instead to branch to some line label called "Button_Pushed," you could use "bpl Button_Pushed."

 

Michael

Link to comment
Share on other sites

You should change the "beq Button_Not_Pushed" to "bmi Button_Not_Pushed." Or if you wanted instead to branch to some line label called "Button_Pushed," you could use "bpl Button_Pushed."

 

Michael

 

Thank you! I thought I tried that but I guess that I did not, well any way thanks, it works now.

vong20080625.bin

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