You've already forked pokecrystal-board
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:
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
|
ClearJoypadPublic: ; 92f
|
||||||
xor a
|
xor a
|
||||||
; Pressed this frame (delta)
|
; Pressed this frame (delta)
|
||||||
ld [$ffa7], a
|
ld [hJoyPressed], a
|
||||||
; Currently pressed
|
; Currently pressed
|
||||||
ld [$ffa8], a
|
ld [hJoyDown], a
|
||||||
ret
|
ret
|
||||||
; 935
|
; 935
|
||||||
|
|
||||||
@@ -22,10 +22,10 @@ Joypad: ; 935
|
|||||||
|
|
||||||
; Updates:
|
; Updates:
|
||||||
|
|
||||||
; $ffa2: released this frame (delta)
|
; hJoypadReleased: released this frame (delta)
|
||||||
; $ffa3: pressed this frame (delta)
|
; hJoypadPressed: pressed this frame (delta)
|
||||||
; $ffa4: currently pressed
|
; hJoypadDown: currently pressed
|
||||||
; $ffa5: pressed so far
|
; hJoypadSum: pressed so far
|
||||||
|
|
||||||
; Any of these three bits can be used to disable input.
|
; Any of these three bits can be used to disable input.
|
||||||
ld a, [$cfbe]
|
ld a, [$cfbe]
|
||||||
@@ -76,27 +76,27 @@ Joypad: ; 935
|
|||||||
ld [rJOYP], a
|
ld [rJOYP], a
|
||||||
|
|
||||||
; To get the delta we xor the last frame's input with the new one.
|
; 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
|
ld e, a
|
||||||
xor b
|
xor b
|
||||||
ld d, a
|
ld d, a
|
||||||
; Released this frame:
|
; Released this frame:
|
||||||
and e
|
and e
|
||||||
ld [$ffa2], a
|
ld [hJoypadReleased], a
|
||||||
; Pressed this frame:
|
; Pressed this frame:
|
||||||
ld a, d
|
ld a, d
|
||||||
and b
|
and b
|
||||||
ld [$ffa3], a
|
ld [hJoypadPressed], a
|
||||||
|
|
||||||
; Add any new presses to the list of collective presses:
|
; Add any new presses to the list of collective presses:
|
||||||
ld c, a
|
ld c, a
|
||||||
ld a, [$ffa5]
|
ld a, [hJoypadSum]
|
||||||
or c
|
or c
|
||||||
ld [$ffa5], a
|
ld [hJoypadSum], a
|
||||||
|
|
||||||
; Currently pressed:
|
; Currently pressed:
|
||||||
ld a, b
|
ld a, b
|
||||||
ld [$ffa4], a
|
ld [hJoypadDown], a
|
||||||
|
|
||||||
; Now that we have the input, we can do stuff with it.
|
; Now that we have the input, we can do stuff with it.
|
||||||
|
|
||||||
@@ -110,11 +110,11 @@ Joypad: ; 935
|
|||||||
|
|
||||||
|
|
||||||
GetJoypadPublic: ; 984
|
GetJoypadPublic: ; 984
|
||||||
; Update mirror joypad input from $ffa4 (real input)
|
; Update mirror joypad input from hJoypadDown (real input)
|
||||||
|
|
||||||
; $ffa6: released this frame (delta)
|
; hJoyReleased: released this frame (delta)
|
||||||
; $ffa7: pressed this frame (delta)
|
; hJoyPressed: pressed this frame (delta)
|
||||||
; $ffa8: currently pressed
|
; hJoyDown: currently pressed
|
||||||
|
|
||||||
; bit 0 A
|
; bit 0 A
|
||||||
; 1 B
|
; 1 B
|
||||||
@@ -137,28 +137,28 @@ GetJoypadPublic: ; 984
|
|||||||
jr z, .auto
|
jr z, .auto
|
||||||
|
|
||||||
; To get deltas, take this and last frame's input.
|
; To get deltas, take this and last frame's input.
|
||||||
ld a, [$ffa4] ; real input
|
ld a, [hJoypadDown] ; real input
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, [$ffa8] ; last frame mirror
|
ld a, [hJoyDown] ; last frame mirror
|
||||||
ld e, a
|
ld e, a
|
||||||
|
|
||||||
; Released this frame:
|
; Released this frame:
|
||||||
xor b
|
xor b
|
||||||
ld d, a
|
ld d, a
|
||||||
and e
|
and e
|
||||||
ld [$ffa6], a
|
ld [hJoyReleased], a
|
||||||
|
|
||||||
; Pressed this frame:
|
; Pressed this frame:
|
||||||
ld a, d
|
ld a, d
|
||||||
and b
|
and b
|
||||||
ld [$ffa7], a
|
ld [hJoyPressed], a
|
||||||
|
|
||||||
; It looks like the collective presses got commented out here.
|
; It looks like the collective presses got commented out here.
|
||||||
ld c, a
|
ld c, a
|
||||||
|
|
||||||
; Currently pressed:
|
; Currently pressed:
|
||||||
ld a, b
|
ld a, b
|
||||||
ld [$ffa8], a ; frame input
|
ld [hJoyDown], a ; frame input
|
||||||
|
|
||||||
.quit
|
.quit
|
||||||
pop bc
|
pop bc
|
||||||
@@ -174,7 +174,7 @@ GetJoypadPublic: ; 984
|
|||||||
; A value of $ff will immediately end the stream.
|
; A value of $ff will immediately end the stream.
|
||||||
|
|
||||||
; Read from the input stream.
|
; Read from the input stream.
|
||||||
ld a, [$ff9d]
|
ld a, [hROMBank]
|
||||||
push af
|
push af
|
||||||
ld a, [AutoInputBank]
|
ld a, [AutoInputBank]
|
||||||
rst Bankswitch
|
rst Bankswitch
|
||||||
@@ -232,8 +232,8 @@ GetJoypadPublic: ; 984
|
|||||||
pop af
|
pop af
|
||||||
rst Bankswitch
|
rst Bankswitch
|
||||||
ld a, b
|
ld a, b
|
||||||
ld [$ffa7], a ; pressed
|
ld [hJoyPressed], a ; pressed
|
||||||
ld [$ffa8], a ; input
|
ld [hJoyDown], a ; input
|
||||||
jr .quit
|
jr .quit
|
||||||
; 9ee
|
; 9ee
|
||||||
|
|
||||||
@@ -251,9 +251,9 @@ StartAutoInput: ; 9ee
|
|||||||
ld [AutoInputLength], a
|
ld [AutoInputLength], a
|
||||||
; Reset input mirrors.
|
; Reset input mirrors.
|
||||||
xor a
|
xor a
|
||||||
ld [$ffa7], a ; pressed this frame
|
ld [hJoyPressed], a ; pressed this frame
|
||||||
ld [$ffa6], a ; released this frame
|
ld [hJoyReleased], a ; released this frame
|
||||||
ld [$ffa8], a ; currently pressed
|
ld [hJoyDown], a ; currently pressed
|
||||||
|
|
||||||
ld a, AUTO_INPUT
|
ld a, AUTO_INPUT
|
||||||
ld [InputType], a
|
ld [InputType], a
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
INCLUDE "wram.asm"
|
INCLUDE "wram.asm"
|
||||||
INCLUDE "constants.asm"
|
INCLUDE "constants.asm"
|
||||||
INCLUDE "gbhw.asm"
|
INCLUDE "gbhw.asm"
|
||||||
|
INCLUDE "hram.asm"
|
||||||
INCLUDE "main.tx"
|
INCLUDE "main.tx"
|
||||||
|
@@ -128,7 +128,7 @@ VBlank0: ; 2b1
|
|||||||
jr nz, .vblankoccurred
|
jr nz, .vblankoccurred
|
||||||
|
|
||||||
; update oam by dma transfer
|
; update oam by dma transfer
|
||||||
call $ff80
|
call hPushOAM
|
||||||
; 403f:
|
; 403f:
|
||||||
; ld a, $c4
|
; ld a, $c4
|
||||||
; ld [rDMA], a
|
; ld [rDMA], a
|
||||||
@@ -230,7 +230,7 @@ VBlank1: ; 337
|
|||||||
call UpdateBGMap
|
call UpdateBGMap
|
||||||
call LoadTiles
|
call LoadTiles
|
||||||
; update oam by dma transfer
|
; update oam by dma transfer
|
||||||
call $ff80
|
call hPushOAM
|
||||||
; 403f:
|
; 403f:
|
||||||
; ld a, $c4
|
; ld a, $c4
|
||||||
; ld [rDMA], a
|
; ld [rDMA], a
|
||||||
@@ -339,7 +339,7 @@ VBlank3: ; 396
|
|||||||
call LoadTiles
|
call LoadTiles
|
||||||
|
|
||||||
; update oam by dma transfer
|
; update oam by dma transfer
|
||||||
call $ff80
|
call hPushOAM
|
||||||
; 403f:
|
; 403f:
|
||||||
; ld a, $c4 ; Sprites / $100
|
; ld a, $c4 ; Sprites / $100
|
||||||
; ld [rDMA], a
|
; ld [rDMA], a
|
||||||
@@ -411,7 +411,7 @@ VBlank4: ; 3df
|
|||||||
call SafeLoadTiles
|
call SafeLoadTiles
|
||||||
|
|
||||||
; update oam by dma transfer
|
; update oam by dma transfer
|
||||||
call $ff80
|
call hPushOAM
|
||||||
; 403f:
|
; 403f:
|
||||||
; ld a, $c4
|
; ld a, $c4
|
||||||
; ld [rDMA], a
|
; ld [rDMA], a
|
||||||
|
Reference in New Issue
Block a user