More splitting of main.asm; remove unneeded rept 2

This commit is contained in:
pikalaxalt 2016-05-04 11:46:23 -04:00
parent 82f1534925
commit 3713b71d9e
107 changed files with 1222 additions and 1610 deletions

View File

@ -1348,9 +1348,8 @@ GetNoiseSample: ; e86c5
ld d, 0
; load ptr to noise sample set in hl
ld hl, Drumkits
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -1363,9 +1362,8 @@ endr
; use 'pitch' to seek noise sample set
ld e, a
ld d, 0
rept 2
add hl, de
endr
add hl, de
; load sample pointer into NoiseSampleAddress
ld a, [hli]
ld [NoiseSampleAddressLo], a
@ -1387,9 +1385,8 @@ ParseMusicCommand: ; e870f
ld d, 0
; seek command pointer
ld hl, MusicCommands
rept 2
add hl, de
endr
add hl, de
; jump to the new pointer
ld a, [hli]
ld h, [hl]
@ -1639,9 +1636,8 @@ Music_JumpIf: ; e8817
inc hl
ld d, [hl]
; skip pointer
rept 2
inc de
endr
inc de
; update address
ld [hl], d
dec hl
@ -1693,9 +1689,8 @@ MusicEE; e883e
inc hl
ld d, [hl]
; skip pointer
rept 2
inc de
endr
inc de
; update address
ld [hl], d
dec hl
@ -2811,9 +2806,8 @@ LoadChannel: ; e8d1b
ld c, a
ld b, 0
ld hl, ChannelPointers
rept 2
add hl, bc
endr
add hl, bc
ld c, [hl]
inc hl
ld b, [hl] ; bc = channel pointer
@ -3282,9 +3276,8 @@ ClearChannels:: ; e8fe9
; doesn't seem to be used, but functionally identical to MapSetup_Sound_Off
ld hl, rNR50
xor a
rept 2
ld [hli], a
endr
ld [hli], a
ld a, $80
ld [hli], a
ld hl, rNR10

View File

@ -275,9 +275,8 @@ Music_GoldenrodCity_Ch3: ; eb584
vibrato $8, $23
notetype $c, $25
Music_GoldenrodCity_branch_eb58c: ; eb58c
rept 2
callchannel Music_GoldenrodCity_branch_eb5aa
endr
callchannel Music_GoldenrodCity_branch_eb5aa
callchannel Music_GoldenrodCity_branch_eb5d2
note __, 3
octave 3

View File

@ -492,9 +492,8 @@ Music_JohtoWildBattle_branch_f5fdb: ; f5fdb
note G_, 2
loopchannel 7, Music_JohtoWildBattle_branch_f5fdb
note F#, 4
rept 2
callchannel Music_JohtoWildBattle_branch_f6055
endr
callchannel Music_JohtoWildBattle_branch_f6055
Music_JohtoWildBattle_branch_f5fe8: ; f5fe8
note D_, 2
note G_, 2

View File

@ -325,25 +325,21 @@ Music_KantoWildBattle_branch_ed1c8: ; ed1c8
note F_, 1
note F#, 1
notetype $6, $b7
rept 2
callchannel Music_KantoWildBattle_branch_ed307
endr
callchannel Music_KantoWildBattle_branch_ed307
forceoctave $1
rept 2
callchannel Music_KantoWildBattle_branch_ed307
endr
callchannel Music_KantoWildBattle_branch_ed307
forceoctave $0
rept 4
callchannel Music_KantoWildBattle_branch_ed307
endr
forceoctave $1
rept 2
callchannel Music_KantoWildBattle_branch_ed307
endr
callchannel Music_KantoWildBattle_branch_ed307
forceoctave $0
rept 2
callchannel Music_KantoWildBattle_branch_ed307
endr
callchannel Music_KantoWildBattle_branch_ed307
note __, 16
octave 3
note A#, 16

View File

@ -216,9 +216,8 @@ endr
pop de
pop hl
rept 2
inc hl
endr
inc hl
jr c, .loop
.used_item

View File

@ -107,9 +107,8 @@ endr
ld hl, AIScoringPointers
dec c
ld b, 0
rept 2
add hl, bc
endr
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a

View File

@ -133,18 +133,16 @@ AI_Setup: ; 385e0
call AI_50_50
jr c, .checkmove
rept 2
dec [hl]
endr
dec [hl]
jr .checkmove
.discourage
call Random
cp 30
jr c, .checkmove
rept 2
inc [hl]
endr
inc [hl]
jr .checkmove
; 38635
@ -264,9 +262,8 @@ AI_Offensive: ; 386a2
and a
jr nz, .checkmove
rept 2
inc [hl]
endr
inc [hl]
jr .checkmove
; 386be
@ -420,9 +417,8 @@ AI_Smart_Sleep: ; 387e3
.asm_387f0
call AI_50_50
ret c
rept 2
dec [hl]
endr
dec [hl]
ret
; 387f7
@ -533,9 +529,8 @@ AI_Smart_LockOn: ; 3881d
call AI_50_50
ret c
rept 2
dec [hl]
endr
dec [hl]
ret
.asm_38882
@ -560,9 +555,8 @@ endr
cp 180
jr nc, .asm_3888b
rept 2
dec [hl]
endr
dec [hl]
jr .asm_3888b
.asm_388a2
@ -645,9 +639,8 @@ AI_Smart_EvasionUp: ; 388d4
jr nc, .asm_38911
.asm_388ef
rept 2
dec [hl]
endr
dec [hl]
ret
.asm_388f2
@ -676,9 +669,8 @@ endr
jr c, .asm_38911
.asm_3890f
rept 2
inc [hl]
endr
inc [hl]
; 30% chance to end up here if enemy's HP is full and player is not badly poisoned.
; 77% chance to end up here if enemy's HP is above 50% but not full.
@ -722,9 +714,8 @@ endr
call Random
cp $50
ret c
rept 2
dec [hl]
endr
dec [hl]
ret
; Player is seeded.
@ -756,9 +747,8 @@ AI_Smart_AlwaysHit: ; 38947
call AI_80_20
ret c
rept 2
dec [hl]
endr
dec [hl]
ret
; 3895b
@ -828,9 +818,8 @@ AI_Smart_AccuracyDown: ; 38985
jr nc, .asm_389bf
.asm_3899d
rept 2
dec [hl]
endr
dec [hl]
ret
.asm_389a0
@ -859,9 +848,8 @@ endr
jr c, .asm_389bf
.asm_389bd
rept 2
inc [hl]
endr
inc [hl]
; We only end up here if the move has not been already encouraged.
.asm_389bf
@ -900,9 +888,8 @@ endr
call Random
cp $50
ret c
rept 2
dec [hl]
endr
dec [hl]
ret
; Player is seeded.
@ -1010,9 +997,8 @@ AI_Smart_Moonlight: ; 38a3a
call Random
cp $19
ret c
rept 2
dec [hl]
endr
dec [hl]
ret
; 38a4e
@ -1093,9 +1079,8 @@ AI_Smart_Bind: ; 38a71
ret nc
call AI_50_50
ret c
rept 2
dec [hl]
endr
dec [hl]
ret
; 38a9c
@ -1200,9 +1185,8 @@ AI_Smart_SpDefenseUp2: ; 38aed
.asm_38b09
call AI_80_20
ret c
rept 2
dec [hl]
endr
dec [hl]
ret
.asm_38b10
@ -1255,9 +1239,8 @@ AI_Smart_Paralyze: ; 38b26
ret nc
call AI_80_20
ret c
rept 2
dec [hl]
endr
dec [hl]
ret
.asm_38b3a
@ -1289,9 +1272,8 @@ AI_Smart_SpeedDownHit: ; 38b40
call Random
cp 30
ret c
rept 2
dec [hl]
endr
dec [hl]
ret
; 38b5c
@ -1528,9 +1510,8 @@ AI_Smart_Encore: ; 38c3b
call Random
cp $46
ret c
rept 2
dec [hl]
endr
dec [hl]
ret
.asm_38c81
@ -1685,9 +1666,8 @@ AI_Smart_Spite: ; 38cd5
call Random
cp $64
ret c
rept 2
dec [hl]
endr
dec [hl]
ret
; 38d16
@ -1755,9 +1735,8 @@ endr
ret z
call AI_50_50
ret c
rept 2
dec [hl]
endr
dec [hl]
ret
.no_status
@ -2007,15 +1986,13 @@ AI_Smart_Curse: ; 38e5c
ret nc
call AI_80_20
ret c
rept 2
dec [hl]
endr
dec [hl]
ret
.asm_38e90
rept 2
inc [hl]
endr
inc [hl]
.asm_38e92
inc [hl]
.asm_38e93
@ -2065,9 +2042,8 @@ endr
call AI_50_50
ret c
rept 2
dec [hl]
endr
dec [hl]
ret
; 38ed2
@ -2119,9 +2095,8 @@ AI_Smart_Protect: ; 38ed2
call Random
cp 20
ret c
rept 2
inc [hl]
endr
inc [hl]
ret
; 38f1d
@ -2151,9 +2126,8 @@ AI_Smart_Foresight: ; 38f1d
call Random
cp 100
ret c
rept 2
dec [hl]
endr
dec [hl]
ret
; 38f4a
@ -2272,9 +2246,8 @@ endr
call AI_50_50
ret c
rept 2
dec [hl]
endr
dec [hl]
ret
.asm_38fd8
@ -2296,9 +2269,8 @@ AI_Smart_FuryCutter: ; 38fdb
cp 2
jr c, .end
rept 2
dec [hl]
endr
dec [hl]
cp 3
jr c, .end
@ -2344,9 +2316,8 @@ AI_Smart_Rollout: ; 38fef
call Random
cp 200
ret nc
rept 2
dec [hl]
endr
dec [hl]
ret
.asm_39020
@ -2406,9 +2377,8 @@ AI_Smart_Earthquake: ; 39044
call AICompareSpeed
ret nc
rept 2
dec [hl]
endr
dec [hl]
ret
.could_dig
@ -2455,9 +2425,8 @@ AI_Smart_Pursuit: ; 39072
.asm_3907d
call AI_50_50
ret c
rept 2
dec [hl]
endr
dec [hl]
ret
; 39084
@ -2482,9 +2451,8 @@ AI_Smart_RapidSpin: ; 39084
call AI_80_20
ret c
rept 2
dec [hl]
endr
dec [hl]
ret
; 3909e
@ -2636,9 +2604,8 @@ AIGoodWeatherType: ; 39122
ret nz
.good
rept 2
dec [hl]
endr
dec [hl]
ret
; 39134
@ -2733,9 +2700,8 @@ AI_Smart_PsychUp: ; 39152
ret
.asm_39188
rept 2
inc [hl]
endr
inc [hl]
ret
; 3918b
@ -2820,9 +2786,8 @@ AI_Smart_Gust: ; 391d5
call AICompareSpeed
ret nc
rept 2
dec [hl]
endr
dec [hl]
ret
; Try to predict if the player will use Fly this turn.
@ -2849,9 +2814,8 @@ AI_Smart_FutureSight: ; 391f3
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
ret z
rept 2
dec [hl]
endr
dec [hl]
ret
; 39200
@ -2886,18 +2850,16 @@ AI_Smart_Solarbeam: ; 3920b
cp 25 ; 1/10
ret c
rept 2
inc [hl]
endr
inc [hl]
ret
.asm_3921e
call AI_80_20
ret c
rept 2
dec [hl]
endr
dec [hl]
ret
; 39225
@ -2991,9 +2953,8 @@ AICheckPlayerHalfHP: ; 3926e
ld c, [hl]
sla c
rl b
rept 2
inc hl
endr
inc hl
ld a, [hld]
cp c
ld a, [hl]
@ -3013,9 +2974,8 @@ AICheckEnemyHalfHP: ; 39281
ld c, [hl]
sla c
rl b
rept 2
inc hl
endr
inc hl
ld a, [hld]
cp c
ld a, [hl]
@ -3039,9 +2999,8 @@ AICheckEnemyQuarterHP: ; 39298
rl b
sla c
rl b
rept 2
inc hl
endr
inc hl
ld a, [hld]
cp c
ld a, [hl]
@ -3063,9 +3022,8 @@ AICheckPlayerQuarterHP: ; 392b3
rl b
sla c
rl b
rept 2
inc hl
endr
inc hl
ld a, [hld]
cp c
ld a, [hl]

View File

@ -626,9 +626,8 @@ FindEnemyMonsWithEnoughHP: ; 34b77
ld b, [hl]
inc hl
ld c, [hl]
rept 2
inc hl
endr
inc hl
; hl = MaxHP + 1
; b = (4 * b) % $100 + (c & 3)
; c = c / 4

View File

@ -45,9 +45,8 @@ HiddenPowerDamage: ; fbced
; Multiply by 5
ld b, a
rept 2
add a
endr
add a
add b
; Add Special & 3
@ -75,9 +74,8 @@ endr
ld a, [hl]
and 3 << 4
swap a
rept 2
add a
endr
add a
or b
; Skip Normal

162
battle/link_result.asm Executable file
View File

@ -0,0 +1,162 @@
DetermineLinkBattleResult: ; 2b930
callba UpdateEnemyMonInParty
ld hl, PartyMon1HP
call .CountMonsRemaining
push bc
ld hl, OTPartyMon1HP
call .CountMonsRemaining
ld a, c
pop bc
cp c
jr z, .even_number_of_mons_remaining
jr c, .defeat
jr .victory
.even_number_of_mons_remaining
call .BothSides_CheckNumberMonsAtFullHealth
jr z, .drawn
ld a, e
cp $1
jr z, .victory
cp $2
jr z, .defeat
ld hl, PartyMon1HP
call .CalcPercentHPRemaining
push de
ld hl, OTPartyMon1HP
call .CalcPercentHPRemaining
pop hl
ld a, d
cp h
jr c, .victory
jr z, .compare_lo
jr .defeat
.compare_lo
ld a, e
cp l
jr z, .drawn
jr nc, .defeat
.victory
ld a, [wBattleResult]
and $f0
ld [wBattleResult], a
ret
.defeat
ld a, [wBattleResult]
and $f0
add $1
ld [wBattleResult], a
ret
.drawn
ld a, [wBattleResult]
and $f0
add $2
ld [wBattleResult], a
ret
.CountMonsRemaining: ; 2b995
ld c, 0
ld b, 3
ld de, PARTYMON_STRUCT_LENGTH - 1
.loop
ld a, [hli]
or [hl]
jr nz, .not_fainted
inc c
.not_fainted
add hl, de
dec b
jr nz, .loop
ret
.CalcPercentHPRemaining: ; 2b9a6
ld de, 0
ld c, $3
.loop2
ld a, [hli]
or [hl]
jr z, .next
dec hl
xor a
ld [hDividend + 0], a
ld a, [hli]
ld [hDividend + 1], a
ld a, [hli]
ld [hDividend + 2], a
xor a
ld [hDividend + 3], a
ld a, [hli]
ld b, a
ld a, [hld]
srl b
rr a
srl b
rr a
ld [hDivisor], a
ld b, $4
call Divide
ld a, [hQuotient + 2]
add e
ld e, a
ld a, [hQuotient + 1]
adc d
ld d, a
dec hl
.next
push de
ld de, $2f
add hl, de
pop de
dec c
jr nz, .loop2
ret
.BothSides_CheckNumberMonsAtFullHealth: ; 2b9e1
ld hl, PartyMon1HP
call .CheckFaintedOrFullHealth
jr nz, .finish ; we have a pokemon that's neither fainted nor at full health
ld hl, OTPartyMon1HP
call .CheckFaintedOrFullHealth
ld e, $1
ret
.finish
ld hl, OTPartyMon1HP
call .CheckFaintedOrFullHealth
ld e, $0
ret nz ; we both have pokemon that are neither fainted nor at full health
ld e, $2
ld a, $1
and a
ret
.CheckFaintedOrFullHealth: ; 2ba01
ld d, 3
.loop3
ld a, [hli]
ld b, a
ld a, [hli]
ld c, a
or b
jr z, .fainted_or_full_health
ld a, [hli]
cp b
ret nz
ld a, [hld]
cp c
ret nz
.fainted_or_full_health
push de
ld de, PARTYMON_STRUCT_LENGTH - 2
add hl, de
pop de
dec d
jr nz, .loop3
ret

