shithub: pokecrystal

Download patch

ref: ae36ef2c7fb722b7480d73c7a95a5d1e2ece7831
parent: e95d42e0af1921f516c1fd4269024aa3f586514f
author: pikalaxalt <[email protected]>
date: Tue May 10 08:31:49 EDT 2016

Labeled every function in ROM0 that's referenced in the source

--- a/audio/engine.asm
+++ b/audio/engine.asm
@@ -2489,9 +2489,9 @@
 
 ; 3-byte pointers (bank, address)
 	ld hl, Cries
-rept 3
 	add hl, de
-endr
+	add hl, de
+	add hl, de
 
 	ld a, [hli]
 	ld [MusicBank], a
@@ -2708,9 +2708,9 @@
 
 ; get sfx ptr
 	ld hl, SFX
-rept 3
 	add hl, de
-endr
+	add hl, de
+	add hl, de
 
 ; bank
 	ld a, [hli]
--- a/battle/ai/items.asm
+++ b/battle/ai/items.asm
@@ -196,9 +196,9 @@
 	jr z, .has_item
 
 	dec de
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	jr .loop
 
 .has_item
--- a/battle/ai/move.asm
+++ b/battle/ai/move.asm
@@ -19,9 +19,9 @@
 ; The default score is 20. Unusable moves are given a score of 80.
 	ld a, 20
 	ld hl, Buffer1
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ld [hl], a
 
 ; Don't pick disabled moves.
--- a/battle/ai/scoring.asm
+++ b/battle/ai/scoring.asm
@@ -596,9 +596,9 @@
 	ret c
 
 .asm_388c6
-rept 3
 	inc [hl]
-endr
+	inc [hl]
+	inc [hl]
 	ret
 ; 388ca
 
@@ -610,9 +610,9 @@
 	call Random
 	cp 25
 	ret c
-rept 3
 	dec [hl]
-endr
+	dec [hl]
+	dec [hl]
 	ret
 ; 388d4
 
@@ -1208,9 +1208,9 @@
 	call AICompareSpeed
 	ret nc
 
-rept 3
 	dec [hl]
-endr
+	dec [hl]
+	dec [hl]
 	ret
 ; 38b20
 
@@ -1515,9 +1515,9 @@
 	ret
 
 .asm_38c81
-rept 3
 	inc [hl]
-endr
+	inc [hl]
+	inc [hl]
 	ret
 
 .EncoreMoves:
@@ -1587,15 +1587,15 @@
 	cp $1
 	jr z, .asm_38cc7
 
-rept 3
 	dec [hl]
-endr
+	dec [hl]
+	dec [hl]
 	ret
 
 .asm_38cc7
-rept 3
 	inc [hl]
-endr
+	inc [hl]
+	inc [hl]
 	ret
 ; 38ccb
 
@@ -1607,9 +1607,9 @@
 	ld a, [EnemyMonStatus]
 	and $20
 	ret z
-rept 3
 	dec [hl]
-endr
+	dec [hl]
+	dec [hl]
 	ret
 ; 38cd5
 
@@ -1708,9 +1708,9 @@
 	jr z, .next
 
 	; status
-rept 3
 	dec hl
-endr
+	dec hl
+	dec hl
 	ld a, [hl]
 	or c
 	ld c, a
@@ -1774,9 +1774,9 @@
 	ld a, [BattleMonHP]
 	sbc b
 	ret nc
-rept 3
 	dec [hl]
-endr
+	dec [hl]
+	dec [hl]
 	ret
 ; 38d93
 
@@ -1900,9 +1900,9 @@
 .asm_38e26
 	call AI_80_20
 	ret c
-rept 3
 	dec [hl]
-endr
+	dec [hl]
+	dec [hl]
 	ret
 ; 38e2e
 
@@ -2233,9 +2233,9 @@
 	call AI_80_20
 	ret c
 
-rept 3
 	dec [hl]
-endr
+	dec [hl]
+	dec [hl]
 	ret
 
 .asm_38fcb
@@ -2274,9 +2274,9 @@
 
 	cp 3
 	jr c, .end
-rept 3
 	dec [hl]
-endr
+	dec [hl]
+	dec [hl]
 
 .end
 
@@ -2579,9 +2579,9 @@
 ; 3911e
 
 AIBadWeatherType: ; 3911e
-rept 3
 	inc [hl]
-endr
+	inc [hl]
+	inc [hl]
 	ret
 ; 39122
 
--- a/battle/anim_commands.asm
+++ b/battle/anim_commands.asm
@@ -108,7 +108,7 @@
 	call RunBattleAnimCommand
 	call _ExecuteBGEffects
 	call BattleAnim_UpdateOAM_All
-	call Function3b0c
+	call PushLYOverrides
 	call BattleAnimRequestPals
 
 ; Speed up Rollout's animation.
@@ -265,9 +265,9 @@
 	ld a, [hl]
 	and $f0
 	ld [hli], a
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	dec c
 	jr nz, .loop
 	ret
--- a/battle/bg_effects.asm
+++ b/battle/bg_effects.asm
@@ -738,9 +738,9 @@
 	ld l, a
 	ld a, [wBattleAnimTemp2]
 	ld h, a
-rept 3
 	add hl, de
-endr
+	add hl, de
+	add hl, de
 	ld a, [hl]
 	cp -1
 	jr z, .end
@@ -805,9 +805,9 @@
 	ld e, [hl]
 	ld d, 0
 	ld hl, .BGSquares
-rept 3
 	add hl, de
-endr
+	add hl, de
+	add hl, de
 	ld a, [hli]
 	ld b, a
 	and $f
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -4080,9 +4080,9 @@
 	ld de, BattleMonDVs
 	ld bc, MON_PKRUS - MON_DVS
 	call CopyBytes
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	ld de, BattleMonLevel
 	ld bc, PARTYMON_STRUCT_LENGTH - MON_LEVEL
 	call CopyBytes
@@ -4172,9 +4172,9 @@
 	ld de, EnemyMonDVs
 	ld bc, MON_PKRUS - MON_DVS
 	call CopyBytes
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	ld de, EnemyMonLevel
 	ld bc, PARTYMON_STRUCT_LENGTH - MON_LEVEL
 	call CopyBytes
@@ -4302,9 +4302,9 @@
 endr
 	ld [hl], a
 	ld hl, PlayerUsedMoves
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ld [hl], a
 	ld [PlayerDisableCount], a
 	ld [PlayerFuryCutterCount], a
@@ -6637,9 +6637,9 @@
 	xor a
 	ld h, d
 	ld l, e
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ld [hl], a
 ; Make sure the predef knows this isn't a partymon
 	ld [MagikarpLength], a
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -3402,9 +3402,9 @@
 	sla c
 	rl b
 .mimic_screen
-rept 3
 	dec hl
-endr
+	dec hl
+	dec hl
 	ld a, [hli]
 	ld l, [hl]
 	ld h, a
@@ -3948,9 +3948,9 @@
 	set SUBSTATUS_ENCORED, [hl]
 	call BattleRandom
 	and $3
-rept 3
 	inc a
-endr
+	inc a
+	inc a
 	ld [de], a
 	call CheckOpponentWentFirst
 	jr nz, .finish_move
@@ -4089,12 +4089,12 @@
 	ld a, [CurDamage + 1]
 	rr a
 	ld [CurDamage + 1], a
-rept 3
 	inc hl
-endr
-rept 3
+	inc hl
+	inc hl
 	inc de
-endr
+	inc de
+	inc de
 
 .EnemyShareHP: ; 359ac
 	ld c, [hl]
@@ -7442,9 +7442,9 @@
 	ret nz
 	call BattleRandom
 	and 3
-rept 3
 	inc a
-endr
+	inc a
+	inc a
 	ld [hl], a
 	ld a, BATTLE_VARS_MOVE_ANIM
 	call GetBattleVar
--- a/battle/trainer_huds.asm
+++ b/battle/trainer_huds.asm
@@ -81,9 +81,9 @@
 	jr z, .fainted
 
 .got_hp
-rept 3
 	dec hl
-endr
+	dec hl
+	dec hl
 	ld a, [hl]
 	and a
 	ld b, $32 ; statused
@@ -92,9 +92,9 @@
 	jr .load
 
 .fainted
-rept 3
 	dec hl
-endr
+	dec hl
+	dec hl
 
 .load
 	ld a, b
--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -18,10 +18,12 @@
 ; GetName types
 PKMN_NAME     EQU 1
 MOVE_NAME     EQU 2
+; dummied out EQU 3
 ITEM_NAME     EQU 4
 PARTY_OT_NAME EQU 5
 ENEMY_OT_NAME EQU 6
 TRAINER_NAME  EQU 7
+; broken ptr  EQU 8
 
 ; hp
 HP_GREEN  EQU 0
--- a/engine/buy_sell_toss.asm
+++ b/engine/buy_sell_toss.asm
@@ -48,7 +48,7 @@
 ; 2500e
 
 BuySellToss_InterpretJoypad: ; 2500e
-	call Function354b ; get joypad
+	call JoyTextDelay_ForcehJoyDown ; get joypad
 	bit B_BUTTON_F, c
 	jr nz, .b
 	bit A_BUTTON_F, c
--- a/engine/clock_reset.asm
+++ b/engine/clock_reset.asm
@@ -121,7 +121,7 @@
 ; 0x200ba
 
 .joy_loop
