OK so I'm trying to make a routine that takes a pokemon thats stored in FBI's storage routine(which is determined by the value in var 0x8000) then store it into a trainers party setup in RAM(which trainer slot determined by var 0x8001)
the EV for the transferred Pokemon is set by var 0x8002. Now I have 2 versions of the routine, the first works, but is very messy/has poor execution, in which it will only store the first Pokemon.
The second routine has been rewritten a few times, each time with different results, none good. Currently it crashes the ROM, previously it just froze.
Working old routine:
Broken new routine:
Any help is appreciated!
the EV for the transferred Pokemon is set by var 0x8002. Now I have 2 versions of the routine, the first works, but is very messy/has poor execution, in which it will only store the first Pokemon.
The second routine has been rewritten a few times, each time with different results, none good. Currently it crashes the ROM, previously it just froze.
Working old routine:
Spoiler:
Code:
.align 2
.thumb
Main:
Push {r0-r7, lr}
mov r6, #0x0
ldr r7, .Var_8004
ldrb r7, [r7]
mov r3, #0x64
mov r5, #0x10
mul r3, r7, r3
mul r5, r7, r5
mov r5, r7
ldr r2, =(0x20370BA)
@EV
ldr r0, .Var
ldrh r0, [r0]
strh r0, [r2]
@level
ldr r4, =(0x20242D8)
add r4, r3, r4
ldrb r4, [r4]
add r2, r5, r2
strb r4, [r2, #0x2]
@decrypt setup
ldr r0, =(0x2024284)
add r7, r0, r3
@Species
mov r0, r7
mov r1, #0xB
bl Decrypt
strh r0, [r2, #0x4]
@Item
mov r0, r7
mov r1, #0xC
bl Decrypt
strh r0, [r2, #0x6]
@Move1
mov r0, r7
mov r1, #0xD
bl Decrypt
strh r0, [r2, #0x8]
@Move2
mov r0, r7
mov r1, #0xE
bl Decrypt
strh r0, [r2, #0xA]
@Move3
mov r0, r7
mov r1, #0xF
bl Decrypt
strh r0, [r2, #0xC]
@Move4
mov r0, r7
mov r1, #0xD
bl Decrypt
strh r0, [r2, #0xD]
Decrypt:
ldr r2, =(0x803FBE8)
bx r2
.VAR:
.word 0x020270B8 + (0x800A *2)
.Var_8004:
.word 0x020270B8 + (0x8004 *2)
.align 2
Broken new routine:
Spoiler:
Code:
.thumb
.align 2
main:
push {r0-r7, lr}
ldr r5, =(0x20370b8) @StorageSlot
ldr r6, =(0x20370ba) @PartySlot
ldr r7, =(0x20370BC) @EV
ldrb r5, [r5]
ldrb r6, [r6]
ldrb r7, [r7]
mov r3, #0x10
mov r4, #0x64
mul r5, r4, r5
mul r6, r3, r6
ldr r3, =(0x2037100) @TrainerParty
add r6, r3, r6
ldr r3, =(0x203C000) @Storage
add r5, r3, r5
strb r7, [r6]
ldr r3, =(0x803FBE9) @DecryptASM
@
@Level
@
mov r0, r5
mov r1, #0x38
bl Linker
ldr r7, =(0x2037102)
strb r0, [r7]
@
@Species
@
mov r0, r5
mov r1, #0xB
bl Linker
ldr r7, =(0x2037104)
strh r0, [r7]
@
@Item
@
mov r0, r5
mov r1, #0xC
bl Linker
ldr r7, =(0x2037106)
strh r0, [r7]
@
@Moves
@
mov r0, r5
mov r1, #0xD
bl Linker
ldr r7, =(0x2037108)
strh r0, [r7]
mov r0, r5
mov r1, #0xE
bl Linker
ldr r7, =(0x203710A)
strh r0, [r7]
mov r0, r5
mov r1, #0xF
bl Linker
ldr r7, =(0x203710C)
strh r0, [r7]
mov r0, r5
mov r1, #0x10
bl Linker
ldr r7, =(0x203710E)
strh r0, [r7]
End:
pop {r0-r7, pc}
Linker:
bx r3
.align 2
Any help is appreciated!