View Single Post
  #5    
Old November 18th, 2009 (01:48 AM).
HackMew's Avatar
HackMew HackMew is offline
Mewtwo Strikes Back
Crystal Tier
 
Join Date: Jun 2006
Posts: 1,314
Quote originally posted by Juan:
Routine to add more animations (1 animation):
Code:
@thumb
thumb_code
main:
	push {r4-r6, lr}
	lsl r5, r0, #0x10
	lsr r6, r5, #0x10
	mov r0, #7
	and r0, r6
	cmp r0, r0
	bne NoAnimation
	lsr r0, r5, #0x13
	bl Animation

NoAnimation:
	pop {r4-r6}
	pop {r0}
	bx r0


Animation:
	...
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:

Code:
@thumb
thumb_code
main:
	push {r4, lr}
	lsl r4, r0, #0x10
	lsl r0, r4, #0xD
	lsr r0, r0, #0x1D
	cmp r0, #0x0
	bne return

Animation:
	lsr r0, r4, #0x13
	...

return:
	pop {r4, pc}
__________________
Reply With Quote