-	call Function354b
+	call JoyTextDelay_ForcehJoyDown
 	ld c, a
 	push af
 	call .PrintTime
--- a/engine/color.asm
+++ b/engine/color.asm
@@ -405,9 +405,9 @@
 Function8cb4:
 	ld l, e
 	ld h, 0
-rept 3
 	add hl, hl
-endr
+	add hl, hl
+	add hl, hl
 	ld de, Palettes_8d05
 	add hl, de
 	call CheckCGB
@@ -855,9 +855,9 @@
 GetMonPalettePointer:
 	ld l, a
 	ld h, $0
-rept 3
 	add hl, hl
-endr
+	add hl, hl
+	add hl, hl
 	ld bc, PokemonPalettes
 	add hl, bc
 	ret
@@ -1101,9 +1101,9 @@
 	call SGBDelayCycles
 	ld a, $30
 	ld [rJOYP], a
-rept 3
 	ld a, [rJOYP]
-endr
+	ld a, [rJOYP]
+	ld a, [rJOYP]
 	call SGBDelayCycles
 	call SGBDelayCycles
 	ld a, [rJOYP]
@@ -1946,9 +1946,9 @@
 	ld a, [MapGroup]
 	ld l, a
 	ld h, 0
-rept 3
 	add hl,hl
-endr
+	add hl,hl
+	add hl,hl
 	ld de, RoofPals
 	add hl, de
 	ld a, [TimeOfDayPal]
--- a/engine/crystal_intro.asm
+++ b/engine/crystal_intro.asm
@@ -1655,9 +1655,9 @@
 	ret
 
 CrystalIntro_UnownFade: ; e5223 (39:5223)
-rept 3
 	add a
-endr
+	add a
+	add a
 	ld e, a
 	ld d, $0
 	ld hl, BGPals
@@ -1777,9 +1777,9 @@
 .got_pointer
 	ld a, [wcf65]
 	and $7
-rept 3
 	add a
-endr
+	add a
+	add a
 	ld c, a
 	ld a, [rSVBK]
 	push af
@@ -1835,9 +1835,9 @@
 ; e539d
 
 Intro_FadeUnownWordPals: ; e539d (39:539d)
-rept 3
 	add a
-endr
+	add a
+	add a
 	ld e, a
 	ld d, $0
 	ld hl, BGPals
--- a/engine/debug.asm
+++ b/engine/debug.asm
@@ -573,9 +573,9 @@
 ; 81ca7
 
 Function81ca7: ; 81ca7
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	ld a, [de]
 	call Function81cbc
 	ld a, [de]
@@ -1233,9 +1233,9 @@
 	ld a, [wcf64]
 	ld l, a
 	ld h, $0
-rept 3
 	add hl, hl
-endr
+	add hl, hl
+	add hl, hl
 	ld de, UnknBGPals
 	add hl, de
 	ld de, wc608
--- a/engine/events.asm
+++ b/engine/events.asm
@@ -1030,9 +1030,9 @@
 	ld c, a
 	ld b, 0
 	ld hl, PlayerEventScriptPointers
-rept 3
 	add hl, bc
-endr
+	add hl, bc
+	add hl, bc
 	ld a, [hli]
 	ld [ScriptBank], a
 	ld a, [hli]
--- a/engine/events_2.asm
+++ b/engine/events_2.asm
@@ -459,9 +459,9 @@
 	ld e, a
 	ld d, 0
 	ld hl, .Jumptable_ba
-rept 3
 	add hl, de
-endr
+	add hl, de
+	add hl, de
 	ld a, [hli]
 	push af
 	ld a, [hli]
--- a/engine/events_3.asm
+++ b/engine/events_3.asm
@@ -704,9 +704,9 @@
 .loop
 	sub [hl]
 	jr c, .ok
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	jr .loop
 
 .ok
--- a/engine/evolution_animation.asm
+++ b/engine/evolution_animation.asm
@@ -353,9 +353,9 @@
 	ld a, [hl]
 	or b
 	ld [hli], a
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	dec c
 	jr nz, .loop6
 	pop bc
--- a/engine/fish.asm
+++ b/engine/fish.asm
@@ -50,9 +50,9 @@
 	cp [hl]
 	jr z, .ok
 	jr c, .ok
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	jr .loop
 .ok
 	inc hl
--- a/engine/fruit_trees.asm
+++ b/engine/fruit_trees.asm
@@ -66,9 +66,9 @@
 ResetFruitTrees: ; 4406a
 	xor a
 	ld hl, FruitTreeFlags
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ld [hl], a
 	ld hl, DailyFlags
 	set 4, [hl]
--- a/engine/healmachineanim.asm
+++ b/engine/healmachineanim.asm
@@ -218,9 +218,9 @@
 	ld [hld], a
 	ld a, e
 	ld [hli], a
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	dec c
 	jr nz, .palette_loop_2
 	pop de
--- a/engine/link.asm
+++ b/engine/link.asm
@@ -579,9 +579,9 @@
 	jr nz, .loop2
 	ld hl, wMisc
 	ld a, $fd
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ld b, $c8
 	xor a
 .loop3
@@ -1213,9 +1213,9 @@
 	callba InitTradeSpeciesList
 	xor a
 	ld hl, wOtherPlayerLinkMode
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ld [hl], a
 	ld a, 1
 	ld [wMenuCursorY], a
--- a/engine/map_objects.asm
+++ b/engine/map_objects.asm
@@ -268,9 +268,9 @@
 	ld [hl], a
 	ld hl, OBJECT_MOVEMENT_BYTE_INDEX
 	add hl, bc
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ld [hl], a ; OBJECT_30
 	ld hl, OBJECT_DIRECTION_WALKING
 	add hl, bc
--- a/engine/map_setup.asm
+++ b/engine/map_setup.asm
@@ -204,9 +204,9 @@
 	ld c, a
 	ld b, 0
 	ld hl, MapSetupCommands
-rept 3
 	add hl, bc
-endr
+	add hl, bc
+	add hl, bc
 
 	; bank
 	ld b, [hl]
--- a/engine/mart.asm
+++ b/engine/mart.asm
@@ -418,9 +418,9 @@
 	ld e, a
 	ld d, 0
 	ld hl, .MartTextFunctionPointers
-rept 3
 	add hl, de
-endr
+	add hl, de
+	add hl, de
 	ret
 ; 15cb0
 
@@ -576,9 +576,9 @@
 	ld h, [hl]
 	ld l, a
 	inc hl
-rept 3
 	add hl, de
-endr
+	add hl, de
+	add hl, de
 	inc hl
 	ld a, [hli]
 	ld [hMoneyTemp + 2], a
@@ -617,9 +617,9 @@
 	ld h, [hl]
 	ld l, a
 	inc hl
-rept 3
 	add hl, de
-endr
+	add hl, de
+	add hl, de
 	inc hl
 	ld e, [hl]
 	inc hl
@@ -663,9 +663,9 @@
 	ld c, a
 	ld b, 0
 	ld hl, wMartItem1BCD
-rept 3
 	add hl, bc
-endr
+	add hl, bc
+	add hl, bc
 	push de
 	ld d, h
 	ld e, l
--- a/engine/menu.asm
+++ b/engine/menu.asm
@@ -836,8 +836,8 @@
 	ld [hli], a
 ; wCursorOffCharacter, wCursorCurrentTile
 	xor a
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ret
 ; 244c3
--- a/engine/mon_icons.asm
+++ b/engine/mon_icons.asm
@@ -169,9 +169,10 @@
 	call GetMemIconGFX
 	ld a, [hObjectStructIndexBuffer]
 ; y coord
-rept 4
 	add a
-endr
+	add a
+	add a
+	add a
 	add $1c
 	ld d, a
 ; x coord
--- a/engine/move_mon.asm
+++ b/engine/move_mon.asm
@@ -1459,9 +1459,9 @@
 	ld a, [hl]
 	swap a
 	and $1
-rept 3
 	add a
-endr
+	add a
+	add a
 	ld b, a
 	ld a, [hli]
 	and $1
--- a/engine/predef.asm
+++ b/engine/predef.asm
@@ -12,9 +12,9 @@
 	ld e, a
 	ld d, 0
 	ld hl, PredefPointers
-rept 3
-	add hl,de
-endr
+	add hl, de
+	add hl, de
+	add hl, de
 	pop de
 
 	ld a, [hli]
@@ -64,7 +64,7 @@
 	add_predef CopyPkmnToTempMon
 	add_predef ListMoves ; $20
 	add_predef PlaceNonFaintStatus
-	add_predef Function50cdb
+	add_predef Predef22
 	add_predef ListMovePP
 	add_predef GetGender
 	add_predef StatsScreenInit
@@ -102,7 +102,7 @@
 	add_predef PlaceStatusString
 	add_predef LoadMonAnimation
 	add_predef AnimateFrontpic
-	add_predef Functiond0669 ; $48
+	add_predef Predef48 ; $48
 	add_predef HOF_AnimateFrontpic
-	dbw $ff, Function2d43 ; ????
+	dwb $43ff, $2d
 ; 864c
--- a/engine/printer.asm
+++ b/engine/printer.asm
@@ -293,9 +293,9 @@
 Function841fb: ; 841fb (21:41fb)
 	xor a
 	ld hl, wca82
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ld [hl], a
 	ld hl, wca86
 	ld [hli], a
