• 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.

Help Thread: ASM & Disassembly

Status
Not open for further replies.
417
Posts
9
Years
    • Seen Nov 20, 2016
    You can temporarily edit a stat. Try something like placing it in the pc then withdrawing again. It will cancel out your alteration which (I'm guessing) is not your goal.
     

    Lance32497

    LanceKoijer of Pokemon_Addicts
    792
    Posts
    9
    Years
  • You can temporarily edit a stat. Try something like placing it in the pc then withdrawing again. It will cancel out your alteration which (I'm guessing) is not your goal.

    Oh, I haven't tried that yet, maybe that's not a good hack to start my asm. Well I will still try, If I finally changed the bytes there then I will advance to that.
     

    Lance32497

    LanceKoijer of Pokemon_Addicts
    792
    Posts
    9
    Years
  • PurpleOrange

    still don't know what I'm doing
    367
    Posts
    10
    Years
  • No, you should just use some math. Recall, countpokemon stores the amount of Pokemon in the lastresult (I forget if it's 0-5 or 1-6). From there, you just add to 0x2024284, 0x64 * amount of Pokemon. Lastresult is 0x20370D0 btw.

    i'm a little confused by this bit, do i use countpokemon in an xse script and somehow put the compare lastresult part in the routine? sorry if 'm being stupid here ahaha

    You can't using mov. What you can do is use ldr instead of move for things that are 32 bits (so a nickname won't fit). But set_attr (the function Touched calls in that routine) takes a pointer to the value to set, rather than an actual value (so you don't need to make r2 something other than a pointer. Touched uses the stack, which is probably what confused you. You could use a ROM address. Like this:

    Code:
        ldr r0, =(0x02024284)
        mov r1, #0x2
       ldr r2, =(address to nick name)
        ldr r3, =(0x0804037C + 1)
        bl linker

    so the ldr r2 replaces the move r2; push {r2}; and move r2, sp, but does the bl linker get rid of the bl call_via r3 and the two pops at the end of the routine?

    orig routine below for convenience
    Spoiler:
     
    7
    Posts
    10
    Years
  • Well ... I have a question about creating a sort of puzzle, that is, what I want is to make a square 3x3 in map, ie, 3 tiles 3 tiles. In which there are only eight tiles, but in one, empty. And when you press "A " on a tile that is adjacent to the empty space, the tile will move it, so I can make the puzzle.

    By the way, I feel my bad English, I'm Spanish
     

    C me

    Creator of Pokemon League Of Legends
    681
    Posts
    10
    Years
    • Seen Apr 9, 2021
    This routine won't compile for me for some reason, usually when I drag a routine onto the compiler I get the bin file, but nothing appears for this one.

    Spoiler:


    What's wrong?
     

    Touched

    Resident ASMAGICIAN
    625
    Posts
    9
    Years
    • Age 122
    • Seen Feb 1, 2018
    This routine won't compile for me for some reason, usually when I drag a routine onto the compiler I get the bin file, but nothing appears for this one.

    Spoiler:


    What's wrong?

    No idea, seems to assemble just fine for me.

    Do not drag your assembly file onto the assembler, use the command line so that you have a chance to read the output. If you have to drag and drop, add a pause to end of the batch file (I assume you're using Hackmew's batch file) so that you can read the assembler output.
     

    C me

    Creator of Pokemon League Of Legends
    681
    Posts
    10
    Years
    • Seen Apr 9, 2021
    No idea, seems to assemble just fine for me.

    Do not drag your assembly file onto the assembler, use the command line so that you have a chance to read the output. If you have to drag and drop, add a pause to end of the batch file (I assume you're using Hackmew's batch file) so that you can read the assembler output.

    I drag it onto the thumb program, how do I add a pause?
     

    C me

    Creator of Pokemon League Of Legends
    681
    Posts
    10
    Years
    • Seen Apr 9, 2021
    Its says Assembler messages:

    38:Warning: Partial line at end of file ignored

    26:Error: invalid offset, value too big <0xFFFFFFFC>
     
    417
    Posts
    9
    Years
    • Seen Nov 20, 2016
    Its says Assembler messages:

    38:Warning: Partial line at end of file ignored

    26:Error: invalid offset, value too big <0xFFFFFFFC>
    Idk. I copy pasted and was also able to assemble with no issues, but I'm not using hackmew's batch file.

    Is there anything else you're assembling in the same .s file? Meh, here's your bin:

    Code:
    00 B5 0C 48 00 78 0C 49 58 22 50 43 43 18 18 8D 78 22 99 8D 0B 1C 09 1A 08 1C 50 43 19 1C 00 F0 06 F8 01 21 09 18 06 4A 11 70 01 BC 00 47 03 4A 10 47 C0 46 0C 42 02 02 84 40 02 02 41 75 2E 08 00 44 02 02
     
    41
    Posts
    10
    Years
  • How to compile and use this patch? (it is for gold)

    Spoiler:


    Also, PKSVUI cant load Scintilla.dll even though they're in the same directory
     
    Last edited:
    127
    Posts
    10
    Years
    • Seen May 4, 2024
    Hi,
    I found the routine of the battle command C1 (hidden power), I wanted to write a far more simple routine to just return the type of the user (wich I think I have), and, if it is needed, the power (fixe)

    Here is the hidden power routine :
    Spoiler:



    I don't want to someone translate the routine, but, does someone know what it returns ? I mean, It supposed to determine type and power, but in the end it pop five register. So how they're used ?
    Or there only R0 that is used ? If so, how the data are stored in ?
    I know there's a lot of question but I read tutorials since hours but I am not able to understand this one x)

    Could someone explain to me how this person was able to obtain the internal code for a battle command? I have been looking for something like this for at least a week, so if someone could please explain this to me, it would be very helpful.
     

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • Could someone explain to me how this person was able to obtain the internal code for a battle command? I have been looking for something like this for at least a week, so if someone could please explain this to me, it would be very helpful.

    That's from an IDA IDB file. You can find the IDB in knizz or Touched's signature, but it's against the rules for us to post an IDA download. You'll have to pirate buy it yourself :x
     
    7
    Posts
    8
    Years
    • Seen Nov 20, 2016
    I got a script to change the IV of the pokemon in first party slot using the below script from user Touched. However the IV value only changes and the PKMN stats do not reflect the IV value change... What is going on?

    To be clear, the code works, it changes the IV value, but the stats are not updated to reflect the change.

    Code from /archive/index.php/t-347391.html:
    .text
    .align 2
    .thumb
    .thumb_func

    main:
    push {lr} @ Preserve LR, you are setting it and it needs to be maintained

    ldr r0, =(0x02024284)
    mov r1, #0x27

    @ Load the value we want to set
    mov r2, #0x1F
    @ We want a pointer to this value, so place it on the stack
    push {r2}
    mov r2, sp

    @ We now have a pointer to 0x1F. Thus a ldr r2, [r2] would set r2 to 0x1F

    @ Call the function as usual
    ldr r3, =(0x0804037C + 1)
    bl call_via_r3

    @ Take the value off the stack (we don't need it anymore)
    pop {r2}

    @ Return (LR was pushed onto the stack, take it off and put the value on PC)
    pop {pc}

    call_via_r3:
    bx r3
     
    Last edited:
    146
    Posts
    11
    Years
    • CO
    • Seen Mar 16, 2023
    So I was going threw my asm folder and found a text file that reads

    Spoiler:


    Now I converted it into this
    Code:
    .text
    .align 2
    .thumb
    .thumb_func
    
    main:
            push {r0-r2, lr} 
            ldr r0, =(0x0203f414)
            ldr r0, [r0]
            ldr r1, =(0x020370C2)
            ldrb r2, [r0]
            cmp r2, #0xf
            bgt end
            ldrh r1, [r1]
            cmp r1, #0x10 
            blt infect
            mov r1, #0x10
    infect:
            strb r1, [r0]
            
    end:
            pop {r0-r2, pc}
    
    .align 2
    Before I converted the original routine, I could not get it to compile.
    After conversion I compiled it an came up with this
    Code:
    07 B5 06 48 00 68 06 49 02 78 0F 2A 04 DC 09 88 
    10 29 00 DB 10 21 01 70 07 BD C0 46 14 F4 03 02 
    C2 70 03 02
    The only difference I could see between the two was that after BD mine had C0 46 wile the original has 00 00.

    My question is
    Am I going about this right?
    And I have tried to make a testing script but I can't seem to get it to work so I don't know if if either of these Pokerus routines work or its just my scripting at the moment.

    Any help is much appreciated ^_^
     
    417
    Posts
    9
    Years
    • Seen Nov 20, 2016
    Spoiler:
    Please link to the original post. I'm not familiar with those offsets, but for now I'll assume that the comments are accurate. I ask for the original routine because the routine is altering the (encrypted) misc data structure, but I see neither decryption nor encryption. It appears that routine is intended to be used with the routines JPAN wrote, which you don't need to use anymore anyways. The game has built in routines for handling encrypted data. As for your C0 46 and 00 00 question, they are irrelevant to your current issue. That is for alignment purposes only; you'll notice that the two words following them are the literal pool which needs to be word aligned for ldr to load them. In this particular case, they could literally be any combination of two bytes, and I'm fairly sure C0 46 is the what devkitARM uses for any .align 2.
     
    146
    Posts
    11
    Years
    • CO
    • Seen Mar 16, 2023
    Please link to the original post. I'm not familiar with those offsets, but for now I'll assume that the comments are accurate. I ask for the original routine because the routine is altering the (encrypted) misc data structure, but I see neither decryption nor encryption. It appears that routine is intended to be used with the routines JPAN wrote, which you don't need to use anymore anyways. The game has built in routines for handling encrypted data. As for your C0 46 and 00 00 question, they are irrelevant to your current issue. That is for alignment purposes only; you'll notice that the two words following them are the literal pool which needs to be word aligned for ldr to load them. In this particular case, they could literally be any combination of two bytes, and I'm fairly sure C0 46 is the what devkitARM uses for any .align 2.


    Ok...
    So after digging around, I found that the post that I had saved in a text file was from the Script Help Thread but was deleted. So I started looking again and found the original post here

    In the "Catch the pokerus" section

    Also you where right as this does work with JPANs encryption and decryption routines, I think anyway >_<

    If I was better at scripting I would use the in game routines but I was trying to use this for simplicity.
    Not to mention I have really never seen a hack use Pokerus so I was hoping to add the feature to mine.
    Now I am not so sure about it >_<
     
    417
    Posts
    9
    Years
    • Seen Nov 20, 2016
    Ok...
    So after digging around, I found that the post that I had saved in a text file was from the Script Help Thread but was deleted. So I started looking again and found the original post here

    In the "Catch the pokerus" section

    Also you where right as this does work with JPANs encryption and decryption routines, I think anyway >_<

    If I was better at scripting I would use the in game routines but I was trying to use this for simplicity.
    Not to mention I have really never seen a hack use Pokerus so I was hoping to add the feature to mine.
    Now I am not so sure about it >_<
    Info on the decrypter:
    http://www.romhack.me/database/23/fire-red-commonly-used-asm-rom-offsets/page_3/

    If you aren't sure how to use that, there are a few ASM tutorials around. A few resources that may be helpful:

    http://www.pokecommunity.com/showthread.php?t=343871
    https://github.com/Touched/asm-tutorial/blob/master/doc.md
    http://problemkaputt.de/gbatek.htm
     
    Status
    Not open for further replies.
    Back
    Top