Ver Mensaje Individual
Predeterminado Re: GBA | ASM | Check STAT
Dicho por Turambar Ver mensaje
I've seen the routine and realize that u're right. I really appreciate you to show me how to optimize it.

Of course I've already change it.
LSL with the immediate number 1 is already 2x, so you should have put #1 instead of your #0x2.

And as I've mentioned, you don't need push and pop here. What you need is a simple 'bx lr' under label 'end', w/o any push/pop in your routine. LR is usually only changed by BL.

	ldr r0, var_8003
	ldrh r0, [r0] //slot del Pokemon
	mov r1, #0x64
	mul r0, r1
	ldr r1, firstpokemon
	add r0, r0, r1
	add r0, r0, #0x58 //offset de max PS
	ldr r1, var_8004
	ldrh r1, [r1]
	lsl r1, r1, #1
	add r0, r0, r1
	ldrh r0, [r0] //valor de la estadística deseada
	ldr r1, var_8005
	ldrh r1, [r1] //parámetro al que comparar la estadística
	cmp r0, r1
	beq equal
	cmp r0, r1
	blo minus
	mov r0, #0x2
	b end	

	mov r0, #0x1
	b end

	mov r0, #0x0
	ldr r1, var_8003
	strh r0, [r1]
	bx lr

.align 2
var_8003:	.word 0x020370BE
var_8004:	.word 0x020370C0
var_8005:	.word 0x020370C2
firstpokemon:	.word 0x02024284

Última edición por jiangzhengwenjz; 31/12/2018 a las 15:59