View File

@ -141,9 +141,8 @@ CalcMagikarpLength: ; fbbfc
; hl = de * 10
ld h, d
ld l, e
rept 2
add hl, hl
endr
add hl, hl
add hl, de
add hl, hl

View File

@ -72,9 +72,8 @@ DoWeatherModifiers: ; fbda4
jr z, .ApplyModifier
.NextWeatherType:
rept 2
inc de
endr
inc de
jr .CheckWeatherType
@ -99,9 +98,8 @@ endr
jr z, .ApplyModifier
.NextWeatherMove:
rept 2
inc de
endr
inc de
jr .CheckWeatherMove
.ApplyModifier:

View File

@ -39,12 +39,10 @@ BattleIntroSlidingPics: ; 4e980
ld a, d
ld [hSCX], a
call .subfunction5
rept 2
inc e
endr
rept 2
inc e
dec d
dec d
endr
pop af
push af
cp $1
@ -66,9 +64,8 @@ endr
ld c, $12 ; 18
ld de, $4
.loop3
rept 2
dec [hl]
endr
dec [hl]
add hl, de
dec c
jr nz, .loop3

View File

@ -24,7 +24,7 @@
const SCGB_POKEDEX_UNOWN_MODE
const SCGB_17
const SCGB_18
const SCGB_19
const SCGB_GAMEFREAK_LOGO
const SCGB_1A
const SCGB_1B
const SCGB_FRONTPICPALS

View File

@ -1,3 +1,75 @@
GetDexEntryPointer: ; 44333
; return dex entry pointer b:de
push hl
ld hl, PokedexDataPointerTable
ld a, b
dec a
ld d, 0
ld e, a
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
push de
rlca
rlca
and $3
ld hl, .PokedexEntryBanks
ld d, 0
ld e, a
add hl, de
ld b, [hl]
pop de
pop hl
ret
.PokedexEntryBanks: ; 44351
GLOBAL PokedexEntries1
GLOBAL PokedexEntries2
GLOBAL PokedexEntries3
GLOBAL PokedexEntries4
db BANK(PokedexEntries1)
db BANK(PokedexEntries2)
db BANK(PokedexEntries3)
db BANK(PokedexEntries4)
GetDexEntryPagePointer: ; 44355
call GetDexEntryPointer ; b:de
push hl
ld h, d
ld l, e
; skip species name
.loop1
ld a, b
call GetFarByte
inc hl
cp "@"
jr nz, .loop1
; skip height and weight
rept 4
inc hl
endr
; if c != 1: skip entry
dec c
jr z, .done
; skip entry
.loop2
ld a, b
call GetFarByte
inc hl
cp "@"
jr nz, .loop2
.done
ld d, h
ld e, l
pop hl
ret
PokedexDataPointerTable: ; 0x44378
; Pointers to all the Pokedex entries.
dw BulbasaurPokedexEntry

View File

@ -273,9 +273,8 @@ HPBarAnim_UpdateHPRemaining: ; d784
push hl
add hl, de
ld a, " "
rept 2
ld [hli], a
endr
ld [hli], a
ld [hld], a
dec hl
ld a, [Buffer3]

View File

@ -142,9 +142,8 @@ _DepositPKMN: ; e2391 (38:6391)
ld e, a
ld d, 0
ld hl, BillsPCDepositJumptable
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -411,9 +410,8 @@ BillsPC_Withdraw: ; e2675 (38:6675)
ld e, a
ld d, 0
ld hl, .dw
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -675,9 +673,8 @@ _MovePKMNWithoutMail: ; e2759
ld e, a
ld d, 0
ld hl, .Jumptable2
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -2010,9 +2007,8 @@ MovePKMNWitoutMail_InsertMon: ; e31e7
.moving_to_box
ld hl, .Jumptable
rept 2
add hl, bc
endr
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@ -2143,7 +2139,7 @@ endr
ld hl, wBillsPC_ScrollPosition
add [hl]
ld [CurPartyMon], a
callba Function51322
callba InsertPokemonIntoBox
ret
; e3316
@ -2172,7 +2168,7 @@ endr
ld hl, wBillsPC_ScrollPosition
add [hl]
ld [CurPartyMon], a
callba Function5138b
callba InsertPokemonIntoParty
ret
; e3357
@ -2256,9 +2252,8 @@ BillsPC_ApplyPalettes: ; e33d0 (38:73d0)
BillsPC_Jumptable: ; e33df (38:73df)
ld e, a
ld d, $0
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a

View File

@ -442,9 +442,8 @@ GLOBAL EggMoves
ld c, a
ld b, 0
ld hl, EggMovePointers
rept 2
add hl, bc
endr
add hl, bc
ld a, BANK(EggMovePointers)
call GetFarHalfword
.loop
@ -477,9 +476,8 @@ endr
ld c, a
ld b, 0
ld hl, EvosAttacksPointers
rept 2
add hl, bc
endr
add hl, bc
ld a, BANK(EvosAttacksPointers)
call GetFarHalfword
.loop3

View File

@ -71,9 +71,8 @@ _CardFlip: ; e00ee (38:40ee)
ld e, a
ld d, 0
ld hl, .Jumptable
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -276,9 +275,8 @@ endr
ld e, a
ld d, 0
ld hl, wDeck
rept 2
add hl, de
endr
add hl, de
ld a, [wCardFlipWhichCard]
ld e, a
add hl, de
@ -442,9 +440,8 @@ CardFlip_DisplayCardFaceUp: ; e03ec
ld e, a
ld d, 0
ld hl, .Deck
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld e, a
ld d, [hl]
@ -675,9 +672,8 @@ CardFlip_BlankDiscardedCardSlot: ; e0534
and a
jr nz, .discarded2
hlcoord 13, 3
rept 2
add hl, bc
endr
add hl, bc
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@ -686,9 +682,8 @@ endr
.discarded2
hlcoord 13, 3
rept 2
add hl, bc
endr
add hl, bc
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@ -703,9 +698,8 @@ endr
and a
jr nz, .discarded1
hlcoord 13, 4
rept 2
add hl, bc
endr
add hl, bc
ld [hl], $3b
ld bc, SCREEN_WIDTH
add hl, bc
@ -714,9 +708,8 @@ endr
.discarded1
hlcoord 13, 4
rept 2
add hl, bc
endr
add hl, bc
ld [hl], $3d
ld bc, SCREEN_WIDTH
add hl, bc
@ -731,9 +724,8 @@ endr
and a
jr nz, .discarded4
hlcoord 13, 6
rept 2
add hl, bc
endr
add hl, bc
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@ -742,9 +734,8 @@ endr
.discarded4
hlcoord 13, 6
rept 2
add hl, bc
endr
add hl, bc
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@ -759,9 +750,8 @@ endr
and a
jr nz, .discarded3
hlcoord 13, 7
rept 2
add hl, bc
endr
add hl, bc
ld [hl], $3c
ld bc, SCREEN_WIDTH
add hl, bc
@ -770,9 +760,8 @@ endr
.discarded3
hlcoord 13, 7
rept 2
add hl, bc
endr
add hl, bc
ld [hl], $3d
ld bc, SCREEN_WIDTH
add hl, bc
@ -787,9 +776,8 @@ endr
and a
jr nz, .discarded6
hlcoord 13, 9
rept 2
add hl, bc
endr
add hl, bc
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@ -798,9 +786,8 @@ endr
.discarded6
hlcoord 13, 9
rept 2
add hl, bc
endr
add hl, bc
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@ -815,9 +802,8 @@ endr
and a
jr nz, .discarded5
hlcoord 13, 10
rept 2
add hl, bc
endr
add hl, bc
ld [hl], $3c
ld bc, SCREEN_WIDTH
add hl, bc
@ -826,9 +812,8 @@ endr
.discarded5
hlcoord 13, 10
rept 2
add hl, bc
endr
add hl, bc
ld [hl], $3d
ld bc, SCREEN_WIDTH
add hl, bc
@ -1296,9 +1281,8 @@ ChooseCard_HandleJoypad: ; e089c
ld [hl], a
cp $3
jr c, .left_to_number_gp
rept 2
dec [hl]
endr
dec [hl]
jp .play_sound
.left_to_number_gp
@ -1326,9 +1310,8 @@ endr
ld [hl], a
cp $4
ret nc
rept 2
inc [hl]
endr
inc [hl]
jr .play_sound
.d_up ; e090a
@ -1357,9 +1340,8 @@ endr
ld [hl], a
cp $3
jr c, .up_to_mon_group
rept 2
dec [hl]
endr
dec [hl]
jr .play_sound
.up_to_mon_group
@ -1387,9 +1369,8 @@ endr
ld [hl], a
cp $6
ret nc
rept 2
inc [hl]
endr
inc [hl]
.play_sound ; e0959
ld de, SFX_POKEBALLS_PLACED_ON_TABLE
@ -1408,9 +1389,8 @@ CardFlip_UpdateCursorOAM: ; e0960
.skip
call CollapseCursorPosition
rept 2
add hl, hl
endr
add hl, hl
ld de, .OAMData
add hl, de
ld a, [hli]

View File

@ -258,9 +258,8 @@ Credits_Jumptable: ; 109926
ld e, a
ld d, 0
ld hl, .Jumptable
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -326,9 +325,8 @@ Credits_LYOverride: ; 109986 (42:5986)
cp $30
jr c, Credits_LYOverride
ld a, [wCreditsLYOverride]
rept 2
dec a
endr
dec a
ld [wCreditsLYOverride], a
ld hl, LYOverrides + $1f
call .Fill
@ -398,9 +396,8 @@ ParseCredits: ; 1099aa
ld e, a
ld d, 0
ld hl, CreditsStrings
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld d, [hl]
ld e, a
@ -741,9 +738,8 @@ Credits_LoadBorderGFX: ; 109bca (42:5bca)
ld [hl], a
ld a, [wCreditsBorderMon]
and 3
rept 2
add a
endr
add a
add e
add a
ld e, a

View File

@ -13,7 +13,7 @@ Copyright_GFPresents: ; e4579
ld a, $90
ld [hWY], a
call WaitBGMap
ld b, SCGB_19
ld b, SCGB_GAMEFREAK_LOGO
call GetSGBLayout
call SetPalettes
ld c, 10
@ -82,13 +82,13 @@ Copyright_GFPresents: ; e4579
depixel 10, 11, 4, 0
ld a, SPRITE_ANIM_INDEX_GAMEFREAK_LOGO
call _InitSpriteAnimStruct
ld hl, $7
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], $a0
ld hl, $c
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld [hl], $60
ld hl, $d
ld hl, SPRITEANIMSTRUCT_0D
add hl, bc
ld [hl], $30
xor a
@ -101,7 +101,7 @@ Copyright_GFPresents: ; e4579
ld [hBGMapMode], a
ld a, $90
ld [hWY], a
ld de, $e4e4
lb de, %11100100, %11100100
call DmgToCgbObjPals
ret
; e465e
@ -120,9 +120,8 @@ PlaceGameFreakPresents: ; e4670
ld e, a
ld d, 0
ld hl, .dw
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -218,9 +217,8 @@ GameFreakLogoJumper: ; e46ed (39:46ed)
ld e, [hl]
ld d, 0
ld hl, GameFreakLogoScenes
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -317,9 +315,8 @@ GameFreakLogoScene4: ; e4776 (39:4776)
ld e, a
ld d, $0
ld hl, GameFreakLogoPalettes
rept 2
add hl, de
endr
add hl, de
ld a, [rSVBK]
push af
ld a, $5
@ -436,9 +433,8 @@ IntroSceneJumper: ; e490f
ld e, a
ld d, 0
ld hl, IntroScenes
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -986,9 +982,8 @@ IntroScene12: ; e4cfa (39:4cfa)
ret z
cp c
jr z, .playsound
rept 2
inc hl
endr
inc hl
jr .loop
.playsound
ld a, [hli]
@ -1667,9 +1662,8 @@ endr
ld d, $0
ld hl, BGPals
add hl, de
rept 2
inc hl
endr
inc hl
ld a, [wcf65]
and $3f
cp $1f
@ -1698,9 +1692,8 @@ endr
push hl
ld hl, .BWFade
rept 2
add hl, bc
endr
add hl, bc
ld a, [hli]
ld d, [hl]
ld e, a
@ -1712,9 +1705,8 @@ endr
push hl
ld hl, .BlackLBlueFade
rept 2
add hl, bc
endr
add hl, bc
ld a, [hli]
ld d, [hl]
ld e, a
@ -1726,9 +1718,8 @@ endr
push hl
ld hl, .BlackBlueFade
rept 2
add hl, bc
endr
add hl, bc
ld a, [hli]
ld d, [hl]
ld e, a
@ -2127,9 +2118,8 @@ Intro_PerspectiveScrollBG: ; e552f (39:552f)
; grass in the front
ld hl, LYOverrides + $5f
ld a, [hl]
rept 2
inc a
endr
inc a
ld bc, $31
call ByteFill
ld a, [LYOverrides + 0]

View File

