mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-04-09 05:44:44 -07:00
Flesh out HRAM labels
This commit is contained in:
parent
b570c4d6e6
commit
d775767651
50
hram.asm
Normal file
50
hram.asm
Normal file
@ -0,0 +1,50 @@
|
||||
hPushOAM EQU $ff80
|
||||
|
||||
hBuffer EQU $ff8b
|
||||
|
||||
hRTCDayHi EQU $ff8d
|
||||
hRTCDayLo EQU $ff8e
|
||||
hRTCHours EQU $ff8f
|
||||
hRTCMinutes EQU $ff90
|
||||
hRTCSeconds EQU $ff91
|
||||
|
||||
hHours EQU $ff94
|
||||
|
||||
hMinutes EQU $ff96
|
||||
|
||||
hSeconds EQU $ff98
|
||||
|
||||
hROMBank EQU $ff9d
|
||||
|
||||
hJoypadReleased EQU $ffa2
|
||||
hJoypadPressed EQU $ffa3
|
||||
hJoypadDown EQU $ffa4
|
||||
hJoypadSum EQU $ffa5
|
||||
hJoyReleased EQU $ffa6
|
||||
hJoyPressed EQU $ffa7
|
||||
hJoyDown EQU $ffa8
|
||||
|
||||
hPastLeadingZeroes EQU $ffb3
|
||||
|
||||
hLCDStatCustom EQU $ffc6
|
||||
|
||||
hBGMapMode EQU $ffd4
|
||||
hBGMapThird EQU $ffd5
|
||||
hBGMapAddress EQU $ffd6
|
||||
|
||||
hOAMUpdate EQU $ffd8
|
||||
hSPBuffer EQU $ffd9
|
||||
|
||||
hBGMapUpdate EQU $ffdb
|
||||
|
||||
hTileAnimFrame EQU $ffdf
|
||||
|
||||
hRandomAdd EQU $ffe1
|
||||
hRandomSub EQU $ffe2
|
||||
|
||||
hBattleTurn EQU $ffe4
|
||||
hCGBPalUpdate EQU $ffe5
|
||||
hCGB EQU $ffe6
|
||||
hSGB EQU $ffe7
|
||||
hDMATransfer EQU $ffe8
|
||||
|
54
joypad.asm
54
joypad.asm
@ -9,9 +9,9 @@ JoypadInt: ; 92e
|
||||
ClearJoypadPublic: ; 92f
|
||||
xor a
|
||||
; Pressed this frame (delta)
|
||||
ld [$ffa7], a
|
||||
ld [hJoyPressed], a
|
||||
; Currently pressed
|
||||
ld [$ffa8], a
|
||||
ld [hJoyDown], a
|
||||
ret
|
||||
; 935
|
||||
|
||||
@ -22,10 +22,10 @@ Joypad: ; 935
|
||||
|
||||
; Updates:
|
||||
|
||||
; $ffa2: released this frame (delta)
|
||||
; $ffa3: pressed this frame (delta)
|
||||
; $ffa4: currently pressed
|
||||
; $ffa5: pressed so far
|
||||
; hJoypadReleased: released this frame (delta)
|
||||
; hJoypadPressed: pressed this frame (delta)
|
||||
; hJoypadDown: currently pressed
|
||||
; hJoypadSum: pressed so far
|
||||
|
||||
; Any of these three bits can be used to disable input.
|
||||
ld a, [$cfbe]
|
||||
@ -76,27 +76,27 @@ Joypad: ; 935
|
||||
ld [rJOYP], a
|
||||
|
||||
; To get the delta we xor the last frame's input with the new one.
|
||||
ld a, [$ffa4] ; last frame
|
||||
ld a, [hJoypadDown] ; last frame
|
||||
ld e, a
|
||||
xor b
|
||||
ld d, a
|
||||
; Released this frame:
|
||||
and e
|
||||
ld [$ffa2], a
|
||||
ld [hJoypadReleased], a
|
||||
; Pressed this frame:
|
||||
ld a, d
|
||||
and b
|
||||
ld [$ffa3], a
|
||||
ld [hJoypadPressed], a
|
||||
|
||||
; Add any new presses to the list of collective presses:
|
||||
ld c, a
|
||||
ld a, [$ffa5]
|
||||
ld a, [hJoypadSum]
|
||||
or c
|
||||
ld [$ffa5], a
|
||||
ld [hJoypadSum], a
|
||||
|
||||
; Currently pressed:
|
||||
ld a, b
|
||||
ld [$ffa4], a
|
||||
ld [hJoypadDown], a
|
||||
|
||||
; Now that we have the input, we can do stuff with it.
|
||||
|
||||
@ -110,11 +110,11 @@ Joypad: ; 935
|
||||
|
||||
|
||||
GetJoypadPublic: ; 984
|
||||
; Update mirror joypad input from $ffa4 (real input)
|
||||
; Update mirror joypad input from hJoypadDown (real input)
|
||||
|
||||
; $ffa6: released this frame (delta)
|
||||
; $ffa7: pressed this frame (delta)
|
||||
; $ffa8: currently pressed
|
||||
; hJoyReleased: released this frame (delta)
|
||||
; hJoyPressed: pressed this frame (delta)
|
||||
; hJoyDown: currently pressed
|
||||
|
||||
; bit 0 A
|
||||
; 1 B
|
||||
@ -137,28 +137,28 @@ GetJoypadPublic: ; 984
|
||||
jr z, .auto
|
||||
|
||||
; To get deltas, take this and last frame's input.
|
||||
ld a, [$ffa4] ; real input
|
||||
ld a, [hJoypadDown] ; real input
|
||||
ld b, a
|
||||
ld a, [$ffa8] ; last frame mirror
|
||||
ld a, [hJoyDown] ; last frame mirror
|
||||
ld e, a
|
||||
|
||||
; Released this frame:
|
||||
xor b
|
||||
ld d, a
|
||||
and e
|
||||
ld [$ffa6], a
|
||||
ld [hJoyReleased], a
|
||||
|
||||
; Pressed this frame:
|
||||
ld a, d
|
||||
and b
|
||||
ld [$ffa7], a
|
||||
ld [hJoyPressed], a
|
||||
|
||||
; It looks like the collective presses got commented out here.
|
||||
ld c, a
|
||||
|
||||
; Currently pressed:
|
||||
ld a, b
|
||||
ld [$ffa8], a ; frame input
|
||||
ld [hJoyDown], a ; frame input
|
||||
|
||||
.quit
|
||||
pop bc
|
||||
@ -174,7 +174,7 @@ GetJoypadPublic: ; 984
|
||||
; A value of $ff will immediately end the stream.
|
||||
|
||||
; Read from the input stream.
|
||||
ld a, [$ff9d]
|
||||
ld a, [hROMBank]
|
||||
push af
|
||||
ld a, [AutoInputBank]
|
||||
rst Bankswitch
|
||||
@ -232,8 +232,8 @@ GetJoypadPublic: ; 984
|
||||
pop af
|
||||
rst Bankswitch
|
||||
ld a, b
|
||||
ld [$ffa7], a ; pressed
|
||||
ld [$ffa8], a ; input
|
||||
ld [hJoyPressed], a ; pressed
|
||||
ld [hJoyDown], a ; input
|
||||
jr .quit
|
||||
; 9ee
|
||||
|
||||
@ -251,9 +251,9 @@ StartAutoInput: ; 9ee
|
||||
ld [AutoInputLength], a
|
||||
; Reset input mirrors.
|
||||
xor a
|
||||
ld [$ffa7], a ; pressed this frame
|
||||
ld [$ffa6], a ; released this frame
|
||||
ld [$ffa8], a ; currently pressed
|
||||
ld [hJoyPressed], a ; pressed this frame
|
||||
ld [hJoyReleased], a ; released this frame
|
||||
ld [hJoyDown], a ; currently pressed
|
||||
|
||||
ld a, AUTO_INPUT
|
||||
ld [InputType], a
|
||||
|
@ -1,4 +1,5 @@
|
||||
INCLUDE "wram.asm"
|
||||
INCLUDE "constants.asm"
|
||||
INCLUDE "gbhw.asm"
|
||||
INCLUDE "hram.asm"
|
||||
INCLUDE "main.tx"
|
||||
|
@ -128,7 +128,7 @@ VBlank0: ; 2b1
|
||||
jr nz, .vblankoccurred
|
||||
|
||||
; update oam by dma transfer
|
||||
call $ff80
|
||||
call hPushOAM
|
||||
; 403f:
|
||||
; ld a, $c4
|
||||
; ld [rDMA], a
|
||||
@ -230,7 +230,7 @@ VBlank1: ; 337
|
||||
call UpdateBGMap
|
||||
call LoadTiles
|
||||
; update oam by dma transfer
|
||||
call $ff80
|
||||
call hPushOAM
|
||||
; 403f:
|
||||
; ld a, $c4
|
||||
; ld [rDMA], a
|
||||
@ -339,7 +339,7 @@ VBlank3: ; 396
|
||||
call LoadTiles
|
||||
|
||||
; update oam by dma transfer
|
||||
call $ff80
|
||||
call hPushOAM
|
||||
; 403f:
|
||||
; ld a, $c4 ; Sprites / $100
|
||||
; ld [rDMA], a
|
||||
@ -411,7 +411,7 @@ VBlank4: ; 3df
|
||||
call SafeLoadTiles
|
||||
|
||||
; update oam by dma transfer
|
||||
call $ff80
|
||||
call hPushOAM
|
||||
; 403f:
|
||||
; ld a, $c4
|
||||
; ld [rDMA], a
|
||||
|
Loading…
x
Reference in New Issue
Block a user