• 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

5,256
Posts
16
Years

Nature-affected stats colouring routines [FR]:

CLICK FOR EMERALD

This is probably the least efficient way to do this, but it works.

Attack:
Code:
.thumb
@ 00 49 08 47 XX XX XX XX at x137134

ldr r1, [r2]
ldrb r2,[r1,#4]
add r2,#0x32
lsl r2,r2,#0x18
lsr r2,r2,#0x18
push {r0-r3}
ldr r0, =(0x0203B140)
ldr r0, [r0]
ldr r2, =(0x3290)
add r0, r0, r2
mov r1, #0
bl decryptbranch
bl getnaturebranch
cmp r0, #1 @ Lonely
beq red
cmp r0, #2 @ Brave
beq red
cmp r0, #3 @ Adamant
beq red
cmp r0, #4 @ Naughty
beq red
cmp r0, #5 @ Bold
beq blue
cmp r0, #10 @ Timid
beq blue
cmp r0, #15 @ Modest
beq blue
cmp r0, #20 @ Calm
beq blue

black:
ldr r6, blackfont
b end

red:
ldr r6, redfont
b end

blue:
ldr r6, bluefont

end:
pop {r0-r3}
ldr r1, =(0x0813713c+1)
bx r1

decryptbranch:
ldr r2, =(0x0803FBE8+1)
bx r2

getnaturebranch:
ldr r2, =(0x08042EB4+1)
bx r2

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00

Defense:
Code:
.thumb
@ 00 49 08 47 XX XX XX XX at x137158

ldr r1, [r2]
ldrb r2,[r1,#6]
add r2,#0x32
lsl r2,r2,#0x18
lsr r2,r2,#0x18
push {r0-r3}
ldr r0, =(0x0203B140)
ldr r0, [r0]
ldr r2, =(0x3290)
add r0, r0, r2
mov r1, #0
bl decryptbranch
bl getnaturebranch
cmp r0, #1 @ Lonely
beq blue
cmp r0, #5 @ Nold
beq red
cmp r0, #7 @ Relaxed
beq red
cmp r0, #8 @ Impish
beq red
cmp r0, #9 @ Lax
beq red
cmp r0, #11 @ Hasty
beq blue
cmp r0, #16 @ Mild
beq blue
cmp r0, #21 @ Gentle
beq blue

black:
ldr r6, blackfont
b end

red:
ldr r6, redfont
b end

blue:
ldr r6, bluefont

end:
pop {r0-r3}
ldr r1, =(0x08137162+1)
bx r1

decryptbranch:
ldr r2, =(0x0803FBE8+1)
bx r2

getnaturebranch:
ldr r2, =(0x08042EB4+1)
bx r2

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00

Special Attack:
Code:
.thumb
@ 00 49 08 47 XX XX XX XX at x13717C

mov r2,r8
ldr r1, [r2]
ldrb r2,[r1,#8]
add r2,#0x32
lsl r2,r2,#0x18
lsr r2,r2,#0x18
push {r0-r3}
ldr r0, =(0x0203B140)
ldr r0, [r0]
ldr r2, =(0x3290)
add r0, r0, r2
mov r1, #0
bl decryptbranch
bl getnaturebranch
cmp r0, #3 @ Adamant
beq blue
cmp r0, #8 @ Impish
beq blue
cmp r0, #13 @ Jolly
beq blue
cmp r0, #15 @ Modest
beq red
cmp r0, #16 @ Mild
beq red
cmp r0, #17 @ Quiet
beq red
cmp r0, #19 @ Rash
beq red
cmp r0, #23 @ Careful
beq blue

black:
ldr r6, blackfont
b end

red:
ldr r6, redfont
b end

blue:
ldr r6, bluefont

end:
pop {r0-r3}
ldr r1, =(0x08137188+1)
bx r1

decryptbranch:
ldr r2, =(0x0803FBE8+1)
bx r2

getnaturebranch:
ldr r2, =(0x08042EB4+1)
bx r2

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00

Special Defense:
Code:
.thumb
@ 00 49 08 47 XX XX XX XX at x1371A4

ldr r1, [r2]
ldrb r2,[r1,#0xA]
add r2,#0x32
lsl r2,r2,#0x18
lsr r2,r2,#0x18
push {r0-r3}
ldr r0, =(0x0203B140)
ldr r0, [r0]
ldr r2, =(0x3290)
add r0, r0, r2
mov r1, #0
bl decryptbranch
bl getnaturebranch
cmp r0, #4 @ Naughty
beq blue
cmp r0, #9 @ Lax
beq blue
cmp r0, #14 @ Naive
beq blue
cmp r0, #19 @ Rash
beq blue
cmp r0, #20 @ Calm
beq red
cmp r0, #21 @ Gentle
beq red
cmp r0, #22 @ Sassy
beq red
cmp r0, #23 @ Careful
beq red

black:
ldr r6, blackfont
b end

red:
ldr r6, redfont
b end

blue:
ldr r6, bluefont

end:
pop {r0-r3}
ldr r1, =(0x081371AE+1)
bx r1

decryptbranch:
ldr r2, =(0x0803FBE8+1)
bx r2

getnaturebranch:
ldr r2, =(0x08042EB4+1)
bx r2

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00

Speed:
Code:
.thumb
@ 00 49 08 47 XX XX XX XX at x1371C8

mov r2,r8
ldr r1, [r2]
ldrb r2,[r1,#0xC]
add r2,#0x32
lsl r2,r2,#0x18
lsr r2,r2,#0x18
push {r0-r3}
ldr r0, =(0x0203B140)
ldr r0, [r0]
ldr r2, =(0x3290)
add r0, r0, r2
mov r1, #0
bl decryptbranch
bl getnaturebranch
cmp r0, #2 @ Brave
beq blue
cmp r0, #7 @ Relaxed
beq blue
cmp r0, #10 @ Timid
beq red
cmp r0, #11 @ Hasty
beq red
cmp r0, #13 @ Jolly
beq red
cmp r0, #14 @ Naive
beq red
cmp r0, #17 @ Quiet
beq blue
cmp r0, #22 @ Sassy
beq blue

black:
ldr r6, blackfont
b end

red:
ldr r6, redfont
b end

blue:
ldr r6, bluefont

end:
pop {r0-r3}
ldr r1, =(0x081371d4+1)
bx r1

decryptbranch:
ldr r2, =(0x0803FBE8+1)
bx r2

getnaturebranch:
ldr r2, =(0x08042EB4+1)
bx r2

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00

Reverting the font colour back to black:
Code:
.thumb
@ 00 49 08 47 XX XX XX XX at 081371F0

ldr r1, [r2]
ldrb r2,[r1,#0xE]
add r2,#0xF
lsl r2,r2,#0x18
lsr r2,r2,#0x18
ldr r6, blackfont
ldr r1, =(0x081371FA+1)
bx r1

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00

where XX XX XX XX is the location of each routine +1.

This colours the stat increased by the Pokémon's nature red, and the stat that is decreased blue.

8IfVLeT.png
ltTHc6K.png


Edit: Updated 23/12/2015, the old routines had a few errors that I forgot to update after making changes to my ROM. I've also confirmed what bluefont should be in a vanilla ROM. Enjoy!
 
Last edited:

DoesntKnowHowToPlay

Tiny Umbrella with Lots and Lots of Good
265
Posts
12
Years
  • Seen Feb 24, 2024
I've noticed significant demand for working Dawn Stone evolutions, specifically ones that require the mon to be a specific gender. My bad if this is already posted somewhere but here y'all go:

Code:
.org 0x4318e
lsl r0, r0, #0x0
ldr r2, .MethodAddr
bx r2

.MethodAddr: .word 0x085B2521 #UPDATE THIS TO MAIN FUNCTION OFFSET+1


.org 0x5B2520 #UPDATE THIS TO MOST CONVENIENT FREE SPACE IN YOUR HACK
cmp r0, #0x7
beq StandardStone
cmp r0, #0x14 #UPDATE THIS
beq MaleStone
cmp r0, #0x15 #UPDATE THIS
beq FemaleStone
b NoEvo

MaleStone:
push {r1-r3}
mov r0, r7
mov r1, r8
ldr r1, [r1, #0x0]
bl DetermineGender
pop {r1-r3}
cmp r0, #0x0
beq StandardStone
b NoEvo


FemaleStone:
push {r1-r3}
mov r0, r7
mov r1, r8
ldr r1, [r1, #0x0]
bl DetermineGender
pop {r1-r3}
cmp r0, #0xFE
beq StandardStone
b NoEvo


StandardStone:
ldrh r0, [r1, #0x2]
cmp r0, r9
beq Finish

NoEvo:
ldr r2, .NoEvoReturn
bx r2

DetermineGender:
ldr r2, .DetermineGenderFunc
bx r2

Finish:
ldr r2, .EvoReturn
bx r2

.NoEvoReturn: .word 0x08043199
.EvoReturn: .word 0x0804317d
.DetermineGenderFunc: .word 0x0803f78d
Change the values in the lines marked UPDATE THIS to the indexes of male stone evos and female stone evos. Leave their entries blank in the general evolution table; stone evolutions function differently from level-up evolutions.
 
6
Posts
9
Years
  • Age 31
  • Seen Feb 24, 2017
Hi~
I've been trying for a few weeks to make an asm routine were you store the species of a party pokemon in a var, but i've had no success.

Could anyone help me with this? ^^
 
5,256
Posts
16
Years

checkitem hack to store quantity in 0x8008

This is probably a relatively esoteric hack, but I found a use for it so I might as well share it. When using the checkitem command, it will now buffer the quantity of said item into the variable 0x8008, and then behaves as usual for the regular usage of the command.

The reason I made this was to do something like the following dummy script:

Code:
checkitem ITEM_BLUESHARD 0x1
if B_< goto @none
buffernumber 0x0 0x8008
msgbox @string1 0x6
...

#org @string1
= You have [buffer1] Blue Shards.

It will always buffer to 0x8008, but you can change the RAM loc in the routine if you want it to be some other variable.

Code:
.thumb

@ 00 4A 10 47 XX+1 XX XX XX at 08099f88

lsl r0,r0,#0x10
lsr r0,r0,#0x10
ldr r2, =(0x020370C8) @ RAM location of 0x8008
strh r0, [r2]
ldr r2, =(0x08099f58+1)
cmp r0, r5
bcs branch
ldr r2, =(0x08099f90+1)

branch:
bx r2
 
Last edited:

Shogun

I'll be back
527
Posts
10
Years

Nature-affected stats colouring routines [FR]:

This is probably the least efficient way to do this, but it works.

Attack:
Code:
.thumb
@ 00 49 08 47 XX XX XX XX at x137134

ldr r1, [r2]
ldrb r2,[r1,#4]
add r2,#0x32
lsl r2,r2,#0x18
lsr r2,r2,#0x18
push {r0-r3}
ldr r0, =(0x0203B140)
ldr r0, [r0]
ldr r2, =(0x3290)
add r0, r0, r2
mov r1, #0
bl decryptbranch
bl getnaturebranch
cmp r0, #1 @ Lonely
beq red
cmp r0, #2 @ Brave
beq red
cmp r0, #3 @ Adamant
beq red
cmp r0, #4 @ Naughty
beq red
cmp r0, #5 @ Bold
beq blue
cmp r0, #10 @ Timid
beq blue
cmp r0, #15 @ Modest
beq blue
cmp r0, #20 @ Calm
beq blue

black:
ldr r6, blackfont
b end

red:
ldr r6, redfont
b end

blue:
ldr r6, bluefont

end:
pop {r0-r3}
ldr r1, =(0x0813713c+1)
bx r1

decryptbranch:
ldr r2, =(0x0803FBE8+1)
bx r2

getnaturebranch:
ldr r2, =(0x08042EB4+1)
bx r2

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00
Defense:
Code:
.thumb
@ 00 49 08 47 XX XX XX XX at x137158

ldr r1, [r2]
ldrb r2,[r1,#6]
add r2,#0x32
lsl r2,r2,#0x18
lsr r2,r2,#0x18
push {r0-r3}
ldr r0, =(0x0203B140)
ldr r0, [r0]
ldr r2, =(0x3290)
add r0, r0, r2
mov r1, #0
bl decryptbranch
bl getnaturebranch
cmp r0, #1 @ Lonely
beq blue
cmp r0, #5 @ Nold
beq red
cmp r0, #7 @ Relaxed
beq red
cmp r0, #8 @ Impish
beq red
cmp r0, #9 @ Lax
beq red
cmp r0, #11 @ Hasty
beq blue
cmp r0, #16 @ Mild
beq blue
cmp r0, #21 @ Gentle
beq blue

black:
ldr r6, blackfont
b end

red:
ldr r6, redfont
b end

blue:
ldr r6, bluefont

end:
pop {r0-r3}
ldr r1, =(0x08137162+1)
bx r1

decryptbranch:
ldr r2, =(0x0803FBE8+1)
bx r2

getnaturebranch:
ldr r2, =(0x08042EB4+1)
bx r2

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00
Special Attack:
Code:
.thumb
@ 00 49 08 47 XX XX XX XX at x13717C

mov r2,r8
ldr r1, [r2]
ldrb r2,[r1,#8]
add r2,#0x32
lsl r2,r2,#0x18
lsr r2,r2,#0x18
push {r0-r3}
ldr r0, =(0x0203B140)
ldr r0, [r0]
ldr r2, =(0x3290)
add r0, r0, r2
mov r1, #0
bl decryptbranch
bl getnaturebranch
cmp r0, #3 @ Adamant
beq blue
cmp r0, #8 @ Impish
beq blue
cmp r0, #13 @ Jolly
beq blue
cmp r0, #15 @ Modest
beq red
cmp r0, #16 @ Mild
beq red
cmp r0, #17 @ Quiet
beq red
cmp r0, #19 @ Rash
beq red
cmp r0, #23 @ Careful
beq blue

black:
ldr r6, blackfont
b end

red:
ldr r6, redfont
b end

blue:
ldr r6, bluefont

end:
pop {r0-r3}
ldr r1, =(0x08137188+1)
bx r1

decryptbranch:
ldr r2, =(0x0803FBE8+1)
bx r2

getnaturebranch:
ldr r2, =(0x08042EB4+1)
bx r2

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00
Special Defense:
Code:
.thumb
@ 00 49 08 47 XX XX XX XX at x1371A4

ldr r1, [r2]
ldrb r2,[r1,#0xA]
add r2,#0x32
lsl r2,r2,#0x18
lsr r2,r2,#0x18
push {r0-r3}
ldr r0, =(0x0203B140)
ldr r0, [r0]
ldr r2, =(0x3290)
add r0, r0, r2
mov r1, #0
bl decryptbranch
bl getnaturebranch
cmp r0, #4 @ Naughty
beq blue
cmp r0, #9 @ Lax
beq blue
cmp r0, #14 @ Naive
beq blue
cmp r0, #19 @ Rash
beq blue
cmp r0, #20 @ Calm
beq red
cmp r0, #21 @ Gentle
beq red
cmp r0, #22 @ Sassy
beq red
cmp r0, #23 @ Careful
beq red

black:
ldr r6, blackfont
b end

red:
ldr r6, redfont
b end

blue:
ldr r6, bluefont

end:
pop {r0-r3}
ldr r1, =(0x081371AE+1)
bx r1

decryptbranch:
ldr r2, =(0x0803FBE8+1)
bx r2

getnaturebranch:
ldr r2, =(0x08042EB4+1)
bx r2

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00
Speed:
Code:
.thumb
@ 00 49 08 47 XX XX XX XX at x1371C8

mov r2,r8
ldr r1, [r2]
ldrb r2,[r1,#0xC]
add r2,#0x32
lsl r2,r2,#0x18
lsr r2,r2,#0x18
push {r0-r3}
ldr r0, =(0x0203B140)
ldr r0, [r0]
ldr r2, =(0x3290)
add r0, r0, r2
mov r1, #0
bl decryptbranch
bl getnaturebranch
cmp r0, #2 @ Brave
beq blue
cmp r0, #7 @ Relaxed
beq blue
cmp r0, #10 @ Timid
beq red
cmp r0, #11 @ Hasty
beq red
cmp r0, #13 @ Jolly
beq red
cmp r0, #14 @ Naive
beq red
cmp r0, #17 @ Quiet
beq blue
cmp r0, #22 @ Sassy
beq blue

black:
ldr r6, blackfont
b end

red:
ldr r6, redfont
b end

blue:
ldr r6, bluefont

end:
pop {r0-r3}
ldr r1, =(0x081371d4+1)
bx r1

decryptbranch:
ldr r2, =(0x0803FBE8+1)
bx r2

getnaturebranch:
ldr r2, =(0x08042EB4+1)
bx r2

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
redfont: .word 0x08RRRRRR @ ROM location that contains: 00 01 0A 00
bluefont: .word 0x08BBBBBB @ ROM location that contains: 00 07 0A 00
Reverting the font colour back to black:
Code:
.thumb
@ 00 49 08 47 XX XX XX XX at 081371F0

ldr r1, [r2]
ldrb r2,[r1,#0xE]
add r2,#0xF
lsl r2,r2,#0x18
lsr r2,r2,#0x18
ldr r6, blackfont
ldr r1, =(0x081371FA+1)
bx r1

.align 2
blackfont: .word 0x08463FA4 @ In a vanilla FR ROM, this contains: 00 0E 0A 00
where XX XX XX XX is the location of each routine +1.

This colours the stat increased by the Pokémon's nature red, and the stat that is decreased blue.

8IfVLeT.png
ltTHc6K.png


Edit: Updated 23/12/2015, the old routines had a few errors that I forgot to update after making changes to my ROM. I've also confirmed what bluefont should be in a vanilla ROM. Enjoy!


I don't know why but for me it doesn't works.
I've replaced the XX XX XX XX with the following pointers for each routines
Spoiler:


After that, I have replace the two last lines for each of them except for the last one (reverting font) with that :
Spoiler:


I've test it with a calm bulbasaur but everything stay black. No blue colour or red colour.
 
417
Posts
9
Years
  • Age 33
  • Seen Nov 20, 2016
I don't know why but for me it doesn't works.
I've replaced the XX XX XX XX with the following pointers for each routines
Spoiler:


After that, I have replace the two last lines for each of them except for the last one (reverting font) with that :
Spoiler:


I've test it with a calm bulbasaur but everything stay black. No blue colour or red colour.

When trying to figure out a problem, always state what rom you are modding...
Aslo I can tell you that you didn't do +1 with your reverse Hex...
ergo "Attack : Offset CFAEC1 >>> pointer C1 AE CF 08" should look like
"Attack : Offset CFAEC1 >>> pointer C2 AE CF 08"
That isn't how it works either. The asm itself needs to be halfword aligned for the opcodes. The +1 is to branch in THUMB mode. Therefore, on top of the opcodes not being aligned, you'd be branching to 0x08CFAEC2 in ARM (which also makes no sense because ARM is four bytes per instruction). The problem is that the bin should be pasted at 0xCFAEC0.
 

Shogun

I'll be back
527
Posts
10
Years
That isn't how it works either. The asm itself needs to be halfword aligned for the opcodes. The +1 is to branch in THUMB mode. Therefore, on top of the opcodes not being aligned, you'd be branching to 0x08CFAEC2 in ARM (which also makes no sense because ARM is four bytes per instruction). The problem is that the bin should be pasted at 0xCFAEC0.

No. I've found my error. It was in the line about the redfont and the bluefont offsets but now here is the result
Pokemon%20Cloud%20White344_zpsuzz7asy1.png
 

Lance32497

LanceKoijer of Pokemon_Addicts
792
Posts
9
Years
Guys, I really really need this routine, I know it wouldn't be hard for you, I got a bug on my rom and I made a lot of changes in that. The bug is the TM and HM, it doesn't really work properly.
12509093_940209062713817_3331187354503156368_n.jpg

So my request is a routine that checks if that pokemon can learn a certain move, var 8004 fpr the Pokemon Specie and var 8005 for the move to check, then that routine will check the table of learnable moves of that Pokèmon.
 
Last edited:
417
Posts
9
Years
  • Age 33
  • Seen Nov 20, 2016
Guys, I really really need this routine, I know it wouldn't be hard for you, I got a bug on my rom and I made a lot of changes in that. The bug is the TM and HM, it doesn't really work properly.
12509093_940209062713817_3331187354503156368_n.jpg

So my request is a routine that checks if that pokemon can learn a certain move, var 8004 fpr the Pokemon Specie and var 8005 for the move to check, then that routine will check the table of learnable moves of that Pokèmon.
I'd say fixing the TM bag would be the better option, but
Code:
	ldr r3, var8004
	ldrh r0, [r3, #0x0]
	lsl r0, r0, #0x3 @assuming length of tm compatibility is still 8 bytes
	ldr r1, tm_compatibility
	add r0, r1
	ldrh r2, [r3, #0x2]	@var8005
	lsr r1, r2, #0x3 @I assume "move" is tm number, not the actual move index?
	ldrb r0, [r0, r1]
	lsl r2, r2, #0x1D
	lsr r2, r2, #0x1D
	lsr r0, r0, r2
	lsl r0, r0, #0x1F
	lsr r0, r0, #0x1F
	strh r0, [r3, 0x0]	@store back in var8004, or wherever
	bx lr
.align
var8004:		.word 0x Donotknowoffsetoffthetopofmyhead
tm_compatibility:	.word 0x WhereverYouPutIt
 

Lance32497

LanceKoijer of Pokemon_Addicts
792
Posts
9
Years
I'd say fixing the TM bag would be the better option, but
Code:
	ldr r3, var8004
	ldrh r0, [r3, #0x0]
	lsl r0, r0, #0x3 @assuming length of tm compatibility is still 8 bytes
	ldr r1, tm_compatibility
	add r0, r1
	ldrh r2, [r3, #0x2]	@var8005
	lsr r1, r2, #0x3 @I assume "move" is tm number, not the actual move index?
	ldrb r0, [r0, r1]
	lsl r2, r2, #0x1D
	lsr r2, r2, #0x1D
	lsr r0, r0, r2
	lsl r0, r0, #0x1F
	lsr r0, r0, #0x1F
	strh r0, [r3, 0x0]	@store back in var8004, or wherever
	bx lr
.align
var8004:		.word 0x Donotknowoffsetoffthetopofmyhead
tm_compatibility:	.word 0x WhereverYouPutIt

Thank you very much, this is helpful indeed. Anyway I expanded the number of TM so do I have to change some values there? And
var 8004 is the Pokèmon number and Var 8005 is the TM Number, let's say TM32, it would be 20, then, in var 8004, it will state whether it's 1,l earnable or 0, not learnable
 
417
Posts
9
Years
  • Age 33
  • Seen Nov 20, 2016
Thank you very much, this is helpful indeed. Anyway I expanded the number of TM so do I have to change some values there? And
var 8004 is the Pokèmon number and Var 8005 is the TM Number, let's say TM32, it would be 20, then, in var 8004, it will state whether it's 1,l earnable or 0, not learnable
I'm guessing that you meant to say "TM32, it would be 0x20" which would be almost correct. TM indexing starts at zero, so the index for TM01 is 0x00, TM02 is 0x01, ..., TM32 is 0x1F (31 decimal). The answer to the TM expansion depends on exactly what your TM compatibility table looks like, specifically how long an entry is for a species. In the regular game, the table is 8 bytes long (64 bits) so I used the instruction
Code:
lsl r0, r0, #0x3 @assuming length of tm compatibility is still 8 bytes
Because that shift is multiplying species index by eight.
As for var8004 at the end of routine, yes. After the routine, var8004 will contain 0 for incompatible and 1 for compatible.
 

Lance32497

LanceKoijer of Pokemon_Addicts
792
Posts
9
Years
I'm guessing that you meant to say "TM32, it would be 0x20" which would be almost correct. TM indexing starts at zero, so the index for TM01 is 0x00, TM02 is 0x01, ..., TM32 is 0x1F (31 decimal). The answer to the TM expansion depends on exactly what your TM compatibility table looks like, specifically how long an entry is for a species. In the regular game, the table is 8 bytes long (64 bits) so I used the instruction
Code:
lsl r0, r0, #0x3 @assuming length of tm compatibility is still 8 bytes
Because that shift is multiplying species index by eight.
As for var8004 at the end of routine, yes. After the routine, var8004 will contain 0 for incompatible and 1 for compatible.

The new compatibility contains 16 bytes, (128 bits) soI'll make it
Code:
lsl r0, r0, #0x4
I got it now, thanks a lot.
 

Lance32497

LanceKoijer of Pokemon_Addicts
792
Posts
9
Years
Could anyone port the Ability Switching to Emerald? Unless I missed it somewhere...
http://www.pokecommunity.com/showpost.php?p=8533505&postcount=278

I haven't tested it yet

Ability switching: EMERALD


Very simple, it turned out to not have to adjust the PID.

How to insert:

Just compile the following routine into free space:

Spoiler:


Usage:

Set in variable 0x8004 the slot number of the Pokemon who's ability you want to swap. Note that Pokemon with only 1 ability won't have their abilities swapped.
 
199
Posts
12
Years
  • Seen Jul 18, 2016
I haven't tested it yet

Ability switching: EMERALD


Very simple, it turned out to not have to adjust the PID.

How to insert:

Just compile the following routine into free space:

Spoiler:


Usage:

Set in variable 0x8004 the slot number of the Pokemon who's ability you want to swap. Note that Pokemon with only 1 ability won't have their abilities swapped.

Tried it with a dual ability Pokemon and didn't change.
=\ Any ideas?
 

Lance32497

LanceKoijer of Pokemon_Addicts
792
Posts
9
Years
Tried it with a dual ability Pokemon and didn't change.
=\ Any ideas?
I'll try to look at that, perhaps one of the addresses is incorrect.

I'd say fixing the TM bag would be the better option, but
Code:
	ldr r3, var8004
	ldrh r0, [r3, #0x0]
	lsl r0, r0, #0x3 @assuming length of tm compatibility is still 8 bytes
	ldr r1, tm_compatibility
	add r0, r1
	ldrh r2, [r3, #0x2]	@var8005
	lsr r1, r2, #0x3 @I assume "move" is tm number, not the actual move index?
	ldrb r0, [r0, r1]
	lsl r2, r2, #0x1D
	lsr r2, r2, #0x1D
	lsr r0, r0, r2
	lsl r0, r0, #0x1F
	lsr r0, r0, #0x1F
	strh r0, [r3, 0x0]	@store back in var8004, or wherever
	bx lr
.align
var8004:		.word 0x Donotknowoffsetoffthetopofmyhead
tm_compatibility:	.word 0x WhereverYouPutIt

Tried this one, but it doesn't work correctly, I modified the routine because it doesn't compile to my compiler
Spoiler:

I changed that to 4 since I had expanded the TM and HM, then, this is my script:
Spoiler:
Var 8004 being the index number of Flygon
and Var 8005 being the TM index which is TM 32 Double Team, it always jumps to YES even though I unchecked it.
 
Back
Top