@ -300,9 +300,8 @@ Function81a74: ; 81a74
ld e, a
ld d, 0
ld hl, Jumptable_81acf
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -482,9 +481,8 @@ Function81bf4: ; 81bf4
inc a
ld l, a
ld h, $0
rept 2
add hl, hl
endr
add hl, hl
ld de, OverworldMap
add hl, de
ld de, wc608
@ -558,9 +556,8 @@ Function81c33: ; 81c33
ld a, [wc608 + 3]
ld [hli], a
xor a
rept 2
ld [hli], a
endr
ld [hli], a
ld [hl], a
ld hl, wSGBPals
call Function81f0c
@ -609,9 +606,8 @@ Function81cc2: ; 81cc2
ld e, a
ld d, 0
ld hl, Jumptable_81d02
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -855,9 +851,8 @@ String_81e4d: db "おぼえられない@" ; cannot be taught
Function81e55: ; 81e55
cp $32
jr c, .asm_81e5b
rept 2
inc a
endr
inc a
.asm_81e5b
add $bf
@ -938,9 +933,8 @@ Function81eca: ; 81eca
inc a
ld l, a
ld h, $0
rept 2
add hl, hl
endr
add hl, hl
ld de, OverworldMap
add hl, de
ld e, l
@ -970,9 +964,8 @@ Function81ee3: ; 81ee3
inc de
ld [hli], a
xor a
rept 2
ld [hli], a
endr
ld [hli], a
dec c
jr nz, .asm_81ee3
ret
@ -1108,9 +1101,8 @@ Function81f5e: ; 81f5e
ld a, b
ld [hli], a
ld a, [de]
rept 2
add a
endr
add a
add $18
ld [hli], a
xor a
@ -1356,9 +1348,8 @@ Function822f0: ; 822f0
ld e, a
ld d, 0
ld hl, .dw
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -1400,9 +1391,8 @@ Function82309: ; 82309
ld e, a
ld d, $0
ld hl, wc608
rept 2
add hl, de
endr
add hl, de
ld e, l
ld d, h
call Function81ea5
@ -1500,9 +1490,8 @@ Function82391: ; 82391
ld c, a
ld b, $0
ld hl, wc608
rept 2
add hl, bc
endr
add hl, bc
ld a, e
ld [hli], a
ld [hl], d

View File

@ -0,0 +1,298 @@
_ResetClock: ; 4d3b1
callba BlankScreen
ld b, SCGB_08
call GetSGBLayout
call LoadStandardFont
call LoadFontsExtra
ld de, MUSIC_MAIN_MENU
call PlayMusic
ld hl, .text_askreset
call PrintText
ld hl, .NoYes_MenuDataHeader
call CopyMenuDataHeader
call VerticalMenu
ret c
ld a, [wMenuCursorY]
cp $1
ret z
call ClockResetPassword
jr c, .wrongpassword
ld a, BANK(sRTCStatusFlags)
call GetSRAMBank
ld a, $80
ld [sRTCStatusFlags], a
call CloseSRAM
ld hl, .text_okay
call PrintText
ret
.wrongpassword
ld hl, .text_wrong
call PrintText
ret
.text_okay ; 0x4d3fe
; Password OK. Select CONTINUE & reset settings.
text_jump UnknownText_0x1c55db
db "@"
.text_wrong ; 0x4d403
; Wrong password!
text_jump UnknownText_0x1c560b
db "@"
.text_askreset ; 0x4d408
; Reset the clock?
text_jump UnknownText_0x1c561c
db "@"
.NoYes_MenuDataHeader: ; 0x4d40d
db $00 ; flags
db 07, 14 ; start coords
db 11, 19 ; end coords
dw .NoYes_MenuData2
db 1 ; default option
.NoYes_MenuData2: ; 0x4d415
db $c0 ; flags
db 2 ; items
db "NO@"
db "YES@"
ClockResetPassword: ; 4d41e
call .CalculatePassword
push de
ld hl, StringBuffer2
ld bc, 5
xor a
call ByteFill
ld a, $4
ld [StringBuffer2 + 5], a
ld hl, .pleaseenterpasswordtext
call PrintText
.loop
call .updateIDdisplay
.loop2
call JoyTextDelay
ld a, [hJoyLast]
ld b, a
and A_BUTTON
jr nz, .confirm
ld a, b
and D_PAD
jr z, .loop2
call .dpadinput
ld c, 3
call DelayFrames
jr .loop
.confirm
call .ConvertDecIDToBytes
pop de
ld a, e
cp l
jr nz, .nope
ld a, d
cp h
jr nz, .nope
and a
ret
.nope
scf
ret
.pleaseenterpasswordtext ; 0x4d463
; Please enter the password.
text_jump UnknownText_0x1c562e
db "@"
.updateIDdisplay ; 4d468
hlcoord 14, 15
ld de, StringBuffer2
ld c, 5
.loop3
ld a, [de]
add "0"
ld [hli], a
inc de
dec c
jr nz, .loop3
hlcoord 14, 16
ld bc, 5
ld a, " "
call ByteFill
hlcoord 14, 16
ld a, [StringBuffer2 + 5]
ld e, a
ld d, $0
add hl, de
ld [hl], $61
ret
.dpadinput ; 4d490
ld a, b
and D_LEFT
jr nz, .left
ld a, b
and D_RIGHT
jr nz, .right
ld a, b
and D_UP
jr nz, .up
ld a, b
and D_DOWN
jr nz, .down
ret
.left
ld a, [StringBuffer2 + 5]
and a
ret z
dec a
ld [StringBuffer2 + 5], a
ret
.right
ld a, [StringBuffer2 + 5]
cp $4
ret z
inc a
ld [StringBuffer2 + 5], a
ret
.up
call .getcurrentdigit
ld a, [hl]
cp 9
jr z, .wraparound_up
inc a
ld [hl], a
ret
.wraparound_up
ld [hl], $0
ret
.down
call .getcurrentdigit
ld a, [hl]
and a
jr z, .wraparound_down
dec a
ld [hl], a
ret
.wraparound_down
ld [hl], 9
ret
.getcurrentdigit ; 4d4d5
ld a, [StringBuffer2 + 5]
ld e, a
ld d, $0
ld hl, StringBuffer2
add hl, de
ret
.ConvertDecIDToBytes: ; 4d4e0
ld hl, 0
ld de, StringBuffer2 + 4
ld bc, 1
call .ConvertToBytes
ld bc, 10
call .ConvertToBytes
ld bc, 100
call .ConvertToBytes
ld bc, 1000
call .ConvertToBytes
ld bc, 10000
.ConvertToBytes: ; 4d501
ld a, [de]
dec de
push hl
ld hl, 0
call AddNTimes
ld c, l
ld b, h
pop hl
add hl, bc
ret
.CalculatePassword: ; 4d50f
ld a, BANK(sPlayerData)
call GetSRAMBank
ld de, 0
ld hl, sPlayerData + (PlayerID - wPlayerData)
ld c, $2
call .ComponentFromNumber
ld hl, sPlayerData + (PlayerName - wPlayerData)
ld c, $5 ; PLAYER_NAME_LENGTH_J
call .ComponentFromString
ld hl, sPlayerData + (Money - wPlayerData)
ld c, $3
call .ComponentFromNumber
call CloseSRAM
ret
.ComponentFromNumber: ; 4d533
ld a, [hli]
add e
ld e, a
ld a, $0
adc d
ld d, a
dec c
jr nz, .ComponentFromNumber
ret
.ComponentFromString: ; 4d53e
ld a, [hli]
cp "@"
ret z
add e
ld e, a
ld a, $0
adc d
ld d, a
dec c
jr nz, .ComponentFromString
ret
_DeleteSaveData: ; 4d54c
callba BlankScreen
ld b, SCGB_08
call GetSGBLayout
call LoadStandardFont
call LoadFontsExtra
ld de, MUSIC_MAIN_MENU
call PlayMusic
ld hl, .Text_ClearAllSaveData
call PrintText
ld hl, .NoYesMenuDataHeader
call CopyMenuDataHeader
call VerticalMenu
ret c
ld a, [wMenuCursorY]
cp $1
ret z
callba EmptyAllSRAMBanks
ret
.Text_ClearAllSaveData: ; 0x4d580
; Clear all save data?
text_jump UnknownText_0x1c564a
db "@"
.NoYesMenuDataHeader: ; 0x4d585
db $00 ; flags
db 07, 14 ; start coords
db 11, 19 ; end coords
dw .MenuData2
db 1 ; default option
.MenuData2: ; 0x4d58d
db $c0 ; flags
db 2 ; items
db "NO@"
db "YES@"

View File

@ -184,12 +184,10 @@ PlaceMapNameCenterAlign: ; b80e1 (2e:40e1)
InitMapSignAttrMap: ; b8115
ld de, AttrMap - TileMap
add hl, de
rept 2
inc b
endr
rept 2
inc b
inc c
inc c
endr
ld a, $87
.loop
push bc
@ -261,15 +259,13 @@ PlaceMapNameFrame: ; b812f
jr .enterloop
.continueloop
rept 2
ld [hli], a
endr
ld [hli], a
.enterloop
inc a
rept 2
ld [hli], a
endr
ld [hli], a
dec a
dec c
jr nz, .continueloop
@ -522,9 +518,8 @@ GetTreeMons: ; b82d2
ld e, a
ld d, 0
ld hl, TreeMons
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]

View File

@ -187,9 +187,8 @@ EvolutionAnimation: ; 4e5e1
call .Flash
pop bc
inc b
rept 2
dec c
endr
dec c
jr nz, .loop
and a
ret
@ -344,9 +343,8 @@ endr
ld a, [hVBlankCounter]
and %1110
srl a
rept 2
inc a
endr
inc a
and $7
ld b, a
ld hl, Sprites + 3 ; attributes

View File

@ -46,9 +46,8 @@ EvolveAfterBattle_MasterLoop
ld b, 0
ld c, a
ld hl, EvosAttacksPointers
rept 2
add hl, bc
endr
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@ -437,9 +436,8 @@ LearnLevelMoves: ; 42487
ld b, 0
ld c, a
ld hl, EvosAttacksPointers
rept 2
add hl, bc
endr
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@ -638,9 +636,8 @@ GetPreEvolution: ; 42581
.loop ; For each Pokemon...
ld hl, EvosAttacksPointers
ld b, 0
rept 2
add hl, bc
endr
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a

View File

@ -38,9 +38,8 @@ endr
inc hl
ld e, b
ld d, 0
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -84,9 +83,8 @@ endr
and 3
cp NITE
jr c, .time_species
rept 2
inc hl
endr
inc hl
.time_species
ld d, [hl]

View File

@ -25,9 +25,8 @@ HealMachineAnim: ; 12324
ld e, a
ld d, 0
ld hl, .Pointers
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a

View File

@ -3,9 +3,8 @@ GetLandmarkCoords: ; 0x1ca896
push hl
ld l, e
ld h, 0
rept 2
add hl, hl
endr
add hl, hl
ld de, Landmarks
add hl, de
ld a, [hli]
@ -24,9 +23,8 @@ GetLandmarkName:: ; 0x1ca8a5
ld l, e
ld h, 0
rept 2
add hl, hl
endr
add hl, hl
ld de, Landmarks + 2
add hl, de
ld a, [hli]

View File

@ -1094,14 +1094,12 @@ Function2868a: ; 2868a
ld a, $46
ld [hli], a
xor a
rept 2
ld [hli], a
endr
ld [hli], a
ld [hl], a
pop hl
rept 2
inc de
endr
inc de
ret
; 28771

View File

@ -145,9 +145,8 @@ GetMart: ; 15b31
.IsAMart:
ld hl, Marts
rept 2
add hl, de
endr
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
@ -393,9 +392,8 @@ LoadBuyMenuText: ; 15c7d
pop af
ld e, a
ld d, 0
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -405,9 +403,8 @@ endr
MartAskPurchaseQuantity: ; 15c91
call GetMartDialogGroup ; gets a pointer from GetMartDialogGroup.MartTextFunctionPointers
rept 2
inc hl
endr
inc hl
ld a, [hl]
and a
jp z, StandardMartAskPurchaseQuantity

View File

@ -654,7 +654,7 @@ SentGetPkmnIntoFromBox: ; db3f
ld a, [sBoxCount]
dec a
ld b, a
call Functiondcb6
call RestorePPofDepositedPokemon
.CloseSRAM_And_ClearCarryFlag:
call CloseSRAM
and a
@ -667,7 +667,7 @@ CloseSRAM_And_SetCarryFlag: ; dcb1
ret
; dcb6
Functiondcb6: ; dcb6
RestorePPofDepositedPokemon: ; dcb6
ld a, b
ld hl, sBoxMons
ld bc, BOXMON_STRUCT_LENGTH
@ -696,10 +696,10 @@ Functiondcb6: ; dcb6
ld a, [MonType]
push af
ld b, 0
.asm_dcec
.loop
ld a, [hli]
and a
jr z, .asm_dd18
jr z, .done
ld [TempMonMoves], a
ld a, BOXMON
ld [MonType], a
@ -722,9 +722,9 @@ Functiondcb6: ; dcb6
inc b
ld a, b
cp NUM_MOVES
jr c, .asm_dcec
jr c, .loop
.asm_dd18
.done
pop af
ld [MonType], a
pop af
@ -1025,7 +1025,7 @@ SentPkmnIntoBox: ; de6e
call CopyBytes
ld b, 0
call Functiondcb6
call RestorePPofDepositedPokemon
call CloseSRAM
scf

133
engine/move_mon_wo_mail.asm Executable file
View File

@ -0,0 +1,133 @@
InsertPokemonIntoBox: ; 51322
ld a, BANK(sBoxCount)
call GetSRAMBank
ld hl, sBoxCount
call InsertSpeciesIntoBoxOrParty
ld a, [sBoxCount]
dec a
ld [wd265], a
ld hl, sBoxMonNicknames
ld bc, PKMN_NAME_LENGTH
ld de, wBufferMonNick
call InsertDataIntoBoxOrParty
ld a, [sBoxCount]
dec a
ld [wd265], a
ld hl, sBoxMonOT
ld bc, NAME_LENGTH
ld de, wBufferMonOT
call InsertDataIntoBoxOrParty
ld a, [sBoxCount]
dec a
ld [wd265], a
ld hl, sBoxMons
ld bc, BOXMON_STRUCT_LENGTH
ld de, wBufferMon
call InsertDataIntoBoxOrParty
ld hl, wBufferMonMoves
ld de, TempMonMoves
ld bc, NUM_MOVES
call CopyBytes
ld hl, wBufferMonPP
ld de, TempMonPP
ld bc, NUM_MOVES
call CopyBytes
ld a, [CurPartyMon]
ld b, a
callba RestorePPofDepositedPokemon
jp CloseSRAM
InsertPokemonIntoParty: ; 5138b
ld hl, PartyCount
call InsertSpeciesIntoBoxOrParty
ld a, [PartyCount]
dec a
ld [wd265], a
ld hl, PartyMonNicknames
ld bc, PKMN_NAME_LENGTH
ld de, wBufferMonNick
call InsertDataIntoBoxOrParty
ld a, [PartyCount]
dec a
ld [wd265], a
ld hl, PartyMonOT
ld bc, NAME_LENGTH
ld de, wBufferMonOT
call InsertDataIntoBoxOrParty
ld a, [PartyCount]
dec a
ld [wd265], a
ld hl, PartyMons
ld bc, PARTYMON_STRUCT_LENGTH
ld de, wBufferMon
call InsertDataIntoBoxOrParty
ret
InsertSpeciesIntoBoxOrParty: ; 513cb
inc [hl]
inc hl
ld a, [CurPartyMon]
ld c, a
ld b, 0
add hl, bc
ld a, [CurPartySpecies]
ld c, a
.loop
ld a, [hl]
ld [hl], c
inc hl
inc c
ld c, a
jr nz, .loop
ret
InsertDataIntoBoxOrParty: ; 513e0
push de
push hl
push bc
ld a, [wd265]
dec a
call AddNTimes
push hl
add hl, bc
ld d, h
ld e, l
pop hl
.loop
push bc
ld a, [wd265]
ld b, a
ld a, [CurPartyMon]
cp b
pop bc
jr z, .insert
push hl
push de
push bc
call CopyBytes
pop bc
pop de
pop hl
push hl
ld a, l
sub c
ld l, a
ld a, h
sbc b
ld h, a
pop de
ld a, [wd265]
dec a
ld [wd265], a
jr .loop
.insert
pop bc
pop hl
ld a, [CurPartyMon]
call AddNTimes
ld d, h
ld e, l
pop hl
call CopyBytes
ret

