Ver Mensaje Individual
Predeterminado Re: GBA | ASM | Check STAT
Dicho por jiangzhengwenjz Ver mensaje
Hi, i just took a glance at your routine and i think some points need to be improved obviously.
1. When you write a C function (e.g. something to be called by callasm script command), you never need to push r0-r3, as they're assumed to be 'temporary variables' and other functions won't need their value.
You even don't need to push the LR (aka. r14) here, because it's never changed. so you don't need to push and pop anything. What you need is just a 'bx lr' when you want to 'return'.
mov r2, #0x2 
mul r1, r2
This is not good coding habit, as we can use LSL opcode instead, which is much faster to be executed.
3. in all three cases you have
ldr r1, var_8003
strh r0, [r1]
so why not put them under label 'end'?

Anyway it's still nice work to practise on your own!
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.