That routine is **wrong**. You meant to write "cmp r0, #0x0", but you put a cmp r0, r0, instead. And since r0 will always be equal to r0 (obviously), the routine won't work properly. BTW, the routine is unoptimized as well. Here's the fixed and improved version:

Typing error ^^

But, thanks, i will edit :)

EDIT: Fixed ^^

Yeah congratulations.

And Juan, I think you have just helped out a lot of rom hackers :3 (including me)

I hope so :)

Yup.

@Juan:

This is the *exact* same method that I used. It's good to know that I did it correctly even without a tutorial^^

Nice work.

Thanks ^^

this is for things like flowers and waves,etc right?

Yes

If somebody finds another error, both typographical and explanation, just let me know.