23495-GBA_|_Otros_|_ROUTINE_ASM:_Change_status_of_pokemon
#8
Andrea 25004
Hello everyone :)

weel this is the new routine ^^"
i explain you every single part:
ldr r2, .8002
ldrh r2,[r2]
cmp r2, #0x0
beq parte2
b loop

load var 8002, if the val of var 8002 it's 0 then go to part2 :)
else go to loop because var 8002 decides how many pokemon change status :)
parte2:
ldr r0, .8000
ldrh r0,[r0]
ldr r1,.100
mul r1,r0
ldr r0, .pokemon_data
add r0, r0, r1
ldr r1, .8001
strb r1,[r0]
b fine

this part of routine used to infect single pokemon in the team with setting var 8000 for the pokemon place in the team and var 8001 the state :)
ldr r2, .8002 /*variabile 8002*/
ldrh r2,[r2]
ldr r3,.100 /*interval byte between pokemon team*/
mul r3,r2
ldr r0, .pokemon_data /*offset state*/
add r0, r0, r3
ldr r1, .8001 /*save state*/
strb r1,[r0]

same thing with part of routine on top :)
sub r2, r2, #0x80
sub r2, r2, #0x80
cmp r2, #0x0
beq fine
b loop

this is important part of routine :)
so the var 8002 it's stored in the r2 and we setting with:
number of pokemon *100
the comand sub subtract 100 (80+80) to var 8002 and avery loop infect a pokemon :)
fine:
pop {r0-r3,pc}

end of routine x'D
example of script:
to infect one pokemon:

setvar 0x8000 0x4 /fourth pokemon in the team
setvar 0x8001 0x80 /poisong state
callasm 0x700001

to infect 3 pokemon of your team:

setvar 0x8002 0x300 /3 pokemon*100
setvar 0x8001 0x10 /burn state
callasm 0x700001

if you have problem write in the comment :) bye