@@ -1362,7 +1362,7 @@
 	call AddNTimes
 	ld a, [hl]
 	pop hl
-	call Function383d
+	call PrintLevel_Force3Digits
 .ok2
 	ld hl, wd002
 	inc [hl]
--- a/engine/scripting.asm
+++ b/engine/scripting.asm
@@ -1652,9 +1652,9 @@
 	inc [hl]
 	ld d, $0
 	ld hl, wScriptStack
-rept 3
 	add hl, de
-endr
+	add hl, de
+	add hl, de
 	pop de
 	ld a, [ScriptBank]
 	ld [hli], a
@@ -1825,9 +1825,9 @@
 	call GetScriptByte
 	ld d, a
 	ld hl, StdScripts
-rept 3
 	add hl, de
-endr
+	add hl, de
+	add hl, de
 	ld a, BANK(StdScripts)
 	call GetFarByte
 	ld b, a
@@ -3160,9 +3160,9 @@
 	ld e, [hl]
 	ld d, $0
 	ld hl, wScriptStack
-rept 3
 	add hl,de
-endr
+	add hl,de
+	add hl,de
 	ld a, [hli]
 	ld b, a
 	and " "
--- a/engine/search.asm
+++ b/engine/search.asm
@@ -117,9 +117,9 @@
 	; Load the box.
 	ld hl, BoxAddressTable1
 	ld b, 0
-rept 3
 	add hl, bc
-endr
+	add hl, bc
+	add hl, bc
 	ld a, [hli]
 	call GetSRAMBank
 	ld a, [hli]
--- a/engine/slot_machine.asm
+++ b/engine/slot_machine.asm
@@ -201,9 +201,9 @@
 	ld a, [hl]
 	xor $20
 	ld [hli], a
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	dec c
 	jr nz, .loop
 	ret
@@ -686,9 +686,9 @@
 	ld a, [hl]
 	add d
 	ld [hli], a
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	dec e
 	jr nz, .loop
 	ret
@@ -1844,9 +1844,9 @@
 	ld e, a
 	ld d, 0
 	ld hl, .PayoutStrings
-rept 3
 	add hl, de
-endr
+	add hl, de
+	add hl, de
 	ld de, StringBuffer2
 	ld bc, 4
 	call CopyBytes
--- a/engine/specials.asm
+++ b/engine/specials.asm
@@ -2,9 +2,9 @@
 Special:: ; c01b
 ; Run script special de.
 	ld hl, SpecialsPointers
-rept 3
 	add hl,de
-endr
+	add hl,de
+	add hl,de
 	ld b, [hl]
 	inc hl
 	ld a, [hli]
--- a/engine/sprite_anims.asm
+++ b/engine/sprite_anims.asm
@@ -630,9 +630,9 @@
 	ld hl, SPRITEANIMSTRUCT_0C
 	add hl, bc
 	ld a, [hl]
-rept 3
 	inc [hl]
-endr
+	inc [hl]
+	inc [hl]
 	push af
 	push de
 	call .Sprites_Sine
@@ -807,9 +807,9 @@
 	ld hl, SPRITEANIMSTRUCT_0B
 	add hl, bc
 	ld d, [hl]
-rept 3
 	inc [hl]
-endr
+	inc [hl]
+	inc [hl]
 
 	ld hl, SPRITEANIMSTRUCT_0C
 	add hl, bc
--- a/engine/sprites.asm
+++ b/engine/sprites.asm
@@ -154,9 +154,9 @@
 	ld e, a
 	ld d, 0
 	ld hl, SpriteAnimSeqData
-rept 3
 	add hl, de
-endr
+	add hl, de
+	add hl, de
 	ld e, l
 	ld d, h
 ; Set hl to the first field (field 0) in the current structure.
@@ -521,9 +521,9 @@
 	ld e, a
 	ld d, 0
 	ld hl, SpriteAnimOAMData
-rept 3
 	add hl, de
-endr
+	add hl, de
+	add hl, de
 	ret
 ; 8d1ac
 
--- a/engine/startmenu.asm
+++ b/engine/startmenu.asm
@@ -19,9 +19,9 @@
 	ld a, [wd0d2]
 	ld [wMenuCursorBuffer], a
 	call .DrawMenuAccount_
-	call MenuFunc_1e7f
+	call DrawVariableLengthMenuBox
 	call .DrawBugContestStatusBox
-	call Function2e31
+	call SafeUpdateSprites
 	call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
 	callba LoadFonts_NoOAMUpdate
 	call .DrawBugContestStatus
@@ -142,7 +142,7 @@
 	call Call_ExitMenu
 	call ReloadTilesetAndPalettes
 	call .DrawMenuAccount_
-	call MenuFunc_1e7f
+	call DrawVariableLengthMenuBox
 	call .DrawBugContestStatus
 	call UpdateSprites
 	call ret_d90
--- a/engine/time.asm
+++ b/engine/time.asm
@@ -102,9 +102,9 @@
 	ret nc
 	xor a
 	ld hl, DailyFlags
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ld [hl], a
 	ld hl, wDailyRematchFlags
 rept 4
@@ -381,9 +381,9 @@
 ; 115db
 
 CalcSecsMinsHoursDaysSince: ; 115db
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	ld a, [hSeconds]
 	ld c, a
 	sub [hl]
--- a/engine/timeofdaypals.asm
+++ b/engine/timeofdaypals.asm
@@ -140,9 +140,9 @@
 	ld b, $4
 .asm_8c09c
 	call DmgToCgbTimePals
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	ld c, $7
 	call DelayFrames
 	dec b
@@ -304,9 +304,9 @@
 ConvertTimePalsIncHL: ; 8c15e
 .loop
 	call DmgToCgbTimePals
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	ld c, 2
 	call DelayFrames
 	dec b
@@ -317,9 +317,9 @@
 ConvertTimePalsDecHL: ; 8c16d
 .loop
 	call DmgToCgbTimePals
-rept 3
 	dec hl
-endr
+	dec hl
+	dec hl
 	ld c, 2
 	call DelayFrames
 	dec b
--- a/engine/timeset.asm
+++ b/engine/timeset.asm
@@ -215,9 +215,9 @@
 	ld [hl], a
 	pop hl
 	call DisplayMinutesWithMinString
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	ret
 ; 90810
 
--- a/engine/title.asm
+++ b/engine/title.asm
@@ -377,9 +377,9 @@
 	ld a, [hl]
 	add 2
 	ld [hli], a
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	dec c
 	jr nz, .loop
 
--- a/engine/tmhm2.asm
+++ b/engine/tmhm2.asm
@@ -423,9 +423,9 @@
 
 .NotTMHM:
 	call TMHMPocket_GetCurrentLineCoord
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	push de
 	ld de, TMHM_String_Cancel
 	call PlaceString
--- a/engine/trainer_card.asm
+++ b/engine/trainer_card.asm
@@ -62,9 +62,9 @@
 	call WaitBGMap
 	ld hl, wJumptableIndex
 	xor a
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ld [hl], a
 	ret
 
--- a/engine/variables.asm
+++ b/engine/variables.asm
@@ -7,9 +7,9 @@
 	ld c, a
 	ld b, 0
 	ld hl, .VarActionTable
-rept 3
 	add hl, bc
-endr
+	add hl, bc
+	add hl, bc
 	ld e, [hl]
 	inc hl
 	ld d, [hl]
--- a/engine/warp_connection.asm
+++ b/engine/warp_connection.asm
@@ -326,7 +326,7 @@
 	jr nz, .skip
 	ld hl, VramState
 	set 0, [hl]
-	call Function2e31
+	call SafeUpdateSprites
 .skip
 	ld a, [wPlayerSpriteSetupFlags]
 	and %00011100
--- a/engine/wildmons.asm
+++ b/engine/wildmons.asm
@@ -62,9 +62,9 @@
 	ld b, a
 	ld a, [hli]
 	ld c, a
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	ld a, NUM_WILDMONS_PER_AREA_TIME_OF_DAY * 3
 	call .SearchMapForMon
 	jr nc, .next_grass
@@ -267,9 +267,9 @@
 	call CheckEncounterRoamMon
 	jp c, .startwildbattle
 
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	call CheckOnWater
 	ld de, .WaterMonTable
 	jr z, .watermon
@@ -595,9 +595,9 @@
 	cp [hl]
 	jr nz, .DontEncounterRoamMon
 ; We've decided to take on a beast, so stage its information for battle.
-rept 3
 	dec hl
-endr
+	dec hl
+	dec hl
 	ld a, [hli]
 	ld [TempWildMonSpecies], a
 	ld a, [hl]
--- a/event/battle_tower.asm
+++ b/event/battle_tower.asm
@@ -157,9 +157,9 @@
 ; 8b281
 
 .GetTextPointers: ; 8b281
-rept 3
 	inc de
-endr
+	inc de
+	inc de
 	ld a, [de]
 	ld l, a
 	inc de
--- a/event/bug_contest_judging.asm
+++ b/event/bug_contest_judging.asm
@@ -340,9 +340,9 @@
 	jr z, .loop2
 	ld c, a
 	ld b, 0
-rept 3
 	add hl, bc
-endr
+	add hl, bc
+	add hl, bc
 	ld a, [hli]
 	ld [wBugContestTempMon], a
 	ld a, [hli]
--- a/event/celebi.asm
+++ b/event/celebi.asm
@@ -55,9 +55,9 @@
 	ld c, $4
 .OAMloop:
 	ld [hli], a
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	inc a
 	dec c
 	jr nz, .OAMloop
