Thread: Research: Asm-scanner
View Single Post
Old June 18th, 2010 (3:52 PM).
Xenesis's Avatar
Xenesis Xenesis is offline
Syogun Changer
Join Date: May 2006
Location: Australia
Nature: Sassy
Posts: 55
Send a message via AIM to Xenesis Send a message via Windows Live Messenger to Xenesis
Originally Posted by ZodiacDaGreat View Post
Uhm, hardly any routines in Pokemon is ARM based, besides the routine calling the main loop I think.
You'll find this is the case with pretty well all GBA games for one simple reason: An ARM Opcode is 32 bits, a THUMB opcode (with the exception of the bl instruction) is 16 bits and the GBA's bus width for reading from cartridge is 16 bits. Thus, any ARM opcodes take two reads to load which is slow. Very slow. That being said, if you pre-load the code to areas in RAM (and you will find this happens) it will execute fine.

46C0 mov r8, r8 is a functional but completely useless opcode that in that particular situation is just being used as padding to make all of the bx rx opcodes word aligned, but some people also like to use it as a breakpoint opcode when debugging. Anyhow, that chunk of code would be used for launching subroutines, as the address range of a bl opcode is limited.
Reply With Quote