Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- WaitForInput::
- call WaitForAllButtonsToBeReleased
- .loop
- call GetJoypad
- ld a, [PressedJoypad]
- and $FF
- jr z, .loop
- ret
- WaitForAllButtonsToBeReleased::
- call GetJoypad
- ld a, [DownJoypad]
- and a
- jr nz, WaitForAllButtonsToBeReleased
- ret
- ; also relevant
- LoopGameChoice_Inner::
- call WaitForInput
- and JOY_SELECT
- jr nz, Change
- and JOY_START
- jr z, LoopGameChoice_Inner
- ; do what you had selected
- GetJoypad::
- ld a, %00100000
- ld [rP1], a
- ld a, [rP1]
- ld a, [rP1]
- ld a, [rP1]
- ld a, [rP1]
- and $0F
- swap a
- ld b, a
- ld a, %00010000
- ld [rP1], a
- ld a, [rP1]
- ld a, [rP1]
- ld a, [rP1]
- ld a, [rP1]
- and $0F
- or b
- cpl
- ld d, a
- ld b, a
- ld a, [DownJoypad]
- cpl
- and b
- ld [PressedJoypad], a
- ld hl, Flags
- bit 0, [hl]
- jr z, .skip
- ld a, [DownJoypad]
- ld b, a
- ld a, d
- cpl
- and b
- ld a, b
- ld [ReleasedJoypad], a
- ld a, d
- ld [DownJoypad], a
- ret
- .skip
- set 0, [hl]
- ld a, $FF
- ld [ReleasedJoypad], a
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement