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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -45,9 +45,8 @@ HiddenPowerDamage: ; fbced
; Multiply by 5 ; Multiply by 5
ld b, a ld b, a
rept 2
add a add a
endr add a
add b add b
; Add Special & 3 ; Add Special & 3
@ -75,9 +74,8 @@ endr
ld a, [hl] ld a, [hl]
and 3 << 4 and 3 << 4
swap a swap a
rept 2
add a add a
endr add a
or b or b
; Skip Normal ; 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 ; hl = de * 10
ld h, d ld h, d
ld l, e ld l, e
rept 2
add hl, hl add hl, hl
endr add hl, hl
add hl, de add hl, de
add hl, hl add hl, hl

View File

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

View File

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

View File

@ -24,7 +24,7 @@
const SCGB_POKEDEX_UNOWN_MODE const SCGB_POKEDEX_UNOWN_MODE
const SCGB_17 const SCGB_17
const SCGB_18 const SCGB_18
const SCGB_19 const SCGB_GAMEFREAK_LOGO
const SCGB_1A const SCGB_1A
const SCGB_1B const SCGB_1B
const SCGB_FRONTPICPALS 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. ; Pointers to all the Pokedex entries.
dw BulbasaurPokedexEntry dw BulbasaurPokedexEntry

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -654,7 +654,7 @@ SentGetPkmnIntoFromBox: ; db3f
ld a, [sBoxCount] ld a, [sBoxCount]
dec a dec a
ld b, a ld b, a
call Functiondcb6 call RestorePPofDepositedPokemon
.CloseSRAM_And_ClearCarryFlag: .CloseSRAM_And_ClearCarryFlag:
call CloseSRAM call CloseSRAM
and a and a
@ -667,7 +667,7 @@ CloseSRAM_And_SetCarryFlag: ; dcb1
ret ret
; dcb6 ; dcb6
Functiondcb6: ; dcb6 RestorePPofDepositedPokemon: ; dcb6
ld a, b ld a, b
ld hl, sBoxMons ld hl, sBoxMons
ld bc, BOXMON_STRUCT_LENGTH ld bc, BOXMON_STRUCT_LENGTH
@ -696,10 +696,10 @@ Functiondcb6: ; dcb6
ld a, [MonType] ld a, [MonType]
push af push af
ld b, 0 ld b, 0
.asm_dcec .loop
ld a, [hli] ld a, [hli]
and a and a
jr z, .asm_dd18 jr z, .done
ld [TempMonMoves], a ld [TempMonMoves], a
ld a, BOXMON ld a, BOXMON
ld [MonType], a ld [MonType], a
@ -722,9 +722,9 @@ Functiondcb6: ; dcb6
inc b inc b
ld a, b ld a, b
cp NUM_MOVES cp NUM_MOVES
jr c, .asm_dcec jr c, .loop
.asm_dd18 .done
pop af pop af
ld [MonType], a ld [MonType], a
pop af pop af
@ -1025,7 +1025,7 @@ SentPkmnIntoBox: ; de6e
call CopyBytes call CopyBytes
ld b, 0 ld b, 0
call Functiondcb6 call RestorePPofDepositedPokemon
call CloseSRAM call CloseSRAM
scf 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 e, a
ld d, 0 ld d, 0
ld hl, .Jumptable ld hl, .Jumptable
rept 2
add hl, de add hl, de
endr add hl, de
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
ld l, a ld l, a
@ -401,9 +400,8 @@ NamingScreenJoypadLoop: ; 11915
ld e, a ld e, a
ld d, $0 ld d, $0
ld hl, .Jumptable ld hl, .Jumptable
rept 2
add hl, de add hl, de
endr add hl, de
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
ld l, a ld l, a
@ -662,9 +660,8 @@ NamingScreen_AnimateCursor: ; 11a3b (4:5a3b)
jr nz, .asm_11ade jr nz, .asm_11ade
ld a, $4 ld a, $4
.asm_11ade .asm_11ade
rept 2
dec a dec a
endr dec a
ld e, a ld e, a
add a add a
add e add e
@ -1164,9 +1161,8 @@ INCBIN "gfx/icon/mail2.2bpp"
ld e, a ld e, a
ld d, 0 ld d, 0
ld hl, .Jumptable ld hl, .Jumptable
rept 2
add hl, de add hl, de
endr add hl, de
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
ld l, a ld l, a
@ -1391,9 +1387,8 @@ ComposeMail_AnimateCursor: ; 120c1 (4:60c1)
jr nz, .wrap_around_command_left jr nz, .wrap_around_command_left
ld a, $4 ld a, $4
.wrap_around_command_left .wrap_around_command_left
rept 2
dec a dec a
endr dec a
ld e, a ld e, a
add a add a
add e add e
@ -1476,9 +1471,8 @@ MailComposition_TryAddLastCharacter: ; 121ac (4:61ac)
jr nz, .asm_121c3 jr nz, .asm_121c3
push hl push hl
ld hl, wNamingScreenCurrNameLength ld hl, wNamingScreenCurrNameLength
rept 2
dec [hl] dec [hl]
endr dec [hl]
jr .asm_121c8 jr .asm_121c8
.asm_121c3 .asm_121c3

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -35,9 +35,8 @@ GetTimeOfDay:: ; 14032
cp [hl] cp [hl]
jr c, .match jr c, .match
; else, get the next entry ; else, get the next entry
rept 2
inc hl inc hl
endr inc hl
; try again ; try again
jr .check 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 inc hl
ld e, a ld e, a
ld d, 0 ld d, 0
rept 2
add hl, de add hl, de
endr add hl, de
call .IsSameItem call .IsSameItem
jr c, .NoRegisteredItem jr c, .NoRegisteredItem
and a and a
@ -71,9 +70,8 @@ endr
inc hl inc hl
ld e, a ld e, a
ld d, 0 ld d, 0
rept 2
add hl, de add hl, de
endr add hl, de
call .IsSameItem call .IsSameItem
jr c, .NoRegisteredItem jr c, .NoRegisteredItem
ret ret

