View Full Version : [ASM]Inserting routines;How do you do them and your problems?

January 3rd, 2010, 07:56 PM
Usually I steal a piece of code that's about 5 instructions

so I can do a

LDR r3,=myroutine;
MOV r15,r3

then my routine executes, or i'll just edit some code.

Recently I tried the callasm function and my function executed but died, yet I know the code works.

What to do you guys do? Prefer?

January 3rd, 2010, 08:51 PM
I dunno, cause I'm not quite that ASM savvy yet... Dunno how to do that...
You sure you ended the routine correctly? (Just saying, cause everyone makes mistakes from time to time...)

January 3rd, 2010, 09:00 PM
I haven't delved deeply enough into ASM to require editing of preexisting code but I'm thinking I'll end up using your method because it's so simple^^
I assume that with your method you have to "recreate" the code that you overwrote with the 'ldr' and 'mov' in your custom routine?

January 3rd, 2010, 09:14 PM
Yes, you have to. And you'd also wanna make sure that the registers after executing your code must have the same values. This can be done by push and pop. Here's my way:
ldr r0, .Routine
bx r0

January 3rd, 2010, 09:29 PM
Ahh... very helpful indeed Zodiac...
See, this is why I like the R&D department... Mature discussion about the finer points of hacking...
Good stuff indeed...

January 4th, 2010, 05:24 AM
ldr Rx, offset+1
bx Rx


ldr Rx, offset
mov PC Rx

July 23rd, 2013, 02:06 PM
ldr Rx, offset+1
bx Rx


ldr Rx, offset
mov PC Rx

How do you insert that offset?
I mean, when I try to compile "ldr r0, 0x08900001 bx r0" it threws an error.
Should I do:
ldr r0, .offset
bx r0
.offset: .word 0x8900001