--- a/event/field_moves.asm
+++ b/event/field_moves.asm
@@ -398,9 +398,9 @@
 	ld c, $4
 .loop2
 	ld [hli], a
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	inc a
 	dec c
 	jr nz, .loop2
--- a/event/happiness_egg.asm
+++ b/event/happiness_egg.asm
@@ -67,9 +67,9 @@
 	dec c
 	ld b, 0
 	ld hl, .Actions
-rept 3
 	add hl, bc
-endr
+	add hl, bc
+	add hl, bc
 	ld d, 0
 	add hl, de
 	ld a, [hl]
--- a/event/magnet_train.asm
+++ b/event/magnet_train.asm
@@ -48,7 +48,7 @@
 	callab PlaySpriteAnimations
 	call MagnetTrain_Jumptable
 	call MagnetTrain_UpdateLYOverrides
-	call Function3b0c
+	call PushLYOverrides
 	call DelayFrame
 	jr .loop
 
@@ -149,9 +149,9 @@
 	xor a
 	ld [hli], a
 	ld a, [wMagnetTrainInitPosition]
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ld de, MUSIC_MAGNET_TRAIN
 	call PlayMusic2
 	ret
@@ -426,7 +426,7 @@
 	callba PlaySpriteAnimations
 	call MagnetTrain_Jumptable
 	call MagnetTrain_UpdateLYOverrides
-	call Function3b0c
+	call PushLYOverrides
 	call DelayFrame
 	ld a, [rSVBK]
 	push af
--- a/event/mom.asm
+++ b/event/mom.asm
@@ -588,9 +588,9 @@
 	push de
 	ld e, a
 	ld d, 0
-rept 3
 	add hl, de
-endr
+	add hl, de
+	add hl, de
 	pop de
 	ret
 ; 16613
--- a/event/special.asm
+++ b/event/special.asm
@@ -188,9 +188,9 @@
 .loop
 	sub [hl]
 	jr c, .ok
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	jr .loop
 
 .ok
--- a/gfx/pics/animation.asm
+++ b/gfx/pics/animation.asm
@@ -1109,7 +1109,7 @@
 	ret
 ; d0669
 
-Functiond0669: ; d0669 Predef 48
+Predef48: ; d0669 Predef 48
 	ld a, $1
 	ld [wBoxAlignment], a
 
--- a/home.asm
+++ b/home.asm
@@ -798,12 +798,7 @@
 	dbw 0, PartyMonOT
 	dbw 0, OTPartyMonOT
 	dba TrainerClassNames
-; 33c0
-
-Function33c0:
-	inc b
-	ld d, d
-	ld c, e
+	dbw $4, $4b52 ; within PackMenuGFX
 ; 33c3
 
 GetName:: ; 33c3
@@ -834,9 +829,9 @@
 	ld e, a
 	ld d, 0
 	ld hl, NamesPointers
-rept 3
 	add hl, de
-endr
+	add hl, de
+	add hl, de
 	ld a, [hli]
 	rst Bankswitch
 	ld a, [hli]
@@ -1142,7 +1137,7 @@
 	jp TextBox
 ; 354b
 
-Function354b:: ; 354b joypad
+JoyTextDelay_ForcehJoyDown:: ; 354b joypad
 	call DelayFrame
 
 	ld a, [hInMenu]
@@ -1692,15 +1687,15 @@
 ; How many digits?
 	ld c, 2
 	cp 100
-	jr c, Function3842
+	jr c, Print8BitNumRightAlign
 
 ; 3-digit numbers overwrite the :L.
 	dec hl
 	inc c
-	jr Function3842
+	jr Print8BitNumRightAlign
 ; 383d
 
-Function383d:: ; 383d
+PrintLevel_Force3Digits:: ; 383d
 ; Print :L and all 3 digits
 	ld [hl], "<LV>"
 	inc hl
@@ -1707,7 +1702,7 @@
 	ld c, 3
 ; 3842
 
-Function3842:: ; 3842
+Print8BitNumRightAlign:: ; 3842
 	ld [wd265], a
 	ld de, wd265
 	ld b, PRINTNUM_RIGHTALIGN | 1
@@ -1715,6 +1710,8 @@
 ; 384d
 
 Function384d:: ; 384d
+; XXX
+; GetNthMove
 	ld hl, wListMoves_MoveIndicesBuffer
 	ld c, a
 	ld b, 0
@@ -1907,6 +1904,10 @@
 ; 392d
 
 Function392d:: ; 392d
+; XXX
+; GetDexNumber
+; Probably used in gen 1 to convert index number to dex number
+; Not required in gen 2 because index number == dex number
 	push hl
 	ld a, b
 	dec a
@@ -1913,7 +1914,7 @@
 	ld b, 0
 	add hl, bc
 	ld hl, BaseData + 0
-	ld bc, $0020
+	ld bc, BaseData1 - BaseData0
 	call AddNTimes
 	ld a, BANK(BaseData)
 	call GetFarHalfword
@@ -1925,7 +1926,7 @@
 
 INCLUDE "home/battle.asm"
 
-Function3b0c:: ; 3b0c
+PushLYOverrides:: ; 3b0c
 
 	ld a, [hFFC6]
 	and a
--- a/home/copy.asm
+++ b/home/copy.asm
@@ -421,9 +421,9 @@
 	push af
 	ld h, 0
 	ld l, c
-rept 3
 	add hl, hl
-endr
+	add hl, hl
+	add hl, hl
 	ld b, h
 	ld c, l
 	pop af
--- a/home/fade.asm
+++ b/home/fade.asm
@@ -2,6 +2,8 @@
 
 
 Function48c:: ; 48c
+; XXX
+; TimeOfDayFade
 	ld a, [TimeOfDayPal]
 	ld b, a
 	ld hl, IncGradGBPalTable_11
--- a/home/init.asm
+++ b/home/init.asm
@@ -100,7 +100,7 @@
 	ld [rSVBK], a
 	call ClearVRAM
 	call ClearSprites
-	call Function270
+	call ClearsScratch
 
 
 	ld a, BANK(LoadPushOAM)
@@ -194,9 +194,10 @@
 
 ClearWRAM:: ; 25a
 ; Wipe swappable WRAM banks (1-7)
+; Assumes CGB or AGB
 
 	ld a, 1
-.asm_25c
+.bank_loop
 	push af
 	ld [rSVBK], a
 	xor a
@@ -206,15 +207,17 @@
 	pop af
 	inc a
 	cp 8
-	jr nc, .asm_25c
+	jr nc, .bank_loop
 	ret
 ; 270
 
-Function270:: ; 270
-	ld a, $0
+ClearsScratch:: ; 270
+; Wipe the first 32 bytes of sScratch
+
+	ld a, BANK(sScratch)
 	call GetSRAMBank
-	ld hl, $a000
-	ld bc, $0020
+	ld hl, sScratch
+	ld bc, $20
 	xor a
 	call ByteFill
 	call CloseSRAM
--- a/home/map.asm
+++ b/home/map.asm
@@ -155,9 +155,9 @@
 	add a
 	ld l, a
 	ld h, 0
-rept 3
 	add hl, hl
-endr
+	add hl, hl
+	add hl, hl
 	ld a, [TilesetBlocksAddress]
 	add l
 	ld l, a
@@ -694,9 +694,9 @@
 	ld a, [hli]
 	ld h, [hl]
 	ld l, a
-rept 3
 	inc hl ; get to the warp coords
-endr
+	inc hl ; get to the warp coords
+	inc hl ; get to the warp coords
 	ld a, [WarpNumber]
 	dec a
 	ld c, a
@@ -751,9 +751,9 @@
 	ld [hConnectionStripLength], a
 	ld c, a
 	ld b, 0
-rept 3
 	add hl, bc
-endr
+	add hl, bc
+	add hl, bc
 	ld c, 3
 	add hl, bc
 	ld a, [MapBlockDataBank]
@@ -1072,7 +1072,7 @@
 
 	push hl
 	call SpeechTextBox
-	call Function2e31
+	call SafeUpdateSprites
 	ld a, 1
 	ld [hOAMUpdate], a
 	call ApplyTilemap
--- a/home/menu.asm
+++ b/home/menu.asm
@@ -229,9 +229,9 @@
 ; 1e5d
 
 DoNthMenu:: ; 1e5d
-	call MenuFunc_1e7f
+	call DrawVariableLengthMenuBox
 	call MenuWriteText
-	call Function1eff
+	call InitMenuCursorAndButtonPermissions
 	call GetStaticMenuJoypad
 	call GetMenuJoypad
 	call MenuClickSound
@@ -239,17 +239,17 @@
 ; 1e70
 
 SetUpMenu:: ; 1e70
-	call MenuFunc_1e7f ; ???
+	call DrawVariableLengthMenuBox ; ???
 	call MenuWriteText
-	call Function1eff ; set up selection pointer
+	call InitMenuCursorAndButtonPermissions ; set up selection pointer
 	ld hl, w2DMenuFlags1
 	set 7, [hl]
 	ret
 
-MenuFunc_1e7f::
+DrawVariableLengthMenuBox::
 	call CopyMenuData2
 	call GetMenuIndexSet
-	call Function1ea6
+	call AutomaticGetMenuBottomCoord
 	call MenuBox
 	ret
 
