@@ -122,40 +122,40 @@ Right:
122122
123123; ANCHOR: input-routine
124124UpdateKeys:
125- ; Poll half the controller
126- ld a , JOYP_GET_BUTTONS
127- call .onenibble
128- ld b, a ; B7-4 = 1; B3-0 = unpressed buttons
125+ ; Poll half the controller
126+ ld a , JOYP_GET_BUTTONS
127+ call .onenibble
128+ ld b, a ; B7-4 = 1; B3-0 = unpressed buttons
129129
130- ; Poll the other half
131- ld a, JOYP_GET_CTRL_PAD
132- call .onenibble
133- swap a ; A7-4 = unpressed directions; A3-0 = 1
134- xor a , b ; A = pressed buttons + directions
135- ld b, a ; B = pressed buttons + directions
130+ ; Poll the other half
131+ ld a, JOYP_GET_CTRL_PAD
132+ call .onenibble
133+ swap a ; A7-4 = unpressed directions; A3-0 = 1
134+ xor a , b ; A = pressed buttons + directions
135+ ld b, a ; B = pressed buttons + directions
136136
137- ; And release the controller
138- ld a, JOYP_GET_NONE
139- ldh [ rJOYP ], a
137+ ; And release the controller
138+ ld a, JOYP_GET_NONE
139+ ldh [ rJOYP ], a
140140
141- ; Combine with previous wCurKeys to make wNewKeys
142- ld a, [ wCurKeys ]
143- xor a , b ; A = keys that changed state
144- and a , b ; A = keys that changed to pressed
145- ld [ wNewKeys ], a
146- ld a, b
147- ld [ wCurKeys ], a
148- ret
141+ ; Combine with previous wCurKeys to make wNewKeys
142+ ld a, [ wCurKeys ]
143+ xor a , b ; A = keys that changed state
144+ and a , b ; A = keys that changed to pressed
145+ ld [ wNewKeys ], a
146+ ld a, b
147+ ld [ wCurKeys ], a
148+ ret
149149
150- .onenibble
151- ldh [ rJOYP ], a ; switch the key matrix
152- call .knownret ; burn 10 cycles calling a known ret
153- ldh a, [ rJOYP ] ; ignore value while waiting for the key matrix to settle
154- ldh a, [ rJOYP ]
155- ldh a, [ rJOYP ] ; this read counts
156- or a , $ F0 ; A7-4 = 1; A3-0 = unpressed keys
157- .knownret
158- ret
150+ .onenibble
151+ ldh [ rJOYP ], a ; switch the key matrix
152+ call .knownret ; burn 10 cycles calling a known ret
153+ ldh a, [ rJOYP ] ; ignore value while waiting for the key matrix to settle
154+ ldh a, [ rJOYP ]
155+ ldh a, [ rJOYP ] ; this read counts
156+ or a , $ F0 ; A7-4 = 1; A3-0 = unpressed keys
157+ .knownret
158+ ret
159159; ANCHOR_END: input-routine
160160
161161; ANCHOR: memcpy
0 commit comments