left key- bit 10000000- run left right key- bit 01000000- run right up key- 00100000- jump down key- 00010000- crouch "a" key- 00001000- say "A" "b" key- 00000100- say "B" press a and b- 00001100- double jump press left and right- 11000000- shift between facing left and facing right I justify the use of these particular bits by saying, each direction and command has its own specific place for the "1" within the list of eight 0s. left it 1st, right is 2nd- left and right are the main functions of the character, and so come first within the bits up is 3rd, down is 4th- this movement is secondary to left and right, but still important A is 5th, and B is 6th- this is not as necessary, so it is within the variables at the end of the bits. Combination moves: left and right causes the characters to shift between the two A and B causes the character to double jump.
source: anaptyxis