View File

@ -556,8 +556,8 @@ SpriteAnimSeqData: ; 8d1c4
db SPRITE_ANIM_FRAMESET_07, SPRITE_ANIM_SEQ_04, $00 ; 01 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_08, SPRITE_ANIM_SEQ_05, $05 ; 02
db SPRITE_ANIM_FRAMESET_GAMEFREAK_LOGO, SPRITE_ANIM_SEQ_GAMEFREAK_LOGO, $00 ; 03 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_0B, SPRITE_ANIM_SEQ_07, $06 ; 04 gs intro star
db SPRITE_ANIM_FRAMESET_0C, SPRITE_ANIM_SEQ_08, $06 ; 05 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_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_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 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 inc a
ld d, a ld d, a
callba CalcExpAtLevel callba CalcExpAtLevel
rept 2
ld hl, TempMonExp + 2 ld hl, TempMonExp + 2
endr ld hl, TempMonExp + 2
ld a, [hQuotient + 2] ld a, [hQuotient + 2]
sub [hl] sub [hl]
dec hl dec hl
@ -660,9 +659,8 @@ endr
.AlreadyAtMaxLevel: .AlreadyAtMaxLevel:
ld hl, Buffer1 ; wd1ea (aliases: MagikarpLength) ld hl, Buffer1 ; wd1ea (aliases: MagikarpLength)
xor a xor a
rept 2
ld [hli], a ld [hli], a
endr ld [hli], a
ld [hl], a ld [hl], a
ret ret
; 4e119 (13:6119) ; 4e119 (13:6119)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

819
main.asm
View File