@@ -257,8 +257,8 @@
 	xor a
 	ld [hBGMapMode], a
 	call GetMenuIndexSet ; sort out the text
-	call Function1eda ; actually write it
-	call Function2e31
+	call RunMenuItemPrintingFunction ; actually write it
+	call SafeUpdateSprites
 	ld a, [hOAMUpdate]
 	push af
 	ld a, $1
@@ -269,7 +269,7 @@
 	ret
 ; 0x1ea6
 
-Function1ea6:: ; 1ea6
+AutomaticGetMenuBottomCoord:: ; 1ea6
 	ld a, [wMenuBorderLeftCoord]
 	ld c, a
 	ld a, [wMenuBorderRightCoord]
@@ -310,7 +310,7 @@
 	ret
 ; 1eda
 
-Function1eda:: ; 1eda
+RunMenuItemPrintingFunction:: ; 1eda
 	call MenuBoxCoord2Tile
 	ld bc, 2 * SCREEN_WIDTH + 2
 	add hl, bc
@@ -325,7 +325,7 @@
 	ld d, h
 	ld e, l
 	ld hl, wMenuData2DisplayFunctionPointer
-	call .__wMenuData2DisplayFunction__
+	call ._hl_
 	pop hl
 	ld de, 2 * SCREEN_WIDTH
 	add hl, de
@@ -333,7 +333,7 @@
 	jr .loop
 ; 1efb
 
-.__wMenuData2DisplayFunction__ ; 1efb
+._hl_ ; 1efb
 	ld a, [hli]
 	ld h, [hl]
 	ld l, a
@@ -340,7 +340,7 @@
 	jp [hl]
 ; 1eff
 
-Function1eff:: ; 1eff
+InitMenuCursorAndButtonPermissions:: ; 1eff
 	call InitVerticalMenuCursor
 	ld hl, wMenuJoypadFilter
 	ld a, [wMenuData2Flags]
--- a/home/movement.asm
+++ b/home/movement.asm
@@ -150,9 +150,9 @@
 	ld [hli], a
 	ld [hli], a
 	xor a
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	pop bc
 	pop hl
 	ret
--- a/home/text.asm
+++ b/home/text.asm
@@ -525,7 +525,7 @@
 	call LoadBlinkingCursor
 
 .linkbattle
-	call Function13b6
+	call Text_WaitBGMap
 	call ButtonSound
 	hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
 	lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW
@@ -546,7 +546,7 @@
 	call LoadBlinkingCursor
 
 .communication
-	call Function13b6
+	call Text_WaitBGMap
 
 	push de
 	call ButtonSound
@@ -598,7 +598,7 @@
 	call LoadBlinkingCursor
 
 .ok
-	call Function13b6
+	call Text_WaitBGMap
 	call ButtonSound
 	ld a, [wLinkMode]
 	cp LINK_COLOSSEUM
@@ -655,7 +655,7 @@
 	ret
 ; 13b6
 
-Function13b6:: ; 13b6
+Text_WaitBGMap:: ; 13b6
 	push bc
 	ld a, [hOAMUpdate]
 	push af
@@ -1029,6 +1029,8 @@
 ; 1522
 
 Function1522:: ; 1522
+; XXX
+; TX_CRY
 	push de
 	ld e, [hl]
 	inc hl
--- a/home/window.asm
+++ b/home/window.asm
@@ -39,7 +39,7 @@
 	call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
 	xor a
 	ld [hBGMapMode], a
-	call Function2e31
+	call SafeUpdateSprites
 	ld a, $90
 	ld [hWY], a
 	call ReplaceKrisSprite
@@ -78,7 +78,7 @@
 	ret
 ; 2e31
 
-Function2e31:: ; 2e31
+SafeUpdateSprites:: ; 2e31
 	ld a, [hOAMUpdate]
 	push af
 	ld a, [hBGMapMode]
@@ -87,7 +87,9 @@
 	ld [hBGMapMode], a
 	ld a, $1
 	ld [hOAMUpdate], a
+
 	call UpdateSprites
+
 	xor a
 	ld [hOAMUpdate], a
 	call DelayFrame
--- a/items/item_effects.asm
+++ b/items/item_effects.asm
@@ -937,9 +937,9 @@
 	pop bc
 	ret nz
 
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 
 ; Moon Stone's constant from Pokémon Red is used.
 ; No Pokémon evolve with Burn Heal,
--- a/lib/mobile/main.asm
+++ b/lib/mobile/main.asm
@@ -745,9 +745,9 @@
 	ld a, $c8
 	ld [hli], a
 	xor a
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ld [hl], a
 	ld a, $ff
 	ld [$c86e], a
@@ -968,9 +968,9 @@
 	ld a, $c8
 	ld [hli], a
 	xor a
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ld [hl], a
 	ld a, $ff
 	ld [$c86e], a
@@ -2274,9 +2274,9 @@
 .asm_110ee3
 	ld hl, $c98b
 	xor a
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ld [hl], a
 	pop bc
 	pop de
@@ -3081,9 +3081,9 @@
 	push hl
 	ld hl, $c829
 	xor a
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ld [hl], a
 	ld de, $cb47
 	ld hl, Unknown_112072
@@ -3578,9 +3578,9 @@
 	ld [$c800], a
 	xor a
 	ld hl, $c80a
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ld hl, $c81f
 	ld a, [hli]
 	ld b, a
@@ -9143,9 +9143,9 @@
 	ld bc, $0003
 
 .asm_113ccf
-rept 3
 	dec bc
-endr
+	dec bc
+	dec bc
 	ld a, c
 	ld [$cc10], a
 	ld a, b
--- a/main.asm
+++ b/main.asm
@@ -127,7 +127,7 @@
 	call LoadFontsExtra
 	ld a, $90
 	ld [hWY], a
-	call Function2e31
+	call SafeUpdateSprites
 	call LoadStandardFont
 	ret
 
@@ -933,8 +933,8 @@
 	ld h, b
 	ld l, c
 	inc hl
-	ld c, $3
-	call Function3842
+	ld c, 3
+	call Print8BitNumRightAlign
 
 .skip_level
 	pop af
@@ -1517,9 +1517,9 @@
 	ld [wBattleResult], a
 
 	ld hl, wPartyMenuCursor
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ld [hl], a
 
 	ld [wMenuScrollPosition], a
@@ -2782,9 +2782,9 @@
 	jr z, .SkipBox
 	ld hl, .BoxBankAddresses
 	ld b, 0
-rept 3
 	add hl, bc
-endr
+	add hl, bc
+	add hl, bc
 	ld a, [hli]
 	call GetSRAMBank
 	ld a, [hli]
@@ -3505,7 +3505,7 @@
 .mobile
 	ld a, [wcd2f]
 	and a
-	jr nz, .asm_4ea72
+	jr nz, .from_wram
 
 	ld a, $4
 	call GetSRAMBank
@@ -3520,7 +3520,7 @@
 	and a
 	ret
 
-.asm_4ea72
+.from_wram
 	ld a, $5
 	ld hl, w5_dc00
 	call GetFarWRAMByte
@@ -3782,9 +3782,10 @@
 	ld [wWhichHPBar], a
 	push hl
 	push bc
+	; box mons have full HP
 	ld a, [MonType]
 	cp BOXMON
-	jr z, .asm_50b30
+	jr z, .at_least_1_hp
 
 	ld a, [TempMonHP]
 	ld b, a
@@ -3793,7 +3794,7 @@
 
 ; Any HP?
 	or b
-	jr nz, .asm_50b30
+	jr nz, .at_least_1_hp
 
 	xor a
 	ld c, a
@@ -3800,9 +3801,9 @@
 	ld e, a
 	ld a, 6
 	ld d, a
-	jp .asm_50b4a
+	jp .fainted
 
-.asm_50b30
+.at_least_1_hp
 	ld a, [TempMonMaxHP]
 	ld d, a
 	ld a, [TempMonMaxHP + 1]
@@ -3809,18 +3810,18 @@
 	ld e, a
 	ld a, [MonType]
 	cp BOXMON
-	jr nz, .asm_50b41
+	jr nz, .not_boxmon
 
 	ld b, d
 	ld c, e
 
-.asm_50b41
+.not_boxmon
 	predef ComputeHPBarPixels
 	ld a, 6
 	ld d, a
 	ld c, a
 
-.asm_50b4a
+.fainted
 	ld a, c
 	pop bc
 	ld c, a
@@ -3832,14 +3833,14 @@
 	pop hl
 
 ; Print HP
-	ld bc, $15 ; move (1,1)
+	bccoord 1, 1, 0
 	add hl, bc
 	ld de, TempMonHP
 	ld a, [MonType]
 	cp BOXMON
-	jr nz, .asm_50b66
+	jr nz, .not_boxmon_2
 	ld de, TempMonMaxHP
-.asm_50b66
+.not_boxmon_2
 	lb bc, 2, 3
 	call PrintNum
 
@@ -4029,9 +4030,9 @@
 
 .skip
 	pop hl
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	ld d, h
 	ld e, l
 	ld hl, TempMonMoves
@@ -4108,7 +4109,7 @@
 	jr nz, .loop
 	ret
 
-Function50cdb: ; unreferenced predef
+Predef22: ; unreferenced predef
 	push hl
 	push hl
 	ld hl, PartyMonNicknames
@@ -5659,19 +5660,19 @@
 INCLUDE "engine/diploma.asm"
 
 LoadSGBPokedexGFX: ; 1ddf1c
