Get the button press! 2

Discussion in 'Discussion and Q&A Archive' started by Selbi, Jun 22, 2009.

Thread Status:
Not open for further replies.
  1. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    This was very helpful for me, and it should be pinned or something, because it may can help other people as well. However, I have another question, how can I check if A, B and C are pressed at the same time? Or in other words, how can I check if there are multiple buttons pressed?


    (Only 2 points because I don't think it's that hard.)
     
  2. Armada

    Armada DID SOMEONE SAY WEEABOO? Member

    Joined:
    Aug 17, 2007
    Messages:
    98
    Well, I guess you check $FFFFF603 and add the values together to find what's being held down (in Sonic 1).
     
    Last edited by a moderator: Jun 22, 2009
  3. Alriightyman

    Alriightyman I'm back! Member

    Joined:
    Oct 3, 2007
    Messages:
    156
    Location:
    USA
    You are looking for something like:




    cmp.b #$70,($FFFFF604).w ; check if A,B, and C are being held ($F605 for if it is being pressed, not held)


    beq.s SomeLabel


    -code if A,B, and C are not being pressed-


    rts


    SomeLabel:


    code to do if they are being pressed-
     
  4. Thorn

    Thorn wroar Member

    Joined:
    Aug 11, 2007
    Messages:
    70
    ^ Maybe I'm reading it wrong, but your way would work only if Start, Up, Down, Left, and Right were all untouched while A, B, and C were held. If this code is used for moving Sonic, you should probably allow a direction to be pressed at the same time. While you could move the button inputs to d0 or such and do arithmetic on that to weed out the other buttons and be able to use your comparison, it's probably just as quick to simply check each of the three bits for A, B, and C (bits 4, 5, and 6) individually, and branch out of the routine if any one of those checks fails.
     
    Last edited by a moderator: Jun 23, 2009
  5. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    To say it a bit clearlier, I'm making a kind of Jumpdash, which is only working when you are holding A B and C. After releasing any of these buttons it should be canceled.
     
  6. Oerg866

    Oerg866 Well-Known Member Member

    Joined:
    Aug 29, 2008
    Messages:
    299
    Location:
    Frankfurt, Germany
    Loop the check while the jumpdash is being proceeded.
     
Thread Status:
Not open for further replies.