Mine's slightly different. You've left out a check so that it doesn't go over the max HP. This is just for the first Pokemon...
push {r0-r3, lr}
ldr r0, .CurrentHP @Load Current HP
ldrh r1, [r0] @Load the amount at current
ldr r2, .MaxHP @load Max
ldrh r3, [r2] @Load the amount at Max
add r1, #20 @add 20 to current
cmp r3, r1 @Compare New current to max
blt .Copy @if Max < Current, jump
strh r1, [r0] @store current to location
pop {r0-r3, pc}
bx lr @I saw this in examples... So I thought I'd add it. (I should try it without it)
.Copy:
strh r3, [r0] @Copy Max to Current
pop {r0-r3,pc}
bx lr @same as before.
I've left out addresses obviously.
And the ASM would take up less room than a script wouldn't it? The loading of the two bytes from the HP would take 12 bytes instead of the two from an ASM routine. And likewise with storing. This routine is only about 30-40 bytes while if I tried to write a script for it, it would easily pass that. But I guess it's still useful for little things.
push {r0-r3, lr}
ldr r0, .CurrentHP @Load Current HP
ldrh r1, [r0] @Load the amount at current
ldr r2, .MaxHP @load Max
ldrh r3, [r2] @Load the amount at Max
add r1, #20 @add 20 to current
cmp r3, r1 @Compare New current to max
blt .Copy @if Max < Current, jump
strh r1, [r0] @store current to location
pop {r0-r3, pc}
bx lr @I saw this in examples... So I thought I'd add it. (I should try it without it)
.Copy:
strh r3, [r0] @Copy Max to Current
pop {r0-r3,pc}
bx lr @same as before.
I've left out addresses obviously.
And the ASM would take up less room than a script wouldn't it? The loading of the two bytes from the HP would take 12 bytes instead of the two from an ASM routine. And likewise with storing. This routine is only about 30-40 bytes while if I tried to write a script for it, it would easily pass that. But I guess it's still useful for little things.