ref: 7fd20e63223e777872618b3eac7cf49f8b105fec
parent: 95cb4636af8e19922922f4d183edaea20a56596c
author: PikalaxALT <[email protected]>
date: Wed Nov 4 11:14:27 EST 2015
home/copy.asm completely labeled
--- a/battle/anim_objects.asm
+++ b/battle/anim_objects.asm
@@ -4949,7 +4949,7 @@
ld l, a
pop de
push bc
- call Functione73
+ call DecompressRequest2bpp
pop bc
ret
; ce85e (33:685e)
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -9366,7 +9366,7 @@
hlcoord 1, 5
lb bc, 3, 7
call ClearBox
- call Functione51
+ call LoadStandardFont
call Function3ed9f
call Function3fbd6
xor a
--- a/engine/map_setup.asm
+++ b/engine/map_setup.asm
@@ -343,7 +343,7 @@
jr c, .ok
ret
.ok
- call Special_ReplaceKrisSprite
+ call ReplaceKrisSprite
ret
Function1550c: ; 1550c (5:550c)
--- a/engine/pokedex.asm
+++ b/engine/pokedex.asm
@@ -838,7 +838,7 @@
ld hl, PokedexLZ
ld de, VTiles2 tile $31
lb bc, BANK(PokedexLZ), $3a
- call Functione73
+ call DecompressRequest2bpp
.asm_4060f
ret
@@ -2487,7 +2487,7 @@
xor a
call ByteFill
call Function414fb
- call Functione5f
+ call LoadFontsExtra
ld hl, VTiles2 tile $60
ld bc, $0200
call Function41504
@@ -2511,7 +2511,7 @@
ret
Function414fb: ; 414fb
- call Functione51
+ call LoadStandardFont
ld hl, VTiles1
ld bc, $0800
--- a/engine/specials.asm
+++ b/engine/specials.asm
@@ -76,7 +76,7 @@
add_special UpdateTimePals
add_special ClearTileMap
add_special UpdateSprites
- add_special Special_ReplaceKrisSprite
+ add_special ReplaceKrisSprite
add_special Special_GameCornerPrizeMonCheckDex
add_special SpecialSeenMon
add_special WaitSFX
--- a/home/copy.asm
+++ b/home/copy.asm
@@ -8,9 +8,9 @@
ld a, [hROMBank]
push af
- ld a, BANK(Function104284)
+ ld a, BANK(_Get2bpp)
rst Bankswitch
- call Function104284
+ call _Get2bpp
pop af
rst Bankswitch
@@ -24,9 +24,9 @@
ld a, [hROMBank]
push af
- ld a, BANK(Function1042b2)
+ ld a, BANK(_Get1bpp)
rst Bankswitch
- call Function1042b2
+ call _Get1bpp
pop af
rst Bankswitch
@@ -47,7 +47,7 @@
ret
; dfd
-Functiondfd:: ; dfd
+OldDMATransfer:: ; dfd
dec c
ld a, [hBGMapMode]
push af
@@ -59,42 +59,47 @@
rst Bankswitch
.loop
+; load the source and target MSB and LSB
ld a, d
- ld [rHDMA1], a
+ ld [rHDMA1], a ; source MSB
ld a, e
and $f0
- ld [rHDMA2], a
+ ld [rHDMA2], a ; source LSB
ld a, h
and $1f
- ld [rHDMA3], a
+ ld [rHDMA3], a ; target MSB
ld a, l
and $f0
- ld [rHDMA4], a
+ ld [rHDMA4], a ; target LSB
+; stop when c < 8
ld a, c
cp $8
jr c, .done
+; decrease c by 8
sub $8
ld c, a
+; DMA transfer state
ld a, $f
ld [hDMATransfer], a
call DelayFrame
+; add $100 to hl and de
ld a, l
- add 0
+ add $100 % $100
ld l, a
ld a, h
- adc 1
+ adc $100 / $100
ld h, a
ld a, e
- add 0
+ add $100 % $100
ld e, a
ld a, d
- adc 1
+ adc $100 / $100
ld d, a
jr .loop
.done
ld a, c
- and $7f
+ and $7f ; pretty silly, considering at most bits 0-2 would be set
ld [hDMATransfer], a
call DelayFrame
pop af
@@ -107,15 +112,15 @@
-Special_ReplaceKrisSprite:: ; e4a
- callba Function14135
+ReplaceKrisSprite:: ; e4a
+ callba _ReplaceKrisSprite
ret
; e51
-Functione51:: ; e51
- callba Functionfb449
+LoadStandardFont:: ; e51
+ callba _LoadStandardFont
ret
; e58
@@ -126,27 +131,30 @@
-Functione5f:: ; e5f
- callba Functionfb48a
- callba Functionfb4b0
+LoadFontsExtra:: ; e5f
+ callba _LoadFontsExtra1
+ callba _LoadFontsExtra2
ret
; e6c
-Functione6c:: ; e6c
- callba Functionfb4b0
+LoadFontsExtra2:: ; e6c
+ callba _LoadFontsExtra2
ret
; e73
-Functione73:: ; e73
+DecompressRequest2bpp:: ; e73
push de
ld a, BANK(sScratch)
call GetSRAMBank
push bc
+
ld de, sScratch
ld a, b
call FarDecompress
+
pop bc
pop hl
+
ld de, sScratch
call Request2bpp
call CloseSRAM
--- a/home/map.asm
+++ b/home/map.asm
@@ -2022,8 +2022,8 @@
call DisableLCD
call ClearSprites
callba Function14168
- call Functione51
- call Functione5f
+ call LoadStandardFont
+ call LoadFontsExtra
ld a, [hROMBank]
push af
ld a, [MapGroup]
--- a/home/window.asm
+++ b/home/window.asm
@@ -42,7 +42,7 @@
call Function2e31
ld a, $90
ld [hWY], a
- call Special_ReplaceKrisSprite
+ call ReplaceKrisSprite
callba ReturnFromMapSetupScript
callba Function106594
ret
--- a/items/item_effects.asm
+++ b/items/item_effects.asm
@@ -607,7 +607,7 @@
call FadeToWhite
- call Functione51
+ call LoadStandardFont
pop hl
ld de, StringBuffer1
@@ -687,7 +687,7 @@
call PrintText
call FadeToWhite
- call Functione51
+ call LoadStandardFont
jr .asm_ebe2
.asm_ebd1
--- a/main.asm
+++ b/main.asm
@@ -109,8 +109,8 @@
xor a
ld [$ffde], a
call ClearTileMap
- call Functione5f
- call Functione51
+ call LoadFontsExtra
+ call LoadStandardFont
call ResetTextRelatedRAM
ret
; 5b54
@@ -582,7 +582,7 @@
call Function5ebf
call Function5f1c
call Function5f40
- call Functione5f
+ call LoadFontsExtra
call UpdateSprites
ret
; 5eaf
@@ -591,7 +591,7 @@
call Function5ebf
call Function5f1c
call Function5f48
- call Functione5f
+ call LoadFontsExtra
call UpdateSprites
ret
; 5ebf
@@ -856,7 +856,7 @@
call FadeToWhite
call ClearTileMap
- call Functione5f
+ call LoadFontsExtra
call WaitBGMap
xor a
@@ -948,7 +948,7 @@
call DelayFrames
call Intro_PlacePlayerSprite
- call Functione5f
+ call LoadFontsExtra
ld c, 50
call DelayFrames
@@ -1431,7 +1431,7 @@
Copyright: ; 63e2
call ClearTileMap
- call Functione5f
+ call LoadFontsExtra
ld de, CopyrightGFX
ld hl, VTiles2 tile $60
lb bc, BANK(CopyrightGFX), $1d
@@ -1553,11 +1553,11 @@
; 64cd
Function64cd: ; 64cd
- call Functione5f
+ call LoadFontsExtra
ld a, $90
ld [hWY], a
call Function2e31
- call Functione51
+ call LoadStandardFont
ret
; 64db
@@ -4783,7 +4783,7 @@
call Function2914
call UpdateSprites
call DelayFrame
- call Functione51
+ call LoadStandardFont
ret
; c840
@@ -5020,7 +5020,7 @@
copybytetovar Buffer2
writevarcode VAR_MOVEMENT
- special Special_ReplaceKrisSprite
+ special ReplaceKrisSprite
special PlayMapMusic
; step into the water
special Special_SurfStartStep ; (slow_step_x, step_end)
@@ -5258,7 +5258,7 @@
Functioncacb: ; cacb
callba Function561d
call DelayFrame
- call Special_ReplaceKrisSprite
+ call ReplaceKrisSprite
callba Function106594
ret
; cade
@@ -6359,7 +6359,7 @@
ld a, $1
ld [PlayerAction], a
call UpdateSprites
- call Special_ReplaceKrisSprite
+ call ReplaceKrisSprite
ret
; d0a4
@@ -6478,7 +6478,7 @@
writetext UnknownText_0xd17c
closetext
loadmovesprites
- special Special_ReplaceKrisSprite
+ special ReplaceKrisSprite
end
; 0xd14e
@@ -6485,7 +6485,7 @@
Script_GetOnBike_Register: ; 0xd14e
writecode VAR_MOVEMENT, $1
loadmovesprites
- special Special_ReplaceKrisSprite
+ special ReplaceKrisSprite
end
; 0xd156
@@ -6502,7 +6502,7 @@
UnknownScript_0xd163:
loadmovesprites
- special Special_ReplaceKrisSprite
+ special ReplaceKrisSprite
special PlayMapMusic
end
; 0xd16b
@@ -11322,8 +11322,8 @@
Function11c51: ; 11c51
call ClearSprites
callab Function8cf53
- call Functione51
- call Functione5f
+ call LoadStandardFont
+ call LoadFontsExtra
ld de, GFX_11e65
ld hl, VTiles1 tile $6b
@@ -12525,7 +12525,7 @@
push af
ld a, 1
ld [hOAMUpdate], a
- call Functione5f
+ call LoadFontsExtra
pop af
ld [hOAMUpdate], a
.ReturnEnd
@@ -16188,7 +16188,7 @@
ret
; 14135
-Function14135:: ; 14135
+_ReplaceKrisSprite:: ; 14135
call GetPlayerSprite
ld a, [UsedSprites]
ld [hUsedSpriteIndex], a
@@ -22316,7 +22316,7 @@
call Function2173
call Function321c
call UpdateSprites
- call Functione51
+ call LoadStandardFont
ret
; 24547
@@ -26660,7 +26660,7 @@
call DelayFrames
call ClearScreen
call UpdateSprites
- call Functione51
+ call LoadStandardFont
call LoadFontsBattleExtra
callba Function16d69a
call Function3200
@@ -28897,7 +28897,7 @@
ret
.asm_2909b
- call Functione51
+ call LoadStandardFont
scf
ret
; 290a0
@@ -32264,7 +32264,7 @@
_ShowLinkBattleParticipants: ; 2c1b2
call WhiteBGMap
- call Functione5f
+ call LoadFontsExtra
hlcoord 2, 3
ld b, 9
ld c, 14
@@ -34330,8 +34330,8 @@
callba Function1de247
call Function41af7
call DisableLCD
- call Functione51
- call Functione5f
+ call LoadStandardFont
+ call LoadFontsExtra
call Function414b7
call Function4147b
ld a, [wd265]
@@ -36226,7 +36226,7 @@
ld [wd003], a
.asm_4805a
call Function486bf
- call Functione5f
+ call LoadFontsExtra
ld de, GFX_488c3
ld hl, VTiles2 tile $10
lb bc, BANK(GFX_488c3), 1
@@ -38087,7 +38087,7 @@
call DelayFrames
call WhiteBGMap
call Function48000
- call Functione5f
+ call LoadFontsExtra
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, $0
@@ -39576,8 +39576,8 @@
xor a
ld [$ffde], a
call ClearTileMap
- call Functione5f
- call Functione51
+ call LoadFontsExtra
+ call LoadStandardFont
call ResetTextRelatedRAM
ret
; 49ee0
@@ -39829,7 +39829,7 @@
asm_4a111: ; 4a111 (12:6111)
pop bc
- call Functione5f
+ call LoadFontsExtra
jp Function49f0a
Function4a118: ; 4a118 (12:6118)
@@ -40029,7 +40029,7 @@
callba Function11765d
call WhiteBGMap
call Call_ExitMenu
- call Functione5f
+ call LoadFontsExtra
scf
ret
.asm_4a2f0
@@ -40459,7 +40459,7 @@
call GetSGBLayout
callba Function11c1ab
pop bc
- call Functione5f
+ call LoadFontsExtra
jp Function4a4c4
Function4a6c5: ; 4a6c5 (12:66c5)
@@ -42267,8 +42267,8 @@
callba Function8000
ld b, $8
call GetSGBLayout
- call Functione51
- call Functione5f
+ call LoadStandardFont
+ call LoadFontsExtra
ld de, MUSIC_MAIN_MENU
call PlayMusic
ld hl, .text_askreset
@@ -42543,8 +42543,8 @@
callba Function8000
ld b, $8
call GetSGBLayout
- call Functione51
- call Functione5f
+ call LoadStandardFont
+ call LoadFontsExtra
ld de, MUSIC_MAIN_MENU
call PlayMusic
ld hl, UnknownText_0x4d580
@@ -44975,7 +44975,7 @@
call ClearTileMap
call ClearSprites
call DisableLCD
- call Functione51
+ call LoadStandardFont
call LoadFontsBattleExtra
ld hl, VBGMap0
ld bc, VBGMap1 - VBGMap0
@@ -45008,7 +45008,7 @@
call ClearTileMap
call ClearSprites
call DisableLCD
- call Functione51
+ call LoadStandardFont
call LoadFontsBattleExtra
ld hl, VBGMap0
ld bc, VBGMap1 - VBGMap0
@@ -49349,7 +49349,7 @@
push bc
ld a, PLAYER_NORMAL
ld [PlayerState], a
- call Special_ReplaceKrisSprite ; UpdateSprites
+ call ReplaceKrisSprite ; UpdateSprites
pop bc
ret
; 80404
@@ -49776,7 +49776,7 @@
ld de, VTiles0
ld bc, $10
call CopyBytes
- call Functione51
+ call LoadStandardFont
ld hl, VTiles1
lb bc, 8, 0
.asm_8199d
@@ -53681,7 +53681,7 @@
ld hl, VTiles1
lb bc, BANK(Font), $c
call Get1bpp
- call Special_ReplaceKrisSprite
+ call ReplaceKrisSprite
ret
; 8c893
@@ -57994,7 +57994,7 @@
call GetSGBLayout
xor a
ld [hBGMapMode], a ; $ff00+$d4
- call Functione51
+ call LoadStandardFont
ld de, GFX_908fb
ld hl, VTiles2 tile $00
lb bc, BANK(GFX_908fb), 1
@@ -58424,7 +58424,7 @@
ld a, [DefaultFlypoint]
ld [StringBuffer2], a
call Function663
- call Functione51
+ call LoadStandardFont
pop af
ld [hInMenu], a
ret
@@ -61336,7 +61336,7 @@
ld hl, TownMapGFX
ld de, VTiles2
lb bc, BANK(TownMapGFX), $30
- call Functione73
+ call DecompressRequest2bpp
ret
; 91fff
@@ -64511,7 +64511,7 @@
call ClearSprites
call ClearTileMap
call DisableLCD
- call Functione5f
+ call LoadFontsExtra
pop de
push de
ld a, BANK(s0_a600)
@@ -64544,7 +64544,7 @@
call Functionb929a
call WhiteBGMap
call DisableLCD
- call Functione51
+ call LoadStandardFont
jp EnableLCD
; b929a
@@ -65981,8 +65981,8 @@
call PlayMusic
call DelayFrame
call DisableLCD
- call Functione51
- call Functione5f
+ call LoadStandardFont
+ call LoadFontsExtra
ld hl, LZ_e0d16
ld de, VTiles2 tile $00
call Decompress
@@ -71441,7 +71441,7 @@
ld bc, $310
xor a
call ByteFill
- call Functione51
+ call LoadStandardFont
call LoadFontsBattleExtra
ld hl, PCMailGFX
ld de, VTiles2 tile $5c
@@ -71723,7 +71723,7 @@
ld de, DefaultFlypoint
callba Function116c1
call ClearTileMap
- call Functione51
+ call LoadStandardFont
call LoadFontsBattleExtra
ld a, [MenuSelection]
dec a
@@ -72314,7 +72314,7 @@
hlcoord 16, 15 ;where on the screen the number is drawn
add "1"
ld [hl], a
- call Functione5f
+ call LoadFontsExtra
and a
ret
; e4520
@@ -74988,6 +74988,7 @@
INCBIN "gfx/misc/footprints.1bpp"
; fb434
+; This and the following two functions are unreferenced.
Unknown_fb434:
db 0
@@ -75003,9 +75004,10 @@
and a
jp nz, Get2bpp_2
jp Get2bpp
+; End unreferenced block
; fb449
-Functionfb449:: ; fb449
+_LoadStandardFont:: ; fb449
ld de, Font
ld hl, VTiles1
lb bc, BANK(Font), $80
@@ -75032,9 +75034,7 @@
ret
; fb48a
-
-
-Functionfb48a:: ; fb48a
+_LoadFontsExtra1:: ; fb48a
ld de, GFX_f9214
ld hl, VTiles2 tile $60
lb bc, BANK(GFX_f9214), 1
@@ -75050,7 +75050,7 @@
jr LoadFrame
; fb4b0
-Functionfb4b0:: ; fb4b0
+_LoadFontsExtra2:: ; fb4b0
ld de, GFX_f9424
ld hl, VTiles2 tile $61
ld b, BANK(GFX_f9424)
@@ -75521,8 +75521,8 @@
Functionfb8c8: ; fb8c8
call ClearTileMap
- call Functione5f
- call Functione51
+ call LoadFontsExtra
+ call LoadStandardFont
callba Function40ab2
call Function3200
callba Function3da97
@@ -77307,7 +77307,7 @@
ret
-Function104284:: ; 104284
+_Get2bpp:: ; 104284
; 2bpp when [rLCDC] & $80
; switch to WRAM bank 6
ld a, [rSVBK]
@@ -77350,7 +77350,7 @@
ret
; 1042b2
-Function1042b2:: ; 1042b2
+_Get1bpp:: ; 1042b2
; 1bpp when [rLCDC] & $80
.loop
ld a, c
@@ -77785,7 +77785,7 @@
xor a
ld [hTileAnimFrame], a ; $ff00+$df
callba Function14168
- call Functione5f
+ call LoadFontsExtra
callba Function106594
ret
@@ -81626,7 +81626,7 @@
ld hl, LZ_1ddf33
ld de, VTiles2 tile $31
lb bc, BANK(LZ_1ddf33), $3a
- call Functione73
+ call DecompressRequest2bpp
ret
; 1ddf33 (77:5f33)
--- a/maps/PokeCenter2F.asm
+++ b/maps/PokeCenter2F.asm
@@ -435,7 +435,7 @@
special Functionc225
applymovement PLAYER, MovementData_0x192d1c
setflag ENGINE_KRIS_IN_CABLE_CLUB
- special Special_ReplaceKrisSprite
+ special ReplaceKrisSprite
loadfont
writetext Text_LikeTheLook
closetext
@@ -461,7 +461,7 @@
writebyte $90
special Functionc225
applymovement PLAYER, MovementData_0x192d1c
- special Special_ReplaceKrisSprite
+ special ReplaceKrisSprite
applymovement PLAYER, MovementData_0x192d2a
applymovement $2, MovementData_0x192cfe
end
@@ -483,7 +483,7 @@
writebyte $90
special Functionc225
applymovement PLAYER, MovementData_0x192d1c
- special Special_ReplaceKrisSprite
+ special ReplaceKrisSprite
applymovement PLAYER, MovementData_0x192d2a
applymovement $3, MovementData_0x192cfe
end
@@ -544,7 +544,7 @@
applymovement PLAYER, MovementData_0x192d22
faceperson PLAYER, $4
setflag ENGINE_KRIS_IN_CABLE_CLUB
- special Special_ReplaceKrisSprite
+ special ReplaceKrisSprite
loadfont
writetext Text_LikeTheLook
closetext
@@ -571,7 +571,7 @@
writebyte $90
special Functionc225
applymovement PLAYER, MovementData_0x192d1c
- special Special_ReplaceKrisSprite
+ special ReplaceKrisSprite
applymovement PLAYER, MovementData_0x192cfc
applymovement $4, MovementData_0x192d01
.Done:
--- a/misc/mobile_22.asm
+++ b/misc/mobile_22.asm
@@ -499,8 +499,8 @@
Function893b3: ; 893b3 (22:53b3)
call DisableLCD
call ClearSprites
- call Functione51
- call Functione5f
+ call LoadStandardFont
+ call LoadFontsExtra
call Function893ef
call Function8942b
call Function89455
@@ -510,8 +510,8 @@
Function893cc: ; 893cc
call DisableLCD
call ClearSprites
- call Functione51
- call Functione5f
+ call LoadStandardFont
+ call LoadFontsExtra
call Function893ef
call Function89464
call EnableLCD
@@ -4307,7 +4307,7 @@
.asm_8ace4
call CloseSRAM
- call Functione51
+ call LoadStandardFont
ld a, [wd02f]
ld c, a
and a
@@ -4319,7 +4319,7 @@
ld a, $2
call Function89259
jp c, Function8ac7c
- call Functione51
+ call LoadStandardFont
pop de
ld c, $0
scf
--- a/misc/mobile_40.asm
+++ b/misc/mobile_40.asm
@@ -411,7 +411,7 @@
callba RunMapSetupScript
xor a
ld [hMapEntryMethod], a
- call Functione51
+ call LoadStandardFont
ret
; 1002ed
--- a/misc/mobile_42.asm
+++ b/misc/mobile_42.asm
@@ -131,7 +131,7 @@
call DisableLCD
call Function1081ad
call Function1081ca
- call Functione51
+ call LoadStandardFont
call LoadFontsBattleExtra
ld a, $1
ld [rVBK], a
@@ -194,7 +194,7 @@
call DisableLCD
call Function1081ad
call Function1081ca
- call Functione51
+ call LoadStandardFont
call LoadFontsBattleExtra
call EnableLCD
xor a
@@ -326,7 +326,7 @@
ld [hWX], a
ld a, $90
ld [hWY], a
- call Functione51
+ call LoadStandardFont
call LoadFontsBattleExtra
callba Function106462
callba Function106464
--- a/misc/mobile_5f.asm
+++ b/misc/mobile_5f.asm
@@ -10,8 +10,8 @@
xor a
call ByteFill
- call Functione51
- call Functione5f
+ call LoadStandardFont
+ call LoadFontsExtra
ld hl, HaveWantMap
decoord 0, 0