• 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

2
Posts
5
Years
    • Seen Dec 24, 2022
    Heyo, i really like the 80x80 Mugshot Routine jiangzhengwenjzw has made and try atm to make it work on emerald, but unfortunately, i couldn´t achieve this.
    I already tried to research the offsets for emerald but i couldn´t find the correct offsets for this.
    So i would like to ask for some help.
    Can somebody of you help me with the routine, please?
    It would be awesome, because my knowledge is not the greatest. I also searched a lot on google, but the results, i found, aren´t really useful.
     
    990
    Posts
    4
    Years
  • The following development is done by DoesntKnowHowToPlay, and I have no part in it. This has been re-posted as the original link had died.

    [FR] Displaying IV's on the stat screen
    A small piece of ASM that allows you to view IV's in the Pokémon stat screen.

    1.png
    2.png
    3.png

    • Step 1 - Image insert
    First, insert the following image using NSE or TileMolester. Remember the address where you put it:
    Spoiler:


    • Step 2 - Actual ASM
    Next you will need to insert the following ASM. It doesn't matter where, but do remember where you put it.
    Code:
    cmp r0, #0x0
    beq Abort
    cmp r0, #0x3
    bgt Abort
    cmp r0, #0x1
    bne StandardAbort
    b Start
    
    Abort:
    ldr r1, .AbortAddr
    bx r1
    
    StandardAbort:
    ldr r1, .StandardAbortAddr
    bx r1
    
    .align 2
    .AbortAddr: .word 0x08137bfd
    .StandardAbortAddr: .word 0x08137bf9
    
    Start:
    ldr r0, .ActiveMonPtr
    ldr r1, .ActiveOffset
    ldr r0, [r0, #0x0]
    add r6, r0, r1
    
    add sp, #-0x18
    
    HPIV:
    mov r0, r6
    mov r1, #0x27
    bl Decrypter
    
    mov r5, r0
    lsr r5, r5, #0x1
    mov r0, #0x40
    mul r5, r0, r5
    
    mov r1, #0x80
    str r1, [sp, #0x0]
    str r1, [sp, #0x4]
    
    #x, y position
    mov r2, #0xC
    str r2, [sp, #0x8]
    mov r1, #0x6
    str r1, [sp, #0xc]
    
    #x, y size
    mov r2, #0x10
    str r2, [sp, #0x10]
    mov r1, #0x8
    str r1, [sp, #0x14]
    
    mov r0, #0x3
    ldr r1, .GraphicAddr
    add r1, r5
    mov r2, #0x0
    mov r3, #0x0
    bl GraphicHandler
    
    
    
    AtkIV:
    mov r0, r6
    mov r1, #0x28
    bl Decrypter
    
    mov r5, r0
    lsr r5, r5, #0x1
    mov r0, #0x40
    mul r5, r0, r5
    
    mov r1, #0x80
    str r1, [sp, #0x0]
    str r1, [sp, #0x4]
    
    #x, y position
    mov r2, #0xC
    str r2, [sp, #0x8]
    mov r1, #0x17
    str r1, [sp, #0xc]
    
    #x, y size
    mov r2, #0x10
    str r2, [sp, #0x10]
    mov r1, #0x8
    str r1, [sp, #0x14]
    
    mov r0, #0x3
    ldr r1, .GraphicAddr
    add r1, r5
    mov r2, #0x0
    mov r3, #0x0
    bl GraphicHandler
    
    
    
    DefIV:
    mov r0, r6
    mov r1, #0x29
    bl Decrypter
    
    mov r5, r0
    lsr r5, r5, #0x1
    mov r0, #0x40
    mul r5, r0, r5
    
    mov r1, #0x80
    str r1, [sp, #0x0]
    str r1, [sp, #0x4]
    
    #x, y position
    mov r2, #0xC
    str r2, [sp, #0x8]
    mov r1, #0x24
    str r1, [sp, #0xc]
    
    #x, y size
    mov r2, #0x10
    str r2, [sp, #0x10]
    mov r1, #0x8
    str r1, [sp, #0x14]
    
    mov r0, #0x3
    ldr r1, .GraphicAddr
    add r1, r5
    mov r2, #0x0
    mov r3, #0x0
    bl GraphicHandler
    
    
    SAtkIV:
    mov r0, r6
    mov r1, #0x2B
    bl Decrypter
    
    mov r5, r0
    lsr r5, r5, #0x1
    mov r0, #0x40
    mul r5, r0, r5
    
    mov r1, #0x80
    str r1, [sp, #0x0]
    str r1, [sp, #0x4]
    
    #x, y position
    mov r2, #0xC
    str r2, [sp, #0x8]
    mov r1, #0x31
    str r1, [sp, #0xc]
    
    #x, y size
    mov r2, #0x10
    str r2, [sp, #0x10]
    mov r1, #0x8
    str r1, [sp, #0x14]
    
    mov r0, #0x3
    ldr r1, .GraphicAddr
    add r1, r5
    mov r2, #0x0
    mov r3, #0x0
    bl GraphicHandler
    
    
    
    SDefIV:
    mov r0, r6
    mov r1, #0x2C
    bl Decrypter
    
    mov r5, r0
    lsr r5, r5, #0x1
    mov r0, #0x40
    mul r5, r0, r5
    
    mov r1, #0x80
    str r1, [sp, #0x0]
    str r1, [sp, #0x4]
    
    #x, y position
    mov r2, #0xC
    str r2, [sp, #0x8]
    mov r1, #0x3E
    str r1, [sp, #0xc]
    
    #x, y size
    mov r2, #0x10
    str r2, [sp, #0x10]
    mov r1, #0x8
    str r1, [sp, #0x14]
    
    mov r0, #0x3
    ldr r1, .GraphicAddr
    add r1, r5
    mov r2, #0x0
    mov r3, #0x0
    bl GraphicHandler
    
    
    
    SpeedIV:
    mov r0, r6
    mov r1, #0x2A
    bl Decrypter
    
    mov r5, r0
    lsr r5, r5, #0x1
    mov r0, #0x40
    mul r5, r0, r5
    
    mov r1, #0x80
    str r1, [sp, #0x0]
    str r1, [sp, #0x4]
    
    #x, y position
    mov r2, #0xC
    str r2, [sp, #0x8]
    mov r1, #0x4B
    str r1, [sp, #0xc]
    
    #x, y size
    mov r2, #0x10
    str r2, [sp, #0x10]
    mov r1, #0x8
    str r1, [sp, #0x14]
    
    mov r0, #0x3
    ldr r1, .GraphicAddr
    add r1, r5
    mov r2, #0x0
    mov r3, #0x0
    bl GraphicHandler
    
    
    
    add sp, #0x18
    b Abort
    
    
    GraphicHandler:
    ldr r4, .HandlerAddr
    bx r4
    
    Decrypter:
    ldr r2, .DecrypterAddr
    bx r2
    
    .align 2
    .GraphicAddr: .word [B]0x08XXXXXX[/B]
    .HandlerAddr: .word 0x080041f1
    .ActiveMonPtr: .word 0x0203b140
    .ActiveOffset: .word 0x00003290
    .MonIndex: .word 0x0203b16c
    .DecrypterAddr: .word 0x0803FBE9


    Replace the 0x08XXXXXX with the address of the image you just inserted (no +1 or reverse needed).

    • Step 3 - Byte changes
    1. At 0x137BF0, place 00 49 08 47 followed by a pointer to the code you just inserted plus one (for example, if you inserted it at 0x800000, you will place 00 49 08 47 01 00 80 08 at 0x137BF0).
    2. At 0x137BE4, place 01 20 03 E0.

    Ending notes
    With that, you should be good to go. In typical Pokémon fashion, this code does not give you the specific values; it instead gives you a unique two-value range. If you want to change that it's rather easy; cut every line starting with lsr in the code and reassemble it, then adjust the image so it has 32 meaningful values instead of 16.

    Credits
    DoesntKnowHowToPlay - Actual code, image
    Lunos - He did the actual Google cache magic too find it

    Again, this is done by DoesntKnowHowToPlay, and it is not done by me. Any credit should go DoesntKnowHowToPlay, and not me.
     
    Last edited:
    34
    Posts
    3
    Years
  • Hey Upsurge,

    First, thanks for the feedback at the other thread.

    Second, I have some questions (I told I was green)...

    1) The image you kindly provided was saved at 71C000 (used Free Space Finder to find this spot). Should I replace the XXXXXX in your routine as 0x0871C000 or as 0x71C000? I guess it is the first option but I think it is best to ask.

    2) I've copied your routine using Notepad++ and saved as IVRanking.asm but I have no idea about what I do with this file. So, I used a Thumb to turn this .asm into a .bin, opened this .bin file and my rom using HxD and pasted the bin's code inside the ROM starting at 71B500, I think this covers this step - let me know if I'm wrong, please.

    3)

    • Step 3 - Byte changes
    1. At 0x137BF0, place 00 49 08 47 followed by a pointer to the code you just inserted plus one (for example, if you inserted it at 0x800000, you will place 00 49 08 47 01 00 80 08 at 0x137BF0).
    2. At x137BE4, place 01 20 03 E0.

    Can you please explain exactly how this is done?

    Thanks in advance.
     
    Last edited:
    990
    Posts
    4
    Years

  • This is NOT my routine. As said above, it is done by DoesntKnowHowToPlay.

    1) This image was by DonestKnowHowToPlay, and yes, like this: 71C000. As an example, the routine would become:
    Spoiler:

    2) Yes, it covers this step. To automagically insert routines into your ROM, use this tool.

    3) Basically you go to address's 0x137BF0 and 0x137BE4 in any hex editor, and replace (Ctrl+B) them with the said bytes.
     
    34
    Posts
    3
    Years
  • Thanks for linking the tool, this will make my life easier in the future, I suppose.

    3) Basically you go to address's 0x137BF0 and 0x137BE4 in any hex editor, and replace (Ctrl+B) them with the said bytes.

    Ok, I got step 3.2, but 3.1 keeps elluding me.

    In your example 0x800000 became 00 80 08 and that is the part that I'm failing to understand. Can you please explain this further? My case is 71B500, would the final input be 00 49 08 47 01 00 71 B5 08?

    Again, thanks for taking the time to guide me through this.
     
    990
    Posts
    4
    Years
  • Thanks for linking the tool, this will make my life easier in the future, I suppose.



    Ok, I got step 3.2, but 3.1 keeps elluding me.

    In your example 0x800000 became 00 80 08 and that is the part that I'm failing to understand. Can you please explain this further? My case is 71B500, would the final input be 00 49 08 47 01 00 71 B5 08?

    Again, thanks for taking the time to guide me through this.

    It will become 00 49 08 47 01 01 B5 71 08.
     
    34
    Posts
    3
    Years
  • It will become 00 49 08 47 01 01 B5 71 08.

    Thanks!

    Looks like it is almost done but apparently I messed up somehow. The attached image shows the ranking boxes are there but no value inside though.

    Edit: This was how I've inserted the image

    NSE -> Load ROM -> Open Sprite -> Selected the one from the image above -> File -> Insert -> Image Data -> FreeSpaceFinder (checking from the beginning of the ROM and telling the size is 2048 bytes) -> 71C000 - Save


    It is working perfectly, I was dumb and using an old backup without the inserted image. Thanks for guiding me through this. Cheers!
     

    Attachments

    • Capturar.PNG
      Capturar.PNG
      24.7 KB · Views: 61
    Last edited:
    34
    Posts
    3
    Years
  • I've found a way to make TMs unsellable:

    Hi,

    I made all the changes but I can still sell TMs (they are reusable already).

    On top of your changes I've used HexManiacAdvance to alter the Mystery Byte of TMs to "1" (the same way that HMs are displayed).

    I'm using CFRU, by the way, but didn't set the flag for reusable TMs while installing that - everything achieved was through this thread (so far: reusable and no number display).

    Thanks!
     

    BluRose

    blu rass
    811
    Posts
    10
    Years
  • modulate experience with two scripting vars

    help.gif


    take your experience and multiply it by the "var numerator" and then divide it by the "var denominator"

    strongly suggest using higher numbers, i.e. if you want a 60% experience thing then set the numerator to 60 and the denominator to 100 so that the processor generates slightly more accurate numbers
    also make sure that you can't really get more than about 56,000 experience, as that causes interesting errors

    credit me and akamethebulbasaur
    for fire red:
    Spoiler:
     
    Last edited:

    BluRose

    blu rass
    811
    Posts
    10
    Years
  • not to double post but

    give your opposing trainers evs and ivs based on a var each

    help.gif


    this primarily to make difficulty hacks where there can be multiple difficulties

    put a value in one var that you want the opponents ivs to be and another value in another var that you want your opponent's evs to be (and yes, all of them will be the same)
    the pokemon has to have just a custom item (at least that check mark ticked in your favorite trainer editor) then all of their values will be set. custom moveset doesn't have to be defined :P

    pastebin right here

    credit me and doesntknowhowtoplay
    for fire red:
    Spoiler:

    EDIT: new and improved! only needs you to check the custom item instead of going all in on the moveset too
     
    Last edited:

    Bela

    Banned
    262
    Posts
    15
    Years
  • Well done on that KDS !

    <snip>

    Bonus:
    -Life Orb boost
    -Light ball updated
    -Item that boost a certain type of attack for Emerald
    -Timespace Orbs for Emerald

    Note that for timespace orbs and new boost-type item, you can adjust the power added the same way than miracle seed and the like.

    Spoiler:

    Hey everybody, I know it's been 5 years since this was written and most people have moved on from this form of hacking, but I have a small request. I'm interested in adding the time-space orbs and the Pixie Plate to FireRed. From what I have been able to find on this forum, it looks like kleenexfeu did both for Emerald, but this has never been ported to FireRed.

    While I know the CFRU engine exists and likely has these elements, I'm not looking to completely overhaul the game or re-do everything to use that base. I'm also unsure if these could be extracted from CFRU or not. My thinking is that the routines in the quoted post have not been written for FireRed, and a port of them are what I'd need. If someone out there is able to help me with this, please reach out to me on Discord or reply here. Thank you! :)
     
    81
    Posts
    7
    Years
    • Seen today
    not to double post but

    give your opposing trainers evs and ivs based on a var each

    help.gif


    this primarily to make difficulty hacks where there can be multiple difficulties

    put a value in one var that you want the opponents ivs to be and another value in another var that you want your opponent's evs to be (and yes, all of them will be the same)
    the pokemon has to have both a custom moveset and a custom item (at least those check marks ticked in your favorite trainer editor) then all of their values will be set

    pastebin right here

    credit me and doesntknowhowtoplay
    for fire red:
    Spoiler:

    Excuse me, how would the script be done?
     

    BluRose

    blu rass
    811
    Posts
    10
    Years
  • Excuse me, how would the script be done?
    if you want to have a trainer that has its evs and ivs change with difficulty, then you just need to
    - make the trainer's pokémon have a custom held item (moveset optional)
    - insert the routine
    - in any script, set the variables that you chose to the evs and ivs you desire
    i recommend using vars from 0x4012-0x40FF, or if you don't want to clean the rom of its scripts then 0x40C0-0x40FF

    si quieres un entrenador que tiene evs y ivs que cambian con dificultad, pues necesitas
    - hacer que el pokemon del entrenador tiene un objeto (moveset no es necesario)
    - insertar la rutina
    - en un script, carga las variables que escoges para tener los evs y los ivs a los valores que deseas
    recomiendo que uses vars desde 0x4012-0x40FF, o si no quieres borrar la rom de sus scripts 0x40C0-0x40FF
     
    Last edited:

    Dr. Seuss

    Will finish GS Chronicles, I swear!
    523
    Posts
    10
    Years
  • It's been a long time since the main post was updated, so after a few hours I finished to update the index for you to easily find any ASM routine posted in this thread.

    If a link is not properly working or I missed a routine feel free to PM me or any mod to add it to the index
     
    Last edited:

    BluRose

    blu rass
    811
    Posts
    10
    Years

  • - snip -
    Bonus:
    -Life Orb boost
    -Light ball updated
    -Item that boost a certain type of attack for Emerald
    -Timespace Orbs for Emerald

    Note that for timespace orbs and new boost-type item, you can adjust the power added the same way than miracle seed and the like.

    Spoiler:

    life orb, new fairy plate, spacial orbs, and the new soul dew (as of gen 7) all in one routine! based on the quoted routine.

    for fire red:
    Spoiler:
    works the same where it's based on the parameter in the item effect structure

    EDIT: added species requirements and now it doesn't crash
    wholly tested now basically

    EDIT: updated it to include gen 7's soul dew updates. note that it can't use the same held effect as the normal soul dew
     
    Last edited:
    112
    Posts
    8
    Years
    • Seen Mar 15, 2024
    Is there a way to change the species of an egg generated from the daycare to be random between parents? like instead of the egg always hatching as the mother's species, it has a chance if being the father's as well.

    for example, if you breed Nidoking with with Kanghaskhan, the resulting egg has a 50% chance of being a Nidoran, instead of always generating a Kangaskhan egg.

    My idea is to have every pokemon be able to hatch from an egg from normal mothers, male only pokemon are stuck with ditto for mothers.
     
    10
    Posts
    10
    Years
    • Seen Jun 8, 2023
    I don't suppose you could show me the HEX codes or the compiled script on here.

    I've followed everything you put and made the Numerator 60 and Denominator on 100 and it only keeps saying that the Pokémon only receives 1 EXP.

    Any help please would be great!
     
    55
    Posts
    3
    Years
    • Seen Feb 27, 2022
    Since the start menu only runs asm offset,

    I'd like to request an asm routine that targets and runs any chosen normal script offset for the start menu's selection.

    Game: BPRE Fire red
     
    Back
    Top