View File

@ -65,9 +65,8 @@ NamingScreen: ; 116c1
ld e, a
ld d, 0
ld hl, .Jumptable
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -401,9 +400,8 @@ NamingScreenJoypadLoop: ; 11915
ld e, a
ld d, $0
ld hl, .Jumptable
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -662,9 +660,8 @@ NamingScreen_AnimateCursor: ; 11a3b (4:5a3b)
jr nz, .asm_11ade
ld a, $4
.asm_11ade
rept 2
dec a
endr
dec a
ld e, a
add a
add e
@ -1164,9 +1161,8 @@ INCBIN "gfx/icon/mail2.2bpp"
ld e, a
ld d, 0
ld hl, .Jumptable
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -1391,9 +1387,8 @@ ComposeMail_AnimateCursor: ; 120c1 (4:60c1)
jr nz, .wrap_around_command_left
ld a, $4
.wrap_around_command_left
rept 2
dec a
endr
dec a
ld e, a
add a
add e
@ -1476,9 +1471,8 @@ MailComposition_TryAddLastCharacter: ; 121ac (4:61ac)
jr nz, .asm_121c3
push hl
ld hl, wNamingScreenCurrNameLength
rept 2
dec [hl]
endr
dec [hl]
jr .asm_121c8
.asm_121c3

View File

@ -311,9 +311,8 @@ GetTradeAttribute: ; 0xfcdc2
ld e, a
ld d, 0
ld hl, NPCTrades
rept 2
add hl, de
endr
add hl, de
pop de
add hl, de
ret
@ -458,9 +457,8 @@ PrintTradeText: ; fcf38
call AddNTimes
ld a, [wcf64]
ld c, a
rept 2
add hl, bc
endr
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a

View File

@ -85,9 +85,8 @@ GetOptionPointer: ; e42d6
ld e, a ; copy it to de
ld d, 0
ld hl, .Pointers
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -143,9 +142,8 @@ Options_TextSpeed: ; e42f5
.NonePressed:
ld b, 0
ld hl, .Strings
rept 2
add hl, bc
endr
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
@ -363,9 +361,8 @@ Options_Print: ; e4424
.NonePressed:
ld b, $0
ld hl, .Strings
rept 2
add hl, bc
endr
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]

View File

@ -147,9 +147,8 @@ AddOutdoorSprites: ; 141ee
ld c, a
ld b, 0
ld hl, OutdoorSprites
rept 2
add hl, bc
endr
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@ -364,9 +363,8 @@ AddSpriteGFX: ; 142e5
jr z, .exists
and a
jr z, .new
rept 2
inc hl
endr
inc hl
dec c
jr nz, .loop
@ -428,9 +426,8 @@ SortUsedSprites: ; 1431e
ld a, [de]
and a
jr nz, .FoundLastSprite
rept 2
dec de
endr
dec de
dec c
jr nz, .FindLastSprite
.FoundLastSprite:
@ -472,16 +469,14 @@ endr
; Keep doing this until everything's in order.
.loop
rept 2
dec de
endr
dec de
dec c
jr nz, .CheckFollowing
pop hl
rept 2
inc hl
endr
inc hl
pop de
pop bc
dec c

View File

@ -1252,9 +1252,8 @@ Pack_JumptableNext: ; 10866 (4:4866)
Pack_GetJumptablePointer: ; 1086b
ld e, a
ld d, 0
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -1300,9 +1299,8 @@ DrawPackGFX: ; 1089d
jr nz, .female
.male_dude
ld hl, PackGFXPointers
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld e, a
ld d, [hl]

View File

@ -110,9 +110,8 @@ PlacePartyNicknames: ; 5009b
jr nz, .loop
.end
rept 2
dec hl
endr
dec hl
ld de, .CANCEL
call PlaceString
ret
@ -219,9 +218,8 @@ PlacePartyMenuHPDigits: ; 50138
pop de
ld a, "/"
ld [hli], a
rept 2
inc de
endr
inc de
lb bc, 2, 3
call PrintNum
@ -390,9 +388,8 @@ PlacePartyMonEvoStoneCompatibility: ; 5022f
ld e, a
ld d, 0
ld hl, EvosAttacksPointers
rept 2
add hl, de
endr
add hl, de
call .DetermineCompatibility
pop hl
call PlaceString
@ -426,19 +423,16 @@ endr
ld a, [hli]
and a
jr z, .nope
rept 2
inc hl
endr
inc hl
cp EVOLVE_ITEM
jr nz, .loop2
rept 2
dec hl
endr
dec hl
ld a, [CurItem]
cp [hl]
rept 2
inc hl
endr
inc hl
jr nz, .loop2
ld de, .string_able
ret
@ -613,9 +607,8 @@ GetPartyMenuTilemapPointers: ; 50396
ld e, a
ld d, 0
ld hl, .Pointers
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -794,9 +787,8 @@ PrintPartyMenuText: ; 5049a
ld hl, PartyMenuStrings
ld e, a
ld d, $0
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld d, [hl]
ld e, a
@ -932,9 +924,8 @@ PrintPartyMenuActionText: ; 50566
.PrintText: ; 505c1
ld e, a
ld d, 0
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a

View File

@ -266,9 +266,8 @@ CheckSpecialPhoneCall:: ; 90136 (24:4136)
jr nc, .NoPhoneCall
call .DoSpecialPhoneCall
rept 2
inc hl
endr
inc hl
ld a, [hli]
ld e, a
push hl
@ -520,9 +519,8 @@ Phone_CallerTextboxWithName2: ; 902c9
call Phone_CallerTextbox
hlcoord 1, 2
ld [hl], $62
rept 2
inc hl
endr
inc hl
ld a, [PhoneScriptBank]
ld b, a
ld a, [PhoneCallerLo]
@ -621,9 +619,8 @@ Function90363: ; 90363 (24:4363)
call Phone_CallerTextbox
hlcoord 1, 1
ld [hl], $62
rept 2
inc hl
endr
inc hl
ld d, h
ld e, l
pop bc
@ -699,9 +696,8 @@ GetCallerName: ; 903a9 (24:43a9)
ld c, b
ld b, 0
ld hl, NonTrainerCallerNames
rept 2
add hl, bc
endr
add hl, bc
ld a, [hli]
ld e, a
ld d, [hl]

View File

@ -2385,9 +2385,8 @@ Pokedex_ApplyUsualPals: ; 41427
Pokedex_LoadPointer: ; 41432
ld e, a
ld d, 0
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a

View File

@ -21,9 +21,8 @@ Function84022: ; 84022
ld e, a
ld d, 0
ld hl, .Jumptable
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -1133,9 +1132,8 @@ Function84785: ; 84785
ld e, a
ld d, 0
ld hl, PrinterStatusStringPointers
rept 2
add hl, de
endr
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
@ -1166,9 +1164,8 @@ Function847bd: ; 847bd
ld e, a
ld d, 0
ld hl, PrinterStatusStringPointers
rept 2
add hl, de
endr
add hl, de
ld e, [hl]
inc hl
ld d, [hl]

View File

@ -35,9 +35,8 @@ GetTimeOfDay:: ; 14032
cp [hl]
jr c, .match
; else, get the next entry
rept 2
inc hl
endr
inc hl
; try again
jr .check

134
engine/search2.asm Executable file
View File

@ -0,0 +1,134 @@
_FindGreaterThanThatLevel: ; 4dbd2
ld hl, PartyMon1Level
call FindGreaterThanThatLevel
ret
_FindAtLeastThatHappy: ; 4dbd9
ld hl, PartyMon1Happiness
call FindAtLeastThatHappy
ret
_FindThatSpecies: ; 4dbe0
ld hl, PartyMon1Species
jp FindThatSpecies
_FindThatSpeciesYourTrainerID: ; 4dbe6
ld hl, PartyMon1Species
call FindThatSpecies
ret z
ld a, c
ld hl, PartyMon1ID
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld a, [PlayerID]
cp [hl]
jr nz, .nope
inc hl
ld a, [PlayerID + 1]
cp [hl]
jr nz, .nope
ld a, $1
and a
ret
.nope
xor a
ret
FindAtLeastThatHappy: ; 4dc0a
; Sets the bits for the Pokemon that have a happiness greater than or equal to b.
; The lowest bits are used. Sets z if no Pokemon in your party is at least that happy.
ld c, $0
ld a, [PartyCount]
ld d, a
.loop
ld a, d
dec a
push hl
push bc
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
pop bc
ld a, b
cp [hl]
pop hl
jr z, .greater_equal
jr nc, .lower
.greater_equal
ld a, c
or $1
ld c, a
.lower
sla c
dec d
jr nz, .loop
call RetroactivelyIgnoreEggs
ld a, c
and a
ret
FindGreaterThanThatLevel: ; 4dc31
ld c, $0
ld a, [PartyCount]
ld d, a
.loop
ld a, d
dec a
push hl
push bc
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
pop bc
ld a, b
cp [hl]
pop hl
jr c, .greater
ld a, c
or $1
ld c, a
.greater
sla c
dec d
jr nz, .loop
call RetroactivelyIgnoreEggs
ld a, c
and a
ret
FindThatSpecies: ; 4dc56
; Find species b in your party.
; If you have no Pokemon, returns c = -1 and z.
; If that species is in your party, returns its location in c, and nz.
; Otherwise, returns z.
ld c, -1
ld hl, PartySpecies
.loop
ld a, [hli]
cp -1
ret z
inc c
cp b
jr nz, .loop
ld a, $1
and a
ret
RetroactivelyIgnoreEggs: ; 4dc67
ld e, -2
ld hl, PartySpecies
.loop
ld a, [hli]
cp -1
ret z
cp EGG
jr nz, .skip_notegg
ld a, c
and e
ld c, a
.skip_notegg
rlc e
jr .loop

View File

@ -45,9 +45,8 @@ CheckRegisteredItem: ; 13345
inc hl
ld e, a
ld d, 0
rept 2
add hl, de
endr
add hl, de
call .IsSameItem
jr c, .NoRegisteredItem
and a
@ -71,9 +70,8 @@ endr
inc hl
ld e, a
ld d, 0
rept 2
add hl, de
endr
add hl, de
call .IsSameItem
jr c, .NoRegisteredItem
ret

View File

@ -556,8 +556,8 @@ SpriteAnimSeqData: ; 8d1c4
db SPRITE_ANIM_FRAMESET_07, SPRITE_ANIM_SEQ_04, $00 ; 01
db SPRITE_ANIM_FRAMESET_08, SPRITE_ANIM_SEQ_05, $05 ; 02
db SPRITE_ANIM_FRAMESET_GAMEFREAK_LOGO, SPRITE_ANIM_SEQ_GAMEFREAK_LOGO, $00 ; 03
db SPRITE_ANIM_FRAMESET_0B, SPRITE_ANIM_SEQ_07, $06 ; 04
db SPRITE_ANIM_FRAMESET_0C, SPRITE_ANIM_SEQ_08, $06 ; 05
db SPRITE_ANIM_FRAMESET_0B, SPRITE_ANIM_SEQ_07, $06 ; 04 gs intro star
db SPRITE_ANIM_FRAMESET_0C, SPRITE_ANIM_SEQ_08, $06 ; 05 gs intro sparkle
db SPRITE_ANIM_FRAMESET_SLOT_GOLEM, SPRITE_ANIM_SEQ_SLOT_GOLEM, $07 ; 06 slots golem
db SPRITE_ANIM_FRAMESET_SLOTS_CHANSEY, SPRITE_ANIM_SEQ_SLOTS_CHANSEY, $07 ; 07 slots chansey
db SPRITE_ANIM_FRAMESET_SLOTS_EGG, SPRITE_ANIM_SEQ_SLOTS_EGG, $07 ; 08 slots egg

View File

@ -641,9 +641,8 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6)
inc a
ld d, a
callba CalcExpAtLevel
rept 2
ld hl, TempMonExp + 2
endr
ld hl, TempMonExp + 2
ld a, [hQuotient + 2]
sub [hl]
dec hl
@ -660,9 +659,8 @@ endr
.AlreadyAtMaxLevel:
ld hl, Buffer1 ; wd1ea (aliases: MagikarpLength)
xor a
rept 2
ld [hli], a
endr
ld [hli], a
ld [hl], a
ret
; 4e119 (13:6119)

View File

@ -231,9 +231,8 @@ ItemSwitch_ConvertSpacingToDW: ; 24a80 (9:4a80)
ld c, a
ld b, 0
ld hl, .spacing_dws
rept 2
add hl, bc
endr
add hl, bc
ld c, [hl]
inc hl
ld b, [hl]

View File

@ -374,9 +374,8 @@ CalcHoursDaysSince: ; 115d2
; 115d6
CalcMinsHoursDaysSince: ; 115d6
rept 2
inc hl
endr
inc hl
xor a
jr _CalcMinsHoursDaysSince
; 115db

View File

@ -46,9 +46,8 @@ ValidateOTTrademon: ; fb57e
ld [CurSpecies], a
call GetBaseData
ld hl, wLinkOTPartyMonTypes
rept 2
add hl, bc
endr
add hl, bc
ld a, [BaseType1]
cp [hl]
jr nz, .abnormal

View File

@ -245,9 +245,8 @@ GetTimePalette: ; 8c117
ld e, a
ld d, 0
ld hl, .TimePalettes
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -346,9 +345,8 @@ GetTimePalFade: ; 8c17c
ld c, a
ld b, $0
ld hl, .dmgfades
rept 2
add hl, bc
endr
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a

View File

@ -200,9 +200,8 @@ UnreferencedFunction907f1: ; 907f1
push hl
call DisplayHourOClock
pop de
rept 2
inc de
endr
inc de
ld a, ":"
ld [de], a
inc de
@ -521,9 +520,8 @@ Special_SetDayOfWeek: ; 90913
ld e, a
ld d, 0
ld hl, .WeekdayStrings
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld d, [hl]
ld e, a

View File

