The PokéCommunity Forums

The PokéCommunity Forums (
-   ROM Hacking Hub (
-   -   Survey [ASM]Inserting routines;How do you do them and your problems? (

interdpth January 3rd, 2010 7:56 PM

[ASM]Inserting routines;How do you do them and your problems?
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?

0m3GA ARS3NAL January 3rd, 2010 8: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...)

colcolstyles January 3rd, 2010 9: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?

ZodiacDaGreat January 3rd, 2010 9: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

0m3GA ARS3NAL January 3rd, 2010 9: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...

Juan January 4th, 2010 5:24 AM

ldr Rx, offset+1
bx Rx


ldr Rx, offset
mov PC Rx

Kurapika July 23rd, 2013 2:06 PM


Originally Posted by Juan (Post 5449551)
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


All times are GMT -8. The time now is 6:48 AM.

Like our Facebook Page Follow us on Twitter © 2002 - 2015 The PokéCommunity™,
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / Poké
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2015.