Skip to content

Commit 6f72aa2

Browse files
committed
disable controller while keyboard is active
1 parent 831a04a commit 6f72aa2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/nmi/pollcontroller.asm

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,21 @@ pollController:
6666

6767
diffOldAndNewButtons:
6868
ldx #$01
69+
.if KEYBOARD = 1
70+
; clear controller input when keyboard is active
71+
; disable keyboard when reset sequence is pressed
72+
lda keyboardFlag
73+
beq @diffForPlayer
74+
lda newlyPressedButtons_player1
75+
and #BUTTON_B|BUTTON_A|BUTTON_SELECT|BUTTON_START
76+
cmp #BUTTON_B|BUTTON_A|BUTTON_SELECT|BUTTON_START
77+
php
78+
lda #$00
79+
sta newlyPressedButtons_player1
80+
plp
81+
bne @diffForPlayer
82+
sta keyboardFlag
83+
.endif
6984
@diffForPlayer:
7085
lda newlyPressedButtons_player1,x
7186
tay

0 commit comments

Comments
 (0)