Split out joypad and overworld code from home.asm.

This commit is contained in:
yenatch 2014-05-30 18:30:25 -07:00
parent 188ac8a9b4
commit 93b1361dff
3 changed files with 2460 additions and 2459 deletions

2461
home.asm

File diff suppressed because it is too large Load diff

39
home/joypad.asm Normal file
View file

@ -0,0 +1,39 @@
ReadJoypad::
; Poll joypad input.
; Unlike the hardware register, button
; presses are indicated by a set bit.
ld a, 1 << 5 ; select direction keys
ld c, 0
ld [rJOYP], a
rept 6
ld a, [rJOYP]
endr
cpl
and %1111
swap a
ld b, a
ld a, 1 << 4 ; select button keys
ld [rJOYP], a
rept 10
ld a, [rJOYP]
endr
cpl
and %1111
or b
ld [hJoyInput], a
ld a, 1 << 4 + 1 << 5 ; deselect keys
ld [rJOYP], a
ret
Joypad::
; Update the joypad state variables:
; [hJoyReleased] keys released since last time
; [hJoyPressed] keys pressed since last time
; [hJoyHeld] currently pressed keys
homecall _Joypad
ret

2419
home/overworld.asm Normal file

File diff suppressed because it is too large Load diff