blob: 9948b6e7cd987f24be69f9700fde69a2e0bd631d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
ReadJoypad::
; Poll joypad input.
; Unlike the hardware register, button
; presses are indicated by a set bit.
ld a, 1 << 5 ; select direction keys
ld c, 0
ld [rJOYP], a
REPT 6
ld a, [rJOYP]
ENDR
cpl
and %1111
swap a
ld b, a
ld a, 1 << 4 ; select button keys
ld [rJOYP], a
REPT 10
ld a, [rJOYP]
ENDR
cpl
and %1111
or b
ld [hJoyInput], a
ld a, 1 << 4 + 1 << 5 ; deselect keys
ld [rJOYP], a
ret
Joypad::
; Update the joypad state variables:
; [hJoyReleased] keys released since last time
; [hJoyPressed] keys pressed since last time
; [hJoyHeld] currently pressed keys
homecall _Joypad
ret
|