-	ld hl, LZ_1ddf33
+	ld hl, SGBPokedexGFX_LZ
 	ld de, VTiles2 tile $31
 	call Decompress
 	ret
 
 LoadSGBPokedexGFX2: ; 1ddf26 (77:5f26)
-	ld hl, LZ_1ddf33
+	ld hl, SGBPokedexGFX_LZ
 	ld de, VTiles2 tile $31
-	lb bc, BANK(LZ_1ddf33), $3a
+	lb bc, BANK(SGBPokedexGFX_LZ), $3a
 	call DecompressRequest2bpp
 	ret
 
-LZ_1ddf33: ; 1ddf33
+SGBPokedexGFX_LZ: ; 1ddf33
 INCBIN "gfx/pokedex/sgb.2bpp.lz"
 
 LoadQuestionMarkPic: ; 1de0d7
--- a/misc/crystal_misc.asm
+++ b/misc/crystal_misc.asm
@@ -576,16 +576,16 @@
 	push de
 	ld a, $3
 	call Function17aae0
-rept 3
 	add a
-endr
+	add a
+	add a
 	add $0
 	push af
 	ld a, $4
 	call Function17aae0
-rept 3
 	add a
-endr
+	add a
+	add a
 	add $8
 	ld c, a
 	pop af
--- a/misc/gfx_41.asm
+++ b/misc/gfx_41.asm
@@ -550,9 +550,9 @@
 	ld a, b
 	ld l, c
 	ld h, $0
-rept 3
 	add hl, hl ; multiply by 8
-endr
+	add hl, hl ; multiply by 8
+	add hl, hl ; multiply by 8
 	ld c, l
 	ld b, h
 	ld h, d
--- a/misc/mobile_12_2.asm
+++ b/misc/mobile_12_2.asm
@@ -53,9 +53,9 @@
 	jr z, .asm_4a8d1
 	ld hl, .BoxAddrs
 	ld b, 0
-rept 3
 	add hl, bc
-endr
+	add hl, bc
+	add hl, bc
 	ld a, [hli]
 	call GetSRAMBank
 	ld a, [hli]
--- a/misc/mobile_22.asm
+++ b/misc/mobile_22.asm
@@ -45,7 +45,9 @@
 	ret
 
 Function89185: ; 89185 (22:5185)
-; Compares c bytes starting at de and hl and incrementing together until a match is found.
+; strcmp(hl, de, c)
+; Compares c bytes starting at de and hl and incrementing together until a mismatch is found.
+; Preserves hl and de.
 	push de
 	push hl
 .loop
@@ -62,7 +64,9 @@
 	ret
 
 Function89193: ; 89193
+; copy(hl, de, 4)
 ; Copies c bytes from hl to de.
+; Preserves hl and de.
 	push de
 	push hl
 .loop
@@ -355,10 +359,10 @@
 
 Function8931b: ; 8931b
 	push hl
-	ld hl, $a03b
+	ld hl, $a03b ; 4:a03b
 	ld a, [MenuSelection]
 	dec a
-	ld bc, $0025
+	ld bc, 37
 	call AddNTimes
 	ld b, h
 	ld c, l
@@ -371,7 +375,9 @@
 	add hl, bc
 
 Function89331: ; 89331
-; Scans up to 5 characters starting at hl, looking for a nonspace character up to the next terminator.  Sets carry if it does not find a nonspace character.  Returns the location of the following character in hl.
+; Scans up to 5 characters starting at hl, looking for a nonspace character up to the next terminator.
+; Sets carry if it does not find a nonspace character.
+; Returns the location of the following character in hl.
 	push bc
 	ld c, 5
 .loop
@@ -1649,44 +1655,44 @@
 ; 89a57
 
 Function89a57: ; 89a57
-	call Function354b
-	bit 6, c
-	jr nz, .asm_89a78
-	bit 7, c
-	jr nz, .asm_89a81
-	bit 0, c
-	jr nz, .asm_89a70
-	bit 1, c
-	jr nz, .asm_89a70
-	bit 3, c
-	jr nz, .asm_89a74
+	call JoyTextDelay_ForcehJoyDown ; joypad
+	bit D_UP_F, c
+	jr nz, .d_up
+	bit D_DOWN_F, c
+	jr nz, .d_down
+	bit A_BUTTON_F, c
+	jr nz, .a_b_button
+	bit B_BUTTON_F, c
+	jr nz, .a_b_button
+	bit START_F, c
+	jr nz, .start_button
 	scf
 	ret
 
-.asm_89a70
+.a_b_button
 	ld a, $1
 	and a
 	ret
 
-.asm_89a74
+.start_button
 	ld a, $2
 	and a
 	ret
 
-.asm_89a78
-	call Function89a9b
-	call nc, Function89a8a
+.d_up
+	call .MoveCursorUp
+	call nc, .PlayPocketSwitchSFX
 	ld a, $0
 	ret
 
-.asm_89a81
-	call Function89a93
-	call nc, Function89a8a
+.d_down
+	call .MoveCursorDown
+	call nc, .PlayPocketSwitchSFX
 	ld a, $0
 	ret
 ; 89a8a
 
-Function89a8a: ; 89a8a
+.PlayPocketSwitchSFX: ; 89a8a
 	push af
 	ld de, SFX_SWITCH_POCKETS
 	call PlaySFX
@@ -1694,42 +1700,42 @@
 	ret
 ; 89a93
 
-Function89a93: ; 89a93
-	ld d, $28
-	ld e, $1
-	call Function89aa3
+.MoveCursorDown: ; 89a93
+	ld d, 40
+	ld e,  1
+	call .ApplyCursorMovement
 	ret
 ; 89a9b
 
-Function89a9b: ; 89a9b
-	ld d, $1
-	ld e, $ff
-	call Function89aa3
+.MoveCursorUp: ; 89a9b
+	ld d,  1
+	ld e, -1
+	call .ApplyCursorMovement
 	ret
 ; 89aa3
 
-Function89aa3: ; 89aa3
+.ApplyCursorMovement: ; 89aa3
 	ld a, [MenuSelection]
 	ld c, a
 	push bc
-.asm_89aa8
+.loop
 	ld a, [MenuSelection]
 	cp d
-	jr z, .asm_89ac0
+	jr z, .equal_to_d
 	add e
-	jr nz, .asm_89ab2
+	jr nz, .not_zero
 	inc a
 
-.asm_89ab2
+.not_zero
 	ld [MenuSelection], a
-	call Function89ac7
-	jr nc, .asm_89aa8
-	call Function89ae6
+	call .Function89ac7 ; BCD conversion of data in SRAM?
+	jr nc, .loop
+	call .Function89ae6 ; split [MenuSelection] into [wd030] + [wd031] where [wd030] <= 5
 	pop bc
 	and a
 	ret
 
-.asm_89ac0
+.equal_to_d
 	pop bc
 	ld a, c
 	ld [MenuSelection], a
@@ -1737,48 +1743,48 @@
 	ret
 ; 89ac7
 
-Function89ac7: ; 89ac7
+.Function89ac7: ; 89ac7
 	call OpenSRAMBank4
 	call Function8931b
-	call Function89ad4
+	call .Function89ad4
 	call CloseSRAM
 	ret
 ; 89ad4
 
-Function89ad4: ; 89ad4
+.Function89ad4: ; 89ad4
 	push de
-	call Function8932d
-	jr c, .asm_89ae3
-	ld hl, $0011
+	call Function8932d ; find a non-space character within 5 bytes of bc
+	jr c, .no_nonspace_character
+	ld hl, 17
 	add hl, bc
 	call Function89b45
-	jr c, .asm_89ae4
+	jr c, .finish_decode
 
-.asm_89ae3
+.no_nonspace_character
 	and a
 
-.asm_89ae4
+.finish_decode
 	pop de
 	ret
 ; 89ae6
 
-Function89ae6: ; 89ae6
+.Function89ae6: ; 89ae6
 	ld hl, wd031
 	xor a
 	ld [hl], a
 	ld a, [MenuSelection]
-.asm_89aee
-	cp $6
-	jr c, .asm_89afc
-	sub $5
+.loop2
+	cp 6
+	jr c, .load_and_ret
+	sub 5
 	ld c, a
 	ld a, [hl]
-	add $5
+	add 5
 	ld [hl], a
 	ld a, c
-	jr .asm_89aee
+	jr .loop2
 
-.asm_89afc
+.load_and_ret
 	ld [wd030], a
 	ret
 ; 89b00
@@ -1823,48 +1829,50 @@
 	ret
 
 Function89b45: ; 89b45
+	; some sort of decoder?
+	; BCD?
 	push hl
 	push bc
 	ld c, $10
 	ld e, $0
-.asm_89b4b
+.loop
 	ld a, [hli]
 	ld b, a
 	and $f
-	cp $a
-	jr c, .asm_89b5a
+	cp 10
+	jr c, .low_nybble_less_than_10
 	ld a, c
 	cp $b
-	jr nc, .asm_89b74
-	jr .asm_89b71
+	jr nc, .clear_carry
+	jr .set_carry
 
-.asm_89b5a
+.low_nybble_less_than_10
 	dec c
 	swap b
 	inc e
 	ld a, b
 	and $f
-	cp $a
-	jr c, .asm_89b6c
+	cp 10
+	jr c, .high_nybble_less_than_10
 	ld a, c
 	cp $b
