Quote:
Originally Posted by FBI agent
I'm going to be using IDA in the Workshops, so you'll be able to learn there.
|
After an hour's research, I've found something really funny.

(I changed 3 item names into pointers, as you can see)
This can be done by using no$gba's function of changing the value of registers.
I will explain what I did:
add breakpoint at 08108450 and 0810848C(for the sake of cancel):
these two places do such math calculations, as you know before.
Code:
lsl r2, r6, #0x2
add r4, r2, r6
lsl r4, r4, #0x2
sub r4, r4, r6
After calculation r4's value will change each time the 2 functions are called.
If after each calculation I modify r4 to 0, 0x19, 0x19 * 2, 0x19 * 3......
The item will be shown correctly as the image showed.
However when it comes to a routine it all messed up and I really don't know the reason because I think they do the same thing.
This is my routine.
Code:
.thumb
@at 0x08800070, branch from the function you know
lsl r2, r6, #0x2 @original code
add r4, r2, r6
lsl r4, r4, #0x2
sub r4, r4, r6
mov r0, r4 @new code start, parameter1
mov r1, #0x13 @parameter2
ldr r3, labeltwo @function pointer
bl div @call the div function
mov r1, #0x19
mul r0, r1
mov r4, r0
ldr r0, label
bx r0 @back to the original code
div:
bx r3
.align 2
labeltwo:
.word 0x081E4019
label:
.word 0x08108459
Code:
.thumb
@This code is at 0x08800100 as I did before, branch from the function you know
ldr r5, =0x203AD1C
lsl r2, r6, #0x2
add r4, r2, r6
lsl r4, r4, #0x2
sub r4, r4, r6
mov r0, r4
mov r1, #0x13
ldr r3, label
bl div
mov r1, #0x19
mul r0, r1
mov r4, r0
ldr r0, back
bx r0
div:
bx r3
.align 2
label:
.word 0x081E4019
back:
.word 0x08108497
I'm very confused as I think the function does the same thing as changing value of r4, and I think the registers I use are safe.
Maybe you can find my problem?