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

HackMew's Knowledge

94
Posts
13
Years
    • Seen Nov 2, 2016
    With ASM, how would you do modulo?
    There are a couple of ways in fr. There is software interrupt 0x6, which is a bios function call that does division and modulo. There is routine 081E4018 developed by gamefreak, that does division and modulo as well.

    R0 = dividend
    R1 = divisor

    returning
    R0 = quotient
    R1 = modulo answer

    081E4684 is another routine made by gamefreak that does modulo only.

    A few other math routines:
    081E460C: another division routine
    081E3B9C: square root, calls swi 0x8

    I've stumbled across a few others that I dont remember..
     
    24
    Posts
    12
    Years
    • Seen Apr 29, 2012
    There are a couple of ways in fr. There is software interrupt 0x6, which is a bios function call that does division and modulo. There is routine 081E4018 developed by gamefreak, that does division and modulo as well.

    R0 = dividend
    R1 = divisor

    returning
    R0 = quotient
    R1 = modulo answer

    081E4684 is another routine made by gamefreak that does modulo only.

    A few other math routines:
    081E460C: another division routine
    081E3B9C: square root, calls swi 0x8

    I've stumbled across a few others that I dont remember..

    Thank you for your assistance.
     
    3
    Posts
    13
    Years
    • Seen Nov 15, 2012
    Hey guys i have a question how do i get the results lesson1.bin this:
    03 B5 03 48 00 68 03 49 80 89 08 80 03 BD C0 46
    0C 50 00 03 D0 70 03 02
    into my rom?
     
    5
    Posts
    11
    Years
    • Seen Dec 7, 2012
    kan u post something on xse? it aint wantin to work for me. it will work. but it shuts down after like a second.
     

    Deokishisu

    Mr. Magius
    990
    Posts
    18
    Years
  • kan u post something on xse? it aint wantin to work for me. it will work. but it shuts down after like a second.

    O poor English, struck down in its prime.

    Anyway, this is because of the auto update feature. Since Hackmew's site is down, it tries to update, fails, and closes. To fix it, go into your .ini file and change it so that the AutoUpdateCheck equals zero.

    So that line should look like this:
    AutoUpdateCheck=0
     

    GoGoJJTech

    (☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
    2,475
    Posts
    11
    Years
  • These are extremely helpful ( and long ) well great job hackmew
     
    1,323
    Posts
    16
    Years
    • Seen Dec 9, 2023
    I decided to take a crack at HackMew's ASM challenge, and I succeeded!
    efews8.png
    16ld1g2.png


    This is what I modified the routine to:
    Code:
    .text
    .align 2
    .thumb
    .thumb_func
    .global lesson1
    
    main:
    	push {r0-r1, lr}
    	ldr r0, .PLAYER_DATA
    	ldr r0, [r0]
    	ldr r1, .VAR
    	ldrh r0, [r0, #0xC]
    	strh r0, [r1]	
    	ldr r0, .PLAYER_DATA
    	ldr r0, [r0]
    	ldr r1, .NEXT
    	ldrh r0, [r0, #0xA]
    	strh r0, [r1]
    	pop {r0-r1, pc}
    
    
    .align 2
    .PLAYER_DATA:
    	.word 0x0300500C
    .VAR:
    	.word 0x020270B6 + (0x800D * 2)
    .NEXT:
    	.word 0x020270B8 + (0x8000 * 2)

    And the XSE script:
    Code:
    #dynamic 0x800000
    #org @main
    callasm YourASMoffset
    buffernumber 0x0 LASTRESULT
    buffernumber 0x1 0x8000
    msgbox @msg MSG_FACE
    end
    
    
    #org @msg
    = Your Trainer ID is [buffer2].\nYour Secret ID is [buffer1].

    Going to do my best to get ASM down...
     

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • I decided to take a crack at HackMew's ASM challenge, and I succeeded!
    efews8.png
    16ld1g2.png


    Spoiler:

    Going to do my best to get ASM down...

    Spoiler tags, pls!
    Also, you don't need to load player data twice.
    It should till work without doing this the second time:
    ldr r0, .PLAYER_DATA
    ldr r0, [r0]

    EDIT: I lied, the way you did it, you did need to load it twice (or subtract :D).
     

    karatekid552

    What happens if I push it?....
    1,771
    Posts
    11
    Years
  • Almost all of the reference links for the ASM tutorial are broken. I have found a few of them, would it be alright for me to post them here? Or should I pm them to DrFuji/giradalkia to add to the end of the tut?

    Edit: only two are broken.... Wow, I remember that being a lot more last time....

    Edit2: I guess since no one has objected it is fine for me to post the links here:


    Assembly Wikipedia: (So easy to find it really wasn't broken, but whatever) http://en.wikipedia.org/wiki/Assembly_language

    ARM7DTMI Technical Manuel: http://infocenter.arm.com/help/topic/com.arm.doc.ddi0210c/DDI0210B.pdf

    Tonic: Whirlwind Tour of ARM Assembly: http://www.coranac.com/tonc/text/asm.htm


    Hope these help anyone who wants to learn ASM.
     
    Last edited:
    949
    Posts
    11
    Years
  • Since I see people asking questions here, I have a problem using ldr with cmp. I am making a code that compares two words, one located in the RAM and the other located in the ROM. so what I do:
    Spoiler:
    The problem is, the jump never occurs even when the words are equal... So I tried this:
    Spoiler:
    And this 2nd code works correctly but takes more space and it is more complicated. So, I'm wondering if ldr and/or cmr commands have some particular behaviour that makes the first code not working??? Or am I just doing something wrong?
     
    Last edited:

    karatekid552

    What happens if I push it?....
    1,771
    Posts
    11
    Years
  • Since I see people asking questions here, I have a problem using ldr with cmp. I am making a code that compares two words, one located in the RAM and the other located in the ROM. so what I do:
    Spoiler:
    The problem is, the jump never occurs even when the words are equal... So I tried this:
    Spoiler:
    And this 2nd code works correctly but takes more space and it is more complicated. So, I'm wondering if ldr and/or cmr commands have some particular behaviour that makes the first code not working??? Or am I just doing something wrong?

    Would you mind giving us all of the ASM in the regular format? It is really tough the read this way.
     

    karatekid552

    What happens if I push it?....
    1,771
    Posts
    11
    Years
  • code 1: code 2: The first one doesn't jump to TheyAreEqualz even when it should, the second code works perfectly for me. (Sorry, for some reason, line skips are removed from my posts ;_; I think it's just my ****** Internet -.-')

    From looking at your code, both routines are loading different things. Parts are loading words and others are loading half-words and neither lines up with the other routine. That is probably where your problem lies. A word is 4 bytes and a half-word is 2 bytes. Take that as you wish.
     
    949
    Posts
    11
    Years
  • Spoiler:

    But does this way work for any other variables other than the 0x8000 family?
     

    karatekid552

    What happens if I push it?....
    1,771
    Posts
    11
    Years
  • Spoiler:

    But does this way work for any other variables other than the 0x8000 family?

    The others are DMA protected. Check my battle bg changer to see how to check vars of others. There is an in-game decrypter function.
     

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • I got the error 'thumb' not recognized as an internal blah blah

    You need to navigate in the command prompt to the directory containing "thumb.bat" and the rest of those files. From what it looks, you're trying to run it from a directory which doesn't have it.

    I would move all the files into 1 folder and do:
    cd path\To\File
    thumb source.asm compiled.bin


    Next time:
    http://www.pokecommunity.com/showthread.php?t=339708
     
    275
    Posts
    8
    Years
  • So I have tried using the palette editing tutorial together with APE.
    I did change the palettes of the National Pokédex, but I failed as for the right ones.
    The broken images in OP could really be of help here.
    Instead of changing that "green" frame of the National Pokédex for the brown one from the Regional Pokédex, I changed the background of the Pokédex to red and brown (and I didn't even use red while editting palettes...)
    I opened the palettes, just like HackMew's tutorial said to, and I changed every green color for brown colors (only colors that were already in the palette) and this happened.
    Help?
     
    Back
    Top