ref: b35294752c55b5df88ccfc785279c36f30a43fd6
parent: f94af3e2d6effcaf94c8912a17542b99c1e7e9f8
author: yenatch <yenatch@gmail.com>
date: Fri Jan 23 04:48:14 EST 2015
rename hJoyHeldLast -> hJoyLast
--- a/engine/joypad.asm
+++ b/engine/joypad.asm
@@ -1,9 +1,13 @@
_Joypad::
+; hJoyReleased: (hJoyLast ^ hJoyInput) & hJoyLast
+; hJoyPressed: (hJoyLast ^ hJoyInput) & hJoyInput
+
ld a, [hJoyInput]
cp A_BUTTON + B_BUTTON + SELECT + START ; soft reset
jp z, TrySoftReset
+
ld b, a
- ld a, [hJoyHeldLast]
+ ld a, [hJoyLast]
ld e, a
xor b
ld d, a
@@ -13,15 +17,19 @@
and b
ld [hJoyPressed], a
ld a, b
- ld [hJoyHeldLast], a
+ ld [hJoyLast], a
+
ld a, [wd730]
bit 5, a
jr nz, DiscardButtonPresses
- ld a, [hJoyHeldLast]
+
+ ld a, [hJoyLast]
ld [hJoyHeld], a
+
ld a, [wJoyIgnore]
and a
ret z
+
cpl
ld b, a
ld a, [hJoyHeld]
@@ -41,11 +49,13 @@
TrySoftReset:
call DelayFrame
- ; reset joypad (to make sure the
- ; player is really trying to reset)
+
+ ; deselect (redundant)
ld a, $30
ld [rJOYP], a
+
ld hl, hSoftReset
dec [hl]
jp z, SoftReset
+
jp Joypad
--- a/engine/palettes.asm
+++ b/engine/palettes.asm
@@ -381,7 +381,7 @@
LoadSGB: ; 7202b (1c:602b)
xor a
ld [wOnSGB], a
- call Func_7209b
+ call CheckSGB
ret nc
ld a, $1
ld [wOnSGB], a
@@ -440,7 +440,7 @@
dw DataSnd_725a8
dw DataSnd_725b8
-Func_7209b: ; 7209b (1c:609b)
+CheckSGB: ; 7209b (1c:609b)
ld hl, MltReq2Packet
di
call SendSGBPacket
@@ -536,8 +536,7 @@
ret
Wait7000: ; 7214a (1c:614a)
-; each loop takes about 10 cycles so this routine actually loops through 70000
-; cycles.
+; Each loop takes 9 cycles so this routine actually waits 63000 cycles.
ld de, 7000
.loop
nop
--- a/hram.asm
+++ b/hram.asm
@@ -58,7 +58,7 @@
hSCY EQU $FFAF
hWY EQU $FFB0
-hJoyHeldLast EQU $FFB1
+hJoyLast EQU $FFB1
hJoyReleased EQU $FFB2
hJoyPressed EQU $FFB3
hJoyHeld EQU $FFB4