summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Huderle <huderlem@gmail.com>2015-03-16 21:34:58 -0700
committerMarcus Huderle <huderlem@gmail.com>2015-03-16 21:34:58 -0700
commit8d9f84c0fe65b12f967f2b466c979d8d2f3947cf (patch)
treec9f72b0e57e6d9edeb168542cb992b4ddb46e3bc
parent186293994b06348bb0376baba72f7415d37dfc0f (diff)
Add label for pressed buttons.
-rwxr-xr-xhram.asm3
-rwxr-xr-xmain.asm24
2 files changed, 14 insertions, 13 deletions
diff --git a/hram.asm b/hram.asm
index f7d55d8..750739b 100755
--- a/hram.asm
+++ b/hram.asm
@@ -1,6 +1,7 @@
hJoypadState EQU $FF98 ; current state of buttons. See joy_constants.asm for which bits
; correspond to which buttons.
-hNewlyPressedButtons EQU $FF99 ; mask for buttons that were pressed in the current frame.
+hNewlyPressedButtons EQU $FF99 ; buttons that were pressed in the current frame.
+hPressedButtons EQU $FF9A ; buttons that were pressed last frame and current frame(?)
hPrevPreviousJoypadState EQU $FF9B ; joypad state from two frames ago. See joy_constants.asm for
; which bits correspond to which buttons. (need a better name for this...)
hPreviousJoypadState EQU $FF9C ; prevoius frame's joypad state. See joy_constants.asm for
diff --git a/main.asm b/main.asm
index a942b6a..eb27ea4 100755
--- a/main.asm
+++ b/main.asm
@@ -1297,7 +1297,7 @@ ReadJoypad: ; 0xab8
ld hl, hJoypadState
and [hl] ; a contains newly-pressed buttons compared to last frame
ld [hNewlyPressedButtons], a
- ld [$ff9a], a
+ ld [hPressedButtons], a
pop af
ld hl, hPreviousJoypadState
and [hl] ; a contains newly-pressed buttons compared to two frames ago
@@ -1314,7 +1314,7 @@ ReadJoypad: ; 0xab8
dec [hl]
jr nz, .asm_b1a
ld a, [hJoypadState]
- ld [$ff9a], a
+ ld [hPressedButtons], a
ld a, [$d807]
ld [$ff9d], a
jr .asm_b1a
@@ -1331,7 +1331,7 @@ ReadJoypad: ; 0xab8
ld a, [hNewlyPressedButtons]
or [hl]
ld [hli], a
- ld a, [$ff9a]
+ ld a, [hPressedButtons]
or [hl]
ld [hli], a
ret
@@ -7042,7 +7042,7 @@ GoToHighScoresFromTitlescreen: ; 0xc1e7
ret
Func_c1fc: ; 0xc1fc
- ld a, [$ff9a]
+ ld a, [hPressedButtons]
ld b, a
ld a, [hl]
bit 6, b
@@ -7357,7 +7357,7 @@ Func_c400: ; 0xc400
ret
Func_c41a: ; 0xc41a
- ld a, [$ff9a]
+ ld a, [hPressedButtons]
ld b, a
ld a, [$d916]
bit 6, b
@@ -7768,7 +7768,7 @@ Func_c6e8: ; 0xc6e8
ret
UpdateSoundTestBackgroundMusicSelection: ; 0xc715
- ld a, [$ff9a] ; joypad state
+ ld a, [hPressedButtons] ; joypad state
ld b, a
ld a, [wSoundTestCurrentBackgroundMusic]
bit BIT_D_LEFT, b ; was the left dpad button pressed?
@@ -7800,7 +7800,7 @@ UpdateSoundTestSoundEffectSelection: ; 0xc73a
call PlaySoundEffect
ret
.didntPressAButton
- ld a, [$ff9a] ; joypad state
+ ld a, [hPressedButtons] ; joypad state
ld b, a
ld a, [wSoundTextCurrentSoundEffect]
bit BIT_D_LEFT, b ; was the left dpad button pressed?
@@ -9155,7 +9155,7 @@ ExitHighScoresScreen: ; 0xd171
ret
Func_d18b: ; 0xd18b
- ld a, [$ff9a]
+ ld a, [hPressedButtons]
ld b, a
ld a, [$da81]
ld e, a
@@ -9936,7 +9936,7 @@ StartingStages: ; 0xd7d1
db STAGE_RED_FIELD_BOTTOM, STAGE_BLUE_FIELD_BOTTOM
Func_d7d3: ; 0x57d3
- ld a, [$ff9a]
+ ld a, [hPressedButtons]
ld b, a
ld a, [$d913]
bit 5, b
@@ -11436,7 +11436,7 @@ Func_28368: ; 0x28368
jr nz, .asm_28371
jp Func_284bc
.asm_28371
- ld a, [$ff9a]
+ ld a, [hPressedButtons]
ld b, a
ld a, [$daa2]
ld e, a
@@ -11546,7 +11546,7 @@ Func_28368: ; 0x28368
INCBIN "baserom.gbc",$2842c,$284bc - $2842c
Func_284bc: ; 0x284bc
- ld a, [$ff9a]
+ ld a, [hPressedButtons]
ld b, a
ld a, [$daa2]
bit 5, b
@@ -11599,7 +11599,7 @@ ExitPokedexScreen: ; 0x284f9
ret
Func_28513: ; 0x28513
- ld a, [$ff9a]
+ ld a, [hPressedButtons]
ld hl, $d95e
or [hl]
ld [hl], a