• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • 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.
Hello guys, I want to ask this,
str stores the value of a certain register into a register
while add adds a byte in a certain register

so let's say r0 has 0x020370b8
ldr r0, =(0x020370B8)
ldr r1, =(0x0880EE4A)
ldrb r1, [r1]
ldrb r0, [r0]
strb r0, [r1]

so it means that by doing that, 0x020370B8 has 0x4A

while
ldr r0, =(0x020370B8)
ldrb r0, [r0]
add r0, r0, #0x5

so it means that by doing that, r0 is now 0x020370BD

correct me if I'm wrong
 
Hello guys, I want to ask this,
str stores the value of a certain register into a register
while add adds a byte in a certain register

so let's say r0 has 0x020370b8
ldr r0, =(0x020370B8)
ldr r1, =(0x0880EE4A)
ldrb r1, [r1]
ldrb r0, [r0]
strb r0, [r1]

so it means that by doing that, 0x020370B8 has 0x4A

while
ldr r0, =(0x020370B8)
ldrb r0, [r0]
add r0, r0, #0x5

so it means that by doing that, r0 is now 0x020370BD

correct me if I'm wrong

nnnnnope.
ldrb loads a byte from an address into a certain register. and stop trying to write to the rom, it's not gonna work.
 
Hello guys, I want to ask this,
str stores the value of a certain register into a register
while add adds a byte in a certain register

so let's say r0 has 0x020370b8
ldr r0, =(0x020370B8)
ldr r1, =(0x0880EE4A) Here you load a ROM address, as mentioned above it means "Read Only Memory". You cannot right something in here. Just let you know.
ldrb r1, [r1] Here you load a byte in r1, so r1 doesn't contain a pointer anymore. Actually pointer are just numbers, but it would look like "000000XX" which point to nothing relevant AFAIK.
ldrb r0, [r0]
strb r0, [r1] So here you write a byte at the address "000000XX", which I don't even know if it's possible.

so it means that by doing that, 0x020370B8 has 0x4A Actually you didn't change what was wrote at 0x020370B8 as I explained.

while
ldr r0, =(0x020370B8)
ldrb r0, [r0] again, you load a byte into r0, so let's suppose at 0x020370B8 there was 0x24 wrote, r0 contain now 0x24.
add r0, r0, #0x5 By adding 0x5 it hold now 0x29

so it means that by doing that, r0 is now 0x020370BD And not that

correct me if I'm wrong

Responses in bold.

Ninja-ed, thanks daniilS.
 
Last edited:
Aahhhh, thanks for response, I really need to read carefully ASM tutorials 24/7..
thanks for letting me know,
 
Hello guys, I'm trying to build a routine that lets the Var 8000 edit thePokémon data substructures(Bulbapedia term)
.... I had read the entire site but I can't find the RAM Address of that Pokemon Data substructure
 
Hello guys, I'm trying to build a routine that lets the Var 8000 edit thePokémon data substructures(Bulbapedia term)
.... I had read the entire site but I can't find the RAM Address of that Pokemon Data substructure
 
Hello guys, I'm trying to build a routine that lets the Var 8000 edit thePokémon data substructures(Bulbapedia term)
.... I had read the entire site but I can't find the RAM Address of that Pokemon Data substructure

Use the FBI's routine in the ASM resource thread. For the substructure it's wrote in bulbapedia, something like 0x020244EC for emerald if I remember well
 
Use the FBI's routine in the ASM resource thread. For the substructure it's wrote in bulbapedia, something like 0x020244EC for emerald if I remember well

Thanks, gonna check this
 
Hello guys, I'm trying to build a routine that lets the Var 8000 edit thePokémon data substructures(Bulbapedia term)
.... I had read the entire site but I can't find the RAM Address of that Pokemon Data substructure