@ -1174,169 +1174,7 @@ Function29fe4: ; unreferenced
ret ret
INCLUDE "engine/wildmons.asm" INCLUDE "engine/wildmons.asm"
INCLUDE "battle/link_result.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
ChrisBackpic: ; 2ba1a ChrisBackpic: ; 2ba1a
INCBIN "gfx/misc/player.6x6.2bpp.lz" INCBIN "gfx/misc/player.6x6.2bpp.lz"
@ -2103,78 +1941,6 @@ DisplayDexEntry: ; 4424d
String_44331: ; 44331 String_44331: ; 44331
db "#@" 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 "data/pokedex/entry_pointers.asm"
INCLUDE "engine/mail.asm" INCLUDE "engine/mail.asm"
@ -2505,7 +2271,7 @@ SaveMenu_LoadEDTile: ; 4cf45 (13:4f45)
and a and a
jp z, WaitBGMap jp z, WaitBGMap
; The following is a modified version of Function3246. ; The following is a modified version of LoadEDTile.
ld a, [hBGMapMode] ld a, [hBGMapMode]
push af push af
xor a xor a
@ -2646,7 +2412,7 @@ PhoneRing_LoadEDTile: ; 4d188
cp $0 cp $0
jp z, WaitBGMap jp z, WaitBGMap
; What follows is a modified version of Function3246 (LoadEDTile). ; What follows is a modified version of LoadEDTile.
ld a, [hBGMapMode] ld a, [hBGMapMode]
push af push af
xor a xor a
@ -2817,304 +2583,7 @@ LinkTextbox2: ; 4d35b
jr nz, .row_loop jr nz, .row_loop
ret ret
_ResetClock: ; 4d3b1 INCLUDE "engine/delete_save_change_clock.asm"
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@"
Tilesets:: Tilesets::
INCLUDE "tilesets/tileset_headers.asm" INCLUDE "tilesets/tileset_headers.asm"
@ -3587,7 +3056,7 @@ CheckPartyFullAfterContest: ; 4d9e5
ld de, wBufferMonOT ld de, wBufferMonOT
ld bc, NAME_LENGTH ld bc, NAME_LENGTH
call CopyBytes call CopyBytes
callab Function51322 callab InsertPokemonIntoBox
ld a, [CurPartySpecies] ld a, [CurPartySpecies]
ld [wd265], a ld [wd265], a
call GetPokemonName call GetPokemonName
@ -3730,141 +3199,7 @@ SetEggMonCaughtData: ; 4dbb8 (13:5bb8)
ld [CurPartyLevel], a ld [CurPartyLevel], a
ret ret
_FindGreaterThanThatLevel: ; 4dbd2 INCLUDE "engine/search2.asm"
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/stats_screen.asm" INCLUDE "engine/stats_screen.asm"
CatchTutorial:: ; 4e554 CatchTutorial:: ; 4e554
@ -5303,141 +4638,7 @@ _SwitchPartyMons:
ret ret
INCLUDE "gfx/load_pics.asm" INCLUDE "gfx/load_pics.asm"
INCLUDE "engine/move_mon_wo_mail.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
BaseData:: BaseData::
INCLUDE "data/base_stats.asm" INCLUDE "data/base_stats.asm"
@ -5895,7 +5096,7 @@ LoadPoisonBGPals: ; cbcdd
ld a, [hCGB] ld a, [hCGB]
and a and a
ret nz ret nz
ret ret ; ????
.LoadPals: ; cbce5 .LoadPals: ; cbce5
ld a, [hCGB] ld a, [hCGB]
@ -5904,9 +5105,9 @@ LoadPoisonBGPals: ; cbcdd
ld a, [TimeOfDayPal] ld a, [TimeOfDayPal]
and $3 and $3
cp $3 cp $3
ld a, $0 ld a, %00000000
jr z, .convert_pals jr z, .convert_pals
ld a, $aa ld a, %10101010
.convert_pals .convert_pals
call DmgToCgbBGPals call DmgToCgbBGPals

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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