.thumb
.thumb_func
.equ GriseousIndex, 0x1AA
.equ GiratinaIndex, 0x21C
.equ GiratinaOIndex, 0x483
.equ ArceusNormal, 0x222
.equ FistPlateIndex, 0x1AB
.equ ArceusFight, 0x484
.equ SkyPlateIndex, 0x1AC
.equ ArceusFly, 0x485
.equ ToxicPlateIndex, 0x1AD
.equ ArceusPoison, 0x486
.equ EarthPlateIndex, 0x1AE
.equ ArceusGround, 0x487
.equ StonePlateIndex, 0x1AF
.equ ArceusRock, 0x488
.equ InsectPlateIndex, 0x1B0
.equ ArceusBug, 0x489
.equ SpookyPlateIndex, 0x1B1
.equ ArceusGhost, 0x48A
.equ IronPlateIndex, 0x1B2
.equ ArceusSteel, 0x48B
.equ FlamePlateIndex, 0x1B3
.equ ArceusFire, 0x48C
.equ SplashPlateIndex, 0x1B4
.equ ArceusWater, 0x48D
.equ ZapPlateIndex, 0x1B5
.equ ArceusElectric, 0x48E
.equ MeadowPlateIndex, 0x1B6
.equ ArceusGrass, 0x48F
.equ IciclePlateIndex, 0x1B7
.equ ArceusIce, 0x490
.equ DracoPlateIndex, 0x1B8
.equ ArceusDragon, 0x491
.equ DreadPlateIndex, 0x1B9
.equ ArceusDark, 0x492
.equ MindPlateIndex, 0x1BA
.equ ArceusPsychic, 0x493
.equ PixiPlateIndex, 0x1BD
.equ ArceusFairy, 0x4AA
.equ FightingMemoryIndex, 0x1AB
.equ SilvallyNormal, 0x33F
.equ SilvallyFight, 0x4AB
.equ FlyingMemoryIndex, 0x1AC
.equ SilvallyNormal, 0x33F
.equ SilvallyFly, 0x4AC
.equ PoisonMemoryIndex, 0x1AD
.equ SilvallyNormal, 0x33F
.equ SilvallyPoison, 0x4AD
.equ GroundMemoryIndex, 0x1AE
.equ SilvallyNormal, 0x33F
.equ SilvallyGround, 0x4AE
.equ RockMemoryIndex, 0x1AF
.equ SilvallyNormal, 0x33F
.equ SilvallyRock, 0x4AF
.equ BugMemoryIndex, 0x1B0
.equ SilvallyNormal, 0x33F
.equ SilvallyBug, 0x4B0
.equ GhostMemoryIndex, 0x1B1
.equ SilvallyNormal, 0x33F
.equ SilvallyGhost, 0x4B1
.equ SteelMemoryIndex, 0x1B2
.equ SilvallyNormal, 0x33F
.equ SilvallySteel, 0x4B2
.equ FireMemoryIndex, 0x1B3
.equ SilvallyNormal, 0x33F
.equ SilvallyFire, 0x4B3
.equ WaterMemoryIndex, 0x1B4
.equ SilvallyNormal, 0x33F
.equ SilvallyWater, 0x4B4
.equ ElectricMemoryIndex, 0x1B5
.equ SilvallyNormal, 0x33F
.equ SilvallyElectric, 0x4B5
.equ GrassMemoryIndex, 0x1B6
.equ SilvallyNormal, 0x33F
.equ SilvallyGrass, 0x4B6
.equ IceMemoryIndex, 0x1B7
.equ SilvallyNormal, 0x33F
.equ SilvallyIce, 0x4B7
.equ DragonMemoryIndex, 0x1B8
.equ SilvallyNormal, 0x33F
.equ SilvallyDragon, 0x4B8
.equ DarkMemoryIndex, 0x1B9
.equ SilvallyNormal, 0x33F
.equ SilvallyDark, 0x4B9
.equ PsychicMemoryIndex, 0x1BA
.equ SilvallyNormal, 0x33F
.equ SilvallyPsychic, 0x4BA
.equ FairyMemory, 0x1BD
.equ SilvallyNormal, 0x33F
.equ SilvallyFairy, 0x4BB
Start:
ldrb r1, [r4]
ldrb r0, [r4, #1]
lsl r0, r0, #8
add r1, r1, r0
mov r0, r8
strh r1, [r0, #2]
push {r0-r7}
Initialising:
ldrh r2, [r0]
ldr r6, GiratinaO
cmp r2, r6
beq GrisCheck
ldr r6, Giratina
cmp r2, r6
beq GrisCheck2
LoadGivenItem:
mov r6, #6
adr r5, Table
add r5, #4
mov r7, r1
bl LoopLoad
cmp r6, #0
bne ItemInTable
ItemNotInTable:
adr r5, Table
add r5, #6
mov r6, #6
mov r7, r2
bl LoopLoad
cmp r6, #1
bne Return
ldrh r4, [r5, #2]
b Changing
GrisCheck:
ldr r6, GriseousOrb
cmp r1, r6
beq LoadGivenItem
ldr r4, Giratina
b Changing
GrisCheck2:
ldr r6, GriseousOrb
cmp r1, r6
bne LoadGivenItem
ldr r4, GiratinaO
b Changing
ItemInTable:
ldrh r3, [r5, #2]
mov r7, r2
mov r6, #6
adr r5, Table
bl LoopLoad
cmp r6, #1
bne Return
mov r4, r3
b Changing
Return:
pop {r0-r7}
Return3:
ldr r0, Back
bx r0
Return2:
ldr r0, Back2
bx r0
Changing:
strh r4, [r0]
pop {r0-r7}
ldr r3, Limit
cmp r0, r3
bhi Return3
mov r0, r7
ldr r3, pokemon_calc_checksum
bl Call
strh r0, [r7, #0x1C]
mov r0, r7
ldr r3, pokemon_encrypt
bl Call
mov r0, r7
ldr r3, pokemon_calculate_stats
bl Call
b Return2
LoopLoad:
push {lr}
Looping:
ldrh r4, [r5]
cmp r4, #0
beq Nope
cmp r4, r7
beq Yep
add r5, r6
b Looping
Nope:
mov r6, #0
pop {pc}
Yep:
mov r6, #1
pop {pc}
Call:
mov pc, r3
.align 2
GriseousOrb: .word GriseousIndex
Giratina: .word GiratinaIndex
GiratinaO: .word GiratinaOIndex
pokemon_calc_checksum: .word 0x0803E3E8+1
pokemon_encrypt: .word 0x0803F8F8+1
pokemon_calculate_stats: .word 0x0803E47C+1
Back: .word 0x08040ADA+1
Back2: .word 0x08040AEE+1
Limit: .word 0x02024540
Table:
.hword ArceusNormal, ArceusNormal, FistPlateIndex, ArceusFight, ArceusNormal, SkyPlateIndex, ArceusFly, ArceusNormal, ToxicPlateIndex
.hword ArceusPoison, ArceusNormal, EarthPlateIndex, ArceusGround, ArceusNormal, StonePlateIndex, ArceusRock, ArceusNormal, InsectPlateIndex
.hword ArceusBug, ArceusNormal, SpookyPlateIndex, ArceusGhost, ArceusNormal, IronPlateIndex, ArceusSteel, ArceusNormal, FlamePlateIndex
.hword ArceusFire, ArceusNormal, SplashPlateIndex, ArceusWater, ArceusNormal, ZapPlateIndex, ArceusElectric, ArceusNormal, MeadowPlateIndex
.hword ArceusGrass, ArceusNormal, IciclePlateIndex, ArceusIce, ArceusNormal, DracoPlateIndex, ArceusDragon, ArceusNormal, DreadPlateIndex
.hword ArceusDark, ArceusNormal,MindPlateIndex, ArceusPsychic, ArceusNormal, PixiPlateIndex, ArceusFairy, ArceusNormal
.hword SilvallyNormal, SilvallyNormal, FightingMemoryIndex, SilvallyFight, SilvallyNormal, FlyingMemoryIndex, SilvallyFly, SilvallyNormal, PoisonMemoryIndex
.hword SilvallyPoison, SilvallyNormal, GroundMemoryIndex, SilvallyGround, SilvallyNormal, RockMemoryIndex, SilvallyRock, SilvallyNormal, BugMemoryIndex
.hword SilvallyBug, SilvallyNormal, GhostMemoryIndex, SilvallyGhost, SilvallyNormal, SteelMemoryIndex, SilvallySteel, SilvallyNormal, FireMemoryIndex
.hword SilvallyFire, SilvallyNormal, WaterMemoryIndex, SilvallyWater, SilvallyNormal, ElectricMemoryIndex, SilvallyElectric, SilvallyNormal, GrassMemoryIndex
.hword SilvallyGrass, SilvallyNormal, IceMemoryIndex, SilvallyIce, SilvallyNormal, DragonMemoryIndex, SilvallyDragon, SilvallyNormal, DarkMemoryIndex
.hword SilvallyDark, SilvallyNormal, PsychicMemoryIndex, SilvallyPsychic, SilvallyNormal, FairyMemory, SilvallyFairy, SilvallyNormal, 0x0
.hword 0x0, 0x0, 0x0