summaryrefslogtreecommitdiff
path: root/home/joypad.asm
diff options
context:
space:
mode:
Diffstat (limited to 'home/joypad.asm')
-rw-r--r--home/joypad.asm126
1 files changed, 63 insertions, 63 deletions
diff --git a/home/joypad.asm b/home/joypad.asm
index 392be760b..7a1174b10 100644
--- a/home/joypad.asm
+++ b/home/joypad.asm
@@ -8,9 +8,9 @@ JoypadInt::
ClearJoypad::
xor a
; Pressed this frame (delta)
- ld [hJoyPressed], a
+ ldh [hJoyPressed], a
; Currently pressed
- ld [hJoyDown], a
+ ldh [hJoyDown], a
ret
Joypad::
@@ -38,10 +38,10 @@ Joypad::
; We can only get four inputs at a time.
; We take d-pad first for no particular reason.
ld a, R_DPAD
- ld [rJOYP], a
+ ldh [rJOYP], a
; Read twice to give the request time to take.
- ld a, [rJOYP]
- ld a, [rJOYP]
+ ldh a, [rJOYP]
+ ldh a, [rJOYP]
; The Joypad register output is in the lo nybble (inversed).
; We make the hi nybble of our new container d-pad input.
@@ -55,10 +55,10 @@ Joypad::
; Buttons make 8 total inputs (A, B, Select, Start).
; We can fit this into one byte.
ld a, R_BUTTONS
- ld [rJOYP], a
+ ldh [rJOYP], a
; Wait for input to stabilize.
rept 6
- ld a, [rJOYP]
+ ldh a, [rJOYP]
endr
; Buttons take the lo nybble.
cpl
@@ -68,30 +68,30 @@ endr
; Reset the joypad register since we're done with it.
ld a, $30
- ld [rJOYP], a
+ ldh [rJOYP], a
; To get the delta we xor the last frame's input with the new one.
- ld a, [hJoypadDown] ; last frame
+ ldh a, [hJoypadDown] ; last frame
ld e, a
xor b
ld d, a
; Released this frame:
and e
- ld [hJoypadReleased], a
+ ldh [hJoypadReleased], a
; Pressed this frame:
ld a, d
and b
- ld [hJoypadPressed], a
+ ldh [hJoypadPressed], a
; Add any new presses to the list of collective presses:
ld c, a
- ld a, [hJoypadSum]
+ ldh a, [hJoypadSum]
or c
- ld [hJoypadSum], a
+ ldh [hJoypadSum], a
; Currently pressed:
ld a, b
- ld [hJoypadDown], a
+ ldh [hJoypadDown], a
; Now that we have the input, we can do stuff with it.
@@ -130,28 +130,28 @@ GetJoypad::
jr z, .auto
; To get deltas, take this and last frame's input.
- ld a, [hJoypadDown] ; real input
+ ldh a, [hJoypadDown] ; real input
ld b, a
- ld a, [hJoyDown] ; last frame mirror
+ ldh a, [hJoyDown] ; last frame mirror
ld e, a
; Released this frame:
xor b
ld d, a
and e
- ld [hJoyReleased], a
+ ldh [hJoyReleased], a
; Pressed this frame:
ld a, d
and b
- ld [hJoyPressed], a
+ ldh [hJoyPressed], a
; It looks like the collective presses got commented out here.
ld c, a
; Currently pressed:
ld a, b
- ld [hJoyDown], a ; frame input
+ ldh [hJoyDown], a ; frame input
.quit
pop bc
@@ -167,7 +167,7 @@ GetJoypad::
; A value of $ff will immediately end the stream.
; Read from the input stream.
- ld a, [hROMBank]
+ ldh a, [hROMBank]
push af
ld a, [wAutoInputBank]
rst Bankswitch
@@ -224,8 +224,8 @@ GetJoypad::
pop af
rst Bankswitch
ld a, b
- ld [hJoyPressed], a ; pressed
- ld [hJoyDown], a ; input
+ ldh [hJoyPressed], a ; pressed
+ ldh [hJoyDown], a ; input
jr .quit
StartAutoInput::
@@ -241,9 +241,9 @@ StartAutoInput::
ld [wAutoInputLength], a
; Reset input mirrors.
xor a
- ld [hJoyPressed], a ; pressed this frame
- ld [hJoyReleased], a ; released this frame
- ld [hJoyDown], a ; currently pressed
+ ldh [hJoyPressed], a ; pressed this frame
+ ldh [hJoyReleased], a ; released this frame
+ ldh [hJoyDown], a ; currently pressed
ld a, AUTO_INPUT
ld [wInputType], a
@@ -269,11 +269,11 @@ JoyTitleScreenInput::
call JoyTextDelay
pop bc
- ld a, [hJoyDown]
+ ldh a, [hJoyDown]
cp D_UP | SELECT | B_BUTTON
jr z, .keycombo
- ld a, [hJoyLast]
+ ldh a, [hJoyLast]
and START | A_BUTTON
jr nz, .keycombo
@@ -291,33 +291,33 @@ JoyWaitAorB::
.loop
call DelayFrame
call GetJoypad
- ld a, [hJoyPressed]
+ ldh a, [hJoyPressed]
and A_BUTTON | B_BUTTON
ret nz
call RTC
jr .loop
WaitButton::
- ld a, [hOAMUpdate]
+ ldh a, [hOAMUpdate]
push af
ld a, 1
- ld [hOAMUpdate], a
+ ldh [hOAMUpdate], a
call WaitBGMap
call JoyWaitAorB
pop af
- ld [hOAMUpdate], a
+ ldh [hOAMUpdate], a
ret
JoyTextDelay::
call GetJoypad
- ld a, [hInMenu]
+ ldh a, [hInMenu]
and a
- ld a, [hJoyPressed]
+ ldh a, [hJoyPressed]
jr z, .ok
- ld a, [hJoyDown]
+ ldh a, [hJoyDown]
.ok
- ld [hJoyLast], a
- ld a, [hJoyPressed]
+ ldh [hJoyLast], a
+ ldh a, [hJoyPressed]
and a
jr z, .checkframedelay
ld a, 15
@@ -329,7 +329,7 @@ JoyTextDelay::
and a
jr z, .restartframedelay
xor a
- ld [hJoyLast], a
+ ldh [hJoyLast], a
ret
.restartframedelay
@@ -338,14 +338,14 @@ JoyTextDelay::
ret
WaitPressAorB_BlinkCursor::
- ld a, [hMapObjectIndexBuffer]
+ ldh a, [hMapObjectIndexBuffer]
push af
- ld a, [hObjectStructIndexBuffer]
+ ldh a, [hObjectStructIndexBuffer]
push af
xor a
- ld [hMapObjectIndexBuffer], a
+ ldh [hMapObjectIndexBuffer], a
ld a, 6
- ld [hObjectStructIndexBuffer], a
+ ldh [hObjectStructIndexBuffer], a
.loop
push hl
@@ -354,20 +354,20 @@ WaitPressAorB_BlinkCursor::
pop hl
call JoyTextDelay
- ld a, [hJoyLast]
+ ldh a, [hJoyLast]
and A_BUTTON | B_BUTTON
jr z, .loop
pop af
- ld [hObjectStructIndexBuffer], a
+ ldh [hObjectStructIndexBuffer], a
pop af
- ld [hMapObjectIndexBuffer], a
+ ldh [hMapObjectIndexBuffer], a
ret
SimpleWaitPressAorB::
.loop
call JoyTextDelay
- ld a, [hJoyLast]
+ ldh a, [hJoyLast]
and A_BUTTON | B_BUTTON
jr z, .loop
ret
@@ -388,10 +388,10 @@ ButtonSound::
jp DelayFrames
.wait_input
- ld a, [hOAMUpdate]
+ ldh a, [hOAMUpdate]
push af
ld a, $1
- ld [hOAMUpdate], a
+ ldh [hOAMUpdate], a
ld a, [wInputType]
or a
jr z, .input_wait_loop
@@ -400,22 +400,22 @@ ButtonSound::
.input_wait_loop
call .blink_cursor
call JoyTextDelay
- ld a, [hJoyPressed]
+ ldh a, [hJoyPressed]
and A_BUTTON | B_BUTTON
jr nz, .received_input
call RTC
ld a, $1
- ld [hBGMapMode], a
+ ldh [hBGMapMode], a
call DelayFrame
jr .input_wait_loop
.received_input
pop af
- ld [hOAMUpdate], a
+ ldh [hOAMUpdate], a
ret
.blink_cursor
- ld a, [hVBlankCounter]
+ ldh a, [hVBlankCounter]
and %00010000 ; bit 4, a
jr z, .cursor_off
ld a, "▼"
@@ -436,37 +436,37 @@ BlinkCursor::
cp b
pop bc
jr nz, .place_arrow
- ld a, [hMapObjectIndexBuffer]
+ ldh a, [hMapObjectIndexBuffer]
dec a
- ld [hMapObjectIndexBuffer], a
+ ldh [hMapObjectIndexBuffer], a
ret nz
- ld a, [hObjectStructIndexBuffer]
+ ldh a, [hObjectStructIndexBuffer]
dec a
- ld [hObjectStructIndexBuffer], a
+ ldh [hObjectStructIndexBuffer], a
ret nz
ld a, "─"
ld [hl], a
ld a, -1
- ld [hMapObjectIndexBuffer], a
+ ldh [hMapObjectIndexBuffer], a
ld a, 6
- ld [hObjectStructIndexBuffer], a
+ ldh [hObjectStructIndexBuffer], a
ret
.place_arrow
- ld a, [hMapObjectIndexBuffer]
+ ldh a, [hMapObjectIndexBuffer]
and a
ret z
dec a
- ld [hMapObjectIndexBuffer], a
+ ldh [hMapObjectIndexBuffer], a
ret nz
dec a
- ld [hMapObjectIndexBuffer], a
- ld a, [hObjectStructIndexBuffer]
+ ldh [hMapObjectIndexBuffer], a
+ ldh a, [hObjectStructIndexBuffer]
dec a
- ld [hObjectStructIndexBuffer], a
+ ldh [hObjectStructIndexBuffer], a
ret nz
ld a, 6
- ld [hObjectStructIndexBuffer], a
+ ldh [hObjectStructIndexBuffer], a
ld a, "▼"
ld [hl], a
ret