@ -351,9 +351,8 @@ InitializeBackground: ; 10ef06
ld b, a
ld a, e
ld [hli], a
rept 2
inc e
endr
inc e
ld a, $80
ld [hli], a
dec c

View File

@ -581,9 +581,8 @@ PrintMoveDesc: ; 2cb3e
dec a
ld c, a
ld b, 0
rept 2
add hl, bc
endr
add hl, bc
ld a, [hli]
ld e, a
ld d, [hl]

View File

@ -224,9 +224,8 @@ DoTradeAnimation: ; 29082
ld e, a
ld d, 0
ld hl, .JumpTable
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -519,9 +518,8 @@ Function29281: ; 29281
ld e, a
ld d, 0
ld hl, Jumptable_2928f
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -1105,9 +1103,8 @@ Function29676: ; 29676 (a:5676)
ld e, [hl]
ld d, 0
ld hl, Jumptable_29686
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a

View File

@ -178,9 +178,8 @@ UnownPuzzleJumptable: ; e12ca
ld e, a
ld d, 0
ld hl, .Jumptable
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -840,9 +839,8 @@ LoadUnownPuzzlePiecesGFX: ; e17a3
ld e, a
ld d, 0
ld hl, .LZPointers
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a

View File

@ -34,9 +34,8 @@ PrintUnownWord: ; fba2e (3e:7a2e)
ld e, a
ld d, 0
ld hl, UnownWords
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld e, a
ld d, [hl]

View File

@ -369,7 +369,7 @@ CheckMovingOffEdgeOfMap:: ; 104820 (41:4820)
.left
ld a, [PlayerStandingMapX]
sub $4
sub 4
cp -1
jr z, .ok
and a

View File

@ -108,9 +108,8 @@ endr
ld a, [wNamedObjectIndexBuffer]
cp [hl]
jr z, .found
rept 2
inc hl
endr
inc hl
pop af
dec a
jr nz, .ScanMapLoop
@ -274,9 +273,8 @@ endr
call CheckOnWater
ld de, .WaterMonTable
jr z, .watermon
rept 2
inc hl
endr
inc hl
ld a, [TimeOfDay]
ld bc, $e
call AddNTimes
@ -702,9 +700,8 @@ UpdateRoamMons: ; 2a30d
inc hl
ld c, a
ld b, $0
rept 2
add hl, bc
endr
add hl, bc
ld a, [wRoamMons_LastMapGroup]
cp [hl]
jr nz, .done
@ -866,9 +863,8 @@ RandomPhoneRareWildMon: ; 2a4ab
dec a
ld c, a
ld b, $0
rept 2
add hl, bc
endr
add hl, bc
; We now have the pointer to one of the last (rarest) three wild Pokemon found in that area.
inc hl
ld c, [hl] ; Contains the species index of this rare Pokemon
@ -942,9 +938,8 @@ RandomPhoneWildMon: ; 2a51f
and $3
ld c, a
ld b, $0
rept 2
add hl, bc
endr
add hl, bc
inc hl
ld a, [hl]
ld [wNamedObjectIndexBuffer], a
@ -963,9 +958,8 @@ RandomPhoneMon: ; 2a567
dec a
ld c, a
ld b, 0
rept 2
add hl, bc
endr
add hl, bc
ld a, BANK(TrainerGroups)
call GetFarHalfword

View File

@ -200,13 +200,11 @@ endr
.PrintNthText: ; 8b2a9
push bc
call .GetTextPointers
rept 2
inc hl
endr
inc hl
ld b, $0
rept 2
add hl, bc
endr
add hl, bc
call .LoadTextPointer
call PrintText
pop bc

View File

@ -322,9 +322,8 @@ Buena_getprize: ; 8b154
ld hl, .prizes
ld b, 0
ld c, a
rept 2
add hl, bc
endr
add hl, bc
ret
; 8b15e

View File

@ -13,9 +13,8 @@ Special_SelectRandomBugContestContestants: ; 139a8
ld b, RESET_FLAG
call EventFlagAction
pop hl
rept 2
inc hl
endr
inc hl
pop bc
dec c
jr nz, .loop1
@ -34,9 +33,8 @@ endr
ld e, b
ld d, 0
ld hl, BugCatchingContestantEventFlagTable
rept 2
add hl, de
endr
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
@ -66,9 +64,8 @@ Special_CheckBugContestContestantFlag: ; 139ed
ld hl, BugCatchingContestantEventFlagTable
ld e, a
ld d, 0
rept 2
add hl, de
endr
add hl, de
ld e, [hl]
inc hl
ld d, [hl]

View File

@ -85,9 +85,8 @@ LoadContestantName: ; 13730
ld c, a
ld b, 0
ld hl, BugContestantPointers
rept 2
add hl, bc
endr
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@ -320,23 +319,20 @@ ComputeAIContestantScores: ; 138b0
pop de
jr nz, .done
ld a, e
rept 2
inc a
endr
inc a
ld [wBugContestTempPersonID], a
dec a
ld c, a
ld b, 0
ld hl, BugContestantPointers
rept 2
add hl, bc
endr
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
rept 2
inc hl
endr
inc hl
.loop2
call Random
and 3
@ -412,9 +408,8 @@ ContestScore: ; 13900
ld a, [wContestMonDVs + 0]
ld b, a
and 2
rept 2
add a
endr
add a
ld c, a
swap b
@ -433,12 +428,10 @@ endr
ld a, b
and 2
srl a
rept 2
add c
endr
rept 2
add c
add d
add d
endr
call .AddContestStat

View File

@ -259,9 +259,8 @@ CelebiEvent_Cosine: ; 49b3b (12:5b3b)
ld a, d
ld d, $0
ld hl, .sinewave
rept 2
add hl, de
endr
add hl, de
ld e, [hl]
inc hl
ld d, [hl]

View File

@ -37,9 +37,8 @@ SpecialDratini: ; 0x8b170
; get address of mon's first move
pop de
rept 2
inc de
endr
inc de
.GiveMoves:
ld a, [hl]

View File

@ -70,9 +70,8 @@ Elevator:: ; 1342d
call GetFarByte
cp -1
jr z, .fail
rept 2
inc hl
endr
inc hl
ld a, [wElevatorPointerBank]
call GetFarByte
inc hl
@ -222,9 +221,8 @@ FloorToString: ; 13575
ld e, a
ld d, 0
ld hl, .floors
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a

View File

@ -164,9 +164,8 @@ OWCutJumptable: ; 8ca0c
ld e, a
ld d, 0
ld hl, .dw
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -192,9 +191,8 @@ Cut_SpawnAnimateTree: ; 8ca23 (23:4a23)
ld [wcf64], a
; Cut_StartWaiting
ld hl, wJumptableIndex
rept 2
inc [hl]
endr
inc [hl]
ret
Cut_SpawnAnimateLeaves: ; 8ca3c (23:4a3c)
@ -269,9 +267,8 @@ Cut_GetLeafSpawnCoords: ; 8ca8e (23:4a8e)
add e
ld e, a
ld hl, .Coords
rept 2
add hl, de
endr
add hl, de
ld e, [hl]
inc hl
ld d, [hl]

View File

@ -235,9 +235,8 @@ AnimateHOFMonEntrance: ; 865b5
ld a, [hli]
ld [TempMonSpecies], a
ld [CurPartySpecies], a
rept 2
inc hl
endr
inc hl
ld a, [hli]
ld [TempMonDVs], a
ld a, [hli]
@ -298,9 +297,8 @@ HOF_SlideFrontpic:
ld a, [hSCX]
and a
ret z
rept 2
dec a
endr
dec a
ld [hSCX], a
call DelayFrame
jr .frontpicloop

View File

@ -362,9 +362,8 @@ Kurt_GetAddressOfApricornQuantity: ; 88201
inc hl
ld c, a
ld b, $0
rept 2
add hl, bc
endr
add hl, bc
inc hl
ld a, [hl]
pop bc
@ -379,9 +378,8 @@ Kurt_GetRidOfItem: ; 88211
ld c, a
ld b, $0
inc hl
rept 2
add hl, bc
endr
add hl, bc
ld a, [CurItem]
ld c, a
ld a, [hli]

View File

@ -250,9 +250,8 @@ CalcMagikarpLength: ; fbbfc
; hl = de × 10
ld h, d
ld l, e
rept 2
add hl, hl
endr
add hl, hl
add hl, de
add hl, hl

View File

@ -101,9 +101,8 @@ MagnetTrain_UpdateLYOverrides: ; 8cc99
ld d, a
ld hl, wcf64
ld a, [hl]
rept 2
add d
endr
add d
ld [hl], a
ret
@ -211,9 +210,8 @@ GetMagnetTrainBGTiles: ; 8cd74
ld e, a
ld d, 0
ld hl, MagnetTrainBGTiles
rept 2
add hl, de
endr
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
@ -296,9 +294,8 @@ MagnetTrain_Jumptable: ; 8cdf7
ld e, a
ld d, 0
ld hl, .Jumptable
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -398,17 +395,15 @@ endr
inc a
ld d, a
ld a, e
rept 2
add d
endr
add d
ld [wcf65], a
ld hl, wGlobalAnimXOffset
ld a, [wMagnetTrainDirection]
ld d, a
ld a, [hl]
rept 2
add d
endr
add d
ld [hl], a
ret

View File

@ -23,9 +23,8 @@ Special_BankOfMom: ; 16218
ld e, a
ld d, 0
ld hl, .dw
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -143,9 +142,8 @@ endr
call PrintText
xor a
ld hl, StringBuffer2
rept 2
ld [hli], a
endr
ld [hli], a
ld [hl], a
ld a, $5
ld [wcf64], a
@ -211,9 +209,8 @@ endr
call PrintText
xor a
ld hl, StringBuffer2
rept 2
ld [hli], a
endr
ld [hli], a
ld [hl], a
ld a, $5
ld [wcf64], a

View File

@ -298,9 +298,8 @@ PrintSeerText: ; 4f26d
ld e, a
ld d, 0
ld hl, SeerTexts
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a

View File

@ -90,9 +90,8 @@ Functionb92b8: ; b92b8
cp -1
jr z, .invalid
inc c
rept 2
inc hl
endr
inc hl
jr .loop
.invalid
@ -931,9 +930,8 @@ LoadMailGFX_Color3: ; b991e
.loop
ld a, [de]
inc de
rept 2
ld [hli], a
endr
ld [hli], a
dec c
jr nz, .loop
ret

View File

@ -110,9 +110,8 @@ LoadMonAnimation: ; d00a3
ld c, e
ld b, 0
ld hl, PokeAnims
rept 2
add hl, bc
endr
add hl, bc
ld a, [hli]
ld b, [hl]
ld c, a
@ -513,9 +512,8 @@ Functiond02f8: ; d02f8
ld a, [hli]
ld h, [hl]
ld l, a
rept 2
add hl, de
endr
add hl, de
ld a, [wPokeAnimPointerBank]
call GetFarHalfword
ld a, l
@ -537,9 +535,8 @@ Functiond031b: ; d031b
ld a, [hli]
ld h, [hl]
ld l, a
rept 2
add hl, bc
endr
add hl, bc
ld a, [wPokeAnimFramesBank]
call GetFarHalfword
ld a, [wPokeAnimFramesBank]
@ -970,9 +967,8 @@ GetMonAnimPointer: ; d055c
dec a
ld e, a
ld d, 0
rept 2
add hl, de
endr
add hl, de
ld a, c
ld [wPokeAnimPointerBank], a
call GetFarHalfword
@ -1041,9 +1037,8 @@ GetMonFramesPointer: ; d05ce
dec a
ld e, a
ld d, 0
rept 2
add hl, de
endr
add hl, de
ld a, b
call GetFarHalfword
ld a, l
@ -1081,9 +1076,8 @@ GetMonBitmaskPointer: ; d061b
dec a
ld e, a
ld d, 0
rept 2
add hl, de
endr
add hl, de
ld a, [wPokeAnimBitmaskBank]
call GetFarHalfword
ld a, l

View File

@ -153,9 +153,8 @@ GetBattleVarAddr:: ; 39e7
ld hl, .battlevarpairs
ld c, a
ld b, 0
rept 2
add hl, bc
endr
add hl, bc
ld a, [hli]
ld h, [hl]
@ -175,9 +174,8 @@ endr
ld b, 0
ld hl, .vars
rept 2
add hl, bc
endr
add hl, bc
ld a, [hli]
ld h, [hl]

View File

@ -205,9 +205,8 @@ FarCopyBytesDouble:: ; e9b
.loop
ld a, [de]
inc de
rept 2
ld [hli], a
endr
ld [hli], a
.dec
dec c
jr nz, .loop

View File

@ -42,9 +42,8 @@ Joypad:: ; 935
ld a, R_DPAD
ld [rJOYP], a
; Read twice to give the request time to take.
rept 2
ld a, [rJOYP]
endr
ld a, [rJOYP]
; The Joypad register output is in the lo nybble (inversed).
; We make the hi nybble of our new container d-pad input.
@ -209,9 +208,8 @@ GetJoypad:: ; 984
jr nz, .next
; The current input is overwritten.
rept 2
dec hl
endr
dec hl
ld b, NO_INPUT
jr .finishauto

View File

@ -28,9 +28,8 @@ GetSpriteVTile:: ; 180e
.loop
cp [hl]
jr z, .found
rept 2
inc hl
endr
inc hl
dec c
jr nz, .loop
ld a, [UsedSprites + 1]
@ -503,9 +502,8 @@ rept SPRITEMOVEDATA_FIELDS
endr
ld a, BANK(SpriteMovementData)
call GetFarByte
rept 2
add a
endr
add a
and $c
pop de
pop bc

View File

@ -107,9 +107,8 @@ ComputePathToWalkToPlayer:: ; 1b5f
push hl
ld l, b
ld h, 0
rept 2
add hl, hl
endr
add hl, hl
ld e, a
ld d, 0
add hl, de
@ -148,9 +147,8 @@ SetMenuAttributes:: ; 1bb1
dec b
jr nz, .loop
ld a, $1
rept 2
ld [hli], a
endr
ld [hli], a
xor a
rept 3
ld [hli], a

View File

@ -129,12 +129,10 @@ TextBoxPalette:: ; 1024
; Fill text box width c height b at hl with pal 7
ld de, AttrMap - TileMap
add hl, de
rept 2
inc b
endr
rept 2
inc b
inc c
inc c
endr
ld a, TEXTBOX_PAL
.col
push bc
@ -640,12 +638,10 @@ TextScroll:: ; 138c
dec c
jr nz, .row
rept 2
inc de
endr
rept 2
inc de
inc hl
inc hl
endr
pop af
dec a
jr nz, .col
@ -738,9 +734,8 @@ DoTextUntilTerminator:: ; 13f6
ld c, a
ld b, 0
ld hl, TextCommands
rept 2
add hl, bc
endr
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
@ -1014,9 +1009,8 @@ Text_PlaySound:: ; 1500
jr z, .done
cp b
jr z, .play
rept 2
inc hl
endr
inc hl
jr .loop
.play
@ -1113,9 +1107,8 @@ Text_TX_STRINGBUFFER:: ; 156a
ld e, a
ld d, 0
ld hl, StringBufferPointers
rept 2
add hl, de
endr
add hl, de
ld a, BANK(StringBufferPointers)
call GetFarHalfword
ld d, h
@ -1136,9 +1129,8 @@ Text_TX_DAY:: ; 1582
ld c, a
ld b, 0
ld hl, .Days
rept 2
add hl, bc
endr
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a

