Thread: Development: Taking Pokémon away
View Single Post
  #3    
Old January 24th, 2010 (02:19 AM).
HackMew's Avatar
HackMew HackMew is offline
Mewtwo Strikes Back
Crystal Tier
 
Join Date: Jun 2006
Posts: 1,314
Quote originally posted by Darthatron:
Looks good, except for some things that would seem to backfire. If you wouldn't mind telling me if my thoughts are wrong or not, that would be great.

Code:
...
	cmp r4, #0x2
	blt return
	ldr r6, .VAR
...
return:
	strh r5, [r6, #0x10]
	pop {r0-r7, pc}
r4 contains the the Pokemon Amount and if it's less than 2 then it quits, but when quitting wouldn't it write 0x0 to the address 0x00000010 in the RAM? Surely it's not meant to do that.

EDIT: Also, isn't it supposed to return the value to 0x800D, not 0x8004? Or did I miss something?
Not really... since the value of r6 would then be unpredictable, a random address would be used, basically. E.g. it would not work properly, obviously. I fixed that already even before posting this, anyway. As for the return value, that's correct. Because variable 0x8004 is exactly 0x10 byte before 0x800D.
__________________
Reply With Quote