summaryrefslogtreecommitdiff
path: root/home.asm
diff options
context:
space:
mode:
Diffstat (limited to 'home.asm')
-rw-r--r--home.asm309
1 files changed, 30 insertions, 279 deletions
diff --git a/home.asm b/home.asm
index 2808df8fb..c000fb3d1 100644
--- a/home.asm
+++ b/home.asm
@@ -3,18 +3,15 @@ INCLUDE "includes.asm"
SECTION "NULL", ROM0[0]
NULL::
-
INCLUDE "rst.asm"
INCLUDE "interrupts.asm"
-
SECTION "Header", ROM0[$100]
Start::
nop
jp _Start
-
SECTION "Home", ROM0[$150]
INCLUDE "home/init.asm"
@@ -40,7 +37,6 @@ INCLUDE "home/handshake.asm"
INCLUDE "home/game_time.asm"
INCLUDE "home/map.asm"
-
Function2d43:: ; 2d43
; Inexplicably empty.
; Seen in PredefPointers.
@@ -50,29 +46,26 @@ Function2d43:: ; 2d43
ret
; 2d54
-
INCLUDE "home/farcall.asm"
INCLUDE "home/predef.asm"
INCLUDE "home/window.asm"
-
Function2e4e:: ; 2e4e
; Unreferenced.
scf
ret
; 2e50
-
INCLUDE "home/flag.asm"
-
Function2ebb:: ; 2ebb
- ld a, [wc2cc]
+; unreferenced
+ ld a, [wMonStatusFlags]
bit 1, a
ret z
ld a, [hJoyDown]
- bit 1, a ; B_BUTTON
+ bit B_BUTTON_F, a
ret
; 2ec6
@@ -88,14 +81,14 @@ xor_a_dec_a:: ; 2ec8
; 2ecb
Function2ecb:: ; 2ecb
+; unreferenced
push hl
- ld hl, wc2cc
+ ld hl, wMonStatusFlags
bit 1, [hl]
pop hl
ret
; 2ed3
-
DisableSpriteUpdates:: ; 0x2ed3
; disables overworld sprite updating?
xor a
@@ -119,10 +112,8 @@ EnableSpriteUpdates:: ; 2ee4
ret
; 2ef6
-
INCLUDE "home/string.asm"
-
IsInJohto:: ; 2f17
; Return 0 if the player is in Johto, and 1 in Kanto.
@@ -157,17 +148,14 @@ IsInJohto:: ; 2f17
ret
; 2f3e
-
ret_2f3e:: ; 2f3e
ret
; 2f3f
-
INCLUDE "home/item.asm"
INCLUDE "home/random.asm"
INCLUDE "home/sram.asm"
-
; Register aliases
_hl_:: ; 2fec
@@ -179,10 +167,8 @@ _de_:: ; 2fed
ret
; 2fef
-
INCLUDE "home/double_speed.asm"
-
ClearSprites:: ; 300b
; Erase OAM data
ld hl, Sprites
@@ -209,10 +195,8 @@ HideSprites:: ; 3016
ret
; 3026
-
INCLUDE "home/copy2.asm"
-
LoadTileMapToTempTileMap:: ; 309d
; Load TileMap into TempTileMap
ld a, [rSVBK]
@@ -252,7 +236,6 @@ LoadTempTileMapToTileMap:: ; 30bf
ret
; 30d6
-
CopyName1:: ; 30d6
; Copies the name from de to StringBuffer2
ld hl, StringBuffer2
@@ -305,10 +288,8 @@ SkipNames:: ; 0x30f4
ret
; 0x30fe
-
INCLUDE "home/math.asm"
-
PrintLetterDelay:: ; 313d
; Wait before printing the next letter.
@@ -317,15 +298,15 @@ PrintLetterDelay:: ; 313d
; mid: 3 frames
; slow: 5 frames
-; TextBoxFrame + 1[!0] and A or B override text speed with a one-frame delay.
-; Options[4] and TextBoxFrame + 1[!1] disable the delay.
+; TextBoxFlags[!0] and A or B override text speed with a one-frame delay.
+; Options[4] and TextBoxFlags[!1] disable the delay.
ld a, [Options]
bit NO_TEXT_SCROLL, a
ret nz
; non-scrolling text?
- ld a, [TextBoxFrame + 1]
+ ld a, [TextBoxFlags]
bit 1, a
ret z
@@ -342,7 +323,7 @@ PrintLetterDelay:: ; 313d
ld [hl], a
; force fast scroll?
- ld a, [TextBoxFrame + 1]
+ ld a, [TextBoxFlags]
bit 0, a
jr z, .fast
@@ -392,7 +373,6 @@ PrintLetterDelay:: ; 313d
ret
; 318c
-
CopyDataUntil:: ; 318c
; Copy [hl .. bc) to de.
@@ -412,7 +392,6 @@ CopyDataUntil:: ; 318c
ret
; 0x3198
-
PrintNum:: ; 3198
ld a, [hROMBank]
push af
@@ -426,7 +405,6 @@ PrintNum:: ; 3198
ret
; 31a4
-
MobilePrintNum:: ; 31a4
ld a, [hROMBank]
push af
@@ -440,7 +418,6 @@ MobilePrintNum:: ; 31a4
ret
; 31b0
-
FarPrintText:: ; 31b0
ld [hBuffer], a
ld a, [hROMBank]
@@ -455,7 +432,6 @@ FarPrintText:: ; 31b0
ret
; 31be
-
CallPointerAt:: ; 31be
ld a, [hROMBank]
push af
@@ -474,7 +450,6 @@ CallPointerAt:: ; 31be
ret
; 31cd
-
QueueScript:: ; 31cd
; Push pointer hl in the current bank to wQueuedScriptBank.
ld a, [hROMBank]
@@ -489,7 +464,6 @@ FarQueueScript:: ; 31cf
ret
; 31db
-
StringCmp:: ; 31db
; Compare c bytes at de and hl.
; Return z if they all match.
@@ -504,7 +478,6 @@ StringCmp:: ; 31db
ret
; 0x31e4
-
CompareLong:: ; 31e4
; Compare bc bytes at de and hl.
; Return carry if they all match.
@@ -529,7 +502,6 @@ CompareLong:: ; 31e4
ret
; 31f3
-
ClearBGPalettes:: ; 31f3
call ClearPalettes
WaitBGMap:: ; 31f6
@@ -542,7 +514,7 @@ WaitBGMap:: ; 31f6
ret
; 3200
-Function3200:: ; 0x3200
+WaitBGMap2:: ; 0x3200
ld a, [hCGB]
and a
jr z, .bg0
@@ -560,14 +532,12 @@ Function3200:: ; 0x3200
ret
; 0x3218
-
IsCGB:: ; 3218
ld a, [hCGB]
and a
ret
; 321c
-
ApplyTilemap:: ; 321c
ld a, [hCGB]
and a
@@ -685,7 +655,6 @@ endr
ret
; 32f9
-
SetPalettes:: ; 32f9
; Inits the Palettes
; depending on the system the monochromes palettes or color palettes
@@ -709,7 +678,6 @@ SetPalettes:: ; 32f9
ret
; 3317
-
ClearPalettes:: ; 3317
; Make all palettes white
@@ -747,7 +715,6 @@ ClearPalettes:: ; 3317
ret
; 333e
-
GetMemSGBLayout:: ; 333e
ld b, SCGB_RAM
GetSGBLayout:: ; 3340
@@ -765,7 +732,6 @@ GetSGBLayout:: ; 3340
predef_jump Predef_LoadSGBLayout ; LoadSGBLayout
; 334e
-
SetHPPal:: ; 334e
; Set palette for hp bar pixel length e at hl.
call GetHPPal
@@ -773,7 +739,6 @@ SetHPPal:: ; 334e
ret
; 3353
-
GetHPPal:: ; 3353
; Get palette for hp bar pixel length e in d.
@@ -788,7 +753,6 @@ GetHPPal:: ; 3353
ret
; 335f
-
CountSetBits:: ; 0x335f
; Count the number of set bits in b bytes starting from hl.
; Return in a, c and [wd265].
@@ -815,7 +779,6 @@ CountSetBits:: ; 0x335f
ret
; 0x3376
-
GetWeekday:: ; 3376
ld a, [CurDay]
.mod
@@ -825,10 +788,8 @@ GetWeekday:: ; 3376
ret
; 3380
-
INCLUDE "home/pokedex_flags.asm"
-
NamesPointers:: ; 33ab
dba PokemonNames
dba MoveNames
@@ -904,7 +865,6 @@ endr
ret
; 3411
-
GetNthString:: ; 3411
; Return the address of the
; ath string starting from hl.
@@ -925,7 +885,6 @@ GetNthString:: ; 3411
ret
; 3420
-
GetBasePokemonName:: ; 3420
; Discards gender (Nidoran).
@@ -951,7 +910,6 @@ GetBasePokemonName:: ; 3420
; 343b
-
GetPokemonName:: ; 343b
; Get Pokemon name wd265.
@@ -968,9 +926,8 @@ GetPokemonName:: ; 343b
ld e, a
ld h, 0
ld l, a
-rept 2
add hl, hl ; hl = hl * 4
-endr
+ add hl, hl ; hl = hl * 4
add hl, de ; hl = (hl*4) + de
add hl, hl ; hl = (5*hl) + (5*hl)
ld de, PokemonNames
@@ -991,7 +948,6 @@ endr
ret
; 3468
-
GetItemName:: ; 3468
; Get item name wd265.
@@ -1016,7 +972,6 @@ GetItemName:: ; 3468
ret
; 3487
-
GetTMHMName:: ; 3487
; Get TM/HM name by item id wd265.
@@ -1100,7 +1055,6 @@ GetTMHMName:: ; 3487
db "@"
; 34df
-
IsHM:: ; 34df
cp HM01
jr c, .NotHM
@@ -1111,7 +1065,6 @@ IsHM:: ; 34df
ret
; 34e7
-
IsHMMove:: ; 34e7
ld hl, .HMMoves
ld de, 1
@@ -1128,7 +1081,6 @@ IsHMMove:: ; 34e7
db -1
; 34f8
-
GetMoveName:: ; 34f8
push hl
@@ -1145,27 +1097,26 @@ GetMoveName:: ; 34f8
ret
; 350c
-
-HandleScrollingMenu:: ; 350c
+ScrollingMenu:: ; 350c
call CopyMenuData2
ld a, [hROMBank]
push af
- ld a, BANK(Function245af)
+ ld a, BANK(_ScrollingMenu)
rst Bankswitch
- call Function245af
- call Function3524
- call Function245cb
+ call _InitScrollingMenu
+ call .UpdatePalettes
+ call _ScrollingMenu
pop af
rst Bankswitch
- ld a, [wcf73]
+ ld a, [wMenuJoypad]
ret
; 3524
-Function3524:: ; 3524
+.UpdatePalettes ; 3524
ld hl, VramState
bit 0, [hl]
jp nz, UpdateTimePals
@@ -1212,7 +1163,6 @@ Function354b:: ; 354b joypad
ret
; 3567
-
HandleStoneQueue:: ; 3567
ld a, [hROMBank]
push af
@@ -1344,9 +1294,8 @@ HandleStoneQueue:: ; 3567
inc hl
.next_inc2
-rept 2
inc hl
-endr
+ inc hl
jr .loop2
.nope3
@@ -1358,7 +1307,6 @@ endr
ret
; 3600
-
CheckTrainerBattle2:: ; 3600
ld a, [hROMBank]
@@ -1373,7 +1321,6 @@ CheckTrainerBattle2:: ; 3600
ret
; 360d
-
CheckTrainerBattle:: ; 360d
; Check if any trainer on the map sees the player and wants to battle.
@@ -1493,7 +1440,6 @@ LoadTrainer_continue:: ; 367e
ret
; 36a5
-
FacingPlayerDistance_bc:: ; 36a5
push de
@@ -1504,7 +1450,6 @@ FacingPlayerDistance_bc:: ; 36a5
ret
; 36ad
-
FacingPlayerDistance:: ; 36ad
; Return carry if the sprite at bc is facing the player,
; and its distance in d.
@@ -1575,7 +1520,6 @@ FacingPlayerDistance:: ; 36ad
ret
; 36f5
-
CheckTrainerFlag:: ; 36f5
push bc
ld hl, OBJECT_MAP_OBJECT_INDEX
@@ -1601,7 +1545,6 @@ CheckTrainerFlag:: ; 36f5
ret
; 3718
-
PrintWinLossText:: ; 3718
ld a, [BattleType]
cp BATTLETYPE_CANLOSE
@@ -1629,8 +1572,6 @@ PrintWinLossText:: ; 3718
ret
; 3741
-
-
IsAPokemon:: ; 3741
; Return carry if species a is not a Pokemon.
and a
@@ -1649,7 +1590,6 @@ IsAPokemon:: ; 3741
ret
; 3750
-
DrawBattleHPBar:: ; 3750
; Draw an HP bar d tiles long at hl
; Fill it up to e pixels
@@ -1711,10 +1651,9 @@ DrawBattleHPBar:: ; 3750
ret
; 3786
-
PrepMonFrontpic:: ; 3786
ld a, $1
- ld [wc2c6], a
+ ld [wBoxAlignment], a
_PrepMonFrontpic:: ; 378b
ld a, [CurPartySpecies]
@@ -1730,21 +1669,19 @@ _PrepMonFrontpic:: ; 378b
lb bc, 7, 7
predef FillBox
xor a
- ld [wc2c6], a
+ ld [wBoxAlignment], a
ret
.not_pokemon
xor a
- ld [wc2c6], a
+ ld [wBoxAlignment], a
inc a
ld [CurPartySpecies], a
ret
; 37b6
-
INCLUDE "home/cry.asm"
-
PrintLevel:: ; 382d
; Print TempMonLevel at hl
@@ -1777,7 +1714,6 @@ Function3842:: ; 3842
jp PrintNum
; 384d
-
Function384d:: ; 384d
ld hl, wListMoves_MoveIndicesBuffer
ld c, a
@@ -1787,7 +1723,6 @@ Function384d:: ; 384d
ret
; 3856
-
GetBaseData:: ; 3856
push bc
push de
@@ -1845,7 +1780,6 @@ GetBaseData:: ; 3856
ret
; 389c
-
GetCurNick:: ; 389c
ld a, [CurPartyMon]
ld hl, PartyMonNicknames
@@ -1871,7 +1805,6 @@ GetNick:: ; 38a2
ret
; 38bb
-
PrintBCDNumber:: ; 38bb
; function to print a BCD (Binary-coded decimal) number
; de = address of BCD number
@@ -1973,7 +1906,6 @@ GetPartyLocation:: ; 3927
jp AddNTimes
; 392d
-
Function392d:: ; 392d
push hl
ld a, b
@@ -1991,12 +1923,11 @@ Function392d:: ; 392d
ret
; 3945
-
INCLUDE "home/battle.asm"
Function3b0c:: ; 3b0c
- ld a, [hLCDStatCustom]
+ ld a, [hFFC6]
and a
ret z
@@ -2015,17 +1946,15 @@ Function3b0c:: ; 3b0c
ret
; 3b2a
-
-
_InitSpriteAnimStruct:: ; 3b2a
- ld [wc3b8], a
+ ld [wSpriteAnimIDBuffer], a
ld a, [hROMBank]
push af
ld a, BANK(InitSpriteAnimStruct)
rst Bankswitch
- ld a, [wc3b8]
+ ld a, [wSpriteAnimIDBuffer]
call InitSpriteAnimStruct
@@ -2035,18 +1964,17 @@ _InitSpriteAnimStruct:: ; 3b2a
ret
; 3b3c
+ReinitSpriteAnimFrame:: ; 3b3c
-Function3b3c:: ; 3b3c
-
- ld [wc3b8], a
+ ld [wSpriteAnimIDBuffer], a
ld a, [hROMBank]
push af
- ld a, BANK(Function8d120)
+ ld a, BANK(_ReinitSpriteAnimFrame)
rst Bankswitch
- ld a, [wc3b8]
+ ld a, [wSpriteAnimIDBuffer]
- call Function8d120
+ call _ReinitSpriteAnimFrame
pop af
rst Bankswitch
@@ -2054,182 +1982,5 @@ Function3b3c:: ; 3b3c
ret
; 3b4e
-
INCLUDE "home/audio.asm"
INCLUDE "home/mobile.asm"
-
-
-Function3eea:: ; 3eea
- push hl
- push bc
- ld de, AttrMap - TileMap
- add hl, de
-rept 2
- inc b
-endr
-rept 2
- inc c
-endr
- call Function3f35
- pop bc
- pop hl
- call Function3f47
- ret
-; 3efd
-
-Function3efd:: ; 3efd
- push hl
- hlcoord 0, 12
- ld b, 4
- ld c, 18
- call Function3f0d
- pop hl
- call PrintTextBoxText
- ret
-; 3f0d
-
-Function3f0d:: ; 3f0d
- push hl
- push bc
- ld de, AttrMap - TileMap
- add hl, de
-rept 2
- inc b
-endr
-rept 2
- inc c
-endr
- call Function3f35
- pop bc
- pop hl
- call TextBoxBorder
- ret
-; 3f20
-
-Function3f20:: ; 3f20
- hlcoord 0, 0, AttrMap
- ld b, $6
- ld c, $14
- call Function3f35
- hlcoord 0, 0
- ld b, $4
- ld c, $12
- call Function3f47
- ret
-; 3f35
-
-Function3f35:: ; 3f35
- ld a, $6
- ld de, $0014
-.asm_3f3a
- push bc
- push hl
-.asm_3f3c
- ld [hli], a
- dec c
- jr nz, .asm_3f3c
- pop hl
- add hl, de
- pop bc
- dec b
- jr nz, .asm_3f3a
- ret
-; 3f47
-
-Function3f47:: ; 3f47
- push bc
- call Function3f58
- pop bc
-.asm_3f4c
- push bc
- call Function3f68
- pop bc
- dec b
- jr nz, .asm_3f4c
- call Function3f60
- ret
-; 3f58
-
-Function3f58:: ; 3f58
- ld a, $63
- ld d, $62
- ld e, $64
- jr Function3f6e
-
-Function3f60:: ; 3f60
- ld a, $68
- ld d, $67
- ld e, $69
- jr Function3f6e
-
-Function3f68:: ; 3f68
- ld a, $7f
- ld d, $65
- ld e, $66
-
-Function3f6e:: ; 3f6e
- push hl
- ld [hl], d
- inc hl
-.asm_3f71
- ld [hli], a
- dec c
- jr nz, .asm_3f71
- ld [hl], e
- pop hl
- ld de, $0014
- add hl, de
- ret
-; 3f7c
-
-Function3f7c:: ; 3f7c
- call MenuBoxCoord2Tile
- call GetMenuBoxDims
- dec b
- dec c
- call Function3eea
- ret
-; 3f88
-
-Function3f88:: ; 3f88
- ld hl, w6_d000
- ld b, $0
-.asm_3f8d
- push bc
- ld c, $8
-.asm_3f90
- ld a, [de]
- inc de
- cpl
- ld [hl], $0
- inc hl
- ld [hli], a
- dec c
- jr nz, .asm_3f90
- pop bc
- dec c
- jr nz, .asm_3f8d
- ret
-; 3f9f
-
-Function3f9f:: ; 3f9f
- ld hl, w6_d000
-.asm_3fa2
- push bc
- ld c, $8
-.asm_3fa5
- ld a, [de]
-rept 2
- inc de
-endr
- cpl
- ld [hl], $0
- inc hl
- ld [hli], a
- dec c
- jr nz, .asm_3fa5
- pop bc
- dec c
- jr nz, .asm_3fa2
- ret
-; 3fb5