View File

@ -19,9 +19,8 @@ VBlank:: ; 283
ld e, a
ld d, 0
ld hl, .VBlanks
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a

View File

@ -21,9 +21,8 @@ PrintItemDescription: ; 0x1c8955
dec a
ld c, a
ld b, 0
rept 2
add hl, bc
endr
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]

View File

@ -253,9 +253,8 @@ ParkBall: ; e8a2
jr z, .skip_or_return_from_ball_fn
cp c
jr z, .call_ball_function
rept 2
inc hl
endr
inc hl
jr .get_multiplier_loop
.call_ball_function
@ -288,9 +287,8 @@ endr
ld h, d
ld l, e
rept 2
add hl, de
endr
add hl, de
ld d, h
ld e, l
ld a, d
@ -805,9 +803,8 @@ HeavyBallMultiplier:
dec a
ld e, a
ld d, 0
rept 2
add hl, de
endr
add hl, de
ld a, BANK(PokedexDataPointerTable)
call GetFarHalfword
@ -820,9 +817,8 @@ endr
call GetPokedexEntryBank
push bc
rept 2
inc hl
endr
inc hl
call GetFarHalfword
srl h
@ -868,9 +864,8 @@ endr
ld a, c
cp [hl]
jr c, .heavymon
rept 2
inc hl
endr
inc hl
jr .lookup
.heavymon
@ -929,9 +924,8 @@ GLOBAL EvosAttacksPointers
ld c, a
ld b, 0
ld hl, EvosAttacksPointers
rept 2
add hl, bc
endr
add hl, bc
ld a, BANK(EvosAttacksPointers)
call GetFarHalfword
pop bc
@ -2127,9 +2121,8 @@ GetHealingItemAmount: ; f395 (3:7395)
jr z, .NotFound
cp d
jr z, .done
rept 2
inc hl
endr
inc hl
jr .next
.NotFound:
@ -2335,9 +2328,8 @@ XSpecial: ; f4c5
.loop
cp [hl]
jr z, .got_it
rept 2
inc hl
endr
inc hl
jr .loop
.got_it

View File

@ -681,9 +681,8 @@ Function1103ac: ; 1103ac
ld hl, Unknown_112037
ld de, $cb74
call Function110000
rept 2
inc de
endr
inc de
pop hl
ld bc, 0
call Function110007
@ -1127,9 +1126,8 @@ Function1106ef: ; 1106ef
ld hl, Unknown_112072
ld b, $5
call Function110000
rept 2
inc de
endr
inc de
ld bc, $0001
ld hl, Unknown_11209e
call Function110007
@ -1395,9 +1393,8 @@ Function110905: ; 110905
ld hl, Unknown_112072
ld b, $5
call Function110000
rept 2
inc de
endr
inc de
ld hl, Unknown_1120c8
call Function110007
pop hl
@ -1561,12 +1558,10 @@ Function110a5b: ; 110a5b
ld [hli], a
ld a, d
ld [hli], a
rept 2
inc de
endr
rept 2
inc de
dec bc
dec bc
endr
ld hl, $c98f
ld a, e
ld [hli], a
@ -1586,9 +1581,8 @@ endr
xor a
ld [hli], a
xor a
rept 2
ld [hli], a
endr
ld [hli], a
xor a
ld [$c86b], a
ld de, $cb47
@ -1628,9 +1622,8 @@ Function110af4: ; 110af4
ld [hli], a
ld a, d
ld [hli], a
rept 2
inc de
endr
inc de
ld a, e
ld [hli], a
ld a, d
@ -1641,9 +1634,8 @@ endr
ld [$c86e], a
ld [$c86f], a
jr z, .asm_110b5c
rept 2
dec bc
endr
dec bc
ld a, [$c993]
or a
jp nz, .asm_110bd5
@ -1909,12 +1901,10 @@ Function110c9e: ; 110c9e
ld [hli], a
ld a, d
ld [hli], a
rept 2
inc de
endr
rept 2
inc de
dec bc
dec bc
endr
ld hl, $c98f
ld a, e
ld [hli], a
@ -1934,9 +1924,8 @@ endr
xor a
ld [hli], a
xor a
rept 2
ld [hli], a
endr
ld [hli], a
xor a
ld [$c86b], a
ld de, $cb47
@ -2151,16 +2140,14 @@ Function110ddd: ; 110ddd
ld [$c833], a
ld a, [hli]
ld [$c834], a
rept 2
inc hl
endr
inc hl
ld a, l
ld [$c97f], a
ld a, h
ld [$c980], a
rept 2
dec hl
endr
dec hl
ld a, [hli]
ld h, [hl]
ld l, a
@ -2302,9 +2289,8 @@ endr
ld [hli], a
ld a, d
ld [hli], a
rept 2
inc hl
endr
inc hl
xor a
ld [$c994], a
@ -2350,9 +2336,8 @@ Function110f07: ; 110f07
ld hl, $c866
ld b, $4
call Function110000
rept 2
inc de
endr
inc de
ld b, $6
call Function111f63
ld a, [$cabc]
@ -2424,9 +2409,8 @@ Function111044: ; 111044
ld [hli], a
ld a, d
ld [hli], a
rept 2
inc de
endr
inc de
ld a, e
ld [hli], a
ld a, d
@ -2436,9 +2420,8 @@ endr
or c
ld [$c86e], a
ld [$c86f], a
rept 2
dec bc
endr
dec bc
jp z, Function1111ca
ld a, [$c991]
or a
@ -2741,16 +2724,14 @@ endr
ld [$c833], a
ld a, [hli]
ld [$c834], a
rept 2
inc hl
endr
inc hl
ld a, l
ld [$c97f], a
ld a, h
ld [$c980], a
rept 2
dec hl
endr
dec hl
ld a, [hli]
ld h, [hl]
ld l, a
@ -2828,9 +2809,8 @@ endr
ld a, [hld]
cp $2f
jr nz, .asm_1112a4
rept 2
inc hl
endr
inc hl
ld a, [hl]
cp $30
jr c, .asm_1112cc
@ -2884,9 +2864,8 @@ endr
ld [hli], a
ld a, d
ld [hli], a
rept 2
inc hl
endr
inc hl
ld a, e
ld [hli], a
ld a, d
@ -2904,9 +2883,8 @@ endr
ld [$c9ac], a
ld a, [hli]
ld [$c9ad], a
rept 2
inc hl
endr
inc hl
ld a, [hli]
ld [$c876], a
ld a, [hl]
@ -2922,9 +2900,8 @@ Function111335: ; 111335
ld a, [hli]
ld h, [hl]
ld l, a
rept 2
inc hl
endr
inc hl
ld a, [hli]
ld h, [hl]
ld l, a
@ -3114,9 +3091,8 @@ endr
cp $81
jr nc, .asm_111485
ld c, a
rept 2
inc a
endr
inc a
ld [de], a
inc de
ld a, $ff
@ -3128,9 +3104,8 @@ endr
ld b, c
call Function110000
ld b, c
rept 2
inc b
endr
inc b
call Function111f63
ld hl, $c822
set 7, [hl]
@ -3457,9 +3432,8 @@ Function11164f: ; 11164f (44:564f)
ld a, b
srl a
srl a
rept 2
add b
endr
add b
ld [hl], a
ret
@ -4126,9 +4100,8 @@ Function111abd: ; 111abd (44:5abd)
ld [$c800], a
xor a
ld hl, $c80a
rept 2
ld [hli], a
endr
ld [hli], a
ld [hl], a
ld hl, $c815
ld a, [$c820]
@ -4331,9 +4304,8 @@ Function111c17: ; 111c17 (44:5c17)
.asm_111c52
ld b, a
ld a, [$ca3f]
rept 2
dec a
endr
dec a
cp b
jr c, .asm_111c6e
.asm_111c5b
@ -5604,9 +5576,8 @@ Function112451: ; 112451
xor a
ld [hli], a
xor a
rept 2
ld [hli], a
endr
ld [hli], a
pop de
ld a, $1
ld [$c994], a
@ -5731,24 +5702,21 @@ Function1125c7: ; 1125c7
ld [hli], a
ld a, d
ld [hli], a
rept 2
inc de
endr
inc de
ld a, $80
ld [hli], a
ld a, $c8
ld [hli], a
rept 2
dec bc
endr
dec bc
ld a, $fa
ld [hli], a
ld a, $0
ld [hli], a
xor a
rept 2
ld [hli], a
endr
ld [hli], a
ld de, $cb47
ld hl, Unknown_112072
ld b, $6
@ -6236,9 +6204,8 @@ Function1128db: ; 1128db
ld de, $cb4c
ld a, $1
ld [de], a
rept 2
inc de
endr
inc de
ld b, $1
call Function111f63
jr .asm_112941
@ -6471,9 +6438,8 @@ Function112a56: ; 112a56
ld a, [hli]
ld h, [hl]
ld l, a
rept 2
inc hl
endr
inc hl
ld a, e
ld [hli], a
ld a, d
@ -6970,9 +6936,8 @@ Function112d33: ; 112d33
ld hl, $c821
res 2, [hl]
ld hl, $c86b
rept 2
dec [hl]
endr
dec [hl]
.asm_112d82
ld hl, $c86b
@ -7131,9 +7096,8 @@ endr
cp $1
ld a, $32
jr z, .asm_112e95
rept 2
inc de
endr
inc de
inc a
.asm_112e95
@ -7512,9 +7476,8 @@ Function113095: ; 113095
.asm_1130d6
ld a, [$c82b]
ld c, a
rept 2
dec b
endr
dec b
ld a, b
ld [$c82d], a
jr z, .asm_11310d
@ -7522,9 +7485,8 @@ endr
ld d, a
ld a, [$c872]
ld e, a
rept 2
dec de
endr
dec de
xor a
or d
jr nz, .asm_1130f5
@ -7543,9 +7505,8 @@ endr
ld e, a
ld a, [$c875]
ld d, a
rept 2
inc de
endr
inc de
call Function110000
.asm_11310d
@ -7658,9 +7619,8 @@ Function113197: ; 113197
ld a, b
ld [de], a
inc de
rept 2
dec b
endr
dec b
call Function110000
xor a
ld [de], a
@ -7682,9 +7642,8 @@ Function1131a9: ; 1131a9
inc b
cp $a
jr nz, .asm_1131b7
rept 2
inc hl
endr
inc hl
dec b
ld c, b
call Function110000
@ -7728,9 +7687,8 @@ endr
ld hl, $c821
res 2, [hl]
ld hl, $c86b
rept 2
dec [hl]
endr
dec [hl]
ld a, $4
ret
; 113206
@ -7753,9 +7711,8 @@ Function113206: ; 113206
ld e, a
ld a, [$c875]
ld d, a
rept 2
inc de
endr
inc de
call Function110000
ld a, [$c991]
ld [$c993], a
@ -8026,9 +7983,8 @@ Function1133fe: ; 1133fe
ld a, [hli]
ld h, [hl]
ld l, a
rept 2
inc hl
endr
inc hl
ld a, [hli]
ld h, [hl]
ld l, a
@ -8039,9 +7995,8 @@ endr
ld a, [hld]
cp $2f
jr nz, .asm_11344c
rept 2
inc hl
endr
inc hl
ld e, l
ld d, h
.asm_113455
@ -8059,9 +8014,8 @@ endr
ld a, [hli]
ld h, [hl]
ld l, a
rept 2
inc hl
endr
inc hl
ld a, [hli]
ld h, [hl]
ld l, a
@ -8158,9 +8112,8 @@ Function1134cb: ; 1134cb
ret
.asm_1134f0
rept 2
inc [hl]
endr
inc [hl]
jr .asm_1134fc
.asm_1134f4
@ -9223,9 +9176,8 @@ endr
ld a, $3f
and c
ld [hld], a
rept 2
dec hl
endr
dec hl
pop de
ld b, h
ld c, l
@ -9572,9 +9524,8 @@ Function113ec7: ; 113ec7
ld a, [hli]
ld h, [hl]
ld l, a
rept 2
inc hl
endr
inc hl
ld a, [hld]
dec hl
xor $80
@ -9615,9 +9566,8 @@ Function113ef2: ; 113ef2
ld l, a
ld e, l
ld d, h
rept 2
add hl, de
endr
add hl, de
ld e, l
ld d, h
ld hl, $c815
@ -9677,9 +9627,8 @@ Function113f2d: ; 113f2d
ld l, a
ld e, l
ld d, h
rept 2
add hl, de
endr
add hl, de
ld e, l
ld d, h
ld hl, $c815

819
main.asm
View File

