• 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

239
Posts
8
Years
    • Seen Apr 15, 2024
    I've been a bit on and off with rom hacking, but here's something I threw together recently:

    Expanding Number of Buffers [FR]
    Background info for those who are curious:
    Spoiler:

    This hack requires the JPANs save block hack (I suppose you could use other free RAM outside of the save block area if you don't mind losing buffered values between saves)

    It allows for up to 7 more buffer locations. Currently, there are 3 buffers of 4 bytes each and 4 buffers of 16 bytes each for numbers and strings, respectively. Feel free to change them, I tried to make the assembly routine easy to edit to accommodate various ram blocks. You can certainly buffer more than 4 characters into one of the 4-byte buffers, but it will overwrite anything else you have buffered afterwards. If you want to change the number of 4 vs. 16 byte buffers, just be sure to change the SetX+Y values appropriately.

    Each script buffer command loads a table of buffer RAM pointers for buffers02-04, each from separate locations, obnoxiously enough. Just be sure to copy the data from the compiled routine into your ROM at each script section.

    Spoiler:


    I tested a few of them but not all, so please let me know if there are any bugs.
     
    53
    Posts
    5
    Years
    • Seen Mar 9, 2022
    I have modified and enhanced azurile13's (credits and kudos to him) routine to make this supported on the Compiler's THUMB.bat. These are the things I modified:
    • Added routines creating the hooks that are to be copy-pasted on their respective locations. There are 11 hooks.
    • Added the master location of the routine in which the hooks will create locations for those routines. Insert your free space on .equ MyLoc. Format: 0x###### (Hexadecimal Number)
    • Created and added a new index list of Pokémon up to Generation VI including the formes in style of KDS/Chacha Dinosaur from the filenames of MrDollSteak's sprites in his Sugimori and Gen VI threads. I think there is no master index list for Generation VII. If there is, please PM me and I will add those.
    • With the list created as stated above, you will just have to create your own Regional Pokédex by copy-pasting from your Excel and Notepad file to below "regional_dex_order" and .hword 0x0000 should be first in the list. Make sure the names are all CAPS-LOCKED. In case of Nidorans, Farfetch'd, Mr. Mime, Ho-Oh, Mime Jr., Porygon-Z, and Flabébé, their characters are changed so you'll have to look for them in the master list. NOTE: Cohagrigus have been filtered out and changed into asterisks (*). Remember to correct its name before generating the binary file otherwise the .asm file won't work.

    Custom Regional Pokédex for FireRed:
    Spoiler:

    This works really well, so I thank all of you that contributed to making this.

    I have a question if it's possible to modify this so that in the Search Modes (Alphabetical, Type, etc.) it's able to display the Pokemon added to the regional dex. It only appears to still display only the original 151 in those Modes.
     
    457
    Posts
    10
    Years
    • Seen Apr 9, 2024
    This works really well, so I thank all of you that contributed to making this.

    I have a question if it's possible to modify this so that in the Search Modes (Alphabetical, Type, etc.) it's able to display the Pokemon added to the regional dex. It only appears to still display only the original 151 in those Modes.

    You can also modify and expand those. Check this post: https://www.pokecommunity.com/showpost.php?p=9182559&postcount=827

    hello... it was indeeed a nice recoding of yours...

    I have questions though, does the byte on the equ. part is the actual index number of that Pokémon or that is what can be seen in National Dex. I have, however, made the arrangement that all mons first and the the forms will be the last slot.. by doing that, do I have to edit the index and replace it with the corresponding pokemon index?

    Also, does it support forms now? Liké Flabebe but they will share the same index number.

    EDIT: I have tried to compile all these to my THUMB Assembler but I got no luck because the code is too many that the compiler can't manage to assemble lol. Is there anyway I can compile it? I tried CMD and what I always get is error... tried piece-by-piece assembly but still the compiler can't process it.

    Slr, it is now I saw this. Yes. Those are in their actual index number. If you have custom index list, then of course you have to change it on your own. I just followed the index numbers based on MrDollSteak's and thedarkdragon's sprites. Forms actually work through different indexes such as Rotom with an exception of Castform (also Cherrim and Aegislash?). They just need to have same Pokedex slot.

    Can you also get which lines are getting the error? This vanilla modified coding of mine works well. PM me if you have errors rather than discussing it here.
     
    Last edited:
    53
    Posts
    5
    Years
    • Seen Mar 9, 2022
    You can also modify and expand those. Check this post:

    To clarify, it seems if the National Dex flag is set, it allows all Pokemon to display in the Search Modes which makes sense. Before it is set, only the 151 are able to be seen.

    I haven't added any new Pokemon yet so I don't think I need to expand, but I have made it so that Gen 2 related Pokemon appear with their families in the regional dex.

    The order isn't what I want to edit, but just the trigger for displaying Pokemon that get added to the regional dex. It seems there is only one pointer to each table as well so there's probably something that changes what gets displayed based on the National Dex flag.
     

    Lance Koijer 2.0

    Lance Koijer
    105
    Posts
    6
    Years
  • You can also modify and expand those. Check this post: https://www.pokecommunity.com/showpost.php?p=9182559&postcount=827



    Slr, it is now I saw this. Yes. Those are in their actual index number. If you have custom index list, then of course you have to change it on your own. I just followed the index numbers based on MrDollSteak's and thedarkdragon's sprites. Forms actually work through different indexes such as Rotom with an exception of Castform (also Cherrim and Aegislash?). They just need to have same Pokedex slot.

    Can you also get which lines are getting the error? This vanilla modified coding of mine works well. PM me if you have errors rather than discussing it here.

    Hello, by Pokédex slot, what do you mean? Do I have to make the index number the same in National Dex Order?
     

    luuma

    searching for Meaning, offering HA numel
    162
    Posts
    10
    Years
  • Deposit entire team but one


    Just going to publish this combination of two routines and a script excerpt that you can use to let the player select one Pokémon from their team, and then deposit the rest of their team.

    Spoiler: Script
    Code:
    ...
    countpokemon
    callasm ROUTINE_ONE+1
    compare LASTRESULT 0x1
    if B_<> goto @snippet1
    msgbox @string1 MSG_NORMAL
    call @snippet2
    callasm ROUTINE_TWO+1
    textcolor 0x2 // black
    bufferpartypokemon 0x0 0x0
    bufferboxname 0x1 0x4035
    checkflag 0x834
    if 0x1 goto @snippet3
    msgbox @string2 MSG_NORMAL
    goto @snippet4
    
    //---------------
    #org @snippet1
    msgbox @string3 MSG_NORMAL
    release
    end
    
    //---------------
    #org @snippet2
    special 0x9F
    waitstate
    special2 LASTRESULT 0x147
    compare LASTRESULT 0x19C
    if 0x1 goto @egg
    compare 0x8004 0x5
    if 0x2 goto @exited_out
    return
    
    //---------------
    #org @snippet3
    msgbox @string4 MSG_NORMAL
    goto @snippet4
    
    //---------------
    #org @snippet4
    ...
    
    //---------
    // Strings
    //---------
    #org @string1
    = You are only allowed to bring one\nPOKéMON.\pPlease select which one you would\nlike to bring.
    
    #org @string2
    = [buffer1] will join you.\pThe rest of your team was\ntransferred to SOMEONE's PC.\pThey were placed starting\nin BOX ["][buffer2]."
    
    #org @string3
    = You are only allowed to bring one\nPOKéMON.\pNormally, we would offer to deposit\nthe rest of your team into a BOX.\pHowever, it seems like all of your\nBOXES are full.\pPlease make room and return later.
    
    #org @string4
    = [buffer1] will join you.\pThe rest of your team was\ntransferred to BILL's PC.\pThey were placed starting\nin BOX ["][buffer2]."

    Spoiler: ROUTINE_ONE
    Code:
    .thumb
    
    @ This routine loops through the player's boxes to make sure there is room in a given box to deposit the entire team
    
    main:
        push {r4-r7, lr}
        ldr r0, =(0x020370D0) @ var_800D
        ldrh r0, [r0]
        sub r0, #2 @ party size - 1
        mov r4, r0
        mov r5, #0
        
    box_loop:
        mov r6, #0 @ box_id
        mov r7, #0 @ pos_in_box
        
    pokemon_in_box_loop:
        mov r0, r6
        mov r1, r7
        ldr r3, =(0x0808BD30+1) @ pokemon_by_box_and_position
        bl call_via_r3
        mov r1, #0xB @ req_species
        ldr r3, =(0x0803FD44+1) @ pokemon_getattr_encrypted
        bl call_via_r3
        cmp r0, #0
        beq empty_space_found
    
    next_loop:
        add r7, #1
        cmp r7, #30
        bls pokemon_in_box_loop
    
    completed_current_box:
        add r6, #1
        cmp r6, #14
        bge not_enough_space
        mov r7, #0
        b pokemon_in_box_loop
    
    empty_space_found:
        add r5, #1
        cmp r5, r4
        bls next_loop
    
    enough_space:
        mov r0, #1
        b end
        
    not_enough_space:
        mov r0, #0
        
    end:
        ldr r1, =(0x020370D0) @ var_800D
        str r0, [r1]
        pop {r4-r7}
        pop {r3}
    
    call_via_r3:
        bx r3
    
    .pool

    Spoiler: ROUTINE_TWO
    Code:
    .thumb
    
    @ This routine loops through the player's party, depositing every slot (slot 0 to 5) except for the slot number in var 8004
    @ It then copies the Pokémon in the remaining slot to slot 0, and then erases each Pokémon from slots 1 to 5
    
    main:
        push {r4-r6,lr}
        ldr r4, =(0x020370C0) @ var_8004
        ldrh r4, [r4]
        ldr r5, =(0x02024284) @ party_player
        mov r6, #0
    
    loop:
        cmp r6, #6
        beq continue
        cmp r6, r4
        beq skip
        mov r1, #0x64
        mul r1, r6
        add r0, r1, r5
        ldr r3, =(0x08040B90|1) @ pokemon_add_to_pc
        bl call_via_r3
    
    skip:
        add r6, #1
        b loop
    
    continue:
        mov r1, #0x64
        mul r1, r4
        add r1, r5
        mov r0, r5
        mov r2, #0x64
        ldr r3, =(0x081E5E78|1) @ memcpy
        bl call_via_r3
        ldr r0, =(0x02024284+0x64) @ second Pokémon party address
        ldr r1, =(0x081F42A0) @ just a random 500 (dec) 00 bytes in the ROM
        ldrh r2, =(0x1F4)
        ldr r3, =(0x081E5E78|1) @ memcpy
        bl call_via_r3
        pop {r4-r6}
        pop {r3}
    
    call_via_r3:
        bx r3
    
    .pool


    Edit: I've adapted these new routines for emerald and they work a goddamn treat!

    I got all the offsets I'm using from the .map file of the pokeemerald disassembly (and from just searching for copies of the offsets spherical had found in a vanilla rom)

    Here's what I've changed (in bold)::
    Spoiler: Script
    Code:
    ...
    countpokemon
    callasm ROUTINE_ONE+1
    compare LASTRESULT 0x1
    if 0x5 goto @snippet1
    msgbox @string1 MSG_NORMAL
    call @snippet2
    callasm ROUTINE_TWO+1
    bufferpartypokemon 0x0 0x0
    bufferboxname 0x1[B] 0x4036[/B]
    goto @snippet4
    
    //---------------
    #org @snippet2
    special 0xa2
    waitstate
    [B]Compare 0x8004 0xff
    if 0x1 goto @fail
    special2 lastresult 0x149
    compare lastresult 0x19c
    if 0x1 goto 0x8209b46//name rater saying "now now that is merely an egg[/B]
    return
    
    //---------------
    #org @fail
    msgbox @string5 MSG_NORMAL
    release
    end
    
    #org @string5
    = Oh well, come back soon.

    Routine 1:
    Spoiler:

    Routine 2
    Spoiler:
     
    Last edited:
    5,256
    Posts
    16
    Years
  • I've managed to adapt routine 2 for emerald, but routine 1 is still not checking for filled boxes correctly. Keeps coming back as fine when there isn't any space left. Which isn't really a huge issue, it's a very unlikely outlier case, but it's still not great.
    Does this only happen with your Emerald port, or is it an issue with my routine too? Because I've just tested it in my ROM and it works properly with all 14 boxes being full or having less than 5 empty spaces (or however many it takes to empty the party).

    Another thing I should mention is that you need a failsafe for special 0x9f/0xa2 in the .xse script in case the player presses B or cancels, or the routine will try to carry on while producing a bad egg. Include
    Code:
    Compare 0x8004 0xff
    if 0x1 goto @fail
    after the waitstate command
    Yup, I myself noticed this when troubleshooting in my hack. Another edge case that is worth noting that you missed out is if the player selects an Egg: I'll update the FR script, and I assume an equivalent to special 0x147 exists in Emerald which you can use.
     

    luuma

    searching for Meaning, offering HA numel
    162
    Posts
    10
    Years
  • Does this only happen with your Emerald port, or is it an issue with my routine too?
    Presumably just my emerald port, sorry to have bothered you. I'll give the asms in emerald a look this eve, I assumed FR 0x8BA18 was the same routine as EM 0xd1d30 because they were described in the same way in documentation, but I'm now realising I haven't even checked. Will take a look at the actual contents of the fr asm linked this eve and see if I can find anything similar in emerald

    I'm guessing you've tried with e.g 2 pokemon in party needing depositing with 2 empty spaces cause besides that, I think thatcould be the only difference with how we tested. I'll try that myself too (would make little sense if that was the reason but still worth a look)

    Thanks for spotting that I needed a failsafe for eggs! Emerald special is 0x149 iirc in this case, before I forget



    Edit: I actually think I have a question for you!
    Am i being dumb as hell or could I make routine 2 delete all pokemon but one by simply cutting out the one part that actively transfers to a pc box? my asm knowledge is appalling but I can just cut out
    ldr r3, =(0x0806b490|1) @ pokemon_add_to_pc
    right? the lines above are just lining up to use that routine on the correct pokemon, as far as i can tell
     
    Last edited:
    5,256
    Posts
    16
    Years
  • I actually think I have a question for you!
    Am i being dumb as hell or could I make routine 2 delete all pokemon but one by simply cutting out the one part that actively transfers to a pc box? my asm knowledge is appalling but I can just cut out
    ldr r3, =(0x0806b490|1) @ pokemon_add_to_pc
    right? the lines above are just lining up to use that routine on the correct pokemon, as far as i can tell
    Oh, my bad, I did some further testing and it does indeed not work properly. I can give rewriting it a go.

    As for your question, routine 2 is supposed to:

    - Take the pokemon slot number in 0x8004 that was received by the special called before this routine
    - Loop through the all six slots of the player's party
    -- Deposit the current slot's Pokémon to the box if it is not equal to the slot in 0x8004
    - Copy the data of the Pokémon in the slot in 0x8004 and paste it in the first slot of the party
    - Copy 500 00 bytes and paste them at the second slot of the party, erasing the rest of the player's party, to avoid the Pokémon from being duplicated if its slot was not the first slot
     
    Last edited:

    luuma

    searching for Meaning, offering HA numel
    162
    Posts
    10
    Years
  • Oh, my bad, I did some further testing and it does indeed not work properly. I can give rewriting it a go.

    As for your question, routine 2 is supposed to:

    That would be awesome but it's not something I really need that much. I can just put it in as a bug report honestly. twelve years down the line we'll maybe see some poor soul on the wayback machine losing a high level pokemon to whatever trash they were ev grinding

    Alright to get my deletion routine I've just changed cmp r6 #6 to cmp r6 #0. Not exactly efficient but it's a neat trick for anyone who wants all but their first mon to get deleted at some point (like I do).

    Many thanks for routine 2, it is a beaut!
     
    5,256
    Posts
    16
    Years
  • That would be awesome but it's not something I really need that much. I can just put it in as a bug report honestly. twelve years down the line we'll maybe see some poor soul on the wayback machine losing a high level pokemon to whatever trash they were ev grinding

    Alright to get my deletion routine I've just changed cmp r6 #6 to cmp r6 #0. Not exactly efficient but it's a neat trick for anyone who wants all but their first mon to get deleted at some point (like I do).

    Many thanks for routine 2, it is a beaut!
    I've rewritten routine 1 and it seems like it's working properly now, from the tests I've done.

    Code:
    .thumb
    
    main:
        push {r4-r7, lr}
        ldr r0, =(0x020370D0) @ var_800D
        ldrh r0, [r0]
        sub r0, #2 @ party size - 1
        mov r4, r0
        mov r5, #0
        
    box_loop:
        mov r6, #0 @ box_id
        mov r7, #0 @ pos_in_box
        
    pokemon_in_box_loop:
        mov r0, r6
        mov r1, r7
        ldr r3, =(0x0808BD30+1) @ pokemon_by_box_and_position
        bl call_via_r3
        mov r1, #0xB @ req_species
        ldr r3, =(0x0803FD44+1) @ pokemon_getattr_encrypted
        bl call_via_r3
        cmp r0, #0
        beq empty_space_found
    
    next_loop:
        add r7, #1
        cmp r7, #30
        bls pokemon_in_box_loop
    
    completed_current_box:
        add r6, #1
        cmp r6, #14
        bge not_enough_space
        mov r7, #0
        b pokemon_in_box_loop
    
    empty_space_found:
        add r5, #1
        cmp r5, r4
        bls next_loop
    
    enough_space:
        mov r0, #1
        b end
        
    not_enough_space:
        mov r0, #0
        
    end:
        ldr r1, =(0x020370D0) @ var_800D
        str r0, [r1]
        pop {r4-r7}
        pop {r3}
    
    call_via_r3:
        bx r3
    
    .pool

    I've updated my initial post with the routines as well. You should be able to port this to Emerald quite easily.
     
    Last edited:

    luuma

    searching for Meaning, offering HA numel
    162
    Posts
    10
    Years
  • I've rewritten routine 1 and it seems like it's working properly now, from the tests I've done.
    Awesome job! Here it is for emerald, and it also works perfectly here as far as I can tell.
    Code:
    .thumb
    
    main:
        push {r4-r7, lr}
        ldr r0, =(0x020375f0) @ var_800D
        ldrh r0, [r0]
        sub r0, #2 @ party size - 1
        mov r4, r0
        mov r5, #0
        
    box_loop:
        mov r6, #0 @ box_id
        mov r7, #0 @ pos_in_box
        
    pokemon_in_box_loop:
        mov r0, r6
        mov r1, r7
        ldr r3, =(0x080d2094+1) @ pokemon_by_box_and_position (getboxedmonptr)
        bl call_via_r3
        mov r1, #0xB @ req_species
        ldr r3, =(0x0806a674+1) @ pokemon_getattr_encrypted (getboxmondata)
        bl call_via_r3
        cmp r0, #0
        beq empty_space_found
    
    next_loop:
        add r7, #1
        cmp r7, #30
        bls pokemon_in_box_loop
    
    completed_current_box:
        add r6, #1
        cmp r6, #14
        bge not_enough_space
        mov r7, #0
        b pokemon_in_box_loop
    
    empty_space_found:
        add r5, #1
        cmp r5, r4
        bls next_loop
    
    enough_space:
        mov r0, #1
        b end
        
    not_enough_space:
        mov r0, #0
        
    end:
        ldr r1, =(0x020375f0) @ var_800D
        str r0, [r1]
        pop {r4-r7}
        pop {r3}
    
    call_via_r3:
        bx r3
    
    .pool
     
    41
    Posts
    7
    Years
    • Seen Dec 16, 2018
    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

    Hello everyone, I edited this routine to support the byte manipulation using vars so we don't have to shift bits just for us to use icon above 0xFF.

    Spoiler:


    For Variable 0x8000:
    set it to 3 if you want Pokemon icons to be used
    set it to anything if you want other formats (do not use bytes above 0x04 if you haven't expanded the table yet)

    For Variable 0x8001:
    Set it to the index number of your desired Pokemon Icon.

    Do not forget to add "waitstate" command after calling the ASM.

    Doing this will save you some spaces as you don't have to make many routines if you are wanting for a multiple password formats.

    All credits goes to chestertagat and BluRose.
     
    Last edited:
    53
    Posts
    5
    Years
    • Seen Mar 9, 2022
    I have modified and enhanced azurile13's (credits and kudos to him) routine to make this supported on the Compiler's THUMB.bat. These are the things I modified:
    • Added routines creating the hooks that are to be copy-pasted on their respective locations. There are 11 hooks.
    • Added the master location of the routine in which the hooks will create locations for those routines. Insert your free space on .equ MyLoc. Format: 0x###### (Hexadecimal Number)
    • Created and added a new index list of Pok?mon up to Generation VI including the formes in style of KDS/Chacha Dinosaur from the filenames of MrDollSteak's sprites in his Sugimori and Gen VI threads. I think there is no master index list for Generation VII. If there is, please PM me and I will add those.
    • With the list created as stated above, you will just have to create your own Regional Pok?dex by copy-pasting from your Excel and Notepad file to below "regional_dex_order" and .hword 0x0000 should be first in the list. Make sure the names are all CAPS-LOCKED. In case of Nidorans, Farfetch'd, Mr. Mime, Ho-Oh, Mime Jr., Porygon-Z, and Flab?b?, their characters are changed so you'll have to look for them in the master list. NOTE: Cohagrigus have been filtered out and changed into asterisks (*). Remember to correct its name before generating the binary file otherwise the .asm file won't work.

    Custom Regional Pok?dex for FireRed:
    Spoiler:

    So I have an addendum to this that allows for Pok?mon in the custom regional dex to be seen in the Pok?dex Search Modes.

    It's a bit hacky, as it technically allows every Pok?mon in the National Dex to be seen, so they'll be listed as No. 000 if using the the quoted custom regional dex routine. What it does is hijack the routine for loading each Pok?dex Search Mode to increase the limit of the regional dex to 386 Pok?mon like the National Dex mode routine does.

    If anyone can improve it so that it allows for only custom regional dex Pok?mon before getting the National Dex, please do so. My knowledge of ASM hacking is pretty limited, so this is the best I can do for now.

    Code:
    .thumb
    .align
    
    .equ number_of_mons_in_regional_dex, 170 @or however long you wanted your regional dex to be
    .equ number_of_mons_in_national_dex, 386
    .equ MyLoc, 0x7202E0 @insert your location here
    .equ RomAreaOffset,	0x8000000
    
    .org 0x103616, 0xFF
    ldr r1, HookAlphabet
    bx r1
    .align 2
    HookAlphabet: .word RomAreaOffset+insert_386_hook_alphabet+1
    
    .org 0x1036B6, 0xFF
    ldr r1, HookType
    bx r1
    .align 2
    HookType: .word RomAreaOffset+insert_386_hook_type+1
    
    .org 0x10374E, 0xFF
    ldr r1, HookWeight
    bx r1
    .align 2
    HookWeight: .word RomAreaOffset+insert_386_hook_weight+1
    
    .org 0x1037EA, 0xFF
    ldr r1, HookHeight
    bx r1
    .align 2
    HookHeight: .word RomAreaOffset+insert_386_hook_height+1
    
    .org MyLoc, 0xFF
    insert_386_hook_alphabet: @0x103616 via r1
    ldr           r0, national_dex_limit
    cmp        r5, r0
    bgt          branch_to_finish_loop_alphabet
    movs	r0, r5
    movs	r1, #0
    ldr		r2, alphabet_hook_return
    bx		r2
    
    branch_to_finish_loop_alphabet:
    ldr 		r2, check_finish_loop_alphabet
    bx		r2
    
    
    .align 2
    .pool
    
    .align 2
    
    insert_386_hook_type: @0x1036B6 via r1
    ldr           r0, national_dex_limit
    cmp        r5, r0
    bgt          branch_to_finish_loop_type
    movs      r0, r5
    movs      r1, #0
    ldr		r0, type_hook_return
    bx		r0
    
    branch_to_finish_loop_type:
    ldr 		r2, check_finish_loop_type
    bx		r2
    
    
    .align 2
    .pool
    
    .align 2
    
    insert_386_hook_weight: @0x10374E via r1
    ldr           r0, national_dex_limit
    cmp        r5, r0
    bgt          branch_to_finish_loop_weight
    movs	r0, r5
    movs	r1, #0
    ldr		r0, weight_hook_return
    bx		r0
    
    branch_to_finish_loop_weight:
    ldr 		r2, check_finish_loop_weight
    bx		r2
    
    .align 2
    .pool
    
    .align 2
    
    insert_386_hook_height: @0x1037EA via r1
    ldr           r0, national_dex_limit
    cmp        r5, r0
    bgt          branch_to_finish_loop_height
    movs	r0, r5
    movs	r1, #0
    ldr		r0, height_hook_return
    bx			   r0
    
    branch_to_finish_loop_height:
    ldr 		   r2, check_finish_loop_height
    bx			   r2
    
    
    .align 2
    .pool
    
    .align 2
    
    
    national_dex_limit:	.word number_of_mons_in_national_dex
    check_finish_loop_alphabet:	.word 0x8103682 + 1
    alphabet_hook_return:	.word 0x8103620 + 1
    check_finish_loop_type:	.word 0x8103722 + 1
    type_hook_return:	.word 0x81036C0 + 1
    check_finish_loop_weight:	.word 0x81037BA + 1
    weight_hook_return:	.word 0x8103758 + 1
    check_finish_loop_height:	.word 0x8103856 + 1
    height_hook_return:	.word 0x81037F4 + 1
     

    Lunos

    Random Uruguayan User
    3,114
    Posts
    15
    Years
  • Touched said:
    HEX EDIT

    0x12EB54: 45 66 05 08
    0x054A68: 3C 4C
    0x054A6A: 20 68
    0x054A6C: 00 49
    0x054A6E: 01 E0
    0x054A7E: 34 4E
    0x054B3A: 00 00
    0x054B3C: 00 00
    0x054A70: REVERSED POINTER TO TEXT CONTAINING YOUR DEFAULT NAME (max 8 chars, last char must be 0)
    EDIT: Despite what he says about last char having to be zero, I think its a typo for FF. The name's size limit is 7 bytes (chars) the last byte must be 0xFF (string terminator). If the name is less than 7 characters, pad the remaining characters with 0xFF.
    Is there a way to set a pre-defined name for the Rival too though?
    Because without something like that, this is what happens In-Game.
    Oud_LQTH.png


    Unrelated: Could someone port this routine to Emerald, please?
    It's basically FBI's EV/IV Checker, but it uses the Vars 8000-8005 instead of 8005-800A.
    He wrote it in a matter of minutes at some point inside the Discord server and I had it saved ever since, but I'd really like to have a version that works with Pokémon Emerald too.
    Thanks :)
     
    Last edited:
    232
    Posts
    12
    Years
    • Seen Sep 10, 2019

    Nature-affected stats colouring routines [FR]:

    CLICK FOR EMERALD

    Spoiler:
    Spoiler:


    Hi Spherical Ice, could you shorten your routines into one, similar to what MWisBest did for DizzyEgg's? https://www.pokecommunity.com/showpost.php?p=9611218&postcount=1150
     

    Lunos

    Random Uruguayan User
    3,114
    Posts
    15
    Years
  • Expanding the Bag Entirely [FR]
    I think I'm screwing up somewhere, because I can't get this to work.
    Basically, the process as you explain it Skelli is:
    1) At 0x1083F4, Ctrl+B this: 10 B5 09 4C F1 20 3C 30 C0 00 FA F6 CD FB 20 60 00 28 06 D0 05 48 FA F6 C7 FB 60 60 00 28 00 D0 01 20 10 BC 02 BC 08 47 18 AD 03 02 E3 11 00 00

    2) At 0x99E44, Ctrl+B this: 10 49 0C 48 08 60 96 20 40 00 88 80 08 48 88 60 3C 20 08 73 08 48 08 61 1B 20 08 75 07 48 88 61 80 20 08 77 06 48 08 62 24 31 43 20 08 70 70 47 C0 59 02 02 D0 C6 03 02 3C 58 02 02 D0 C4 03 02 B0 58 02 02 8C 98 03 02

    3) Save and test.

    Correct?
    Welp, I can't get more than 44 items.
    This is the script that I'm trying, and all the items after Calcium are being omitted: https://pastebin.com/gK3UpwHA

    EDIT: I also tried to put all the items after the Calcium in a separate script, but it's useless. I'm just not getting them.
    The bag still ends at Calcium, the 44th item.
     
    Last edited:

    Skeli

    Lord of the Rings
    300
    Posts
    10
    Years
  • I think I'm screwing up somewhere, because I can't get this to work.
    Basically, the process as you explain it Skelli is:


    Correct?
    Welp, I can't get more than 44 items.
    This is the script that I'm trying, and all the items after Calcium are being omitted: https://pastebin.com/gK3UpwHA

    EDIT: I also tried to put all the items after the Calcium in a separate script, but it's useless. I'm just not getting them.
    The bag still ends at Calcium, the 44th item.
    You need to use it in conjunction with this routine posted by Azurile13:
    Code:
    .equ largest_pocket_size, 0xF0
    .equ largest_pocket_size_plus_one, largest_pocket_size + 1
    .equ strings_size,	largest_pocket_size_plus_one * 19
    
    .org 0x1083F4
    main:
    	push {r4, lr}
    	ldr r4, =(0x0203AD18)
    	mov r0, #largest_pocket_size_plus_one
    	add r0, #[B]0xA0 @Change to 0x3C for 300 items[/B]
    	lsl r0, #0x3
    	bl 0x2B9C @malloc
    	str r0, [r4]
    	cmp r0, #0x0
    	beq return
    	ldr r0, =strings_size
    	bl 0x2B9C @malloc
    	str r0, [r4, #0x4]
    	cmp r0, #0x0
    	beq return
    	mov r0, #0x1
    
    return:
    	pop {r4,pc}
    It's been modified to allow support for up to 400 items.
     
    Last edited:

    Lunos

    Random Uruguayan User
    3,114
    Posts
    15
    Years
  • You need to use it in conjunction with this routine posted by Azurile13:
    Code:
    .equ largest_pocket_size, 0xF0
    .equ largest_pocket_size_plus_one, largest_pocket_size + 1
    .equ strings_size,	largest_pocket_size_plus_one * 19
    
    .org 0x1083F4
    main:
    	push {r4, lr}
    	ldr r4, =(0x0203AD18)
    	mov r0, #largest_pocket_size_plus_one
    	add r0, #[B]0xA0 @Change to 0x3C for 300 items[/B]
    	lsl r0, #0x3
    	bl 0x2B9C @malloc
    	str r0, [r4]
    	cmp r0, #0x0
    	beq return
    	ldr r0, =strings_size
    	bl 0x2B9C @malloc
    	str r0, [r4, #0x4]
    	cmp r0, #0x0
    	beq return
    	mov r0, #0x1
    
    return:
    	pop {r4,pc}
    It's been modified to allow support for up to 400 items.

    Isn't that the very first step that I described though?
    1) At 0x1083F4, Ctrl+B this: 10 B5 09 4C F1 20 3C 30 C0 00 FA F6 CD FB 20 60 00 28 06 D0 05 48 FA F6 C7 FB 60 60 00 28 00 D0 01 20 10 BC 02 BC 08 47 18 AD 03 02 E3 11 00 00

    EDIT: Wait, that routine you posted now looks different compared to the one you shared in the post that I quoted before.
    I'm confused.
     
    Last edited:

    Skeli

    Lord of the Rings
    300
    Posts
    10
    Years
  • Isn't that the very first step that I described though?
    I made a mistake in that post. Assemble the new routine, goto the offset in the routine, and copy what's there in the .bin file to that offset in your rom.
     
    Back
    Top