- 19
- Posts
- 8
- Years
- Seen Apr 14, 2017
Firered's "wait-for-interrupt"-loop is quite inefficient. Here is my suggested patch. (Experimental, may or may not freeze the game.)
This should be useful if emulation is slow on your machine. Or if you want to be even faster when holding the space key.Code:BEFORE: 080008aa 8b91 ldrh r1, [r2, #0x1c] 080008ac 1c18 add r0, r3, #0x0 080008ae 4008 and r0, r1 080008b0 2800 cmp r0, #0x0 080008b2 d0fa beq $080008aa 080008b4 bc01 pop {r0} 080008b6 4700 bx r0 AFTER: 080008aa df02 swi $02 080008ac 8b91 ldrh r1, [r2, #0x1c] 080008ae 1c18 add r0, r3, #0x0 080008b0 4008 and r0, r1 080008b2 2800 cmp r0, #0x0 080008b4 d0f9 beq $080008aa 080008b6 bd00 pop {pc}
The same improvement can be made to Emerald.
Code:
BEFORE:
080008c6 8b91 ldrh r1, [r2, #0x1c]
080008c8 1c18 add r0, r3, #0x0
080008ca 4008 and r0, r1
080008cc 2800 cmp r0, #0x0
080008ce d0fa beq $080008c6
080008d0 bc01 pop {r0}
080008d2 4700 bx r0
AFTER:
080008c6 df02 swi $02
080008c8 8b91 ldrh r1, [r2, #0x1c]
080008ca 1c18 add r0, r3, #0x0
080008cc 4008 and r0, r1
080008ce 2800 cmp r0, #0x0
080008d0 d0f9 beq $080008c6
080008d2 bd00 pop {pc}
TL;DR:
At 0x8C6, change:
91 8B 18 1C 08 40 00 28 FA D0 01 BC 00 47
to:
02 DF 91 8B 18 1C 08 40 00 28 F9 D0 00 BD