@ -1174,169 +1174,7 @@ Function29fe4: ; unreferenced
ret
INCLUDE "engine/wildmons.asm"
DetermineLinkBattleResult: ; 2b930
callba UpdateEnemyMonInParty
ld hl, PartyMon1HP
call .CountMonsRemaining
push bc
ld hl, OTPartyMon1HP
call .CountMonsRemaining
ld a, c
pop bc
cp c
jr z, .even_number_of_mons_remaining
jr c, .defeat
jr .victory
.even_number_of_mons_remaining
call .BothSides_CheckNumberMonsAtFullHealth
jr z, .drawn
ld a, e
cp $1
jr z, .victory
cp $2
jr z, .defeat
ld hl, PartyMon1HP
call .CalcPercentHPRemaining
push de
ld hl, OTPartyMon1HP
call .CalcPercentHPRemaining
pop hl
ld a, d
cp h
jr c, .victory
jr z, .compare_lo
jr .defeat
.compare_lo
ld a, e
cp l
jr z, .drawn
jr nc, .defeat
.victory
ld a, [wBattleResult]
and $f0
ld [wBattleResult], a
ret
.defeat
ld a, [wBattleResult]
and $f0
add $1
ld [wBattleResult], a
ret
.drawn
ld a, [wBattleResult]
and $f0
add $2
ld [wBattleResult], a
ret
.CountMonsRemaining: ; 2b995
ld c, 0
ld b, 3
ld de, PARTYMON_STRUCT_LENGTH - 1
.loop
ld a, [hli]
or [hl]
jr nz, .not_fainted
inc c
.not_fainted
add hl, de
dec b
jr nz, .loop
ret
.CalcPercentHPRemaining: ; 2b9a6
ld de, 0
ld c, $3
.loop2
ld a, [hli]
or [hl]
jr z, .next
dec hl
xor a
ld [hDividend + 0], a
ld a, [hli]
ld [hDividend + 1], a
ld a, [hli]
ld [hDividend + 2], a
xor a
ld [hDividend + 3], a
ld a, [hli]
ld b, a
ld a, [hld]
srl b
rr a
srl b
rr a
ld [hDivisor], a
ld b, $4
call Divide
ld a, [hQuotient + 2]
add e
ld e, a
ld a, [hQuotient + 1]
adc d
ld d, a
dec hl
.next
push de
ld de, $2f
add hl, de
pop de
dec c
jr nz, .loop2
ret
.BothSides_CheckNumberMonsAtFullHealth: ; 2b9e1
ld hl, PartyMon1HP
call .CheckFaintedOrFullHealth
jr nz, .finish ; we have a pokemon that's neither fainted nor at full health
ld hl, OTPartyMon1HP
call .CheckFaintedOrFullHealth
ld e, $1
ret
.finish
ld hl, OTPartyMon1HP
call .CheckFaintedOrFullHealth
ld e, $0
ret nz ; we both have pokemon that are neither fainted nor at full health
ld e, $2
ld a, $1
and a
ret
.CheckFaintedOrFullHealth: ; 2ba01
ld d, 3
.loop3
ld a, [hli]
ld b, a
ld a, [hli]
ld c, a
or b
jr z, .fainted_or_full_health
ld a, [hli]
cp b
ret nz
ld a, [hld]
cp c
ret nz
.fainted_or_full_health
push de
ld de, PARTYMON_STRUCT_LENGTH - 2
add hl, de
pop de
dec d
jr nz, .loop3
ret
INCLUDE "battle/link_result.asm"
ChrisBackpic: ; 2ba1a
INCBIN "gfx/misc/player.6x6.2bpp.lz"
@ -2103,78 +1941,6 @@ DisplayDexEntry: ; 4424d
String_44331: ; 44331
db "#@"
GetDexEntryPointer: ; 44333
; return dex entry pointer b:de
push hl
ld hl, PokedexDataPointerTable
ld a, b
dec a
ld d, 0
ld e, a
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
push de
rlca
rlca
and $3
ld hl, .PokedexEntryBanks
ld d, 0
ld e, a
add hl, de
ld b, [hl]
pop de
pop hl
ret
.PokedexEntryBanks: ; 44351
GLOBAL PokedexEntries1
GLOBAL PokedexEntries2
GLOBAL PokedexEntries3
GLOBAL PokedexEntries4
db BANK(PokedexEntries1)
db BANK(PokedexEntries2)
db BANK(PokedexEntries3)
db BANK(PokedexEntries4)
GetDexEntryPagePointer: ; 44355
call GetDexEntryPointer ; b:de
push hl
ld h, d
ld l, e
; skip species name
.loop1
ld a, b
call GetFarByte
inc hl
cp "@"
jr nz, .loop1
; skip height and weight
rept 4
inc hl
endr
; if c != 1: skip entry
dec c
jr z, .done
; skip entry
.loop2
ld a, b
call GetFarByte
inc hl
cp "@"
jr nz, .loop2
.done
ld d, h
ld e, l
pop hl
ret
PokedexDataPointerTable: ; 0x44378
INCLUDE "data/pokedex/entry_pointers.asm"
INCLUDE "engine/mail.asm"
@ -2505,7 +2271,7 @@ SaveMenu_LoadEDTile: ; 4cf45 (13:4f45)
and a
jp z, WaitBGMap
; The following is a modified version of Function3246.
; The following is a modified version of LoadEDTile.
ld a, [hBGMapMode]
push af
xor a
@ -2646,7 +2412,7 @@ PhoneRing_LoadEDTile: ; 4d188
cp $0
jp z, WaitBGMap
; What follows is a modified version of Function3246 (LoadEDTile).
; What follows is a modified version of LoadEDTile.
ld a, [hBGMapMode]
push af
xor a
@ -2817,304 +2583,7 @@ LinkTextbox2: ; 4d35b
jr nz, .row_loop
ret
_ResetClock: ; 4d3b1
callba BlankScreen
ld b, SCGB_08
call GetSGBLayout
call LoadStandardFont
call LoadFontsExtra
ld de, MUSIC_MAIN_MENU
call PlayMusic
ld hl, .text_askreset
call PrintText
ld hl, .NoYes_MenuDataHeader
call CopyMenuDataHeader
call VerticalMenu
ret c
ld a, [wMenuCursorY]
cp $1
ret z
call ClockResetPassword
jr c, .wrongpassword
ld a, BANK(sRTCStatusFlags)
call GetSRAMBank
ld a, $80
ld [sRTCStatusFlags], a
call CloseSRAM
ld hl, .text_okay
call PrintText
ret
.wrongpassword
ld hl, .text_wrong
call PrintText
ret
.text_okay ; 0x4d3fe
; Password OK. Select CONTINUE & reset settings.
text_jump UnknownText_0x1c55db
db "@"
.text_wrong ; 0x4d403
; Wrong password!
text_jump UnknownText_0x1c560b
db "@"
.text_askreset ; 0x4d408
; Reset the clock?
text_jump UnknownText_0x1c561c
db "@"
.NoYes_MenuDataHeader: ; 0x4d40d
db $00 ; flags
db 07, 14 ; start coords
db 11, 19 ; end coords
dw .NoYes_MenuData2
db 1 ; default option
.NoYes_MenuData2: ; 0x4d415
db $c0 ; flags
db 2 ; items
db "NO@"
db "YES@"
ClockResetPassword: ; 4d41e
call .CalculatePassword
push de
ld hl, StringBuffer2
ld bc, 5
xor a
call ByteFill
ld a, $4
ld [StringBuffer2 + 5], a
ld hl, .pleaseenterpasswordtext
call PrintText
.loop
call .updateIDdisplay
.loop2
call JoyTextDelay
ld a, [hJoyLast]
ld b, a
and A_BUTTON
jr nz, .confirm
ld a, b
and D_PAD
jr z, .loop2
call .dpadinput
ld c, 3
call DelayFrames
jr .loop
.confirm
call .ConvertDecIDToBytes
pop de
ld a, e
cp l
jr nz, .nope
ld a, d
cp h
jr nz, .nope
and a
ret
.nope
scf
ret
.pleaseenterpasswordtext ; 0x4d463
; Please enter the password.
text_jump UnknownText_0x1c562e
db "@"
.updateIDdisplay ; 4d468
hlcoord 14, 15
ld de, StringBuffer2
ld c, 5
.loop3
ld a, [de]
add "0"
ld [hli], a
inc de
dec c
jr nz, .loop3
hlcoord 14, 16
ld bc, 5
ld a, " "
call ByteFill
hlcoord 14, 16
ld a, [StringBuffer2 + 5]
ld e, a
ld d, $0
add hl, de
ld [hl], $61
ret
.dpadinput ; 4d490
ld a, b
and D_LEFT
jr nz, .left
ld a, b
and D_RIGHT
jr nz, .right
ld a, b
and D_UP
jr nz, .up
ld a, b
and D_DOWN
jr nz, .down
ret
.left
ld a, [StringBuffer2 + 5]
and a
ret z
dec a
ld [StringBuffer2 + 5], a
ret
.right
ld a, [StringBuffer2 + 5]
cp $4
ret z
inc a
ld [StringBuffer2 + 5], a
ret
.up
call .getcurrentdigit
ld a, [hl]
cp 9
jr z, .wraparound_up
inc a
ld [hl], a
ret
.wraparound_up
ld [hl], $0
ret
.down
call .getcurrentdigit
ld a, [hl]
and a
jr z, .wraparound_down
dec a
ld [hl], a
ret
.wraparound_down
ld [hl], 9
ret
.getcurrentdigit ; 4d4d5
ld a, [StringBuffer2 + 5]
ld e, a
ld d, $0
ld hl, StringBuffer2
add hl, de
ret
.ConvertDecIDToBytes: ; 4d4e0
ld hl, 0
ld de, StringBuffer2 + 4
ld bc, 1
call .ConvertToBytes
ld bc, 10
call .ConvertToBytes
ld bc, 100
call .ConvertToBytes
ld bc, 1000
call .ConvertToBytes
ld bc, 10000
.ConvertToBytes: ; 4d501
ld a, [de]
dec de
push hl
ld hl, 0
call AddNTimes
ld c, l
ld b, h
pop hl
add hl, bc
ret
.CalculatePassword: ; 4d50f
ld a, BANK(sPlayerData)
call GetSRAMBank
ld de, 0
ld hl, sPlayerData + (PlayerID - wPlayerData)
ld c, $2
call .ComponentFromNumber
ld hl, sPlayerData + (PlayerName - wPlayerData)
ld c, $5 ; PLAYER_NAME_LENGTH_J
call .ComponentFromString
ld hl, sPlayerData + (Money - wPlayerData)
ld c, $3
call .ComponentFromNumber
call CloseSRAM
ret
.ComponentFromNumber: ; 4d533
ld a, [hli]
add e
ld e, a
ld a, $0
adc d
ld d, a
dec c
jr nz, .ComponentFromNumber
ret
.ComponentFromString: ; 4d53e
ld a, [hli]
cp "@"
ret z
add e
ld e, a
ld a, $0
adc d
ld d, a
dec c
jr nz, .ComponentFromString
ret
_DeleteSaveData: ; 4d54c
callba BlankScreen
ld b, SCGB_08
call GetSGBLayout
call LoadStandardFont
call LoadFontsExtra
ld de, MUSIC_MAIN_MENU
call PlayMusic
ld hl, .Text_ClearAllSaveData
call PrintText
ld hl, .NoYesMenuDataHeader
call CopyMenuDataHeader
call VerticalMenu
ret c
ld a, [wMenuCursorY]
cp $1
ret z
callba EmptyAllSRAMBanks
ret
.Text_ClearAllSaveData: ; 0x4d580
; Clear all save data?
text_jump UnknownText_0x1c564a
db "@"
.NoYesMenuDataHeader: ; 0x4d585
db $00 ; flags
db 07, 14 ; start coords
db 11, 19 ; end coords
dw .MenuData2
db 1 ; default option
.MenuData2: ; 0x4d58d
db $c0 ; flags
db 2 ; items
db "NO@"
db "YES@"
INCLUDE "engine/delete_save_change_clock.asm"
Tilesets::
INCLUDE "tilesets/tileset_headers.asm"
@ -3587,7 +3056,7 @@ CheckPartyFullAfterContest: ; 4d9e5
ld de, wBufferMonOT
ld bc, NAME_LENGTH
call CopyBytes
callab Function51322
callab InsertPokemonIntoBox
ld a, [CurPartySpecies]
ld [wd265], a
call GetPokemonName
@ -3730,141 +3199,7 @@ SetEggMonCaughtData: ; 4dbb8 (13:5bb8)
ld [CurPartyLevel], a
ret
_FindGreaterThanThatLevel: ; 4dbd2
ld hl, PartyMon1Level
call FindGreaterThanThatLevel
ret
_FindAtLeastThatHappy: ; 4dbd9
ld hl, PartyMon1Happiness
call FindAtLeastThatHappy
ret
_FindThatSpecies: ; 4dbe0
ld hl, PartyMon1Species
jp FindThatSpecies
_FindThatSpeciesYourTrainerID: ; 4dbe6
ld hl, PartyMon1Species
call FindThatSpecies
ret z
ld a, c
ld hl, PartyMon1ID
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld a, [PlayerID]
cp [hl]
jr nz, .nope
inc hl
ld a, [PlayerID + 1]
cp [hl]
jr nz, .nope
ld a, $1
and a
ret
.nope
xor a
ret
FindAtLeastThatHappy: ; 4dc0a
; Sets the bits for the Pokemon that have a happiness greater than or equal to b.
; The lowest bits are used. Sets z if no Pokemon in your party is at least that happy.
ld c, $0
ld a, [PartyCount]
ld d, a
.loop
ld a, d
dec a
push hl
push bc
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
pop bc
ld a, b
cp [hl]
pop hl
jr z, .greater_equal
jr nc, .lower
.greater_equal
ld a, c
or $1
ld c, a
.lower
sla c
dec d
jr nz, .loop
call RetroactivelyIgnoreEggs
ld a, c
and a
ret
FindGreaterThanThatLevel: ; 4dc31
ld c, $0
ld a, [PartyCount]
ld d, a
.loop
ld a, d
dec a
push hl
push bc
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
pop bc
ld a, b
cp [hl]
pop hl
jr c, .greater
ld a, c
or $1
ld c, a
.greater
sla c
dec d
jr nz, .loop
call RetroactivelyIgnoreEggs
ld a, c
and a
ret
FindThatSpecies: ; 4dc56
; Find species b in your party.
; If you have no Pokemon, returns c = -1 and z.
; If that species is in your party, returns its location in c, and nz.
; Otherwise, returns z.
ld c, -1
ld hl, PartySpecies
.loop
ld a, [hli]
cp -1
ret z
inc c
cp b
jr nz, .loop
ld a, $1
and a
ret
RetroactivelyIgnoreEggs: ; 4dc67
ld e, -2
ld hl, PartySpecies
.loop
ld a, [hli]
cp -1
ret z
cp EGG
jr nz, .skip_notegg
ld a, c
and e
ld c, a
.skip_notegg
rlc e
jr .loop
INCLUDE "engine/search2.asm"
INCLUDE "engine/stats_screen.asm"
CatchTutorial:: ; 4e554
@ -5303,141 +4638,7 @@ _SwitchPartyMons:
ret
INCLUDE "gfx/load_pics.asm"
Function51322: ; 51322
ld a, BANK(sBoxCount)
call GetSRAMBank
ld hl, sBoxCount
call Function513cb
ld a, [sBoxCount]
dec a
ld [wd265], a
ld hl, sBoxMonNicknames
ld bc, PKMN_NAME_LENGTH
ld de, wBufferMonNick
call Function513e0
ld a, [sBoxCount]
dec a
ld [wd265], a
ld hl, sBoxMonOT
ld bc, NAME_LENGTH
ld de, wBufferMonOT
call Function513e0
ld a, [sBoxCount]
dec a
ld [wd265], a
ld hl, sBoxMons
ld bc, BOXMON_STRUCT_LENGTH
ld de, wBufferMon
call Function513e0
ld hl, wBufferMonMoves
ld de, TempMonMoves
ld bc, NUM_MOVES
call CopyBytes
ld hl, wBufferMonPP
ld de, TempMonPP
ld bc, NUM_MOVES
call CopyBytes
ld a, [CurPartyMon]
ld b, a
callba Functiondcb6
jp CloseSRAM
Function5138b: ; 5138b
ld hl, PartyCount
call Function513cb
ld a, [PartyCount]
dec a
ld [wd265], a
ld hl, PartyMonNicknames
ld bc, PKMN_NAME_LENGTH
ld de, wBufferMonNick
call Function513e0
ld a, [PartyCount]
dec a
ld [wd265], a
ld hl, PartyMonOT
ld bc, NAME_LENGTH
ld de, wBufferMonOT
call Function513e0
ld a, [PartyCount]
dec a
ld [wd265], a
ld hl, PartyMons
ld bc, PARTYMON_STRUCT_LENGTH
ld de, wBufferMon
call Function513e0
ret
Function513cb: ; 513cb
inc [hl]
inc hl
ld a, [CurPartyMon]
ld c, a
ld b, 0
add hl, bc
ld a, [CurPartySpecies]
ld c, a
.asm_513d8
ld a, [hl]
ld [hl], c
inc hl
inc c
ld c, a
jr nz, .asm_513d8
ret
Function513e0: ; 513e0
push de
push hl
push bc
ld a, [wd265]
dec a
call AddNTimes
push hl
add hl, bc
ld d, h
ld e, l
pop hl
.asm_513ef
push bc
ld a, [wd265]
ld b, a
ld a, [CurPartyMon]
cp b
pop bc
jr z, .asm_51415
push hl
push de
push bc
call CopyBytes
pop bc
pop de
pop hl
push hl
ld a, l
sub c
ld l, a
ld a, h
sbc b
ld h, a
pop de
ld a, [wd265]
dec a
ld [wd265], a
jr .asm_513ef
.asm_51415
pop bc
pop hl
ld a, [CurPartyMon]
call AddNTimes
ld d, h
ld e, l
pop hl
call CopyBytes
ret
INCLUDE "engine/move_mon_wo_mail.asm"
BaseData::
INCLUDE "data/base_stats.asm"
@ -5895,7 +5096,7 @@ LoadPoisonBGPals: ; cbcdd
ld a, [hCGB]
and a
ret nz
ret
ret ; ????
.LoadPals: ; cbce5
ld a, [hCGB]
@ -5904,9 +5105,9 @@ LoadPoisonBGPals: ; cbcdd
ld a, [TimeOfDayPal]
and $3
cp $3
ld a, $0
ld a, %00000000
jr z, .convert_pals
ld a, $aa
ld a, %10101010
.convert_pals
call DmgToCgbBGPals

