mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08: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
|
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
|
||||||
|
268
main.asm
268
main.asm
@ -7,7 +7,7 @@ SECTION "rst8",HOME[$8] ; FarCall
|
|||||||
jp FarJpHl
|
jp FarJpHl
|
||||||
|
|
||||||
SECTION "rst10",HOME[$10] ; Bankswitch
|
SECTION "rst10",HOME[$10] ; Bankswitch
|
||||||
ld [$ff9d], a
|
ld [hROMBank], a
|
||||||
ld [$2000], a
|
ld [$2000], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ UpdateTime: ; 5a7
|
|||||||
; 5b7
|
; 5b7
|
||||||
|
|
||||||
GetClock: ; 5b7
|
GetClock: ; 5b7
|
||||||
; store clock data in $ff8d-$ff91
|
; store clock data in hRTCDayHi-hRTCSeconds
|
||||||
|
|
||||||
; enable clock r/w
|
; enable clock r/w
|
||||||
ld a, $a
|
ld a, $a
|
||||||
@ -236,25 +236,25 @@ GetClock: ; 5b7
|
|||||||
ld [hl], $8 ; S
|
ld [hl], $8 ; S
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
and $3f
|
and $3f
|
||||||
ld [$ff91], a
|
ld [hRTCSeconds], a
|
||||||
; minutes
|
; minutes
|
||||||
ld [hl], $9 ; M
|
ld [hl], $9 ; M
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
and $3f
|
and $3f
|
||||||
ld [$ff90], a
|
ld [hRTCMinutes], a
|
||||||
; hours
|
; hours
|
||||||
ld [hl], $a ; H
|
ld [hl], $a ; H
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
and $1f
|
and $1f
|
||||||
ld [$ff8f], a
|
ld [hRTCHours], a
|
||||||
; day lo
|
; day lo
|
||||||
ld [hl], $b ; DL
|
ld [hl], $b ; DL
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
ld [$ff8e], a
|
ld [hRTCDayLo], a
|
||||||
; day hi
|
; day hi
|
||||||
ld [hl], $c ; DH
|
ld [hl], $c ; DH
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
ld [$ff8d], a
|
ld [hRTCDayHi], a
|
||||||
|
|
||||||
; cleanup
|
; cleanup
|
||||||
call CloseSRAM ; unlatch clock, disable clock r/w
|
call CloseSRAM ; unlatch clock, disable clock r/w
|
||||||
@ -267,16 +267,16 @@ FixDays: ; 5e8
|
|||||||
; mod by 140
|
; mod by 140
|
||||||
|
|
||||||
; check if day count > 255 (bit 8 set)
|
; check if day count > 255 (bit 8 set)
|
||||||
ld a, [$ff8d] ; DH
|
ld a, [hRTCDayHi] ; DH
|
||||||
bit 0, a
|
bit 0, a
|
||||||
jr z, .daylo
|
jr z, .daylo
|
||||||
; reset dh (bit 8)
|
; reset dh (bit 8)
|
||||||
res 0, a
|
res 0, a
|
||||||
ld [$ff8d], a ; DH
|
ld [hRTCDayHi], a ; DH
|
||||||
|
|
||||||
; mod 140
|
; mod 140
|
||||||
; mod twice since bit 8 (DH) was set
|
; mod twice since bit 8 (DH) was set
|
||||||
ld a, [$ff8e] ; DL
|
ld a, [hRTCDayLo] ; DL
|
||||||
.modh
|
.modh
|
||||||
sub 140
|
sub 140
|
||||||
jr nc, .modh
|
jr nc, .modh
|
||||||
@ -286,7 +286,7 @@ FixDays: ; 5e8
|
|||||||
add 140
|
add 140
|
||||||
|
|
||||||
; update dl
|
; update dl
|
||||||
ld [$ff8e], a ; DL
|
ld [hRTCDayLo], a ; DL
|
||||||
|
|
||||||
; unknown output
|
; unknown output
|
||||||
ld a, $40 ; %1000000
|
ld a, $40 ; %1000000
|
||||||
@ -294,7 +294,7 @@ FixDays: ; 5e8
|
|||||||
|
|
||||||
.daylo
|
.daylo
|
||||||
; quit if fewer than 140 days have passed
|
; quit if fewer than 140 days have passed
|
||||||
ld a, [$ff8e] ; DL
|
ld a, [hRTCDayLo] ; DL
|
||||||
cp 140
|
cp 140
|
||||||
jr c, .quit
|
jr c, .quit
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ FixDays: ; 5e8
|
|||||||
add 140
|
add 140
|
||||||
|
|
||||||
; update dl
|
; update dl
|
||||||
ld [$ff8e], a ; DL
|
ld [hRTCDayLo], a ; DL
|
||||||
|
|
||||||
; unknown output
|
; unknown output
|
||||||
ld a, $20 ; %100000
|
ld a, $20 ; %100000
|
||||||
@ -327,10 +327,10 @@ FixDays: ; 5e8
|
|||||||
FixTime: ; 61d
|
FixTime: ; 61d
|
||||||
; add ingame time (set at newgame) to current time
|
; add ingame time (set at newgame) to current time
|
||||||
; day hr min sec
|
; day hr min sec
|
||||||
; store time in CurDay, $ff94, $ff96, $ff98
|
; store time in CurDay, hHours, hMinutes, hSeconds
|
||||||
|
|
||||||
; second
|
; second
|
||||||
ld a, [$ff91] ; S
|
ld a, [hRTCSeconds] ; S
|
||||||
ld c, a
|
ld c, a
|
||||||
ld a, [StartSecond]
|
ld a, [StartSecond]
|
||||||
add c
|
add c
|
||||||
@ -338,11 +338,11 @@ FixTime: ; 61d
|
|||||||
jr nc, .updatesec
|
jr nc, .updatesec
|
||||||
add 60
|
add 60
|
||||||
.updatesec
|
.updatesec
|
||||||
ld [$ff98], a
|
ld [hSeconds], a
|
||||||
|
|
||||||
; minute
|
; minute
|
||||||
ccf ; carry is set, so turn it off
|
ccf ; carry is set, so turn it off
|
||||||
ld a, [$ff90] ; M
|
ld a, [hRTCMinutes] ; M
|
||||||
ld c, a
|
ld c, a
|
||||||
ld a, [StartMinute]
|
ld a, [StartMinute]
|
||||||
adc c
|
adc c
|
||||||
@ -350,11 +350,11 @@ FixTime: ; 61d
|
|||||||
jr nc, .updatemin
|
jr nc, .updatemin
|
||||||
add 60
|
add 60
|
||||||
.updatemin
|
.updatemin
|
||||||
ld [$ff96], a
|
ld [hMinutes], a
|
||||||
|
|
||||||
; hour
|
; hour
|
||||||
ccf ; carry is set, so turn it off
|
ccf ; carry is set, so turn it off
|
||||||
ld a, [$ff8f] ; H
|
ld a, [hRTCHours] ; H
|
||||||
ld c, a
|
ld c, a
|
||||||
ld a, [StartHour]
|
ld a, [StartHour]
|
||||||
adc c
|
adc c
|
||||||
@ -362,11 +362,11 @@ FixTime: ; 61d
|
|||||||
jr nc, .updatehr
|
jr nc, .updatehr
|
||||||
add 24
|
add 24
|
||||||
.updatehr
|
.updatehr
|
||||||
ld [$ff94], a
|
ld [hHours], a
|
||||||
|
|
||||||
; day
|
; day
|
||||||
ccf ; carry is set, so turn it off
|
ccf ; carry is set, so turn it off
|
||||||
ld a, [$ff8e] ; DL
|
ld a, [hRTCDayLo] ; DL
|
||||||
ld c, a
|
ld c, a
|
||||||
ld a, [StartDay]
|
ld a, [StartDay]
|
||||||
adc c
|
adc c
|
||||||
@ -399,23 +399,23 @@ SetClock: ; 691
|
|||||||
|
|
||||||
; seconds
|
; seconds
|
||||||
ld [hl], $8 ; S
|
ld [hl], $8 ; S
|
||||||
ld a, [$ff91]
|
ld a, [hRTCSeconds]
|
||||||
ld [de], a
|
ld [de], a
|
||||||
; minutes
|
; minutes
|
||||||
ld [hl], $9 ; M
|
ld [hl], $9 ; M
|
||||||
ld a, [$ff90]
|
ld a, [hRTCMinutes]
|
||||||
ld [de], a
|
ld [de], a
|
||||||
; hours
|
; hours
|
||||||
ld [hl], $a ; H
|
ld [hl], $a ; H
|
||||||
ld a, [$ff8f]
|
ld a, [hRTCHours]
|
||||||
ld [de], a
|
ld [de], a
|
||||||
; day lo
|
; day lo
|
||||||
ld [hl], $b ; DL
|
ld [hl], $b ; DL
|
||||||
ld a, [$ff8e]
|
ld a, [hRTCDayLo]
|
||||||
ld [de], a
|
ld [de], a
|
||||||
; day hi
|
; day hi
|
||||||
ld [hl], $c ; DH
|
ld [hl], $c ; DH
|
||||||
ld a, [$ff8d]
|
ld a, [hRTCDayHi]
|
||||||
res 6, a ; make sure timer is active
|
res 6, a ; make sure timer is active
|
||||||
ld [de], a
|
ld [de], a
|
||||||
|
|
||||||
@ -438,7 +438,7 @@ FarDecompress: ; b40
|
|||||||
; put a away for a sec
|
; put a away for a sec
|
||||||
ld [$c2c4], a
|
ld [$c2c4], a
|
||||||
; save bank
|
; save bank
|
||||||
ld a, [$ff9d]
|
ld a, [hROMBank]
|
||||||
push af
|
push af
|
||||||
; bankswitch
|
; bankswitch
|
||||||
ld a, [$c2c4]
|
ld a, [$c2c4]
|
||||||
@ -808,14 +808,14 @@ UpdatePalsIfCGB: ; c2f
|
|||||||
; return carry if successful
|
; return carry if successful
|
||||||
|
|
||||||
; check cgb
|
; check cgb
|
||||||
ld a, [$ffe6]
|
ld a, [hCGB]
|
||||||
and a
|
and a
|
||||||
ret z
|
ret z
|
||||||
|
|
||||||
UpdateCGBPals: ; c33
|
UpdateCGBPals: ; c33
|
||||||
; return carry if successful
|
; return carry if successful
|
||||||
; any pals to update?
|
; any pals to update?
|
||||||
ld a, [$ffe5]
|
ld a, [hCGBPalUpdate]
|
||||||
and a
|
and a
|
||||||
ret z
|
ret z
|
||||||
|
|
||||||
@ -924,7 +924,7 @@ ForceUpdateCGBPals: ; c37
|
|||||||
ld [rSVBK], a
|
ld [rSVBK], a
|
||||||
; clear pal update queue
|
; clear pal update queue
|
||||||
xor a
|
xor a
|
||||||
ld [$ffe5], a
|
ld [hCGBPalUpdate], a
|
||||||
; successfully updated palettes
|
; successfully updated palettes
|
||||||
scf
|
scf
|
||||||
ret
|
ret
|
||||||
@ -939,7 +939,7 @@ DmgToCgbBGPals: ; c9f
|
|||||||
push af
|
push af
|
||||||
|
|
||||||
; check cgb
|
; check cgb
|
||||||
ld a, [$ffe6]
|
ld a, [hCGB]
|
||||||
and a
|
and a
|
||||||
jr z, .end
|
jr z, .end
|
||||||
|
|
||||||
@ -964,7 +964,7 @@ DmgToCgbBGPals: ; c9f
|
|||||||
call CopyPals
|
call CopyPals
|
||||||
; request pal update
|
; request pal update
|
||||||
ld a, $1
|
ld a, $1
|
||||||
ld [$ffe5], a
|
ld [hCGBPalUpdate], a
|
||||||
; restore wram bank
|
; restore wram bank
|
||||||
pop af
|
pop af
|
||||||
ld [$ff70], a
|
ld [$ff70], a
|
||||||
@ -988,7 +988,7 @@ DmgToCgbObjPals: ; ccb
|
|||||||
ld [rOBP1], a
|
ld [rOBP1], a
|
||||||
|
|
||||||
; check cgb
|
; check cgb
|
||||||
ld a, [$ffe6]
|
ld a, [hCGB]
|
||||||
and a
|
and a
|
||||||
ret z
|
ret z
|
||||||
|
|
||||||
@ -1015,7 +1015,7 @@ DmgToCgbObjPals: ; ccb
|
|||||||
call CopyPals
|
call CopyPals
|
||||||
; request pal update
|
; request pal update
|
||||||
ld a, $1
|
ld a, $1
|
||||||
ld [$ffe5], a
|
ld [hCGBPalUpdate], a
|
||||||
; restore wram bank
|
; restore wram bank
|
||||||
pop af
|
pop af
|
||||||
ld [$ff70], a
|
ld [$ff70], a
|
||||||
@ -1083,10 +1083,10 @@ INCBIN "baserom.gbc",$d79,$e8d - $d79
|
|||||||
|
|
||||||
; copy bc bytes from a:hl to de
|
; copy bc bytes from a:hl to de
|
||||||
FarCopyBytes: ; e8d
|
FarCopyBytes: ; e8d
|
||||||
ld [$ff8b], a
|
ld [hBuffer], a
|
||||||
ld a, [$ff9d] ; save old bank
|
ld a, [hROMBank] ; save old bank
|
||||||
push af
|
push af
|
||||||
ld a, [$ff8b]
|
ld a, [hBuffer]
|
||||||
rst Bankswitch
|
rst Bankswitch
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
pop af
|
pop af
|
||||||
@ -1096,10 +1096,10 @@ FarCopyBytes: ; e8d
|
|||||||
|
|
||||||
; copy bc*2 source bytes from a:hl to de, doubling each byte in process
|
; copy bc*2 source bytes from a:hl to de, doubling each byte in process
|
||||||
FarCopyBytesDouble: ; e9b
|
FarCopyBytesDouble: ; e9b
|
||||||
ld [$ff8b], a
|
ld [hBuffer], a
|
||||||
ld a, [$ff9d] ; save current bank
|
ld a, [hROMBank] ; save current bank
|
||||||
push af
|
push af
|
||||||
ld a, [$ff8b]
|
ld a, [hBuffer]
|
||||||
rst Bankswitch ; bankswitch
|
rst Bankswitch ; bankswitch
|
||||||
ld a, h ; switcheroo, de <> hl
|
ld a, h ; switcheroo, de <> hl
|
||||||
ld h, d
|
ld h, d
|
||||||
@ -1332,7 +1332,7 @@ CheckDict:
|
|||||||
INCBIN "baserom.gbc",$117b,$1203 - $117b
|
INCBIN "baserom.gbc",$117b,$1203 - $117b
|
||||||
|
|
||||||
Char5D:
|
Char5D:
|
||||||
ld a, [$ffe4]
|
ld a, [hBattleTurn]
|
||||||
push de
|
push de
|
||||||
and a
|
and a
|
||||||
jr nz, .asm_120e ; 0x1207 $5
|
jr nz, .asm_120e ; 0x1207 $5
|
||||||
@ -1422,14 +1422,14 @@ DMATransfer: ; 15d8
|
|||||||
; return carry if successful
|
; return carry if successful
|
||||||
|
|
||||||
; anything to transfer?
|
; anything to transfer?
|
||||||
ld a, [$ffe8]
|
ld a, [hDMATransfer]
|
||||||
and a
|
and a
|
||||||
ret z
|
ret z
|
||||||
; start transfer
|
; start transfer
|
||||||
ld [rHDMA5], a
|
ld [rHDMA5], a
|
||||||
; indicate that transfer has occurred
|
; indicate that transfer has occurred
|
||||||
xor a
|
xor a
|
||||||
ld [$ffe8], a
|
ld [hDMATransfer], a
|
||||||
; successful transfer
|
; successful transfer
|
||||||
scf
|
scf
|
||||||
ret
|
ret
|
||||||
@ -1443,14 +1443,14 @@ UpdateBGMapBuffer: ; 15e3
|
|||||||
; return carry if successful
|
; return carry if successful
|
||||||
|
|
||||||
; any tiles to update?
|
; any tiles to update?
|
||||||
ld a, [$ffdb]
|
ld a, [hBGMapUpdate]
|
||||||
and a
|
and a
|
||||||
ret z
|
ret z
|
||||||
; save wram bank
|
; save wram bank
|
||||||
ld a, [rVBK]
|
ld a, [rVBK]
|
||||||
push af
|
push af
|
||||||
; save sp
|
; save sp
|
||||||
ld [$ffd9], sp
|
ld [hSPBuffer], sp
|
||||||
|
|
||||||
; temp stack
|
; temp stack
|
||||||
ld hl, BGMapBufferPtrs
|
ld hl, BGMapBufferPtrs
|
||||||
@ -1531,7 +1531,7 @@ UpdateBGMapBuffer: ; 15e3
|
|||||||
|
|
||||||
|
|
||||||
; restore sp
|
; restore sp
|
||||||
ld a, [$ffd9]
|
ld a, [hSPBuffer]
|
||||||
ld l, a
|
ld l, a
|
||||||
ld a, [$ffda]
|
ld a, [$ffda]
|
||||||
ld h, a
|
ld h, a
|
||||||
@ -1543,7 +1543,7 @@ UpdateBGMapBuffer: ; 15e3
|
|||||||
|
|
||||||
; we don't need to update bg map until new tiles are loaded
|
; we don't need to update bg map until new tiles are loaded
|
||||||
xor a
|
xor a
|
||||||
ld [$ffdb], a
|
ld [hBGMapUpdate], a
|
||||||
|
|
||||||
; successfully updated bg map
|
; successfully updated bg map
|
||||||
scf
|
scf
|
||||||
@ -1552,12 +1552,12 @@ UpdateBGMapBuffer: ; 15e3
|
|||||||
|
|
||||||
|
|
||||||
WaitTop: ; 163a
|
WaitTop: ; 163a
|
||||||
ld a, [$ffd4]
|
ld a, [hBGMapMode]
|
||||||
and a
|
and a
|
||||||
ret z
|
ret z
|
||||||
|
|
||||||
; wait until top third of bg map can be updated
|
; wait until top third of bg map can be updated
|
||||||
ld a, [$ffd5]
|
ld a, [hBGMapThird]
|
||||||
and a
|
and a
|
||||||
jr z, .quit
|
jr z, .quit
|
||||||
|
|
||||||
@ -1566,14 +1566,14 @@ WaitTop: ; 163a
|
|||||||
|
|
||||||
.quit
|
.quit
|
||||||
xor a
|
xor a
|
||||||
ld [$ffd4], a
|
ld [hBGMapMode], a
|
||||||
ret
|
ret
|
||||||
; 164c
|
; 164c
|
||||||
|
|
||||||
|
|
||||||
UpdateBGMap: ; 164c
|
UpdateBGMap: ; 164c
|
||||||
; get mode
|
; get mode
|
||||||
ld a, [$ffd4]
|
ld a, [hBGMapMode]
|
||||||
and a
|
and a
|
||||||
ret z
|
ret z
|
||||||
|
|
||||||
@ -1585,7 +1585,7 @@ UpdateBGMap: ; 164c
|
|||||||
dec a ; ?
|
dec a ; ?
|
||||||
|
|
||||||
; save bg map address
|
; save bg map address
|
||||||
ld a, [$ffd6]
|
ld a, [hBGMapAddress]
|
||||||
ld l, a
|
ld l, a
|
||||||
ld a, [$ffd7]
|
ld a, [$ffd7]
|
||||||
ld h, a
|
ld h, a
|
||||||
@ -1593,12 +1593,12 @@ UpdateBGMap: ; 164c
|
|||||||
|
|
||||||
; bg map 1 ($9c00)
|
; bg map 1 ($9c00)
|
||||||
xor a
|
xor a
|
||||||
ld [$ffd6], a
|
ld [hBGMapAddress], a
|
||||||
ld a, $9c
|
ld a, $9c
|
||||||
ld [$ffd7], a
|
ld [$ffd7], a
|
||||||
|
|
||||||
; get mode again
|
; get mode again
|
||||||
ld a, [$ffd4]
|
ld a, [hBGMapMode]
|
||||||
push af
|
push af
|
||||||
cp 3
|
cp 3
|
||||||
call z, .tiles
|
call z, .tiles
|
||||||
@ -1609,7 +1609,7 @@ UpdateBGMap: ; 164c
|
|||||||
; restore bg map address
|
; restore bg map address
|
||||||
pop hl
|
pop hl
|
||||||
ld a, l
|
ld a, l
|
||||||
ld [$ffd6], a
|
ld [hBGMapAddress], a
|
||||||
ld a, h
|
ld a, h
|
||||||
ld [$ffd7], a
|
ld [$ffd7], a
|
||||||
ret
|
ret
|
||||||
@ -1632,10 +1632,10 @@ UpdateBGMap: ; 164c
|
|||||||
|
|
||||||
.getthird
|
.getthird
|
||||||
; save sp
|
; save sp
|
||||||
ld [$ffd9], sp
|
ld [hSPBuffer], sp
|
||||||
|
|
||||||
; # tiles to move down * 6 (which third?)
|
; # tiles to move down * 6 (which third?)
|
||||||
ld a, [$ffd5]
|
ld a, [hBGMapThird]
|
||||||
and a ; 0
|
and a ; 0
|
||||||
jr z, .top
|
jr z, .top
|
||||||
dec a ; 1
|
dec a ; 1
|
||||||
@ -1650,7 +1650,7 @@ UpdateBGMap: ; 164c
|
|||||||
; get bg map address
|
; get bg map address
|
||||||
ld a, [$ffd7]
|
ld a, [$ffd7]
|
||||||
ld h, a
|
ld h, a
|
||||||
ld a, [$ffd6]
|
ld a, [hBGMapAddress]
|
||||||
ld l, a
|
ld l, a
|
||||||
; move 12 tiles down
|
; move 12 tiles down
|
||||||
ld de, $0180 ; bgm(0,12)
|
ld de, $0180 ; bgm(0,12)
|
||||||
@ -1668,7 +1668,7 @@ UpdateBGMap: ; 164c
|
|||||||
; get bg map address
|
; get bg map address
|
||||||
ld a, [$ffd7]
|
ld a, [$ffd7]
|
||||||
ld h, a
|
ld h, a
|
||||||
ld a, [$ffd6]
|
ld a, [hBGMapAddress]
|
||||||
ld l, a
|
ld l, a
|
||||||
; move 6 tiles down
|
; move 6 tiles down
|
||||||
ld de, $00c0 ; bgm(0,6)
|
ld de, $00c0 ; bgm(0,6)
|
||||||
@ -1683,14 +1683,14 @@ UpdateBGMap: ; 164c
|
|||||||
; get bg map address
|
; get bg map address
|
||||||
ld a, [$ffd7]
|
ld a, [$ffd7]
|
||||||
ld h, a
|
ld h, a
|
||||||
ld a, [$ffd6]
|
ld a, [hBGMapAddress]
|
||||||
ld l, a
|
ld l, a
|
||||||
; start at middle next time
|
; start at middle next time
|
||||||
ld a, 1
|
ld a, 1
|
||||||
|
|
||||||
.start
|
.start
|
||||||
; which third to draw next update
|
; which third to draw next update
|
||||||
ld [$ffd5], a
|
ld [hBGMapThird], a
|
||||||
; # rows per third
|
; # rows per third
|
||||||
ld a, 6 ; SCREEN_HEIGHT / 3
|
ld a, 6 ; SCREEN_HEIGHT / 3
|
||||||
; # tiles from the edge of the screen to the next row
|
; # tiles from the edge of the screen to the next row
|
||||||
@ -1754,7 +1754,7 @@ UpdateBGMap: ; 164c
|
|||||||
jr nz, .row
|
jr nz, .row
|
||||||
|
|
||||||
; restore sp
|
; restore sp
|
||||||
ld a, [$ffd9]
|
ld a, [hSPBuffer]
|
||||||
ld l, a
|
ld l, a
|
||||||
ld a, [$ffda]
|
ld a, [$ffda]
|
||||||
ld h, a
|
ld h, a
|
||||||
@ -1780,7 +1780,7 @@ SafeLoadTiles2: ; 170a
|
|||||||
GetTiles2: ; 1717
|
GetTiles2: ; 1717
|
||||||
; load [$cf6c] tiles from [$cf6d-e] to [$cf6f-70]
|
; load [$cf6c] tiles from [$cf6d-e] to [$cf6f-70]
|
||||||
; save sp
|
; save sp
|
||||||
ld [$ffd9], sp
|
ld [hSPBuffer], sp
|
||||||
|
|
||||||
; sp = [$cf6d-e] tile source
|
; sp = [$cf6d-e] tile source
|
||||||
ld hl, $cf6d
|
ld hl, $cf6d
|
||||||
@ -1856,7 +1856,7 @@ GetTiles2: ; 1717
|
|||||||
ld [$cf6d], sp
|
ld [$cf6d], sp
|
||||||
|
|
||||||
; restore sp
|
; restore sp
|
||||||
ld a, [$ffd9]
|
ld a, [hSPBuffer]
|
||||||
ld l, a
|
ld l, a
|
||||||
ld a, [$ffda]
|
ld a, [$ffda]
|
||||||
ld h, a
|
ld h, a
|
||||||
@ -1892,7 +1892,7 @@ GetTiles: ; 177d
|
|||||||
; load [$cf67] tiles from [$cf68-9] to [$cf6a-b]
|
; load [$cf67] tiles from [$cf68-9] to [$cf6a-b]
|
||||||
|
|
||||||
; save sp
|
; save sp
|
||||||
ld [$ffd9], sp
|
ld [hSPBuffer], sp
|
||||||
|
|
||||||
; sp = [$cf68-9] tile source
|
; sp = [$cf68-9] tile source
|
||||||
ld hl, $cf68
|
ld hl, $cf68
|
||||||
@ -1971,7 +1971,7 @@ GetTiles: ; 177d
|
|||||||
ld [$cf68], sp
|
ld [$cf68], sp
|
||||||
|
|
||||||
; restore sp
|
; restore sp
|
||||||
ld a, [$ffd9]
|
ld a, [hSPBuffer]
|
||||||
ld l, a
|
ld l, a
|
||||||
ld a, [$ffda]
|
ld a, [$ffda]
|
||||||
ld h, a
|
ld h, a
|
||||||
@ -1997,7 +1997,7 @@ SafeTileAnimation: ; 17d3
|
|||||||
|
|
||||||
; save affected banks
|
; save affected banks
|
||||||
; switch to new banks
|
; switch to new banks
|
||||||
ld a, [$ff9d]
|
ld a, [hROMBank]
|
||||||
push af ; save bank
|
push af ; save bank
|
||||||
ld a, BANK(DoTileAnimation)
|
ld a, BANK(DoTileAnimation)
|
||||||
rst Bankswitch ; bankswitch
|
rst Bankswitch ; bankswitch
|
||||||
@ -2036,7 +2036,7 @@ GetTileType: ; 185d
|
|||||||
ld e, a
|
ld e, a
|
||||||
ld d, $00
|
ld d, $00
|
||||||
add hl, de
|
add hl, de
|
||||||
ld a, [$ff9d] ; current bank
|
ld a, [hROMBank] ; current bank
|
||||||
push af
|
push af
|
||||||
ld a, BANK(TileTypeTable)
|
ld a, BANK(TileTypeTable)
|
||||||
rst Bankswitch
|
rst Bankswitch
|
||||||
@ -2252,7 +2252,7 @@ GetScriptByte: ; 0x26d4
|
|||||||
push hl
|
push hl
|
||||||
push bc
|
push bc
|
||||||
|
|
||||||
ld a, [$ff9d]
|
ld a, [hROMBank]
|
||||||
push af
|
push af
|
||||||
|
|
||||||
ld a, [ScriptBank]
|
ld a, [ScriptBank]
|
||||||
@ -2342,7 +2342,7 @@ GetMapHeaderMember: ; 0x2c04
|
|||||||
|
|
||||||
GetAnyMapHeaderMember: ; 0x2c0c
|
GetAnyMapHeaderMember: ; 0x2c0c
|
||||||
; bankswitch
|
; bankswitch
|
||||||
ld a, [$ff9d]
|
ld a, [hROMBank]
|
||||||
push af
|
push af
|
||||||
ld a, BANK(MapGroupPointers)
|
ld a, BANK(MapGroupPointers)
|
||||||
rst Bankswitch
|
rst Bankswitch
|
||||||
@ -2396,10 +2396,10 @@ FarJpHl: ; 2d63
|
|||||||
; Preserves all registers besides a.
|
; Preserves all registers besides a.
|
||||||
|
|
||||||
; Switch to the new bank.
|
; Switch to the new bank.
|
||||||
ld [$ff8b], a
|
ld [hBuffer], a
|
||||||
ld a, [$ff9d]
|
ld a, [hROMBank]
|
||||||
push af
|
push af
|
||||||
ld a, [$ff8b]
|
ld a, [hBuffer]
|
||||||
rst Bankswitch
|
rst Bankswitch
|
||||||
|
|
||||||
call .hl
|
call .hl
|
||||||
@ -2451,7 +2451,7 @@ Predef: ; 2d83
|
|||||||
ld [$cfb4], a
|
ld [$cfb4], a
|
||||||
|
|
||||||
; save bank
|
; save bank
|
||||||
ld a, [$ff9d] ; current bank
|
ld a, [hROMBank] ; current bank
|
||||||
push af
|
push af
|
||||||
|
|
||||||
; get Predef function to call
|
; get Predef function to call
|
||||||
@ -2595,15 +2595,15 @@ RNG: ; 2f8c
|
|||||||
; Added value
|
; Added value
|
||||||
ld a, [rDIV]
|
ld a, [rDIV]
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, [$ffe1]
|
ld a, [hRandomAdd]
|
||||||
adc b
|
adc b
|
||||||
ld [$ffe1], a
|
ld [hRandomAdd], a
|
||||||
; Subtracted value
|
; Subtracted value
|
||||||
ld a, [rDIV]
|
ld a, [rDIV]
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, [$ffe2]
|
ld a, [hRandomSub]
|
||||||
sbc b
|
sbc b
|
||||||
ld [$ffe2], a
|
ld [hRandomSub], a
|
||||||
pop bc
|
pop bc
|
||||||
ret
|
ret
|
||||||
; 2f9f
|
; 2f9f
|
||||||
@ -2614,7 +2614,7 @@ FarBattleRNG: ; 2f9f
|
|||||||
; allowing link battles to remain in sync using a shared PRNG.
|
; allowing link battles to remain in sync using a shared PRNG.
|
||||||
|
|
||||||
; Save bank
|
; Save bank
|
||||||
ld a, [$ff9d] ; bank
|
ld a, [hROMBank] ; bank
|
||||||
push af
|
push af
|
||||||
; Bankswitch
|
; Bankswitch
|
||||||
ld a, BANK(BattleRNG)
|
ld a, BANK(BattleRNG)
|
||||||
@ -2642,7 +2642,7 @@ Function2fb1: ; 2fb1
|
|||||||
push bc
|
push bc
|
||||||
.asm_2fbb
|
.asm_2fbb
|
||||||
call $2f8c
|
call $2f8c
|
||||||
ld a, [$ffe1]
|
ld a, [hRandomAdd]
|
||||||
ld c, a
|
ld c, a
|
||||||
add b
|
add b
|
||||||
jr c, .asm_2fbb
|
jr c, .asm_2fbb
|
||||||
@ -2775,31 +2775,31 @@ ByteFill: ; 0x3041
|
|||||||
GetFarByte: ; 0x304d
|
GetFarByte: ; 0x304d
|
||||||
; retrieve a single byte from a:hl, and return it in a.
|
; retrieve a single byte from a:hl, and return it in a.
|
||||||
; bankswitch to new bank
|
; bankswitch to new bank
|
||||||
ld [$ff8b], a
|
ld [hBuffer], a
|
||||||
ld a, [$ff9d]
|
ld a, [hROMBank]
|
||||||
push af
|
push af
|
||||||
ld a, [$ff8b]
|
ld a, [hBuffer]
|
||||||
rst Bankswitch
|
rst Bankswitch
|
||||||
|
|
||||||
; get byte from new bank
|
; get byte from new bank
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ld [$ff8b], a
|
ld [hBuffer], a
|
||||||
|
|
||||||
; bankswitch to previous bank
|
; bankswitch to previous bank
|
||||||
pop af
|
pop af
|
||||||
rst Bankswitch
|
rst Bankswitch
|
||||||
|
|
||||||
; return retrieved value in a
|
; return retrieved value in a
|
||||||
ld a, [$ff8b]
|
ld a, [hBuffer]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
GetFarHalfword: ; 0x305d
|
GetFarHalfword: ; 0x305d
|
||||||
; retrieve a halfword from a:hl, and return it in hl.
|
; retrieve a halfword from a:hl, and return it in hl.
|
||||||
; bankswitch to new bank
|
; bankswitch to new bank
|
||||||
ld [$ff8b], a
|
ld [hBuffer], a
|
||||||
ld a, [$ff9d]
|
ld a, [hROMBank]
|
||||||
push af
|
push af
|
||||||
ld a, [$ff8b]
|
ld a, [hBuffer]
|
||||||
rst Bankswitch
|
rst Bankswitch
|
||||||
|
|
||||||
; get halfword from new bank, put it in hl
|
; get halfword from new bank, put it in hl
|
||||||
@ -2926,7 +2926,7 @@ PrintLetterDelay: ; 313d
|
|||||||
push bc
|
push bc
|
||||||
|
|
||||||
; save oam update status
|
; save oam update status
|
||||||
ld hl, $ffd8
|
ld hl, hOAMUpdate
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
push af
|
push af
|
||||||
; orginally turned oam update off, commented out
|
; orginally turned oam update off, commented out
|
||||||
@ -2957,7 +2957,7 @@ PrintLetterDelay: ; 313d
|
|||||||
jr nz, .wait
|
jr nz, .wait
|
||||||
|
|
||||||
; wait one frame if holding a
|
; wait one frame if holding a
|
||||||
ld a, [$ffa8] ; joypad
|
ld a, [hJoyDown] ; joypad
|
||||||
bit 0, a ; A
|
bit 0, a ; A
|
||||||
jr z, .checkb
|
jr z, .checkb
|
||||||
jr .delay
|
jr .delay
|
||||||
@ -2981,7 +2981,7 @@ PrintLetterDelay: ; 313d
|
|||||||
.end
|
.end
|
||||||
; restore oam update flag (not touched in this fn anymore)
|
; restore oam update flag (not touched in this fn anymore)
|
||||||
pop af
|
pop af
|
||||||
ld [$ffd8], a
|
ld [hOAMUpdate], a
|
||||||
pop bc
|
pop bc
|
||||||
pop de
|
pop de
|
||||||
pop hl
|
pop hl
|
||||||
@ -3026,7 +3026,7 @@ WhiteBGMap: ; 31f3
|
|||||||
WaitBGMap: ; 31f6
|
WaitBGMap: ; 31f6
|
||||||
; Tell VBlank to update BG Map
|
; Tell VBlank to update BG Map
|
||||||
ld a, 1 ; BG Map 0 tiles
|
ld a, 1 ; BG Map 0 tiles
|
||||||
ld [$ffd4], a
|
ld [hBGMapMode], a
|
||||||
; Wait for it to do its magic
|
; Wait for it to do its magic
|
||||||
ld c, 4
|
ld c, 4
|
||||||
call DelayFrames
|
call DelayFrames
|
||||||
@ -3039,7 +3039,7 @@ ClearPalettes: ; 3317
|
|||||||
; Make all palettes white
|
; Make all palettes white
|
||||||
|
|
||||||
; For CGB we make all the palette colors white
|
; For CGB we make all the palette colors white
|
||||||
ld a, [$ffe6]
|
ld a, [hCGB]
|
||||||
and a
|
and a
|
||||||
jr nz, .cgb
|
jr nz, .cgb
|
||||||
|
|
||||||
@ -3067,7 +3067,7 @@ ClearPalettes: ; 3317
|
|||||||
ld [$ff70], a
|
ld [$ff70], a
|
||||||
; Request palette update
|
; Request palette update
|
||||||
ld a, 1
|
ld a, 1
|
||||||
ld [$ffe5], a
|
ld [hCGBPalUpdate], a
|
||||||
ret
|
ret
|
||||||
; 333e
|
; 333e
|
||||||
|
|
||||||
@ -3077,12 +3077,12 @@ GetSGBLayout: ; 3340
|
|||||||
; load sgb packets unless dmg
|
; load sgb packets unless dmg
|
||||||
|
|
||||||
; check cgb
|
; check cgb
|
||||||
ld a, [$ffe6]
|
ld a, [hCGB]
|
||||||
and a
|
and a
|
||||||
jr nz, .dosgb
|
jr nz, .dosgb
|
||||||
|
|
||||||
; check sgb
|
; check sgb
|
||||||
ld a, [$ffe7]
|
ld a, [hSGB]
|
||||||
and a
|
and a
|
||||||
ret z
|
ret z
|
||||||
|
|
||||||
@ -3132,7 +3132,7 @@ NamesPointerTable: ; 33ab
|
|||||||
dbw $04, $4b52
|
dbw $04, $4b52
|
||||||
|
|
||||||
GetName: ; 33c3
|
GetName: ; 33c3
|
||||||
ld a, [$ff9d]
|
ld a, [hROMBank]
|
||||||
push af
|
push af
|
||||||
push hl
|
push hl
|
||||||
push bc
|
push bc
|
||||||
@ -3230,7 +3230,7 @@ GetBaseStats: ; 3856
|
|||||||
push hl
|
push hl
|
||||||
|
|
||||||
; Save bank
|
; Save bank
|
||||||
ld a, [$ff9d]
|
ld a, [hROMBank]
|
||||||
push af
|
push af
|
||||||
; Bankswitch
|
; Bankswitch
|
||||||
ld a, BANK(BaseStats)
|
ld a, BANK(BaseStats)
|
||||||
@ -3422,12 +3422,12 @@ LoadMusicByte: ; 3b86
|
|||||||
; input:
|
; input:
|
||||||
; a: bank
|
; a: bank
|
||||||
; de: address
|
; de: address
|
||||||
ld [$ff9d], a
|
ld [hROMBank], a
|
||||||
ld [$2000], a ; bankswitch
|
ld [$2000], a ; bankswitch
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
ld [CurMusicByte], a
|
ld [CurMusicByte], a
|
||||||
ld a, $3a ; manual bank restore
|
ld a, $3a ; manual bank restore
|
||||||
ld [$ff9d], a
|
ld [hROMBank], a
|
||||||
ld [$2000], a ; bankswitch
|
ld [$2000], a ; bankswitch
|
||||||
ret
|
ret
|
||||||
; 3b97
|
; 3b97
|
||||||
@ -3439,10 +3439,10 @@ StartMusic: ; 3b97
|
|||||||
push de
|
push de
|
||||||
push bc
|
push bc
|
||||||
push af
|
push af
|
||||||
ld a, [$ff9d] ; save bank
|
ld a, [hROMBank] ; save bank
|
||||||
push af
|
push af
|
||||||
ld a, BANK(LoadMusic)
|
ld a, BANK(LoadMusic)
|
||||||
ld [$ff9d], a
|
ld [hROMBank], a
|
||||||
ld [$2000], a ; bankswitch
|
ld [$2000], a ; bankswitch
|
||||||
ld a, e ; song number
|
ld a, e ; song number
|
||||||
and a
|
and a
|
||||||
@ -3453,7 +3453,7 @@ StartMusic: ; 3b97
|
|||||||
call SoundRestart
|
call SoundRestart
|
||||||
.end
|
.end
|
||||||
pop af
|
pop af
|
||||||
ld [$ff9d], a ; restore bank
|
ld [hROMBank], a ; restore bank
|
||||||
ld [$2000], a
|
ld [$2000], a
|
||||||
pop af
|
pop af
|
||||||
pop bc
|
pop bc
|
||||||
@ -3473,12 +3473,12 @@ PlayCryHeader: ; 3be3
|
|||||||
push af
|
push af
|
||||||
|
|
||||||
; Save current bank
|
; Save current bank
|
||||||
ld a, [$ff9d]
|
ld a, [hROMBank]
|
||||||
push af
|
push af
|
||||||
|
|
||||||
; Cry headers are stuck in one bank.
|
; Cry headers are stuck in one bank.
|
||||||
ld a, BANK(CryHeaders)
|
ld a, BANK(CryHeaders)
|
||||||
ld [$ff9d], a
|
ld [hROMBank], a
|
||||||
ld [$2000], a
|
ld [$2000], a
|
||||||
|
|
||||||
; Each header is 6 bytes long:
|
; Each header is 6 bytes long:
|
||||||
@ -3511,13 +3511,13 @@ PlayCryHeader: ; 3be3
|
|||||||
|
|
||||||
; That's it for the header
|
; That's it for the header
|
||||||
ld a, BANK(PlayCry)
|
ld a, BANK(PlayCry)
|
||||||
ld [$ff9d], a
|
ld [hROMBank], a
|
||||||
ld [$2000], a
|
ld [$2000], a
|
||||||
call PlayCry
|
call PlayCry
|
||||||
|
|
||||||
; Restore bank
|
; Restore bank
|
||||||
pop af
|
pop af
|
||||||
ld [$ff9d], a
|
ld [hROMBank], a
|
||||||
ld [$2000], a
|
ld [$2000], a
|
||||||
|
|
||||||
pop af
|
pop af
|
||||||
@ -3544,16 +3544,16 @@ StartSFX: ; 3c23
|
|||||||
cp e
|
cp e
|
||||||
jr c, .quit
|
jr c, .quit
|
||||||
.asm_3c32
|
.asm_3c32
|
||||||
ld a, [$ff9d] ; save bank
|
ld a, [hROMBank] ; save bank
|
||||||
push af
|
push af
|
||||||
ld a, $3a ; music bank
|
ld a, $3a ; music bank
|
||||||
ld [$ff9d], a
|
ld [hROMBank], a
|
||||||
ld [$2000], a ; bankswitch
|
ld [$2000], a ; bankswitch
|
||||||
ld a, e
|
ld a, e
|
||||||
ld [CurSFX], a
|
ld [CurSFX], a
|
||||||
call LoadSFX
|
call LoadSFX
|
||||||
pop af
|
pop af
|
||||||
ld [$ff9d], a ; restore bank
|
ld [hROMBank], a ; restore bank
|
||||||
ld [$2000], a ; bankswitch
|
ld [$2000], a ; bankswitch
|
||||||
.quit
|
.quit
|
||||||
pop af
|
pop af
|
||||||
@ -3723,7 +3723,7 @@ TitleScreenEntrance: ; 62bc
|
|||||||
ld hl, $cf63
|
ld hl, $cf63
|
||||||
inc [hl]
|
inc [hl]
|
||||||
xor a
|
xor a
|
||||||
ld [$ffc6], a
|
ld [hLCDStatCustom], a
|
||||||
|
|
||||||
; Play the title screen music.
|
; Play the title screen music.
|
||||||
ld de, MUSIC_TITLE
|
ld de, MUSIC_TITLE
|
||||||
@ -4326,11 +4326,11 @@ INCBIN "baserom.gbc",$c472,$c478 - $c472
|
|||||||
|
|
||||||
SpecialGameboyCheck: ; c478
|
SpecialGameboyCheck: ; c478
|
||||||
; check cgb
|
; check cgb
|
||||||
ld a, [$ffe6]
|
ld a, [hCGB]
|
||||||
and a
|
and a
|
||||||
jr nz, .cgb
|
jr nz, .cgb
|
||||||
; check sgb
|
; check sgb
|
||||||
ld a, [$ffe7]
|
ld a, [hSGB]
|
||||||
and a
|
and a
|
||||||
jr nz, .sgb
|
jr nz, .sgb
|
||||||
; gb
|
; gb
|
||||||
@ -4376,7 +4376,7 @@ PrintNumber_AdvancePointer: ; c64a
|
|||||||
jr nz, .incrementPointer\@
|
jr nz, .incrementPointer\@
|
||||||
bit 6, d ; left alignment or right alignment?
|
bit 6, d ; left alignment or right alignment?
|
||||||
jr z, .incrementPointer\@
|
jr z, .incrementPointer\@
|
||||||
ld a, [$ffb3] ; was H_PASTLEADINGZEROES
|
ld a, [hPastLeadingZeroes]
|
||||||
and a
|
and a
|
||||||
ret z
|
ret z
|
||||||
.incrementPointer\@
|
.incrementPointer\@
|
||||||
@ -4898,7 +4898,7 @@ INCBIN "baserom.gbc",$14000,$14032 - $14000
|
|||||||
|
|
||||||
GetTimeOfDay: ; 14032
|
GetTimeOfDay: ; 14032
|
||||||
; get time of day based on the current hour
|
; get time of day based on the current hour
|
||||||
ld a, [$ff94] ; hour
|
ld a, [hHours] ; hour
|
||||||
ld hl, TimeOfDayTable
|
ld hl, TimeOfDayTable
|
||||||
|
|
||||||
.check
|
.check
|
||||||
@ -6538,7 +6538,7 @@ BattleStartMessage:
|
|||||||
xor a
|
xor a
|
||||||
ld [$cfca], a
|
ld [$cfca], a
|
||||||
ld a, $1
|
ld a, $1
|
||||||
ld [$ffe4], a
|
ld [hBattleTurn], a
|
||||||
ld a, $1
|
ld a, $1
|
||||||
ld [$c689], a
|
ld [$c689], a
|
||||||
ld de, $0101
|
ld de, $0101
|
||||||
@ -7614,7 +7614,7 @@ INCBIN "baserom.gbc",$4e226,$4e33a - $4e226
|
|||||||
|
|
||||||
EggStatsScreen: ; 4e33a
|
EggStatsScreen: ; 4e33a
|
||||||
xor a
|
xor a
|
||||||
ld [$ffd4], a
|
ld [hBGMapMode], a
|
||||||
ld hl, $cda1
|
ld hl, $cda1
|
||||||
call $334e ; SetHPPal
|
call $334e ; SetHPPal
|
||||||
ld b, $3
|
ld b, $3
|
||||||
@ -7706,7 +7706,7 @@ WritePartyMenuTilemap: ; 0x5005f
|
|||||||
push af
|
push af
|
||||||
set 4, [hl] ; Disable text delay
|
set 4, [hl] ; Disable text delay
|
||||||
xor a
|
xor a
|
||||||
ld [$ffd4], a
|
ld [hBGMapMode], a
|
||||||
ld hl, TileMap
|
ld hl, TileMap
|
||||||
ld bc, $0168
|
ld bc, $0168
|
||||||
ld a, " "
|
ld a, " "
|
||||||
@ -10090,7 +10090,7 @@ INCBIN "baserom.gbc",$8c15e,$8c17c - $8c15e
|
|||||||
|
|
||||||
GetTimePalFade: ; 8c17c
|
GetTimePalFade: ; 8c17c
|
||||||
; check cgb
|
; check cgb
|
||||||
ld a, [$ffe6]
|
ld a, [hCGB]
|
||||||
and a
|
and a
|
||||||
jr nz, .cgb
|
jr nz, .cgb
|
||||||
|
|
||||||
@ -11000,18 +11000,18 @@ TownMapBGUpdate: ; 91ee4
|
|||||||
|
|
||||||
; BG Map address
|
; BG Map address
|
||||||
ld a, l
|
ld a, l
|
||||||
ld [$ffd6], a
|
ld [hBGMapAddress], a
|
||||||
ld a, h
|
ld a, h
|
||||||
ld [$ffd7], a
|
ld [$ffd7], a
|
||||||
|
|
||||||
; Only update palettes on CGB
|
; Only update palettes on CGB
|
||||||
ld a, [$ffe6]
|
ld a, [hCGB]
|
||||||
and a
|
and a
|
||||||
jr z, .tiles
|
jr z, .tiles
|
||||||
|
|
||||||
; BG Map mode 2 (palettes)
|
; BG Map mode 2 (palettes)
|
||||||
ld a, 2
|
ld a, 2
|
||||||
ld [$ffd4], a
|
ld [hBGMapMode], a
|
||||||
|
|
||||||
; The BG Map is updated in thirds, so we wait
|
; The BG Map is updated in thirds, so we wait
|
||||||
; 3 frames to update the whole screen's palettes.
|
; 3 frames to update the whole screen's palettes.
|
||||||
@ -11024,7 +11024,7 @@ TownMapBGUpdate: ; 91ee4
|
|||||||
|
|
||||||
; Turn off BG Map update
|
; Turn off BG Map update
|
||||||
xor a
|
xor a
|
||||||
ld [$ffd4], a
|
ld [hBGMapMode], a
|
||||||
ret
|
ret
|
||||||
; 91eff
|
; 91eff
|
||||||
|
|
||||||
@ -13751,10 +13751,10 @@ DoTileAnimation: ; fc000
|
|||||||
ld d, a
|
ld d, a
|
||||||
|
|
||||||
; Play this frame.
|
; Play this frame.
|
||||||
ld a, [$ffdf] ; frame count
|
ld a, [hTileAnimFrame] ; frame count
|
||||||
ld l, a
|
ld l, a
|
||||||
inc a
|
inc a
|
||||||
ld [$ffdf], a
|
ld [hTileAnimFrame], a
|
||||||
|
|
||||||
; Each pointer has:
|
; Each pointer has:
|
||||||
ld h, 0
|
ld h, 0
|
||||||
@ -13978,7 +13978,7 @@ Tileset36Anim: ; 0xfc2e7
|
|||||||
DoneTileAnimation: ; fc2fb
|
DoneTileAnimation: ; fc2fb
|
||||||
; Reset the animation command loop.
|
; Reset the animation command loop.
|
||||||
xor a
|
xor a
|
||||||
ld [$ffdf], a
|
ld [hTileAnimFrame], a
|
||||||
|
|
||||||
WaitTileAnimation: ; fc2fe
|
WaitTileAnimation: ; fc2fe
|
||||||
; Do nothing this frame.
|
; Do nothing this frame.
|
||||||
@ -14050,7 +14050,7 @@ AnimateFlowerTile: ; fc56d
|
|||||||
ld e, a
|
ld e, a
|
||||||
|
|
||||||
; CGB has different color mappings for flowers.
|
; CGB has different color mappings for flowers.
|
||||||
ld a, [$ffe6]
|
ld a, [hCGB]
|
||||||
and 1
|
and 1
|
||||||
|
|
||||||
add e
|
add e
|
||||||
@ -14194,7 +14194,7 @@ TileAnimationPalette: ; fc6d7
|
|||||||
; Transition between color values 0-2 for color 0 in palette 3.
|
; Transition between color values 0-2 for color 0 in palette 3.
|
||||||
|
|
||||||
; No palette changes on DMG.
|
; No palette changes on DMG.
|
||||||
ld a, [$ffe6]
|
ld a, [hCGB]
|
||||||
and a
|
and a
|
||||||
ret z
|
ret z
|
||||||
|
|
||||||
@ -14367,7 +14367,7 @@ StartTitleScreen: ; 10ed67
|
|||||||
|
|
||||||
; Turn BG Map update off
|
; Turn BG Map update off
|
||||||
xor a
|
xor a
|
||||||
ld [$ffd4], a
|
ld [hBGMapMode], a
|
||||||
|
|
||||||
; Reset timing variables
|
; Reset timing variables
|
||||||
ld hl, $cf63
|
ld hl, $cf63
|
||||||
@ -14552,7 +14552,7 @@ StartTitleScreen: ; 10ed67
|
|||||||
|
|
||||||
; Let LCD Stat know we're messing around with SCX
|
; Let LCD Stat know we're messing around with SCX
|
||||||
ld a, rSCX - rJOYP
|
ld a, rSCX - rJOYP
|
||||||
ld [$ffc6], a
|
ld [hLCDStatCustom], a
|
||||||
|
|
||||||
; Restore WRAM bank
|
; Restore WRAM bank
|
||||||
pop af
|
pop af
|
||||||
@ -14579,10 +14579,10 @@ StartTitleScreen: ; 10ed67
|
|||||||
ld [$ffd2], a
|
ld [$ffd2], a
|
||||||
|
|
||||||
ld a, $1
|
ld a, $1
|
||||||
ld [$ffe5], a
|
ld [hCGBPalUpdate], a
|
||||||
|
|
||||||
; Update BG Map 0 (bank 0)
|
; Update BG Map 0 (bank 0)
|
||||||
ld [$ffd4], a
|
ld [hBGMapMode], a
|
||||||
|
|
||||||
xor a
|
xor a
|
||||||
ld [$d002], a
|
ld [$d002], a
|
||||||
@ -14869,7 +14869,7 @@ Function117b31:
|
|||||||
jp Function117cdd
|
jp Function117cdd
|
||||||
|
|
||||||
Function117b4f:
|
Function117b4f:
|
||||||
ld a, [$ffa7]
|
ld a, [hJoyPressed]
|
||||||
cp $2
|
cp $2
|
||||||
jr z, .asm_117ba4 ; 0x117b53 $4f
|
jr z, .asm_117ba4 ; 0x117b53 $4f
|
||||||
cp $1
|
cp $1
|
||||||
@ -14927,7 +14927,7 @@ Function117b4f:
|
|||||||
Function117bb6:
|
Function117bb6:
|
||||||
call Function117c89
|
call Function117c89
|
||||||
ld a, $1
|
ld a, $1
|
||||||
ld [$ffd4], a
|
ld [hBGMapMode], a
|
||||||
ld a, $46
|
ld a, $46
|
||||||
ld hl, $4284
|
ld hl, $4284
|
||||||
rst FarCall
|
rst FarCall
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user