• 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

10
Posts
7
Years
    • Seen Jun 14, 2019
    I want to make an ghost eeveelution and to evolve it you must level it up with a rare candy in the party while it is fainted then once it is leveled up it evolves
     

    Miko-chan

    Haruka Fanboy
    3
    Posts
    6
    Years
  • Old post :/
    Spoiler:
    Okay, having checked the Disable Bag routine for FR here in this thread (which I actually checked before using JPAN's, but apparently I was so in a rush that I didn't check properly).

    Here is the routine for Emerald:
    Code:
    @Insert this compiled routine at 0x0803C230
    .thumb
    .equ qq_bag,        0x0803C230
    .equ flag_check,    0x0809D790
    .equ loc_803C23E,   0x0803C23E
    .equ off_803C254,   0x0803C254
     
    .equ loc,       qq_bag
    .equ checkflag, flag_check
    .equ blockitem, loc_803C23E
    .equ flag,      off_803C254
     
    main:
        ldr r0, [pc, #flag-(loc+4)]
        bl +checkflag-loc
        bne +blockitem-loc
        NOP
        NOP
    All those hours wasted yesterday :catflip:
     
    Last edited:
    146
    Posts
    11
    Years
    • CO
    • Seen Mar 16, 2023
    I want to make an ghost eeveelution and to evolve it you must level it up with a rare candy in the party while it is fainted then once it is leveled up it evolves

    Here ya go ^_^
    Faint/Low Hp Evolution:
    Code:
    .text
    .align 2
    .thumb
    .thumb_func
    .global faintEvolution
    
    main:
    push {r0-r7}
    [COLOR="Lime"]add r0, r6, r7[/COLOR]   @line to change if expanded evos
    lsl r0, r0, #0x3
    add r0, r2, r0
    add r3, r0, r3
    ldrb r2, [r3, #0x2]
    mov r0, r8
    bl decrypt
    mov r11, r0
    pop {r0-r7}
    mov r1, r11
    [COLOR="Lime"]cmp r1, #0x2[/COLOR]    @Compare Amount of Current Hp
    blo low_hp
    b exit
    
    low_hp:
    mov r10, r3
    pop {r0-r7}
    mov r1, r10
    ldr r0, evolution_loc
    bx r0
    
    exit:
    pop {r0-r7}
    ldr r0, no_evo
    bx r0
    
    decrypt: 
    push {r0-r7}
    mov r1, #0x39
    ldr r2, decryptpoke
    bx r2
    
    .align 2
    no_evo: .word 0x08043111
    evolution_loc: .word 0x0804310D
    decryptpoke: .word 0x0803FBE9


    Note for the first highlighted in green:
    If you have expaned your evolutions for your pokemon you must change this line:
    "add r0, r6, r7"
    to:
    8 evos or less = lsl r0, r6, #0x1
    16 evos or less = lsl r0, r6, #0x2
    32 evos or less = lsl r0, r6, #0x3

    or
    just change the bytes in the compiled file from F0 19 to:
    8 evos or less = 70 00
    16 evos or less = B0 00
    32 evos or less = F0 00


    Note for second highlighted in green:
    As it is the Pokemon must be leveled up with a Rare Candy to get it to revive and have 1-Hp.
    You can change the value of 0x2 to something higher but anything lower than 0x2 will not work with this routine.
    After the compare it the vaule must be lower than the "0x2" or what ever value you decide to change it to.


    Hope this helps!
     
    10
    Posts
    7
    Years
    • Seen Jun 14, 2019
    omg thank you so much dude! youve just made me so happy now since im still new to asm i gotta figure out the little bits but im sure i can get it :) again thank you so much would you like credit since youve created the asm for it
     
    10
    Posts
    7
    Years
    • Seen Jun 14, 2019
    so me and my friend got it into the rom and everything and turns out it didnt work, did you test it? cause we cant get it to work
     

    Dionen

    deprived of sleep
    295
    Posts
    12
    Years
  • OAM routines

    Generating OAMs


    This routine is only to generate OAMs which are trainer or Pokemon sprites. I've modified it to be usable with a script, but honestly, setting the values yourself via ASM would've been faster (not that this is noticeably slow, just comparatively). I will have to do more research on making it portray an arbitrary image, but with the expansion work on the Pokedex and such, I don't see it as very necessary anymore.

    How to insert:
    Compile and insert the following routine into a free word aligned offset.

    Spoiler:
    so, little question, cause I'm still learning.
    Is it possible to modify this routine in order to display Item images? Is this display function able to handle them?
    If not, what is the best way to show them?
     
    Last edited:

    Skeli

    Lord of the Rings
    300
    Posts
    10
    Years
  • Why do you want to prevent the player from using the turbo button? One of the main benefits to playing a rom is that you get a turbo button.

    It would lag without turbo. Turbo would probably still speed the game up somewhat, but just not as much.
     
    146
    Posts
    11
    Years
    • CO
    • Seen Mar 16, 2023
    I want the player to get as authentic of an experience as possible when playing my hack, which means that if I can disable the Turbo button, I will. Is there an emulator that doesn't have a turbo button?

    Thank you,

    This should be asked in the Quick Questions thread.
    I have told you before that even with asm this would be hard.
    Because its on a emulator level.
     

    AkameTheBulbasaur

    Akame Marukawa of Iyotono
    409
    Posts
    10
    Years
  • I want the player to get as authentic of an experience as possible when playing my hack, which means that if I can disable the Turbo button, I will. Is there an emulator that doesn't have a turbo button?

    Thank you,

    I'm pretty sure No$GBA doesn't. You can speed up the emulation through the options menu, but as far as I know there isn't a button that you press to do that automatically.

    I could be wrong about this so nobody sue me if there in fact is one xD

    Sweet Scent Script
    This is what I did with FBI's Field Moves ASM in this post.

    I basically just made it so you could attract certain Pokemon in certain special areas with an increased shiny chance.

    You will need FBI's Shiny Generator. Either use this one here or use the modified version if you want to have Synchronize's overworld effect here.

    Then follow the steps for inserting a new field move, except you don't need to expand the table if you're replacing Sweet Scent's effect. Just replace the pointer C9 E0 0D 08 with the pointer to the first routine.

    Also, you will need to go to 0x82E76 and change "20 78" to "06 E0". Also go to 0x82E6C and change "0C 31" to "04 31". This allows Special 0xAB to use the grass data when loading Wild Pokémon.

    Anyway the script I made is here:
    Spoiler:


    The CheckItem part was for the Shiny Charm, so if you have that then change the number to the index number for the Shiny Charm.

    I also modified the Set Wild Battle command with this:
    Spoiler:


    Basically all that does is let you use LASTRESULT for the Pokemon.
     
    Last edited:
    22
    Posts
    9
    Years
    • Seen Feb 1, 2020
    Anyone can make a routine that counts the amount of a certain item in the bag and stores it in a variable? I know this can be made with loops but I think a routine is a better way to do this. Thanks anyway.
     

    pikachux2

    Never Evolve
    115
    Posts
    14
    Years
  • Hey helpful people, you all might have seen my post about this in a thread under Rom Hacking. But anyway, I've never used ASM coding in my PKMN hacking career thus far. I'm making a game in which I only want double battles and have encountered a glitch in which if you start a double battle with 1 (not-fainted) Pokémon is your party, the game just clones that pokemon for your partner in battle... (not desired) I've come to the realization that the only way to keep this game double battles only Is to either fix this glitch by changing the battle engine (sounds too hard) or to find another solution.

    Well, the solution I came up with was to possibly have an ASM call before each trainer that would change the bitfield's double battle bit of the trainer in question to 1 or 0 based on how many Pokémon the player has. Now again, I've never used ASM so I don't know if you have access to that certain part of the rom, but if you did this would be a great way of fixing my problem.

    So any help would be awesome, thanks!
     

    Delta231

    A noob
    681
    Posts
    7
    Years
  • Hey helpful people, you all might have seen my post about this in a thread under Rom Hacking. But anyway, I've never used ASM coding in my PKMN hacking career thus far. I'm making a game in which I only want double battles and have encountered a glitch in which if you start a double battle with 1 (not-fainted) Pokémon is your party, the game just clones that pokemon for your partner in battle... (not desired) I've come to the realization that the only way to keep this game double battles only Is to either fix this glitch by changing the battle engine (sounds too hard) or to find another solution.

    Well, the solution I came up with was to possibly have an ASM call before each trainer that would change the bitfield's double battle bit of the trainer in question to 1 or 0 based on how many Pokémon the player has. Now again, I've never used ASM so I don't know if you have access to that certain part of the rom, but if you did this would be a great way of fixing my problem.

    So any help would be awesome, thanks!

    https://github.com/jiangzhengwenjz/Double_wild_battle
     

    Delta231

    A noob
    681
    Posts
    7
    Years
  • I have a request. I followed this tutorial to make two frame animations in fire red. the only issue is with trainers the animation starts right out of the ball and with wild pokemon it starts at the beggining of the encounter and doesnt show the animation because the pokemon is not in sight when it starts. Would it be possible to create two animation tables and insert an asm routine that sets the pointer at 0x2349BC to point to animation table 1 by default or table 2 if a var or flag is set? If no one has time to make a routine like this could someone at least tell me if it is possible?

    I will say not to implement it because it takes a lot of storage in you rom.
     
    82
    Posts
    6
    Years
  • Hello! Would it be possible to request a routine?

    If possible, I would like a battle routine that only allows you to use a maximum of 6 itmes throughout a battle(ignoring the pokeball bag). This would get rid of potion spamming! :)
     
    Last edited:

    paccy

    Pokeholic
    42
    Posts
    14
    Years
  • Inherit Pokeball from Mother (Emerald)
    So I'm learning asm and decided to see if I could implement passing down pokeballs like in 6th gen, and after a while I managed to make something that seems to work. Since this is basically my first go at writing asm feel free to point out better ways to do things and improve it.

    There's is two parts to this, you have to give the egg its mother's pokeball and you have to keep the ball when it hatches. This is for Emerald only (Though I'm guessing it wouldn't be too hard to port to FR).

    Give Egg Pokeball
    How to insert:
    Compile and put this into free space
    Spoiler:
    and at 0x8070A48 write 00 48 00 47 XX XX XX 08
    (where XX XX XX is the reverse hex pointer of where you put in the code +1)

    How it works:
    When given an egg it will check if either of the parents are female. If yes it will pass on the egg, unless it's a masterball.

    Keep Ball when Hatching
    How to insert:
    Compile and put both of these into free space
    Spoiler:
    Spoiler:
    and at 0x80713D4 write 00 48 00 47 XX XX XX 08
    (where XX XX XX is the reverse hex pointer of where you put in the first piece of code +1)
    and at 0x8071528 write 00 4A 10 47 XX XX XX 08
    (where XX XX XX is the reverse hex pointer of where you put in the second piece of code +1)

    How it works:
    When hatching some data doesn't seem to be transferred to the pokemon, the type of ball being one. The first routine simply stores the ball type to 0x8000 while the second retrieves and gives it to the pokemon where before a normal pokeball was given.
     
    Back
    Top