diff options
| author | Tauwasser <Tauwasser@tauwasser.eu> | 2018-06-01 19:17:29 +0200 |
|---|---|---|
| committer | Tauwasser <Tauwasser@tauwasser.eu> | 2018-06-01 19:17:29 +0200 |
| commit | 05350cd17ddd5d087146ef59720fb881ebda75e0 (patch) | |
| tree | d834f52d720372e5cc78bf0db3c4fbb1e71007de /home | |
| parent | 82203dfa9ed46593860713e876900dcce7f0fa3b (diff) | |
joypad: rename confusingly named registers
Signed-off-by: Tauwasser <Tauwasser@tauwasser.eu>
Diffstat (limited to 'home')
| -rw-r--r-- | home/joypad.asm | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/home/joypad.asm b/home/joypad.asm index 80371b7..35e8086 100644 --- a/home/joypad.asm +++ b/home/joypad.asm @@ -3,6 +3,16 @@ INCLUDE "constants.asm" SECTION "Joypad functions", ROM0[$07FE] Joypad:: ; 7fe (0:7fe) +; Read the joypad register and translate it to something more +; workable for use in-game. There are 8 buttons, so we can use +; one byte to contain all player input. + +; Updates: + +; hJoypadUp: released this frame (delta) +; hJoypadDown: pressed this frame (delta) +; hJoypadState: currently pressed +; hJoypadSum: pressed so far ld a, [$d4ab] and $d0 ret nz @@ -28,22 +38,22 @@ Joypad:: ; 7fe (0:7fe) ld b, a ld a, (1 << 5 | 1 << 4) ; port reset ldh [rJOYP], a - ldh a, [hJoypadDown] + ldh a, [hJoypadState] ld e, a xor b ld d, a and e - ldh [hJoypadReleased], a + ldh [hJoypadUp], a ld a, d and b - ldh [hJoypadPressed], a + ldh [hJoypadDown], a ld c, a ldh a, [hJoypadSum] or c ldh [hJoypadSum], a ld a, b - ldh [hJoypadDown], a - ldh [hJoypadDown2], a + ldh [hJoypadState], a + ldh [hJoypadState2], a and $0f cp $0f jp z, Reset |
