Insert asm routine

Cerrado para nuevas respuestas.


Usuario mítico
Hello guys ^^
Well today I would like to explain as clear as possible how to insert asm routines in a rom.
1° step: download assembler
First of all, begin to download an assembler for your routine asm ^^
Council Hackmew assebler:
Once downloaded, put it in a folder (I recommend the desktop), but can fit any location.
In this folder will be the files previously downloaded the package.
2° step: write routine
Once this is done we have to write our routine :
I post a basic routine:
.align 2

push {r0-r1,lr}
ldr r0, = 0xoffset
mov r1, #0xval
strb r1,[r0]
pop {r0-r1,pc}
Open your notepad and start writing your routine,after the routine save it but we have to do some steps before:
First of all you need to change the various "settings" if you can define these saving.
Below the screen, you should change "Text Documents (*.Txt)" to "All Files" and save with the name you want .asm
ex :
Save your routine in the folder you created earlier ^^
3° step: Assebler routine
Now you need to open a program already included in the Windows OS , The cmd
Once opened you will be presented with this screen:
(I have already done all the steps)

Now I will explain everything in detail .
First of all, in the picture you can see the command "CD" means "Change directory", this allows us to change the folder until you get to our portfolio , in this case Assembly.
Once you reach the desired path you have to write thumb to activate the file "THUMB.BAT " and the name of the routine asm:
ex: thumb routine.asm
If there are no errors should show the message "Assembly successfully"
In our directory should now there is a new file named as our routine but with the extension . Bin
This will be our routine compiled!
4° step: insert routine
Once this is done we should avail ourselves do another program, a hex editor ^^
Open your rom and your routine:
Here comes the important part ^^
First of all, copy the entire contents of the routine .Bin in the rom in an free offset.
I recommend the offset 700000 or free offsetthat you can serach with the FSF.
NOW PUSH CTRL+B to paste the routine in the rom ^^
Why does not CTRL+C? well, it is very simple, if you do a CTRL+C
is as if you added the byte ROM and as a result will crash.
Now we can close our hex editor ^^
We miss the last part of our routine or how to call via scripts.
5° step: call routine with script
The command that we use is the following :
Callasm 0xoffsetroutine+1
Come to order :
Callasm call our routine but the+1? Used to say that XSE calling a routine of type Thumb otherwise the game would freeze in game.
if our offset where we inserted the routine is 700000:
callasm 0x700001
I hope I was as clear as possible,if you have doubt,ask in the comments ^^
Cerrado para nuevas respuestas.