|
Archive Old threads that serve no purpose are here. |
|
Thread Tools | Display Modes |
![]() |
#1 |
Junior Trainer
Join Date: May 2010
Location: U.S.A.
Age: 28
Posts: 70
![]() ![]() |
![]() Today we will be running scripts through ASM! This method only works on overworld events. These will NOT work in bag or in battle. Minimum requirements:
Here is a brief explanation of each command with a scripting analogy, in order to perceive them better: Ldr, the command used to loadnumbers in the registers and RAM. This command is a kind of loadpointer in the literal sense. This command loads a 32bit number in the memory (in this case, the registers) Bl, is like the scripting command 'call', which calls a subroutine (In scripting, a subscript, like 'CallStd'). To function properly, the subroutine call must end in Pop {pc}...Pop {pc} is like the command 'Return' in scripting: It returns to the function that has been called. Bx rX, It's like the command 'Goto' in scripting. --------------------------------------------- ATTENTION: I DO NOT USE THE COMPILER 'Goldroad'. THIS CODE IS FOR DEVKITARM and THE BUILDER MID2AGB (as.exe and objcopy.exe) Example for FireRed: Code:
Spoiler:
The arguments are: r0 = Script offset (the offset of a script you want to use) r1 = Script executor (the offset of the script executor) These are the offsets for the Script Executors (NOTE, don't forget to add +1 to the offset!): Ruby: 080655B8 FireRed: 08069AE4 Emerald: 08098EF8 That's all for now! I hope I have helped! ------------------------------------- Tutorial originally made by: Sonicarvalho AKA Dark Rayquaza
__________________
-Mewthree9000 We all fight a war within ourselves, a war of greatness, a war to become the best. LIVE THE REVOLUTION, PHO! Gotta Hack'em All!! ![]() ![]() My current projects: -Pokemon ChaosBlack[v2] -!!Elite FireRed ROM Base!! Last edited by mewthree9000; 12th November 2013 at 12:18 AM. |
![]() |
|
Sponsored Links |
![]() |
#2 |
What does this button do?.....
![]() Join Date: Feb 2013
Location: Stalker.......
Posts: 229
![]() ![]() |
![]()
Just to add to this, if you need to run a script from the bag, go here:
http://www.pokecommunity.com/showthread.php?t=281573
__________________
If you didn't do it like a BOSS, you didn't do it RIGHT! My Work -Tutorials & Projects- ~The Concept of ASM~ ~Flags, Vars, & Script Tiles~ ~The Complete Guide to Battle Backgrounds~ ~Making Tilesets from Tilemaps: The Super Easy Way~ ~Advanced Over World Sprite Editing: Part 2~ ~How to Create New Evolutionary Stones: Step by Step~ ~How to Change the Start Map with a Hex Editor (FireRed only)~ ![]() ~ YouTube ~ Romhack.me ~ ![]() |
![]() |
![]() |
|
![]() |
#3 |
私の陰茎は非常に大きい
![]() ![]() Join Date: Mar 2013
Location: Brooooo...
Age: 22
Posts: 193
![]() ![]() |
![]()
This get's my THUMBs up
huehuehuehue
__________________
|
![]() |
|
![]() |
#4 |
握りモンスター
![]() ![]() Join Date: Apr 2012
Location: maybe.
Age: 21
Posts: 418
![]() |
![]() Code:
.thumb .align 2 push {lr} ldr r0, SCRIPT_ADDRESS bl SCRIPT_ROUTINE / / subroutine that will run the scripts pop {pc} SCRIPT_ROUTINE: ldr r1, SCRIPT_EXECUTOR Bx r1 .align 2 SCRIPT_ADDRESS: .word 0x081624F5 / / Here is where you define your script offset. SCRIPT_EXECUTOR: .word 0x08069AE5 / / This is the routine that executes the scripts. Offset +1 |
![]() |
![]() |
#5 | |
Unstable?
![]() ![]() Join Date: Oct 2012
Posts: 312
![]() ![]() |
![]() Quote:
|
|
![]() |
![]() |
|
![]() |
#6 | |
握りモンスター
![]() ![]() Join Date: Apr 2012
Location: maybe.
Age: 21
Posts: 418
![]() |
![]() Quote:
also your elitism kinda annoys me. Maybe I don't know everything. |
|
![]() |
![]() |
#7 | |
Unstable?
![]() ![]() Join Date: Oct 2012
Posts: 312
![]() ![]() |
![]() Quote:
Anyways, I'll explain this for you. Code:
push {lr} // store the link register so that you can return the execution frame. ldr r0, SCRIPT_ADDRESS // the offset of your script your executing. bl SCRIPT_ROUTINE / / subroutine that will run the scripts ( so you can return to THIS frame of execution -- there are lots of those ) pop {pc} // go back the frame of execution mentioned on line one. Now this bit is recyclable, and I imagine it's not really necessary to have this ( you could replace the bl SCRIPT_ROUTINE with the part in bold ) but it's for convenience and as far as I can tell, that's the only real reason for using a branching structure. Maybe it can be worked out that it's a more efficient use of your ROM's available space, but I don't feel like looking at the numbers tbh. ( You'll notice the whole thing is bolded, btw ) Code:
SCRIPT_ROUTINE: ldr r1, SCRIPT_EXECUTOR Bx r1 Last edited by Full Metal ★; 4th November 2013 at 01:47 AM. |
|
![]() |
|
![]() |
#8 |
Junior Trainer
Join Date: May 2010
Location: U.S.A.
Age: 28
Posts: 70
![]() ![]() |
![]()
Amazing elaboration, Full Metal! :3
__________________
-Mewthree9000 We all fight a war within ourselves, a war of greatness, a war to become the best. LIVE THE REVOLUTION, PHO! Gotta Hack'em All!! ![]() ![]() My current projects: -Pokemon ChaosBlack[v2] -!!Elite FireRed ROM Base!! |
![]() |
![]() |
#9 |
Oh god the bees
![]() Join Date: Jul 2013
Location: :noitacoL
Age: 22
Posts: 60
![]() |
![]()
Well, if you don't do a bl to the bx, then it won't return to your routine and pop what you pushed. However, you could just replace everything with the two LDRs and the BX (not even having the push or pop) and it should work fine.
__________________
Spoiler:
My resources: My Website diegoisawesome's MEGA-HUGE XSE Scripting Tutorial diegoisawesome's Miscellaneous Finds The Ruins of Alph Puzzles Diego's Miscellaneous Patches GBA Intro Manager The Secret Sauce: Triple-Layer Tiles There, I Fixed It: Game Freak Presents in FireRed V1.0 |
![]() |
![]() |
#10 |
Unstable?
![]() ![]() Join Date: Oct 2012
Posts: 312
![]() ![]() |
![]()
that's...what I was saying... ;_;
|
![]() |
Tags |
asm, mode, run, scripts, thumb, [Tutorial] |
Thread Tools | |
Display Modes | |
|
|