Are you just asking how to edit things in it like IVs? Because if that's the case, there's no reason to "build a routine," as a vanilla rom already has it built in. You can just move/load to a few registers then call it. I'm on a phone now so I can't give it to you right now, but I could give it to you the next time I'm on my computer/ you could probably find it with a quick google.

Also, what do you mean by "that" RAM address? There are six party slots and 30 pokemon in each box.
 
Last edited:
Hello guys, I'm trying to build a routine that lets the Var 8000 edit thePokémon data substructures(Bulbapedia term)
.... I had read the entire site but I can't find the RAM Address of that Pokemon Data substructure

Pokémon data tables are not copied to RAM, they're read from the ROM. You can't change them in real time because you can't edit them from the game. (Obviously)

You may want to have a special case of reading a different piece of data or something. But I'm here to tell you that what you're doing is impossible by normal means.
 
The reason why I'm looking for that is for the pokemon current experience, anyway please forgive me if this routine I created is too dumb, I'm trying to create a routine that var 8004 is the slot number, 8005 is the Stat 0 is Current HP, 1 is Total HP, 2 is Attack and so on, then in 8006 is XXYY where XX can be only be 00(Add YY) or 01(Subtract YY) and YY is the value to add or subtract
But yeah, when I call it in a script, the game freezes
Spoiler:
 
Last edited:
The reason why I'm looking for that is for the pokemon current experience, anyway please forgive me if this routine I created is too dumb, I'm trying to create a routine that var 8004 is the slot number, 8005 is the Stat 0 is Current HP, 1 is Total HP, 2 is Attack and so on, then in 8006 is XXYY where XX can be only be 00(Add YY) or 01(Subtract YY) and YY is the value to add or subtract
But yeah, when I call it in a script, the game freezes
Spoiler:

So much is wrong with this - the cause for the freeze being the least worrying. You label stuff as loops, yet they don't loop? Anyway, your main problem is you push more than you pop, thus causing stack corruption.

Please comment what you think you are doing so I can correct it - I can't guess what this is supposed to do without comments.
 
So much is wrong with this - the cause for the freeze being the least worrying. You label stuff as loops, yet they don't loop? Anyway, your main problem is you push more than you pop, thus causing stack corruption.

Please comment what you think you are doing so I can correct it - I can't guess what this is supposed to do without comments.

am already put the comment
 
The reason why I'm looking for that is for the pokemon current experience, anyway please forgive me if this routine I created is too dumb, I'm trying to create a routine that var 8004 is the slot number, 8005 is the Stat 0 is Current HP, 1 is Total HP, 2 is Attack and so on, then in 8006 is XXYY where XX can be only be 00(Add YY) or 01(Subtract YY) and YY is the value to add or subtract
But yeah, when I call it in a script, the game freezes
Spoiler:


Spoiler:
 
#1: Since r4 won't be used, IMO {r0-r3,lr/pc} is safer. You should check available bytes in SP first
#2: This step is redundant.
#3: IIRC, it's 2 byte per stat, so you should multiply r3 by 2 first.
#4: r1 isn't usable due to #3. Use r0 instead.
#5: The value in r1 should be loaded first into r3 (ldrh). Then, use sub/add r3, r3, r0 instead, assuming you're using r0 and r3 as I've mentioned.
#6: At this rate, you should store the value of r3 into r1 (strh instead of strb). Also, put r3 between limit (0 - 999) before storing them.

#1: If he doesn't use R4 he doesn't need to push/pop any registers...
 
It's not assuming, it's a standard. And may I ask how on earth you would check available space on the stack?
Since the only pokemon game I've ever hacked is R/S, I don't have any good example. In other GBA games, there are times where I need to push some registers (r0-r3) to insert a routine. I'm putting those just for insurance.

To check the availability of the stack, I'm checking all routines before and after this function. A function with SP modifying instruction can limit the space on the stack. If he calls the function inside a SP modifying function, there is a chance that pushing will overwrite important data.
 
Last edited:
Status
Not open for further replies.
Back
Top