View File

@ -61,9 +61,8 @@ ENDC
.okay2
push af
rept 2
add hl, bc
endr
add hl, bc
ld a, [hli]
ld c, a
ld a, [hl]
@ -72,9 +71,8 @@ endr
pop af
ld c, a
ld b, 0
rept 2
add hl, bc
endr
add hl, bc
ld a, [hli]
ld c, a
ld a, [hl]

View File

@ -217,9 +217,8 @@ _BattleTowerBattle: ; 17022c
ld e, a
ld d, 0
ld hl, .dw
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -459,9 +458,8 @@ endr
ld a, POUND
ld [hli], a
xor a
rept 2
ld [hli], a
endr
ld [hli], a
ld [hl], a
jr .done_moves
@ -489,9 +487,8 @@ endr
predef CalcPkmnStats
pop de
pop hl
rept 2
dec de
endr
dec de
ld a, [hli]
ld [de], a
inc de
@ -690,9 +687,8 @@ Function1704e1: ; 1704e1
ld e, a
ld d, 0
ld hl, .dw
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -908,9 +904,8 @@ endr
ld [hli], a
dec c
jr nz, .clearbox_column
rept 2
inc hl
endr
inc hl
dec b
jr nz, .clearbox_row
ret
@ -947,9 +942,8 @@ BattleTowerAction: ; 170687
ld e, a
ld d, 0
ld hl, .dw
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -1393,9 +1387,8 @@ rept 4
dec hl
endr
ld a, "@"
rept 2
ld [hli], a
endr
ld [hli], a
pop hl
ld a, EGG_TICKET
ld [CurItem], a
@ -1445,9 +1438,8 @@ Function1709bb: ; 1709bb (5c:49bb) BattleTowerAction $10
ld e, a
ld d, 0
ld hl, Jumptable_1709e7
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a

View File

@ -682,15 +682,13 @@ Function17aaa9: ; 17aaa9 (5e:6aa9)
Function17aac3: ; 17aac3 (5e:6ac3)
ld a, $b
push hl
rept 2
ld [hli], a
endr
ld [hli], a
pop hl
ld de, SCREEN_WIDTH
add hl, de
rept 2
ld [hli], a
endr
ld [hli], a
ret
Function17aad0: ; 17aad0 (5e:6ad0)

View File

@ -616,9 +616,8 @@ Function4abc3: ; 4abc3
ld a, [wMenuCursorY]
ld [wMenuCursorY], a
ld a, [PartyCount]
rept 2
inc a
endr
inc a
ld b, a
ld a, [wMenuCursorY]
cp b

View File

@ -669,9 +669,8 @@ Function894dc: ; 894dc
ld c, d
ld b, 0
ld hl, .PalettePointers
rept 2
add hl, bc
endr
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@ -787,9 +786,8 @@ Function8956f: ; 8956f
ld a, [TrainerClass]
ld h, 0
ld l, a
rept 2
add hl, hl
endr
add hl, hl
ld de, TrainerPalettes
add hl, de
ld a, [rSVBK]
@ -1043,9 +1041,8 @@ Function896eb: ; 896eb
Function896f5: ; 896f5
call Function8971f
call Function89736
rept 2
inc hl
endr
inc hl
ld b, 2
ClearScreenArea: ; 0x896ff
@ -1071,9 +1068,8 @@ ClearScreenArea: ; 0x896ff
jr nz, .loop
dec hl
rept 2
inc c
endr
inc c
.asm_89713
ld a, $36
ld [hli], a
@ -1107,9 +1103,8 @@ Function8971f: ; 8971f
Function89736: ; 89736
push hl
rept 2
inc hl
endr
inc hl
ld e, c
ld d, $0
add hl, de
@ -1145,9 +1140,8 @@ Function8975b: ; 8975b
ld [hli], a
ld a, $d
ld [hl], a
rept 2
dec hl
endr
dec hl
ld a, $4
ld e, $3
.asm_89769
@ -1912,9 +1906,8 @@ Function89b97: ; 89b97 (22:5b97)
and a
jr z, .asm_89bae
.asm_89ba9
rept 2
inc hl
endr
inc hl
dec a
jr nz, .asm_89ba9
.asm_89bae
@ -2523,9 +2516,8 @@ Function89f77: ; 89f77 (22:5f77)
ld [hli], a
ld a, c
ld [hli], a
rept 2
inc hl
endr
inc hl
ld a, $8
add c
ld c, a

View File

@ -314,9 +314,8 @@ Function8b4d8: ; 8b4d8 (22:74d8)
ld hl, Unknown_8b529
call Function8b50a
push hl
rept 2
inc hl
endr
inc hl
ld a, [hli]
ld b, a
ld a, [hl]
@ -331,9 +330,8 @@ Function8b4ea: ; 8b4ea (22:74ea)
ld hl, Unknown_8b529
call Function8b50a
push hl
rept 2
inc hl
endr
inc hl
ld a, [hli]
ld b, a
ld a, [hl]
@ -698,12 +696,10 @@ Function8b73e: ; 8b73e
Function8b744: ; 8b744
ld de, AttrMap - TileMap
add hl, de
rept 2
inc b
endr
rept 2
inc b
inc c
inc c
endr
xor a
.asm_8b74d
push bc
@ -975,9 +971,8 @@ Function8b8c8: ; 8b8c8
ld b, 0
ld c, a
ld hl, Unknown_8b903
rept 2
add hl, bc
endr
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a

View File

@ -609,9 +609,8 @@ _MobilePrintNum:: ; 1061ef
rept 3
inc de
endr
rept 2
dec a
endr
dec a
.digit_loop
push af

View File

@ -372,9 +372,8 @@ MobileTradeAnim_JumptableLoop: ; 10824b
ld e, a
ld d, 0
ld hl, .Jumptable
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -955,9 +954,8 @@ MobileTradeAnim_GiveTrademon1: ; 108763
ld a, [hSCX]
cp $e0
jr z, .loop2
rept 2
dec a
endr
dec a
ld [hSCX], a
cp $f8
jr nz, .next
@ -974,9 +972,8 @@ endr
ld a, [hSCY]
cp $f8
jr z, .done
rept 2
dec a
endr
dec a
ld [hSCY], a
cp $40
jr z, .init
@ -1125,9 +1122,8 @@ MobileTradeAnim_GetTrademon2: ; 108894
ld a, [hSCY]
cp $78
jr z, .asm_1088ee
rept 2
inc a
endr
inc a
ld [hSCY], a
cp $30
jr z, .asm_1088c5
@ -1166,9 +1162,8 @@ endr
ld a, [hSCX]
cp $c
jr z, .asm_108906
rept 2
inc a
endr
inc a
ld [hSCX], a
cp -8
jr nz, .asm_1088e7

View File

@ -153,9 +153,8 @@ Function114243:: ; 114243
Function11425c: ; 11425c
ld [$dc02], a
pop af
rept 2
ld [hFF8C], a
endr
ld [hFF8C], a
ld [MBC3SRamBank], a
ret
@ -632,9 +631,8 @@ Function1144c8: ; 1144c8
Function1144d1: ; 1144d1
call Function114561
rept 2
dec de
endr
dec de
push de
rept 3
inc de
@ -1006,9 +1004,8 @@ Function1146a4: ; 1146a4
and a
jr nz, .asm_1146e8
.asm_1146da
rept 2
dec bc
endr
dec bc
call Function1149cc
and a
jr nz, .asm_1146e4
@ -1095,9 +1092,8 @@ Function1146fa: ; 1146fa
ld a, [$dc0e]
cp $3
jr nz, .asm_114773
rept 2
dec bc
endr
dec bc
.asm_114773
call Function1149cc
@ -2069,9 +2065,8 @@ Function114c5e: ; 114c5e
inc de
cp $3f
jr nz, .asm_114c62
rept 2
dec de
endr
dec de
.asm_114c75
ld a, [hli]
cp $3f
@ -2091,9 +2086,8 @@ endr
ld a, [hli]
cp $3d
jr nz, .asm_114c84
rept 2
dec bc
endr
dec bc
ld a, l
ld [$dc03], a
ld a, h
@ -2360,9 +2354,8 @@ Function114d99: ; 114d99
add hl, de
ld b, h
ld c, l
rept 2
inc bc
endr
inc bc
xor a
ret
@ -2563,9 +2556,8 @@ Function114ee9: ; 114ee9
ld a, b
ld [hli], a
ld a, c
rept 2
ld [hli], a
endr
ld [hli], a
ld a, [de]
ld [hli], a
inc de
@ -2970,9 +2962,8 @@ Function1150b3: ; 1150b3
.asm_11510b
pop hl
rept 2
dec hl
endr
dec hl
push de
call Function1158c2
pop de
@ -3499,9 +3490,8 @@ Function1153b5: ; 1153b5
ld e, [hl]
inc hl
ld d, [hl]
rept 2
inc hl
endr
inc hl
ld a, [de]
ld [hli], a
inc de
@ -4523,9 +4513,8 @@ endr
ld a, $3f
and c
ld [hld], a
rept 2
dec hl
endr
dec hl
pop de
ld b, h
ld c, l
@ -4581,9 +4570,8 @@ endr
ld a, [hli]
ld c, a
ld b, [hl]
rept 2
inc bc
endr
inc bc
ld a, b
ld [hld], a
ld [hl], c
@ -4864,9 +4852,8 @@ Function115b00: ; 115b00
ld a, [wStartDay]
cp $4
jr z, .asm_115b43
rept 2
inc hl
endr
inc hl
jr .asm_115b43
.asm_115b36
@ -5048,9 +5035,8 @@ Function115bc8: ; 115bc8
ret
.asm_115c33
rept 2
dec hl
endr
dec hl
xor a
ld [hl], a
ld a, $1
@ -5406,9 +5392,8 @@ Function11659d: ; 11659d
ld e, a
ld d, 0
ld hl, Jumptable_1165af
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -6941,9 +6926,8 @@ Function117719: ; 117719 (45:7719)
ld e, a
ld d, 0
ld hl, Jumptable_117728
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -7430,9 +7414,8 @@ Function117ae9: ; 0x117ae9
ld e, a
ld d, $0
ld hl, .Jumptable
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a

View File

@ -375,9 +375,8 @@ Function1161b8: ; 1161b8
ld e, a
ld d, 0
ld hl, .Jumptable
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a

View File

@ -356,9 +356,8 @@ Function16c943: ; 16c943
call Function16cae8
.asm_16c9e1
rept 2
inc e
endr
inc e
ld a, e
cp $8
jr nz, .asm_16c969
@ -459,9 +458,8 @@ Function16ca11: ; 16ca11
call Function16cae8
.asm_16ca88
rept 2
inc e
endr
inc e
ld a, e
cp $8
jr nz, .asm_16ca28

View File

@ -111,9 +111,8 @@ Function170c06: ; 170c06
inc [hl]
.asm_170c15
rept 2
inc hl
endr
inc hl
ld a, [$a89b]
add [hl]
ld [hld], a
@ -138,9 +137,8 @@ endr
ld a, [hli]
ld b, a
ld c, [hl]
rept 2
inc hl
endr
inc hl
ld a, [hld]
sub c
ld c, a
@ -370,9 +368,8 @@ Function171a36: ; 171a36 (5c:5a36)
ld e, a
ld d, 0
ld hl, Jumptable_171a45
rept 2
add hl, de
endr
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@ -732,9 +729,8 @@ Function171ccd: ; 171ccd (5c:5ccd)
Function171cf0: ; 171cf0 (5c:5cf0)
xor a
hlcoord 4, 15
rept 2
ld [hli], a
endr
ld [hli], a
ld a, [wcd4b]
xor $1
ld [wcd4b], a

View File

@ -58,7 +58,7 @@ Predef_LoadSGBLayoutCGB: ; 8d59
dw _CGB_PokedexUnownMode
dw _CGB17
dw _CGB18
dw _CGB19
dw _CGB_GamefreakLogo ; called before copyright
dw _CGB1a
dw _CGB1b
dw _CGB_FrontpicPals
@ -1002,7 +1002,7 @@ _CGB13: ; 94d0
ret
; 94fa
_CGB19: ; 94fa
_CGB_GamefreakLogo: ; 94fa
ld de, UnknBGPals
ld a, $4e
call GetPredefPal

View File

@ -75,9 +75,8 @@ Predef_LoadSGBLayout: ; 864c
ld a, [PlayerHPPal]
ld l, a
ld h, 0
rept 2
add hl, hl
endr
add hl, hl
ld de, Palettes_a8be
add hl, de
@ -93,9 +92,8 @@ endr
ld a, [EnemyHPPal]
ld l, a
ld h, 0
rept 2
add hl, hl
endr
add hl, hl
ld de, Palettes_a8be
add hl, de
@ -148,9 +146,8 @@ endr
ld hl, wSGBPals + 1
ld [hl], $10
rept 2
inc hl
endr
inc hl
ld a, [PlayerHPPal]
add $2f
@ -174,9 +171,8 @@ endr
ld a, [wcda1]
ld l, a
ld h, 0
rept 2
add hl, hl
endr
add hl, hl
ld de, Palettes_a8be
add hl, de
ld a, [hli]

Some files were not shown because too many files have changed in this diff Show More