-	jr nc, .asm_89b74
-	jr .asm_89b71
+	jr nc, .clear_carry
+	jr .set_carry
 
-.asm_89b6c
+.high_nybble_less_than_10
 	inc e
 	dec c
-	jr nz, .asm_89b4b
+	jr nz, .loop
 	dec e
 
-.asm_89b71
+.set_carry
 	scf
-	jr .asm_89b75
+	jr .finish
 
-.asm_89b74
+.clear_carry
 	and a
 
-.asm_89b75
+.finish
 	pop bc
 	pop hl
 	ret
@@ -2027,56 +2035,59 @@
 	ret
 
 Function89c67: ; 89c67 (22:5c67)
-	call Function354b
+; menu scrolling?
+	call JoyTextDelay_ForcehJoyDown ; joypad
 	ld b, $0
-	bit 0, c
-	jr z, .asm_89c74
+	bit A_BUTTON_F, c
+	jr z, .not_a_button
 	ld b, $1
 	and a
 	ret
-.asm_89c74
-	bit 1, c
-	jr z, .asm_89c7a
+
+.not_a_button
+	bit B_BUTTON_F, c
+	jr z, .not_b_button
 	scf
 	ret
-.asm_89c7a
+
+.not_b_button
 	xor a
-	bit 6, c
-	jr z, .asm_89c81
+	bit D_UP_F, c
+	jr z, .not_d_up
 	ld a, $1
-.asm_89c81
-	bit 7, c
-	jr z, .asm_89c87
+.not_d_up
+	bit D_DOWN_F, c
+	jr z, .not_d_down
 	ld a, $2
-.asm_89c87
-	bit 5, c
-	jr z, .asm_89c8d
+.not_d_down
+	bit D_LEFT_F, c
+	jr z, .not_d_left
 	ld a, $3
-.asm_89c8d
-	bit 4, c
-	jr z, .asm_89c93
+.not_d_left
+	bit D_RIGHT_F, c
+	jr z, .not_d_right
 	ld a, $4
-.asm_89c93
+.not_d_right
 	and a
-	ret z
+	ret z ; no dpad pressed
 	dec a
 	ld c, a
 	ld d, $0
-	ld hl, Unknown_89cbf
+	ld hl, .ScrollData0
 	ld a, [wd02f]
 	and a
-	jr z, .asm_89ca5
-	ld hl, Unknown_89ccf
-.asm_89ca5
+	jr z, .got_data
+	ld hl, .ScrollData1
+.got_data
 	ld a, [wd011]
 	and a
-	jr z, .asm_89cb1
+	jr z, .got_row
 	ld e, $4
-.asm_89cad
+.add_n_times
 	add hl, de
 	dec a
-	jr nz, .asm_89cad
-.asm_89cb1
+	jr nz, .add_n_times
+.got_row
 	ld e, c
 	add hl, de
 	ld a, [hl]
@@ -2089,13 +2100,13 @@
 	ret
 ; 89cbf (22:5cbf)
 
-Unknown_89cbf: ; 89cbf
+.ScrollData0: ; 89cbf
 	db 0, 2, 0, 0
 	db 1, 3, 0, 0
 	db 2, 4, 0, 0
 	db 3, 0, 0, 0
 
-Unknown_89ccf: ; 89ccf
+.ScrollData1: ; 89ccf
 	db 0, 0, 0, 0
 	db 0, 3, 0, 0
 	db 2, 4, 0, 0
@@ -2305,7 +2316,7 @@
 
 Function89e1e: ; 89e1e (22:5e1e)
 	call OpenSRAMBank4
-	ld bc, $a037
+	ld bc, $a037 ; 4:a037
 	call Function8b36c
 	call CloseSRAM
 	xor a
@@ -2648,9 +2659,9 @@
 	ld a, $5
 	call Function8a5a3
 	pop hl
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	ld a, $6
 	call Function8a5a3
 	call CGBOnly_LoadEDTile
@@ -4061,7 +4072,7 @@
 ; 8aaf0 (22:6af0)
 
 String_8aaf0: ; 8aaf0
-	db "あたらしい めいし", $4a, "できまし", $22, "@"
+	db "あたらしい めいし<PKMN>できまし<LNBRK>@"
 ; 8ab00
 
 Function8ab00: ; 8ab00
@@ -4096,6 +4107,7 @@
 	ret
 
 Function8ab3b: ; 8ab3b (22:6b3b)
+.pressed_start
 	call Function891fe
 	call ClearBGPalettes
 	call Function893cc
@@ -4114,23 +4126,24 @@
 	call Function89a0c
 	call CloseSRAM
 	call Function891ab
-	call Function8ab77
-	jr c, Function8ab3b
+	call .JoypadLoop
+	jr c, .pressed_start
 	ret
 
-Function8ab77: ; 8ab77 (22:6b77)
-	call Function354b
-	bit 0, c
-	jr nz, .asm_8ab8e
-	bit 1, c
-	jr nz, .asm_8ab8e
-	bit 3, c
-	jr z, Function8ab77
+.JoypadLoop: ; 8ab77 (22:6b77)
+	call JoyTextDelay_ForcehJoyDown
+	bit A_BUTTON_F, c
+	jr nz, .a_b_button
+	bit B_BUTTON_F, c
+	jr nz, .a_b_button
+	bit START_F, c
+	jr z, .JoypadLoop
 	call PlayClickSFX
 	call Function89d0d
 	scf
 	ret
-.asm_8ab8e
+
+.a_b_button
 	call PlayClickSFX
 	and a
 	ret
--- a/misc/mobile_22_2.asm
+++ b/misc/mobile_22_2.asm
@@ -54,10 +54,11 @@
 ; 8b36c
 
 Function8b36c: ; 8b36c (22:736c)
+	; [bc + (0:4)] = -1
 	push bc
 	ld h, b
 	ld l, c
-	ld bc, $4
+	ld bc, 4
 	ld a, -1
 	call ByteFill
 	pop bc
@@ -64,6 +65,7 @@
 	ret
 
 Function8b379: ; 8b379 (22:7379)
+	; d = [bc + e]
 	push bc
 	ld a, c
 	add e
@@ -77,6 +79,7 @@
 	ret
 
 Function8b385: ; 8b385 (22:7385)
+	; [bc + e] = d
 	push bc
 	ld a, c
 	add e
@@ -90,29 +93,32 @@
 	ret
 
 Function8b391: ; 8b391 (22:7391)
+	; find first e in range(4) such that [bc + e] == -1
+	; if none exist, return carry
 	push bc
-	ld e, $0
-	ld d, $4
-.asm_8b396
+	ld e, 0
+	ld d, 4
+.loop
 	ld a, [bc]
 	inc bc
-	cp $ff
-	jr z, .asm_8b3a2
+	cp -1
+	jr z, .done
 	inc e
 	dec d
-	jr nz, .asm_8b396
+	jr nz, .loop
 	dec e
 	scf
-.asm_8b3a2
+.done
 	pop bc
 	ret
 
 Function8b3a4: ; 8b3a4 (22:73a4)
+	; strcmp(hl, bc, 4)
 	push de
 	push bc
 	ld d, b
 	ld e, c
-	ld c, $4
+	ld c, 4
 	call Function89185
 	pop bc
 	pop de
@@ -119,7 +125,7 @@
 	ret
 
 Function8b3b0: ; 8b3b0 (22:73b0)
-	ld bc, $a037
+	ld bc, $a037 ; 4:a037
 	ld a, [$a60b]
 	and a
 	jr z, .asm_8b3c2
@@ -153,82 +159,88 @@
 Function8b3dd: ; 8b3dd (22:73dd)
 	push de
 	push bc
-	call Function354b
+	call JoyTextDelay_ForcehJoyDown ; joypad
 	ld a, c
 	pop bc
 	pop de
-	bit 0, a
-	jr nz, .asm_8b3f7
-	bit 1, a
-	jr nz, .asm_8b40e
-	bit 6, a
-	jr nz, .asm_8b429
-	bit 7, a
-	jr nz, .asm_8b443
+	bit A_BUTTON_F, a
+	jr nz, .a_button
+	bit B_BUTTON_F, a
+	jr nz, .b_button
+	bit D_UP_F, a
+	jr nz, .d_up
+	bit D_DOWN_F, a
+	jr nz, .d_down
 	and a
 	ret
-.asm_8b3f7
+
+.a_button
 	ld a, e
 	cp $3
-	jr z, .asm_8b407
+	jr z, .e_is_zero
 	inc e
-	ld d, $0
+	ld d, 0
 	call Function8b385
 	xor a
 	ld [wd010], a
 	ret
-.asm_8b407
+
+.e_is_zero
 	call PlayClickSFX
 	ld d, $0
 	scf
 	ret
-.asm_8b40e
+
+.b_button
 	ld a, e
 	and a
-	jr nz, .asm_8b41e
+	jr nz, .e_is_not_zero
 	call PlayClickSFX
-	ld d, $ff
+	ld d, -1
 	call Function8b385
-	ld d, $1
+	ld d, 1
 	scf
 	ret
-.asm_8b41e
-	ld d, $ff
+
+.e_is_not_zero
+	ld d, -1
 	call Function8b385
 	dec e
 	xor a
 	ld [wd010], a
 	ret
-.asm_8b429
+
+.d_up
 	call Function8b379
 	ld a, d
 	cp $a
