- 232
- Posts
- 13
- Years
- Seen Sep 10, 2019
I'm trying to make a routine that gets the IV values of a pokemon whose slot is stored at var 0x8007 and store those values into vars 0x8001-0x8006 and the total of those values into var 0x8000. I'm having a difficult time in allowing the routine to loop. here's my routine:
When it attempts to loop, the game freezes.
Code:
.text
.align 2
.thumb
.thumb_func
.global decryptor
main:
push {r0-r5, lr}
ldr r0, var_8007 @slot number should be in var_8007
ldrh r0, [r0]
mov r1, #0x64
mul r1, r1, r0
ldr r0, partypoke
add r5, r1, r0 @slot loaded
mov r1, #0x27
ldr r3, var_8001
mov r4, #0x0
decrypt:
mov r0, r5
ldr r2, poke_decrypt
bl linker
strh r0, [r3] @store result into var_8001-8006
add r4, r4, r0
add r1, r1, #0x1
cmp r1, #0x2D
beq exit
add r3, r3, #0x2
b decrypt
exit:
ldr r1, var_8000 @load var_8000
strh r4, [r1]
pop {r0-r5, pc}
linker:
bx r2
.align 2
var_8000: .word 0x20370B8
var_8001: .word 0x20370BA
var_8007: .word 0x20370C6
partypoke: .word 0x2024284
poke_decrypt: .word 0x803FBE8 + 1
Last edited: