• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Code: ASM Resource Thread

232
Posts
12
Years
    • Seen Sep 10, 2019
    Yeah, that should work. The registers shouldn't need changing as far as I can tell. Best way to know is to test yourself and have a script that buffers the Pokémon's friendship so you can test; that's what I did.

    I tested your routine on a pokemon that had 70 base happiness to start with, holding a soothe bell without factoring met location/luxury ball and its happiness grew by 50 (10 from berry and 40 from halving 80), making it 120 base happiness, instead of 85 ( 70 + 10 +5).

    You could probably use r6 for the add_ten/five/two_happiness and also 'add r6, #1' for met location bonus/luxury ball bonus.

    edit: here's a fix for ease!
    Code:
    add_ten_happiness:
        mov[COLOR=DarkOrange] r6[/COLOR], #10
        b remember_new_happiness
    
    add_five_happiness:
        mov [COLOR=DarkOrange]r6[/COLOR], #5
        b remember_new_happiness
    
    add_two_happiness:
        mov[COLOR=DarkOrange] r6[/COLOR], #2
    
    remember_new_happiness:
        add r5, [COLOR=DarkOrange]r6[/COLOR], r0
    
    luxuryball_check:
        mov r0, r8
        mov r1, #req_pokeball
        mov r2, #0
        ldr r3, get_attr
        bl call_via_r3
        cmp r0, #item_luxuryball
        bne metlocation_check
    
    luxuryball_bonus:
        add r5, #1
    [COLOR=DarkOrange]    add r6, #1[/COLOR]
    
    metlocation_check:
        mov r0, r8
        mov r1, #req_catch_location
        mov r2, #0
        ldr r3, get_attr
        bl call_via_r3
        mov r4, r0
        ldr r3, sav1_map_get_name
        bl call_via_r3
        lsl r0, r0, #0x18
        lsr r0, r0, #0x18
        cmp r4, r0
        bne soothebell_check
    
    metlocation_bonus:
        add r5, #1
    [COLOR=DarkOrange]    add r6, #1[/COLOR]
    
    soothebell_check:
        mov r0, r8
        mov r1, #req_held_item
        mov r2, #0
        ldr r3, get_attr
        bl call_via_r3
        lsl r0, r0, #0x10
        lsr r0, r0, #0x10
        mov r1, #item_soothebell
        cmp r0, r1
        bne add_happiness
    
    soothebell_bonus:
        lsr r0,[COLOR=DarkOrange] r6[/COLOR], #1
        add r5, r0

    If you use this, the new length will be 0x49C bytes
     
    Last edited:
    5,256
    Posts
    16
    Years
  • I tested your routine on a pokemon that had 70 base happiness to start with, holding a soothe bell without factoring met location/luxury ball and its happiness grew by 50 (10 from berry and 40 from halving 80), making it 120 base happiness, instead of 85 ( 70 + 10 +5).

    You could probably use r6 for the add_ten/five/two_happiness and also 'add r6, #1' for met location bonus/luxury ball bonus.

    edit: here's a fix for ease!

    If you use this, the new length will be 0x49C bytes

    Ah, of course. That's what I get for doing ASM at 3am lmao. Fixed the original post, thanks again.
     
    232
    Posts
    12
    Years
    • Seen Sep 10, 2019
    Spherical Ice' [FR] EV-reducing Berries does in fact bring back the Pomeg Glitch. If you want to fix this, go to offset 0x3E742 and make the following change:

    00 29 04 D1 -> 02 29 04 DC

    Credits to HackMew: https://www.pokecommunity.com/showthread.php?t=207217
    Note: Despite what Wichu said about Pomeg no longer being usable on Shedinja in that thread- I've tested it and it works. I'm also not aware if this change affects anything else during gameplay, so if anybody else could chime in...
     
    Last edited:
    239
    Posts
    8
    Years
    • Seen Apr 15, 2024
    Toggle Oak Text in Trainerbattle 0x9 [FR]

    Building off of another post in the Quick Research and Development thread about trainerbattle 0x9, turns out that changing the reserved byte from 0x3 to 0x0 in trainerbattle 0x9 removes the text, but also causes you to white out instead of continue with the script if you lose.

    This routine hijacks the trainerbattle command to use variable 0x8000 to toggle Oak's text on or off, while keeping the same functionality of continuing the script even if you lose the battle. I mentioned this in my linked post, but 0x1 is also written to variable 0x800D if you lose, allowing you to branch the script based on your battle result.

    Here is the code/insertion instructions:
    Code:
    .text
    .align 2
    .thumb
    .thumb_func
    
    @At 08080478: 00 48 00 47 XX XX XX 08
    
    main:
    	ldr r0, =(0x020370B8)			@variable 0x8000
    	ldrb r0, [r0]
    	cmp r0, #0x1
    	beq NoText
    	ldr r0, =(0x080803D8 +1)
    	bl linker
    	mov r1, #0x3
    	and r1, r0
    	cmp r1, #0x0
    	beq NoText
    	ldr r0, =(0x08080484 +1)		@jump back to original routine
    	bx r0
    	
    NoText:
    	ldr r0, =(0x0808048C +1)
    	bx r0
    
    linker:
    	bx r0
    	
    .align 2

    To use:
    Code:
    setvar 0x8000 0x1
    trainerbattle 0x9 0x(ID) 0x3 @lose @win

    Let me know if there are any bugs.
     

    AkameTheBulbasaur

    Akame Marukawa of Iyotono
    409
    Posts
    10
    Years
  • I fixed the issue of Squeetz's Synchronize routine and FBI's Shiny Generator routine conflicting.

    Squeetz's routine works by taking the Synchronize Pokemon's nature and setting that BEFORE the PID is generated. Turns out, FBI's Shiny Generator routine is activated afterwards, and completely redoes the PID generation, essentially making Squeetz's routine never actually come into effect.

    To use both, you can use this combination of both their routines in one. I tested it in my game and it works for all four of these scenarios

    1. Not Shiny and no Synchronize Pokemon
    2. Not Shiny with a Synchronize Pokemon
    3. Shiny and no Synchronize Pokemon
    4. Shiny with a Synchronize Pokemon

    It might not be super efficient, because it loops a lot, but I couldn't find a better way to do it and still get the desired result.

    Spoiler:


    This replaces the Shiny Generator routine, so branch to it at 0x3DB00. You can get rid of the branch at the old Synchronize location since that's not being used.

    If you use this, be sure to credit both FBI and Squeetz for their original routines. I don't want to take any credit for their hard work. I just merged the two preexisting codes.

    A note, this particular routine makes Synchronize activate 100% of the time. Squeetz's routine had a 50% chance. If you want that still, you can add some sort of RNG/compare thing. There's already an RNG in the routine, so this shouldn't be too hard to do (I hope. I've never tried it).

    This also makes Synchronize work with Eggs (I also think, because it did for me, but I hatched the egg immediately after getting it, and I forget when natures are determined.)
     
    Last edited:
    112
    Posts
    8
    Years
    • Seen Mar 15, 2024

    Inheriting IVs from parents (via Destiny Knot, in the daycare)


    How to insert:

    Before doing anything, look at the code. There are two comments that say:
    @masterball lol. Change to item you want :D
    @Parent2 has masterball :D
    At those lines, change the line to "cmp r0, #0xDestinyKnotItemID" and
    "cmp r3, #0xDestinyKnotItemID" respectively.

    Once you're done that, compile and insert into free space.
    Spoiler:


    Here's a compiled version:
    Code:
    48 B4 76 46 28 1C 0C 21 26 4A 00 F0 49 F8 03 1C 28 1C 8C 30 0C 21 23 4A 00 F0 42 F8 01 28 0A D0 01 2B 08 D0 B6 46 48 BC 68 46 29 1C 1E 4B 00 F0 38 F8 1E 48 00 47 05 23 00 F0 26 F8 1B 88 90 B4 27 24 E4 18 00 27 06 2F 18 D0 A7 42 14 D0 01 23 00 F0 1A F8 18 1C 00 88 8C 21 48 43 40 19 27 21 C9 19 13 4A 00 F0 1C F8 12 4A 10 80 27 21 C9 19 68 46 11 4B 00 F0 15 F8 01 37 E4 E7 68 46 0F 4B 00 F0 0E F8 90 BC CD E7 0D 4A 00 F0 09 F8 00 04 00 0C 19 1C 0B 4B 00 F0 04 F8 06 4B 18 80 70 47 10 47 18 47 45 FD 03 08 C1 5A 04 08 01 61 04 08 E9 FB 03 08 D0 70 03 02 7D 03 04 08 7D E4 03 08 C9 4E 04 08 85 46 1E 08
    Now go to 0x460F8 and insert the following:
    Code:
     00 48 00 47 XX XX XX 08
    Where XX XX XX is the pointer in reverse hex +1 of the routine you just compiled.


    How it works:
    When the egg is generated, we check both parents to see if their holding an item matching the item we're looking for. If they are, the egg inherits 5/6 IVs from their parents. Each parent has a 50% chance to pass down one of their IVs.

    There is no usage section, because the rest is done automagically when you have two compatible Pokemon in the daycare and they make an egg :)

    Also, sorry for the double post, I wanted a fresh post for the first page :P

    I want to edit this routine so it doesn't check for an item to be held for it to activate, basically I want Pokemon to inherit IV all the time.

    What should I do?
     
    38
    Posts
    11
    Years
  • Spherical Ice' [FR] EV-reducing Berries does in fact bring back the Pomeg Glitch. If you want to fix this, go to offset 0x3E742 and make the following change:

    00 29 04 D1 -> 02 29 04 DC

    Credits to HackMew: https://www.pokecommunity.com/showthread.php?t=207217
    Note: Despite what Wichu said about Pomeg no longer being usable on Shedinja in that thread- I've tested it and it works. I'm also not aware if this change affects anything else during gameplay, so if anybody else could chime in...

    Is this actually accurate? Cuz AFAIK HackMew's fix is for Emerald, not Fire Red roms.
     

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • I want to edit this routine so it doesn't check for an item to be held for it to activate, basically I want Pokemon to inherit IV all the time.

    What should I do?

    Code:
    	cmp r0, #0x1 @masterball lol. Change to item you want :D
    	beq inherit
    	cmp r3, #0x1 @Parent2 has masterball :D
    	beq inherit

    to
    Code:
    b inherit

    disclaimer: I'm not sure if this routine works/how it works anymore.
     

    chestertagat

    Dumbest Person in the World.
    63
    Posts
    11
    Years
  • I don't know if anyone here has already posted this one,
    But i'm sure someone researched this and used it in their hack. (BTW It's Glazed if you don't know)
    Credits to: TheCreatorofGlazed for the wonderful Idea, BluRose for the Initialization and Touched Sensei for everything else.

    Here it is:

    [FR] Text Display Input Routine
    Basically what this do is get an input from user via naming_function and stores it somewhere in the ram then compare it to some string you can define.

    Note: I'm not GOOD at ASM so don't judge me if i said something wrong or explained something wrong. Please point it out instead . It's just that those ones who I asked to help me are very GOOOOOOOOOOOOD at ASM.
    Routine:
    Spoiler:
    Instruction:
    Spoiler:

    That's it .
    and another one , You can also change the "Rival's Name" text or "PKMN name" if you found out how to do that . It'll be really helpful :)
    This Routine can be used for many things not just for Password System. You can use it to name People in your game , It's up to you.

    and also feel free to ask what is what :D
     
    Last edited:

    BluRose

    blu rass
    811
    Posts
    10
    Years
  • final edit:
    if you want to implement this, stay with this post, i babble a lot. good luck

    EDIT2: reeeeeee that's hacky af but ok that should work lol. unspoilered post and spoilered previous edit

    Spoiler:


    I don't know if anyone here has already posted this one,
    But i'm sure someone researched this and used it in their hack. (BTW It's Glazed if you don't know)
    Credits to: TheCreatorofGlazed for the wonderful Idea, BluRose for the Initialization and Touched Sensei for everything else.

    Here it is:

    [FR] Text Display Input Routine
    Basically what this do is get an input from user via naming_function and stores it somewhere in the ram then compare it to some string you can define.

    Note: I'm not GOOD at ASM so don't judge me if i said something wrong or explained something wrong. Please point it out instead . It's just that those ones who I asked to help me are very GOOOOOOOOOOOOD at ASM.
    Routine:
    Spoiler:
    Instruction:
    Spoiler:

    That's it .
    and another one , You can also change the "Rival's Name" text or "PKMN name" if you found out how to do that . It'll be really helpful :)
    This Routine can be used for many things not just for Password System. You can use it to name People in your game , It's up to you.

    and also feel free to ask what is what :D
    hi
    quick correction
    Spoiler:


    and now, adding on to it

    note: i've not actually gotten the following to work satisfactorily, even when just copying a previous entry directly onto the new one, so i'm considering this incomplete but usable

    okay so basically we're going to repoint the table at x3E248C which has 5 pointers. there's exactly one pointer to this table, should be at x9DB58

    add a new pointer to at least 12 bytes of free space (not hexadecimal). in these bytes, you're going to put some data.
    now, the sequence goes like this:
    1 byte - ida lists this as "pre-filled," meaning you could fill in things automatically? neat, no idea how that would work, though
    1 byte - length of entry. max is 13 (0D)
    1 byte - image index
    1 byte - gender icon shown - 00 no, 01 yes
    1 byte - this one seems to change what it looks like when the naming screen is accessed, but it always looks like this anyways
    5fbftyO.png

    3 unknown bytes
    4 bytes - pointer to what the text for the prompt should be (i.e. "YOUR NAME?" "RIVAL's NAME?")

    * image index can be one of the following values
    00 - nothing shows on the shadow thing
    01 - player character, probably changes depending on gender
    02 - the pc icon, used for renaming boxes (what i use for the password purpose)
    03 - pokémon icon (because no pokémon is loaded in r2, we get the question mark)
    04 - gary overworld
    05 and above reset the game

    and so we go for what i put to simulate the password
    00 0A 02 00 01 00 00 00 XX XX XX 08
    which means it is not pre-filled, the password is ten characters long, the icon used is the one for the pc, there is no gender icon, the "access screen" is 01, and the text for the prompt is located at 08XXXXXX.

    and now for the problem which you all may have caught earlier
    5fbftyO.png

    there's no text, leaving this large blank white space. the pointer i mentioned earlier doesn't seem to affect anything. i even took the rival's entry and pasted it over exactly, and... well, here's the results:
    5OBNUPh.png

    however, editing earlier entries works just finely
    HobldVU.png


    so, um, yeah. happy hacking~

    EDIT3: when 0xFB (celebi index) is in r2, we get this when image is set to 03
    KFsrZ78.png

    can't figure out other two registers though so uh ahaha

    HOPEFULLY final edit:

    okay! so now we're going to do this rather hackily but it should work (has worked for my testing).

    change the bytes at x47614, x9FD1A, xCC038, and xCC112 from 03 to 02. this makes it so that we can use 03 for our purposes. hatching eggs uses 03, but i'm able to nickname hatched pokémon just finely with 02.
    so, x3E248C, the table. repoint x3E2498 to some freespace. at this freespace, fill out your entry:
    00 for unfilled, length of entry up to 0D, 03 for loading the pokémon icon, 00 for no gender icon, 01 00 00 00, and then a pointer to ANY byte that is JUST FF. my entry looks like this:
    Code:
    00 0D 03 00 01 00 00 00 D0 00 00 08
    and now the weird part. the pokémon names each have a limit of 10 bytes, right? well, yes, but this routine loads until a FF shows up. so, what we can do is use two pokémon names to have our own custom message!
    so, i put BF C8 CE BF CC 00 CA BB CD CD D1 C9 CC BE AD FF (ENTER PASSWORD.) at x2469B4, which is the start of the name of the pokémon index 0xFC, or the empty one right after celebi.
    and so we edit the beginning of the routine:
    Code:
            mov r0, #[b]0x3[/b]              @Type: 0-4 , 4=rival 3=Pokemon
            ldr r1, fcode_buffer
            mov r2, #0xFC             @or whichever pokémon you desire that has your custom icon and message, have to edit the routine a bit if over FF
            mov r3, #0
            mov r4, #0
    honestly i'm ashamed that i spent so much time on figuring out this horrible method

    and now the product:
    tT7q6FD.png

    i changed the icon to a blue ralts to show customizability. but there you have it i guess, certainly a subpar solution but it does the job. a better way would probably have been to point the prompt of a vanilla routine to somewhere in the ram, but that doesn't permit the custom icons.
     
    Last edited:

    chestertagat

    Dumbest Person in the World.
    63
    Posts
    11
    Years
  • hi
    quick correction
    Spoiler:


    and now, adding on to it

    note: i've not actually gotten the following to work satisfactorily, even when just copying a previous entry directly onto the new one, so i'm considering this incomplete but usable

    okay so basically we're going to repoint the table at x3E248C which has 5 pointers. there's exactly one pointer to this table, should be at x9DB58

    add a new pointer to at least 12 bytes of free space (not hexadecimal). in these bytes, you're going to put some data.
    now, the sequence goes like this:
    1 byte - ida lists this as "pre-filled," meaning you could fill in things automatically? neat, no idea how that would work, though
    1 byte - length of entry. max is 13 (0D)
    1 byte - image index
    1 byte - gender icon shown - 00 no, 01 yes
    1 byte - this one seems to change what it looks like when the naming screen is accessed, but it always looks like this anyways
    5fbftyO.png

    3 unknown bytes
    4 bytes - pointer to what the text for the prompt should be (i.e. "YOUR NAME?" "RIVAL's NAME?")

    * image index can be one of the following values
    00 - nothing shows on the shadow thing
    01 - player character, probably changes depending on gender
    02 - the pc icon, used for renaming boxes (what i use for the password purpose)
    03 - pokémon icon (because no pokémon is loaded, it is the question mark)
    04 - gary overworld
    05 and above reset the game

    and so we go for what i put to simulate the password
    00 0A 02 00 01 00 00 00 XX XX XX 08
    which means it is not pre-filled, the password is ten characters long, the icon used is the one for the pc, there is no gender icon, the "access screen" is 01, and the text for the prompt is located at 08XXXXXX.

    and now for the problem which you all may have caught earlier
    5fbftyO.png

    there's no text, leaving this large blank white space. the pointer i mentioned earlier doesn't seem to affect anything. i even took the rival's entry and pasted it over exactly, and... well, here's the results:
    5OBNUPh.png

    however, editing earlier entries works just finely
    HobldVU.png


    so, um, yeah. happy hacking~

    WTH did you just do? now it's complete :D (Not ,yet :P)
    Just wanna add something ,if you wan't to modify the icon and change it to something custom.
    Actually you can, How? Change the type to 03, (Pokemon encounter)
    now rememeber that it Writes there the Species name and Icon? well , you just need to add your Custom icon and put it somewhere (You add new pokemon actually, Let's you change the icon and Title) .
    But to be able to choose Pokemon number you need to put a MOV r2, #thePokemonIndexHere.
    That means that argument3 actually becomes the Pokemon Specie number.
    You can check out the other Arguments to the funcetion here's what i know:
    r0 - type ()
    r1 - Pointer to the address you want store the inputted string. in the routine.
    r2 - the PokemonIndexNumber

    Edit: Not yet complete actually, By choosing 0x3 as type (Pokemon) you can customize the Icon but the Title will Show + nickname at the end of the Custom Title (Pokemon Name)
     
    Last edited:
    45
    Posts
    11
    Years
    • Seen Jun 26, 2023
    I have a request:

    Can someone help me make wild Pokemon jump at the start of a battle just like how they do on the status screen (Fire Red)? Like how when you view a Pokemon on the status screen in Fire Red they shift/jump slightly up and down. Thanks.
     
    45
    Posts
    11
    Years
    • Seen Jun 26, 2023
    altariaking's "Animated Sprites in Ruby and FireRed" might be what you're looking for.

    Hmm. It's really not. I'm not looking to animate the sprites but merely to make them 'jump' such as when viewing them from Fire Red's status screen. The code's already there it just needs to be adapted or changed for when there's a battle to make it happen like that. It should be easy enough to do, I just don't know enough ARM, so I posted here hoping to get some help since this doesn't seem to have been done, yet. Thank you for trying, though.
     
    8
    Posts
    9
    Years
    • Seen Jan 9, 2024
    Yeah, I can fix my OP to have the Emerald version of the routines too (if you provide them :P).


    1) I don't know why it's reseting, I haven't tried Darthatron's method and I don't have another method :x
    2) This is a text edit. Look for the text string in the ROM and change it.

    Player Backsprite swapping


    So basically, it just sets your backsprite to another backsprite.

    How to insert:

    Compile into free space the following routine:
    Spoiler:


    Usage:

    In a script insert:
    setvar 0x8000 0x[backsprite number]
    callasm 0x[routine +1]

    Here is a list of possible backsprite numbers:
    Code:
    0x0 - Male Hero
    0x1 - Female Hero
    0x2 - Brendon
    0x3 - May
    0x4 - Teachy TV guy
    0x5 - Old man
    Greater than 0x5 - game crash :3

    Before using this routine there are a few things you should know about it. There is a limit of 6 possible backsprite swaps including: Male Hero, Female Hero, Brendon, May, Teachy TV guy, Old man.
    If you need to have more than 6, then figure that out yourself. Otherwise I would just edit over the existing ones rather than inserting new ones.

    The second thing you need to know is that this routine works by changing the Player's gender byte. You need to set it back to normal after you're done with the event, or it will reflect in the overworld in the form of a nice buggy player char.

    However, you cannot use the checkgender scripting command to figure this out, because we overwrote that byte. So luckily for you, I already thought of that and decided to write the player's backsprite to RAM offset 0x203C231.

    So to set it back, use this after the end of your event:
    Code:
    copybyte 0x20370B8 0x203C231 '@will put the player's old gender byte in 0x8000
    callasm 0x[routine +1]

    That's it. Here's a nice video:

    If this is possible is it also possible for not only the back sprite but the front sprite used for the trainer card and the overworld sprites simultaneously? I was thinking of having the trainer in Emerald be able to change their clothes to the ones from Ruby and Sapphire if the player wanted.
     
    Last edited:

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • If this is possible is it also possible for not only the back sprite but the front sprite used for the trainer card and the overworld sprites simultaneously? I was thinking of having the trainer in Emerald be able to change their clothes to the ones from Ruby and Sapphire if the player wanted.
    The algorithm of changing gender to change the backsprite is fundamentally flawed. But I suppose you can write a small hook to change the front sprite too. Anyways this is years old and I have no intention of updating, much less for Emerald.
     
    59
    Posts
    8
    Years
    • He / Him
    • Seen May 19, 2022

    Nature-affected stats colouring routines [FR]:

    CLICK FOR EMERALD

    This is probably the least efficient way to do this, but it works.

    Attack:
    Code:
    .thumb
    @ 00 49 08 47 XX XX XX XX at x137134
    
    ldr r1, [r2]
    ldrb r2,[r1,#4]
    add r2,#0x32
    lsl r2,r2,#0x18
    lsr r2,r2,#0x18
    push {r0-r3}
    ldr r0, =(0x0203B140)
    ldr r0, [r0]
    ldr r2, =(0x3290)
    add r0, r0, r2
    mov r1, #0
    bl decryptbranch
    bl getnaturebranch
    cmp r0, #1 @ Lonely
    beq red
    cmp r0, #2 @ Brave
    beq red
    cmp r0, #3 @ Adamant
    beq red
    cmp r0, #4 @ Naughty
    beq red
    cmp r0, #5 @ Bold
    beq blue
    cmp r0, #10 @ Timid
    beq blue
    cmp r0, #15 @ Modest
    beq blue
    cmp r0, #20 @ Calm
    beq blue
    
    black:
    ldr r6, blackfont
    b end
    
    red:
    ldr r6, redfont
    b end
    
    blue:
    ldr r6, bluefont
    
    end:
    pop {r0-r3}
    ldr r1, =(0x0813713c+1)
    bx r1
    
    decryptbranch:
    ldr r2, =(0x0803FBE8+1)
    bx r2
    
    getnaturebranch:
    ldr r2, =(0x08042EB4+1)
    bx r2
    
    .align 2
    blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
    redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
    bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00

    Defense:
    Code:
    .thumb
    @ 00 49 08 47 XX XX XX XX at x137158
    
    ldr r1, [r2]
    ldrb r2,[r1,#6]
    add r2,#0x32
    lsl r2,r2,#0x18
    lsr r2,r2,#0x18
    push {r0-r3}
    ldr r0, =(0x0203B140)
    ldr r0, [r0]
    ldr r2, =(0x3290)
    add r0, r0, r2
    mov r1, #0
    bl decryptbranch
    bl getnaturebranch
    cmp r0, #1 @ Lonely
    beq blue
    cmp r0, #5 @ Nold
    beq red
    cmp r0, #7 @ Relaxed
    beq red
    cmp r0, #8 @ Impish
    beq red
    cmp r0, #9 @ Lax
    beq red
    cmp r0, #11 @ Hasty
    beq blue
    cmp r0, #16 @ Mild
    beq blue
    cmp r0, #21 @ Gentle
    beq blue
    
    black:
    ldr r6, blackfont
    b end
    
    red:
    ldr r6, redfont
    b end
    
    blue:
    ldr r6, bluefont
    
    end:
    pop {r0-r3}
    ldr r1, =(0x08137162+1)
    bx r1
    
    decryptbranch:
    ldr r2, =(0x0803FBE8+1)
    bx r2
    
    getnaturebranch:
    ldr r2, =(0x08042EB4+1)
    bx r2
    
    .align 2
    blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
    redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
    bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00

    Special Attack:
    Code:
    .thumb
    @ 00 49 08 47 XX XX XX XX at x13717C
    
    mov r2,r8
    ldr r1, [r2]
    ldrb r2,[r1,#8]
    add r2,#0x32
    lsl r2,r2,#0x18
    lsr r2,r2,#0x18
    push {r0-r3}
    ldr r0, =(0x0203B140)
    ldr r0, [r0]
    ldr r2, =(0x3290)
    add r0, r0, r2
    mov r1, #0
    bl decryptbranch
    bl getnaturebranch
    cmp r0, #3 @ Adamant
    beq blue
    cmp r0, #8 @ Impish
    beq blue
    cmp r0, #13 @ Jolly
    beq blue
    cmp r0, #15 @ Modest
    beq red
    cmp r0, #16 @ Mild
    beq red
    cmp r0, #17 @ Quiet
    beq red
    cmp r0, #19 @ Rash
    beq red
    cmp r0, #23 @ Careful
    beq blue
    
    black:
    ldr r6, blackfont
    b end
    
    red:
    ldr r6, redfont
    b end
    
    blue:
    ldr r6, bluefont
    
    end:
    pop {r0-r3}
    ldr r1, =(0x08137188+1)
    bx r1
    
    decryptbranch:
    ldr r2, =(0x0803FBE8+1)
    bx r2
    
    getnaturebranch:
    ldr r2, =(0x08042EB4+1)
    bx r2
    
    .align 2
    blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
    redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
    bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00

    Special Defense:
    Code:
    .thumb
    @ 00 49 08 47 XX XX XX XX at x1371A4
    
    ldr r1, [r2]
    ldrb r2,[r1,#0xA]
    add r2,#0x32
    lsl r2,r2,#0x18
    lsr r2,r2,#0x18
    push {r0-r3}
    ldr r0, =(0x0203B140)
    ldr r0, [r0]
    ldr r2, =(0x3290)
    add r0, r0, r2
    mov r1, #0
    bl decryptbranch
    bl getnaturebranch
    cmp r0, #4 @ Naughty
    beq blue
    cmp r0, #9 @ Lax
    beq blue
    cmp r0, #14 @ Naive
    beq blue
    cmp r0, #19 @ Rash
    beq blue
    cmp r0, #20 @ Calm
    beq red
    cmp r0, #21 @ Gentle
    beq red
    cmp r0, #22 @ Sassy
    beq red
    cmp r0, #23 @ Careful
    beq red
    
    black:
    ldr r6, blackfont
    b end
    
    red:
    ldr r6, redfont
    b end
    
    blue:
    ldr r6, bluefont
    
    end:
    pop {r0-r3}
    ldr r1, =(0x081371AE+1)
    bx r1
    
    decryptbranch:
    ldr r2, =(0x0803FBE8+1)
    bx r2
    
    getnaturebranch:
    ldr r2, =(0x08042EB4+1)
    bx r2
    
    .align 2
    blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
    redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
    bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00

    Speed:
    Code:
    .thumb
    @ 00 49 08 47 XX XX XX XX at x1371C8
    
    mov r2,r8
    ldr r1, [r2]
    ldrb r2,[r1,#0xC]
    add r2,#0x32
    lsl r2,r2,#0x18
    lsr r2,r2,#0x18
    push {r0-r3}
    ldr r0, =(0x0203B140)
    ldr r0, [r0]
    ldr r2, =(0x3290)
    add r0, r0, r2
    mov r1, #0
    bl decryptbranch
    bl getnaturebranch
    cmp r0, #2 @ Brave
    beq blue
    cmp r0, #7 @ Relaxed
    beq blue
    cmp r0, #10 @ Timid
    beq red
    cmp r0, #11 @ Hasty
    beq red
    cmp r0, #13 @ Jolly
    beq red
    cmp r0, #14 @ Naive
    beq red
    cmp r0, #17 @ Quiet
    beq blue
    cmp r0, #22 @ Sassy
    beq blue
    
    black:
    ldr r6, blackfont
    b end
    
    red:
    ldr r6, redfont
    b end
    
    blue:
    ldr r6, bluefont
    
    end:
    pop {r0-r3}
    ldr r1, =(0x081371d4+1)
    bx r1
    
    decryptbranch:
    ldr r2, =(0x0803FBE8+1)
    bx r2
    
    getnaturebranch:
    ldr r2, =(0x08042EB4+1)
    bx r2
    
    .align 2
    blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
    redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
    bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00

    Reverting the font colour back to black:
    Code:
    .thumb
    @ 00 49 08 47 XX XX XX XX at 081371F0
    
    ldr r1, [r2]
    ldrb r2,[r1,#0xE]
    add r2,#0xF
    lsl r2,r2,#0x18
    lsr r2,r2,#0x18
    ldr r6, blackfont
    ldr r1, =(0x081371FA+1)
    bx r1
    
    .align 2
    blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00

    where XX XX XX XX is the location of each routine +1.

    This colours the stat increased by the Pokémon's nature red, and the stat that is decreased blue.

    8IfVLeT.png
    ltTHc6K.png


    Edit: Updated 23/12/2015, the old routines had a few errors that I forgot to update after making changes to my ROM. I've also confirmed what bluefont should be in a vanilla ROM. Enjoy!

    Sorry for being dumb, but how do I actually implement this into the game?
     
    Back
    Top