-	jr c, .asm_8b433
+	jr c, .less_than_10_up_1
 	ld d, $9
-.asm_8b433
+.less_than_10_up_1
 	inc d
 	ld a, d
 	cp $a
-	jr c, .asm_8b43b
+	jr c, .less_than_10_up_2
 	ld d, $0
-.asm_8b43b
+.less_than_10_up_2
 	call Function8b385
 	xor a
 	ld [wd010], a
 	ret
-.asm_8b443
+
+.d_down
 	call Function8b379
 	ld a, d
 	cp $a
-	jr c, .asm_8b44d
+	jr c, .less_than_10_down
 	ld d, $0
-.asm_8b44d
+.less_than_10_down
 	ld a, d
 	dec d
 	and a
-	jr nz, .asm_8b454
+	jr nz, .nonzero_down
 	ld d, $9
-.asm_8b454
+.nonzero_down
 	call Function8b385
 	xor a
 	ld [wd010], a
@@ -403,6 +415,7 @@
 	ret
 
 Function8b555: ; 8b555 (22:7555)
+.loop
 	ld hl, UnknownText_0x8b5ce
 	call PrintText
 	ld bc, wd017
@@ -416,17 +429,18 @@
 	jr nz, .asm_8b57c
 	ld hl, UnknownText_0x8b5e2
 	call PrintText
-	jr Function8b555
+	jr .loop
+
 .asm_8b57c
 	ld hl, UnknownText_0x8b5d3
 	call PrintText
 	ld bc, wd013
 	call Function8b45c
-	jr c, Function8b555
+	jr c, .loop
 	ld bc, wd017
 	ld hl, wd013
 	call Function8b3a4
-	jr z, .asm_8b5a6
+	jr z, .strings_equal
 	call Function89448
 	ld bc, wd013
 	call Function8b493
@@ -433,10 +447,11 @@
 	ld hl, UnknownText_0x8b5d8
 	call PrintText
 	jr .asm_8b57c
-.asm_8b5a6
+
+.strings_equal
 	call OpenSRAMBank4
 	ld hl, wd013
-	ld de, $a037
+	ld de, $a037 ; 4:a037
 	ld bc, $4
 	call CopyBytes
 	call CloseSRAM
@@ -504,7 +519,7 @@
 	ld bc, wd013
 	call Function8b493
 	call OpenSRAMBank4
-	ld hl, $a037
+	ld hl, $a037 ; 4:a037
 	call Function8b3a4
 	call CloseSRAM
 	jr z, .asm_8b635
--- a/misc/mobile_40.asm
+++ b/misc/mobile_40.asm
@@ -1167,9 +1167,9 @@
 	ld hl, $a800
 	call GetSRAMBank
 	xor a
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	call CloseSRAM
 	ret
 ; 10070d
@@ -7211,9 +7211,9 @@
 	ld a, [wcf44]
 	ld l, a
 	ld h, 0
-rept 3
 	add hl, hl
-endr
+	add hl, hl
+	add hl, hl
 	ld bc, Unknown_103112
 	add hl, bc
 	ld b, $30
--- a/misc/mobile_41.asm
+++ b/misc/mobile_41.asm
@@ -181,9 +181,9 @@
 	inc [hl]
 	jr nz, .asm_106001
 	ld a, $ff
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ld [hl], a
 
 .asm_106001
@@ -211,9 +211,9 @@
 	inc [hl]
 	jr nz, .asm_106027
 	ld a, $ff
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ld [hl], a
 
 .asm_106027
@@ -606,9 +606,9 @@
 	ld de, ._9
 
 .three_to_nine_digits
-rept 3
 	inc de
-endr
+	inc de
+	inc de
 	dec a
 	dec a
 
@@ -689,9 +689,9 @@
 	sbc b
 	ld [hPrintNum6], a
 	ld a, [de]
-rept 3
 	inc de
-endr
+	inc de
+	inc de
 	ld b, a
 	ld a, [hPrintNum1]
 	sbc b
--- a/misc/mobile_45.asm
+++ b/misc/mobile_45.asm
@@ -634,9 +634,9 @@
 	dec de
 	dec de
 	push de
-rept 3
 	inc de
-endr
+	inc de
+	inc de
 	inc hl
 	ld a, [de]
 	ld [hli], a
@@ -4460,9 +4460,9 @@
 	ld bc, $0003
 
 .asm_115914
-rept 3
 	dec bc
-endr
+	dec bc
+	dec bc
 	ld a, c
 	ld [$dc19], a
 	ld a, b
@@ -5139,9 +5139,9 @@
 	ld e, [hl]
 	inc hl
 	ld d, [hl]
-rept 3
 	inc de
-endr
+	inc de
+	inc de
 	ld [hl], d
 	dec hl
 	ld [hl], e
--- a/misc/mobile_46.asm
+++ b/misc/mobile_46.asm
@@ -3767,9 +3767,9 @@
 	ld [hld], a
 	dec hl
 	pop de
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	ld a, h
 	cp $e0
 	jr c, .asm_119b93
--- a/misc/mobile_5c.asm
+++ b/misc/mobile_5c.asm
@@ -495,9 +495,9 @@
 .asm_171b34
 	pop hl
 	ld bc, $14
-rept 3
 	add hl, bc
-endr
+	add hl, bc
+	add hl, bc
 	pop af
 	dec a
 	jr nz, .asm_171b1b
--- a/misc/mobile_5f.asm
+++ b/misc/mobile_5f.asm
@@ -4393,9 +4393,9 @@
 	pop hl
 	add hl, de
 	add hl, de
-rept 3
 	inc hl
-endr
+	inc hl
+	inc hl
 	ld e, l
 	ld d, h
 	ld l, c
--- a/misc/mobile_menu.asm
+++ b/misc/mobile_menu.asm
@@ -836,9 +836,9 @@
 	ld [hli], a
 	ld [hli], a
 	xor a
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ret
 
 Function4a6ab: ; 4a6ab (12:66ab)
--- a/misc/printer_77.asm
+++ b/misc/printer_77.asm
@@ -164,7 +164,7 @@
 	call TextBox
 	hlcoord 8, 2
 	ld a, [TempMonLevel]
-	call Function383d
+	call PrintLevel_Force3Digits
 	hlcoord 12, 2
 	ld [hl], "◀" ; Filled left triangle
 	inc hl
--- a/misc/unused_title.asm
+++ b/misc/unused_title.asm
@@ -10,9 +10,9 @@
 	ld [hBGMapMode], a
 
 	ld hl, wJumptableIndex
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ld [hl], a
 
 	ld hl, UnusedTitleBG_GFX
--- a/predef/crystal.asm
+++ b/predef/crystal.asm
@@ -554,9 +554,9 @@
 	hlcoord 2, 16, AttrMap
 	ld [hli], a
 	ld a, $7
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ld a, $2
 	ld [hl], a
 	hlcoord 2, 17, AttrMap
--- a/predef/sgb.asm
+++ b/predef/sgb.asm
@@ -472,9 +472,9 @@
 	ld a, [CurPartySpecies]
 	ld l, a
 	ld h, 0
-rept 3
 	add hl, hl
-endr
+	add hl, hl
+	add hl, hl
 	ld de, PokemonPalettes
 	add hl, de
 	ld a, [wcf65]
--- a/tilesets/animations.asm
+++ b/tilesets/animations.asm
@@ -472,9 +472,9 @@
 	and 3 << 1
 
 ; 2 x 8 = 16 bytes per tile
-rept 3
 	add a
-endr
+	add a
+	add a
 
 	add WaterTileFrames % $100
 	ld l, a
@@ -511,9 +511,9 @@
 .asm_fc46c
 	ld a, [TileAnimationTimer]
 	call GetForestTreeFrame
-rept 3
 	add a
-endr
+	add a
+	add a
 	add ForestTreeLeftFrames % $100
 	ld l, a
 	ld a, 0
@@ -553,9 +553,9 @@
 .asm_fc4d4
 	ld a, [TileAnimationTimer]
 	call GetForestTreeFrame
-rept 3
 	add a
-endr
+	add a
+	add a
 	add ForestTreeLeftFrames % $100
 	ld l, a
 	ld a, 0
@@ -589,9 +589,9 @@
 	ld a, [TileAnimationTimer]
 	call GetForestTreeFrame
 	xor 2
-rept 3
 	add a
-endr
+	add a
+	add a
 	add ForestTreeLeftFrames % $100
 	ld l, a
 	ld a, 0
@@ -621,9 +621,9 @@
 	ld a, [TileAnimationTimer]
 	call GetForestTreeFrame
 	xor 2
-rept 3
 	add a
-endr
+	add a
+	add a
 	add ForestTreeLeftFrames % $100
 	ld l, a
 	ld a, 0
@@ -734,9 +734,9 @@
 	ld c, l
 	ld a, [TileAnimationTimer]
 	and 6
-rept 3
 	add a
-endr
+	add a
+	add a
 	ld e, a
 	ld d, 0
 	ld hl, SafariFountainFrames
--- a/trainers/read_party.asm
+++ b/trainers/read_party.asm
@@ -310,9 +310,9 @@
 ComputeTrainerReward: ; 3991b (e:591b)
 	ld hl, hProduct
 	xor a
-rept 3
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
 	ld a, [wEnemyTrainerBaseReward]
 	ld [hli], a
 	ld a, [CurPartyLevel]