The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary Hack Research & Development (https://www.pokecommunity.com/forumdisplay.php?f=195)
-   -   Code ASM Resource Thread (https://www.pokecommunity.com/showthread.php?t=339153)

Delta231 February 5th, 2018 11:27 PM

I want to make a request. As Dizzy's Various features added Expansion for Hall of Frame fix. Is there any way to port to Fire Red?

Delta231 February 7th, 2018 12:14 AM

Quote:

Originally Posted by Lunos (Post 9836525)
Exp. All / Gen. 6 Exp. Share [Emerald]
This routine was created by Samu from Wahack and it was posted right here. All the credits belong to him.

I'm afraid that I'll have to leave the comments in Spanish because I don't know how to properly translate them to English due to my lack of knowledge on the ASM programming language. Sorry :(

ASM Routine:
Code:

.thumb
.align 2

/****** NEW GEN EXP SHARE + EGG EXP FIX *******
************************************************
************************************************
************************************************
Créditos a BluRose & Lunos *********************
************************************************
************************************************/

no_crash:
        ldr r0, [r5]
        mov r1, r0
        add r1, #0x53
        ldrb r0, [r1]

flag_check:                                @Se encarga de comprobar si hemos activado el flag
        push {r0-r2}
        ldr r0, flag_number
        ldr r2, flag_routine
        push {r1-r3}
        bl linker
        pop {r1-r3}
        cmp r0, #0x1                @Compara el flag con 0x1 (activado)
        bne routine_off
        pop {r0-r2}       

main:
        @Comprobar el slot y guardarlo en una variable.
        push {r3-r6}
        ldr r6, slot_var                @Carga en r3 el slot del pokemon
        ldrb r3, [r6]
        ldr r4, is_egg_party
        mov r5, #0x64
        mul r5, r5, r3                        @Calcula las posiciones a avanzar
        ldrb r4, [r4, r5]                @Carga en r4 el byte egg/not
        cmp r4, #0x6
        beq pokemonIsEgg
        mov r2, #0x1
        b update_slot

pokemonIsEgg:
        mov r2, #0x0                        @Establece r2 en 0 (no ganará exp)

update_slot:                                @Actualiza y resetea el valor del slot
        add r3, #0x1
        cmp r3, #0x6
        bne end
        mov r3, #0x0

end:
        strh r3, [r6]
        pop {r3-r6}

return:
        push {r2}
        ldr r2, return_dir
        bx r2

routine_off:                                @Ejecuta las instrucciones "originales"
        pop {r0-r2}
        mov r2, #0x1
        and r2, r0
        b return

linker:
        bx r2

.align 2
flag_number:
        .word 0x00000XXX                                        @Elige el numero del flag
flag_routine:
        .word 0x0809D790 +1                                @Rutina que checkea el flag
slot_var:                                                                @Escoge una variable temporal (no uses la 0x8000,
        .word 0x020275D6 + (0x800Y * 2)        @el juego la utiliza al inicializar combates dobles
is_egg_party:
        .word 0x020244EC + 0x13                                @Byte que comprueba si es un huevo
return_dir:
        .word 0x0804A592 + 1                                @Dirección de retorno a la rutina


Note: In order to use this routine, you must set a flag and a temp var in the Lines 72 and 76 respectively.

After inserting the routine in your ROM, open your Pokémon Emerald ROM in a hex editor and make the following changes:
-04A4BE: 02 21
-04A634: 01 20
-04A58A: C0 46 00 4A 10 47 XX XX XX 08 04 BC
Note: XX XX XX = Pointer to the ASM Routine, +1.
Example: If I were to put it in E3CF80, I'd have to replace XX XX XX with 81 CF E3.


Relevant information:
The flag handles the effect itself. If the flag you gave to the routine is OFF (0x0) the Exp. Share will work just like in Gen. 3. If it's ON (0x1), it'll work like in Gen. 1/6/7.

Result:

I'm sure there's ways to make this better, so if anyone could give that a try, that'd be awesome :)


Fire Red Port done by Samu from Whack a hack Foro.
Original Link to the post


Code:

.align 2
.thumb

/****** NEW GEN EXP SHARE + EGG EXP FIX  *******
************** FIRE RED VERSION ********************
************************************************
It Is important to note that you HAVE Tto choose the flag you
wanna use to toggle on/off the routine.
In the same way, you also have to choose a temp variable
for this routine to store a control value. (it will actually count
the current pokemon slot from it's checking)
************************************************
************************************************
************************************************
Credits to BluRose & Lunos          *********************
& Samu (lmao almost forgot myself)  ******************
************************************************
************************************************/

no_crash:
        ldr r0, [r5]
        mov r1, r0
        add r1, #0x53
        ldrb r0, [r1]

flag_check:
@will
 check the flag value, return it to r0 and compare it
        push {r0-r2}
        ldr r0, flag_number
        ldr r2, flag_routine
        push {r1-r3}
        bl linker
        pop {r1-r3}
        cmp r0, #0x1                        @If flag is set (0x1) routine is "on", otherwise is "off"
        bne routine_off
        pop {r0-r2}       

main:

@Che
cks the team slot to check and stores it into a temp variable
        push {r3-r6}
        ldr r6, slot_var                        @Loads the slot in r3
        ldrb r3, [r6]
        ldr r4, is_egg_party
        mov r5, #0x64
        mul r5, r5, r3
        ldrb r4, [r4, r5]                        @Loads in r4 the pointer to the team_slot "egg_byte"
        cmp r4, #0x6                    @if byte value is 0x6 -> pokemon is an egg
        beq pokemonIsEgg
        mov r2, #0x1                    @otherwise set r0 to 0x1 (will gain exp)
        b update_slot

pokemonIsEgg:
        mov r2, #0x0                        @sets r2 to 0x0 (will not gain exp)

update_slot:                                @updates and reset slot value.
        add r3, #0x1
        cmp r3, #0x6
        bne end
        mov r3, #0x0

end:
        strh r3, [r6]
        pop {r3-r6}

return:
        push {r2}
        ldr r2, return_dir
        bx r2

routine_off:                                @"original instructions"
        pop {r0-r2}
        mov r2, #0x1
        and r2, r0
        b return

linker:
        bx r2

.align 2
flag_number:
        .word 0x00000[XXX]                                        @Choose the flag number
flag_routine:
        .word 0x0806E6D0 +1                                @Routine that returns flag value to r0
slot_var:                                                                @choose a temp variable
        .word 0x020270B8 + (0x800[X] * 2)
is_egg_party:
        .word 0x02024284 + 0x13                                @"eggByte" of first pokemon slot
return_dir:
        .word 0x08021CD0 + 1                      @routine return direction



The following changes in the rom are needed:
- Go to 0x08021C3A and overwrite with "02 21".
- Go to 0x08021D70 and write "01 20".
- Go to 0x08021CC6 and write the following:
"C0 46 00 4A 10 47 [XX+1 XX XX 08] 04 BC"
where [XX+1 XX XX 08] is the reverse pointer +1 to the offset of this routine.


Example: If I were to put it in 130F40, I'd have to replace XX XX XX with 41 0F 13.

eMMe97 February 7th, 2018 4:39 AM

Quote:

Originally Posted by Delta231 (Post 9837268)
Fire Red Port done by Samu from Whack a hack Foro.
Original Link to the post


Code:

.align 2
.thumb

/****** NEW GEN EXP SHARE + EGG EXP FIX  *******
************** FIRE RED VERSION ********************
************************************************
It Is important to note that you HAVE Tto choose the flag you
wanna use to toggle on/off the routine.
In the same way, you also have to choose a temp variable
for this routine to store a control value. (it will actually count
the current pokemon slot from it's checking)
************************************************
************************************************
************************************************
Credits to BluRose & Lunos          *********************
& Samu (lmao almost forgot myself)  ******************
************************************************
************************************************/

no_crash:
        ldr r0, [r5]
        mov r1, r0
        add r1, #0x53
        ldrb r0, [r1]

flag_check:
@will
 check the flag value, return it to r0 and compare it
        push {r0-r2}
        ldr r0, flag_number
        ldr r2, flag_routine
        push {r1-r3}
        bl linker
        pop {r1-r3}
        cmp r0, #0x1                        @If flag is set (0x1) routine is "on", otherwise is "off"
        bne routine_off
        pop {r0-r2}       

main:

@Che
cks the team slot to check and stores it into a temp variable
        push {r3-r6}
        ldr r6, slot_var                        @Loads the slot in r3
        ldrb r3, [r6]
        ldr r4, is_egg_party
        mov r5, #0x64
        mul r5, r5, r3
        ldrb r4, [r4, r5]                        @Loads in r4 the pointer to the team_slot "egg_byte"
        cmp r4, #0x6                    @if byte value is 0x6 -> pokemon is an egg
        beq pokemonIsEgg
        mov r2, #0x1                    @otherwise set r0 to 0x1 (will gain exp)
        b update_slot

pokemonIsEgg:
        mov r2, #0x0                        @sets r2 to 0x0 (will not gain exp)

update_slot:                                @updates and reset slot value.
        add r3, #0x1
        cmp r3, #0x6
        bne end
        mov r3, #0x0

end:
        strh r3, [r6]
        pop {r3-r6}

return:
        push {r2}
        ldr r2, return_dir
        bx r2

routine_off:                                @"original instructions"
        pop {r0-r2}
        mov r2, #0x1
        and r2, r0
        b return

linker:
        bx r2

.align 2
flag_number:
        .word 0x00000[XXX]                                        @Choose the flag number
flag_routine:
        .word 0x0806E6D0 +1                                @Routine that returns flag value to r0
slot_var:                                                                @choose a temp variable
        .word 0x020270B8 + (0x800[X] * 2)
is_egg_party:
        .word 0x02024284 + 0x13                                @"eggByte" of first pokemon slot
return_dir:
        .word 0x08021CD0 + 1                      @routine return direction



The following changes in the rom are needed:
- Go to 0x08021C3A and overwrite with "02 21".
- Go to 0x08021D70 and write "01 20".
- Go to 0x08021CC6 and write the following:
"C0 46 00 4A 10 47 [XX+1 XX XX 08] 04 BC"
where [XX+1 XX XX 08] is the reverse pointer +1 to the offset of this routine.


Example: If I were to put it in 130F40, I'd have to replace XX XX XX with 41 0F 13.

It doesn't work correctly.

Without asm:
pidgey level 3 - 24 exp point
with exp share - 12 + 12 exp point

With this routine:
pidgey level 3 - 12 exp point
with exp share flag off - 12 + 24 exp point
with exp share flag on - 12 + 12 + 12 + ... exp point

Skeli February 12th, 2018 2:06 PM

Auto Run [FR]
Compile this ASM, copy everything past offset 0x5BA30 in the bin file, and paste in at 0x5BA30 in your rom. This checks if a flag is set to allow you to run automatically. The default is the original running shoes flag in Fire Red. This also removes the need for a flag to be set in order for the player to run. If you want a flag, you'll have to hook to a new routine altogether.
Code:

.thumb
.global AutoRun

.org 0x5BA30
CheckAutoRunFlag:
ldr r0, .Flag
bl 0x6E6D0 @Flag Check
lsl r0, #0x18
cmp r0, #0x0
bne CheckRunTile

CheckBButton:
mov r0, #0x2
and r5, r0
cmp r5, #0x0
beq 0x5BA8C @Walk

CheckRunTile:
ldr r2, .NPC_States
ldrb r1, [r6, #0x5]
lsl r0, r1, #0x3
add r0, r1
lsl r0, #0x2
add r0, r2
ldrb r0, [r0, #0x1E]
bl 0xBD488 @Runnable Tile
cmp r0, #0x0
bne 0x5BA8C @Walk

Run:
mov r0, r4
bl 0x5BAAC
cmp r0, #0x0
beq 0x5BA74
mov r0, r4
bl 0x5C194
b 0x5BA7A

.align 2
.Flag: .word 0x82F
.NPC_States: .word 0x2036E38


This next piece of code allows you to toggle auto run through the use of the L or R buttons. Just make sure you disable the help menu (put 1D E0 at 0x13B8C2), and flashbacks (somewhere on PC). The bottom area of the code is where the customizable stuff is. If you don't know much about Ram locations leave the helper byte location alone (it's probably fine for you). Also, this code only allows you to change the toggle every second of playtime (so no spamming).
Note:
-The toggling rarely works when the game is in Turbo Mode.
-This code will only work if you've inserted the above code.
-This code must have the same flag as above to work.


Code:

.thumb
.global AutoRunToggle

@Hook at 0x8056458 with r0
@00 48 00 47 XX+1 XX XX 0x8 at 0x8056458

Main:
lsr r1, #0x10
mov r4, r1

CheckButtonPress:
ldrb r2, .Key
ldr r0, .KeyInput
ldrb r0, [r0, #0x1]
mov r1, #0x3
and r0, r1
cmp r0, r2
bne Return

CheckSecondPass:
ldr r0, .HelperByte
ldrb r0, [r0]
ldr r1, .SaveBlock2
ldr r1, [r1]
ldrb r1, [r1, #0x11]
cmp r0, r1
beq Return

ChangeFlag:
ldrh r2, .Flag
mov r0, r2
ldr r1, .Flag_Decrypt
bl Linker
cmp r0, #0x0
bne ClearFlag

SetFlag:
mov r0, r2
ldr r1, .SetFlag
bl Linker
b UpdateHelper

ClearFlag:
mov r0, r2
ldr r1, .ClearFlag
bl Linker

UpdateHelper:
ldr r1, .SaveBlock2
ldr r1, [r1]
ldrb r1, [r1, #0x11]
ldr r0, .HelperByte
strb r1, [r0]

Return:
ldr r1, =0x8112B3D
bl Linker
ldr r1, =0x8056461

Linker:
bx r1

.align 2
.SaveBlock2: .word 0x300500C
.Flag_Decrypt: .word 0x806E6D1
.SetFlag: .word 0x806E681
.ClearFlag: .word 0x806E6A9
.KeyInput: .word 0x04000130
.HelperByte: .word 0x203D800 @Replace with custom loc
.Key: .word 0x1 @0x0 = L+R, 0x1 = L, 0x2 = R @Choose key
.Flag: .word 0x82F @Change to Custom Flag



Lunos February 12th, 2018 3:35 PM

Quote:

Originally Posted by Skeli Unbound (Post 9840234)
Auto Run [FR]
Compile this ASM, copy everything past offset 0x5BA30 in the bin file, and paste in at 0x5BA30 in your rom. This checks if a flag is set to allow you to run automatically. The default is the original running shoes flag in Fire Red. This also removes the need for a flag to be set in order for the player to run. If you want a flag, you'll have to hook to a new routine altogether.
Code:

.thumb
.global AutoRun

.org 0x5BA30
CheckAutoRunFlag:
ldr r0, .Flag
bl 0x6E6D0 @Flag Check
lsl r0, #0x18
cmp r0, #0x0
bne CheckRunTile

CheckBButton:
mov r0, #0x2
and r5, r0
cmp r5, #0x0
beq 0x5BA8C @Walk

CheckRunTile:
ldr r2, .NPC_States
ldrb r1, [r6, #0x5]
lsl r0, r1, #0x3
add r0, r1
lsl r0, #0x2
add r0, r2
ldrb r0, [r0, #0x1E]
bl 0xBD488 @Runnable Tile
cmp r0, #0x0
bne 0x5BA8C @Walk

Run:
mov r0, r4
bl 0x5BAAC
cmp r0, #0x0
beq 0x5BA74
mov r0, r4
bl 0x5C194
b 0x5BA7A

.align 2
.Flag: .word 0x82F
.NPC_States: .word 0x2036E38



Would it be possible to modify it a little bit so when pressing a button like say.. the GBA's R Button, the flag is enabled or disabled? Then it would work just like in Pokémon Procyon/Deneb, a pair of Japanese ROM Hacks in which by pressing the R Button you can toggle ON or OFF the Running Shoes.

Skeli February 12th, 2018 5:53 PM

Quote:

Originally Posted by Lunos (Post 9840283)
Would it be possible to modify it a little bit so when pressing a button like say.. the GBA's R Button, the flag is enabled or disabled? Then it would work just like in Pokémon Procyon/Deneb, a pair of Japanese ROM Hacks in which by pressing the R Button you can toggle ON or OFF the Running Shoes.

They should really learn to share more often.

(Scroll up)

Lunos February 13th, 2018 12:41 AM

Quote:

Originally Posted by Skeli Unbound (Post 9840234)
This next piece of code allows you to toggle auto run through the use of the L or R buttons. Just make sure you disable the help menu first (put 1D E0 at 0x13B8C2). The bottom of the code is where the customizable stuff is. If you don't know much about Ram locations leave the helper byte location alone (it's probably fine for you). Also, this code only allows you to change the toggle every second of playtime (so no spamming). Note that the the toggling rarely works when the game is in Turbo Mode.

Code:

.thumb
.global AutoRunToggle

@Hook at 0x8056458 with r0
@00 48 00 47 XX+1 XX XX 0x8 at 0x8056458

Main:
lsr r1, #0x10
mov r4, r1

CheckButtonPress:
ldrb r2, .Key
ldr r0, .KeyInput
ldrb r0, [r0, #0x1]
mov r1, #0x3
and r0, r1
cmp r0, r2
bne Return

CheckSecondPass:
ldr r0, .HelperByte
ldrb r0, [r0]
ldr r1, .SaveBlock2
ldr r1, [r1]
ldrb r1, [r1, #0x11]
cmp r0, r1
beq Return

ChangeFlag:
ldrh r2, .Flag
mov r0, r2
ldr r1, .Flag_Decrypt
bl Linker
cmp r0, #0x0
bne ClearFlag

SetFlag:
mov r0, r2
ldr r1, .SetFlag
bl Linker
b UpdateHelper

ClearFlag:
mov r0, r2
ldr r1, .ClearFlag
bl Linker

UpdateHelper:
ldr r1, .SaveBlock2
ldr r1, [r1]
ldrb r1, [r1, #0x11]
ldr r0, .HelperByte
strb r1, [r0]

Return:
ldr r1, =0x8112B3D
bl Linker
ldr r1, =0x8056461

Linker:
bx r1

.align 2
.SaveBlock2: .word 0x300500C
.Flag_Decrypt: .word 0x806E6D1
.SetFlag: .word 0x806E681
.ClearFlag: .word 0x806E6A9
.KeyInput: .word 0x04000130
.HelperByte: .word 0x203D800 @Replace with custom loc
.Key: .word 0x1 @0x0 = L+R, 0x1 = L, 0x2 = R @Choose key
.Flag: .word 0x82F @Change to Custom Flag



The first routine is working perfectly fine on my end, but this one's not.
1) I went to the offset 13B8C2 and wrote "1D E0".
2) I compiled the ASM Routine, the only changes I did to it were:
-Line 70: .Key: .word 0x2
-Line 71: .Flag: .word 0x200
3) I inserted the compiled routine in the offset 71A250.
4) I went to the offset 056458 and wrote: 00 48 00 47 51 A2 71 08
And then when I start the game, enable the Flag 0x200 and press the R Button, my character still walks and I still have to run by holding the B Button :/

EDIT: Fixed. I didn't get at first that I had to use both ASM Routines at the same time.

DarkPsychic February 20th, 2018 5:16 PM

Pokemon LoathingFriendship Evolution:
Code:

.text
.align 2
.thumb
.thumb_func
.global loathFriendship

main:
push {r0-r7}
add r0, r6, r7
lsl r0, r0, #0x3
add r0, r2, r0
add r3, r0, r3
ldrb r2, [r3, #0x2]
mov r0, r8
bl decrypt
mov r11, r0
pop {r0-r7}
mov r1, r11
cmp r1, #0x10
blo max_lowhappy
b exit

max_lowhappy:
mov r10, r3
pop {r0-r7}
mov r1, r10
ldr r0, evolution_loc
bx r0

exit:
pop {r0-r7}
ldr r0, no_evo
bx r0

decrypt:
push {r0-r7}
mov r1, #0x20
ldr r2, decryptpoke
bx r2

.align 2
no_evo: .word 0x08043111
evolution_loc: .word 0x0804310D
decryptpoke: .word 0x0803FBE9


The Pokemons happiness must be between 0-10 to trigger the evolution.
To insert follow instructions in this thread.

I hope some find this useful.
I thought about trade evolution basically being just this.
A Pokemon so depressed it evolves...

Miko-chan February 24th, 2018 5:04 AM

Is there a port of the Disable Bag to Emerald?

Trying on my own, I was trying to convert this "Prevent Items" routine by JPAN here:
Spoiler:
Can't post links yet :(
pokecommunity.com/showpost.php?p=6746353&postcount=35

The only problem I have now is finding the address of the routine that shows the "Items can't be used now." message.

Here's the original FR Version:
Spoiler:
Code:

.thumb
.align 2
/*Simple routine to remove item usage from pokemon battles. Same strategy as
the Not catching bypass, we will be using the script already in place for
the item prevention on link/tower battles, and jump to it if it's what we want.

in 080143D6 place 0x00 47, and at 08014410 place the pointer to this function*/
/*begin*/
No_items:                ldr r0, num_to_check        /*flags, variables or addresses*/
                                /*uncomment if flag*/
                                /*
                                bl        CheckFlag        //returns r0 as 1 if flag set
                                cmp r0, #0x1
                                bne return_to_normal
                                */
                                /*uncomment if variable*/
                                /*
                                bl        LoadVariable                //returns r0 as variable content
                                cmp r0, VALUE_OF_VARIABLE
                                bne return_to_normal
                                */
                                /*The address version, compiled*/
                                ldrb r0, [r0]
                                cmp r0, #0x1
                                bne return_to_normal
                                ldr r0, denyItemsAddr
                                bx r0

return_to_normal:        ldr r1, battleFlags
                                ldr r0, [r1]
                                ldr r1, itemForbiddenTestAddr
                                bx r1
/*.hword 0x0000        */
num_to_check:                .word 0x020370c0        /*var 8004 address*/
battleFlags:                        .word 0x02022b4c
denyItemsAddr:                .word 0x080143e1
itemForbiddenTestAddr:        .word 0x080143d9

/*end*/
/*if needed, the called routines*/
/*begin*/
/*
LoadVariable:        ldr r1, ld_Var_addr
                                bx r1
ld_Var_addr:        .word 0x0806e569
*/
/*
CheckFlag:                ldr r1, flagCheck_addr
                                bx r1
flagCheck_addr:        .word 0x0806e6d1
*/

/*end*/



Here's mine (omitted stuff for clarity):
Spoiler:
Code:

/* Routine starts somewhere at 0x0806F116? */
.thumb
.align 2

No_items:    ldr r0, num_to_check
                    ldrb r0, [r0]
                    cmp r0, #0x1
                    bne return_to_normal
                    ldr r0, denyItemsAddr
                    bx r0

return_to_normal:        ldr r1, battleFlags
                                ldr r0, [r1]
                                ldr r1, itemForbiddenTestAddr
                                bx r1

num_to_check:                  .word 0x02022FFC                /* Just to test */
battleFlags:                        .word 0x02022FEC
denyItemsAddr:                  .word 0x08??????                /* I can't find this one */
itemForbiddenTestAddr:        .word 0x0806F11B                /* Not totally sure here tbh */



Hotice03 February 24th, 2018 8:39 AM

I want to make an ghost eeveelution and to evolve it you must level it up with a rare candy in the party while it is fainted then once it is leveled up it evolves

Miko-chan February 24th, 2018 5:25 PM

Old post :/
Spoiler:
Is there a port of the Disable Bag in Emerald?

I've been trying it myself by trying to port JPAN's Prevent Items routine from Fire Red.
It checks for a certain value in memory and calls the "Items can't be used now." used in link battles if it meets the condition.

The original routine from FR:
Code:

.thumb
.align 2
@At 080143D6 place 00 47, and at 08014410 place the pointer to this function + 1
No_items:                ldr r0, num_to_check
                                ldrb r0, [r0]
                                cmp r0, #0x1
                                bne return_to_normal
                                ldr r0, denyItemsAddr
                                bx r0

return_to_normal:        ldr r1, battleFlags
                                ldr r0, [r1]
                                ldr r1, itemForbiddenTestAddr
                                bx r1

num_to_check:                .word 0x020370c0
battleFlags:                        .word 0x02022B4C
denyItemsAddr:                .word 0x080143E1
itemForbiddenTestAddr:        .word 0x080143D9


My attempt at porting it to Emerald:
Code:

@Routine is somewhere at 0x0806F116
.thumb
.align 2

No_items:    ldr r0, num_to_check
                    ldrb r0, [r0]
                    cmp r0, #0x1
                    bne return_to_normal
                    ldr r0, denyItemsAddr
                    bx r0

return_to_normal:        ldr r1, battleFlags
                                ldr r0, [r1]
                                ldr r1, itemForbiddenTestAddr
                                bx r1

num_to_check:                    .word 0x02022FFC                @Some random location for testing
battleFlags:                        .word 0x02022FEC
denyItemsAddr:                  .word 0x08                        @Unusure where this is one located
itemForbiddenTestAddr:        .word 0x0806F11B                @Also not sure here but seems like it



Okay, having checked the Disable Bag routine for FR here in this thread (which I actually checked before using JPAN's, but apparently I was so in a rush that I didn't check properly).

Here is the routine for Emerald:
Code:

@Insert this compiled routine at 0x0803C230
.thumb
.equ qq_bag,        0x0803C230
.equ flag_check,    0x0809D790
.equ loc_803C23E,  0x0803C23E
.equ off_803C254,  0x0803C254

.equ loc,      qq_bag
.equ checkflag, flag_check
.equ blockitem, loc_803C23E
.equ flag,      off_803C254

main:
    ldr r0, [pc, #flag-(loc+4)]
    bl +checkflag-loc
    bne +blockitem-loc
    NOP
    NOP


All those hours wasted yesterday :catflip:

DarkPsychic March 2nd, 2018 1:14 AM

Quote:

Originally Posted by Hotice03 (Post 9845713)
I want to make an ghost eeveelution and to evolve it you must level it up with a rare candy in the party while it is fainted then once it is leveled up it evolves

Here ya go ^_^
Faint/Low Hp Evolution:
Code:

.text
.align 2
.thumb
.thumb_func
.global faintEvolution

main:
push {r0-r7}
add r0, r6, r7  @line to change if expanded evos
lsl r0, r0, #0x3
add r0, r2, r0
add r3, r0, r3
ldrb r2, [r3, #0x2]
mov r0, r8
bl decrypt
mov r11, r0
pop {r0-r7}
mov r1, r11
cmp r1, #0x2    @Compare Amount of Current Hp
blo low_hp
b exit

low_hp:
mov r10, r3
pop {r0-r7}
mov r1, r10
ldr r0, evolution_loc
bx r0

exit:
pop {r0-r7}
ldr r0, no_evo
bx r0

decrypt:
push {r0-r7}
mov r1, #0x39
ldr r2, decryptpoke
bx r2

.align 2
no_evo: .word 0x08043111
evolution_loc: .word 0x0804310D
decryptpoke: .word 0x0803FBE9



Note for the first highlighted in green:
If you have expaned your evolutions for your pokemon you must change this line:
"add r0, r6, r7"
to:
8 evos or less = lsl r0, r6, #0x1
16 evos or less = lsl r0, r6, #0x2
32 evos or less = lsl r0, r6, #0x3

or
just change the bytes in the compiled file from F0 19 to:
8 evos or less = 70 00
16 evos or less = B0 00
32 evos or less = F0 00


Note for second highlighted in green:
As it is the Pokemon must be leveled up with a Rare Candy to get it to revive and have 1-Hp.
You can change the value of 0x2 to something higher but anything lower than 0x2 will not work with this routine.
After the compare it the vaule must be lower than the "0x2" or what ever value you decide to change it to.


Hope this helps!

Hotice03 March 4th, 2018 6:24 AM

omg thank you so much dude! youve just made me so happy now since im still new to asm i gotta figure out the little bits but im sure i can get it :) again thank you so much would you like credit since youve created the asm for it

Hotice03 March 4th, 2018 3:50 PM

so me and my friend got it into the rom and everything and turns out it didnt work, did you test it? cause we cant get it to work

Dionen March 13th, 2018 1:11 PM

Quote:

Originally Posted by FBI (Post 8876273)

OAM routines


Generating OAMs



This routine is only to generate OAMs which are trainer or Pokemon sprites. I've modified it to be usable with a script, but honestly, setting the values yourself via ASM would've been faster (not that this is noticeably slow, just comparatively). I will have to do more research on making it portray an arbitrary image, but with the expansion work on the Pokedex and such, I don't see it as very necessary anymore.

How to insert:
Compile and insert the following routine into a free word aligned offset.

Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

main:
        push {r0-r4, lr}
        sub SP, SP, #0x14

        @load PID
        ldr r2, =(0x20370B8) @PokeSlot
        ldrb r2, [r2]
        cmp r2, #0x6
        beq shiny
        ldr r0, =(0x2024284)
        mov r4, #0x64
        mul r2, r2, r4
        add r2, r2, r0
        ldrh r2, [r2] @PID

        @load TID
        ldr r1, =(0x300500C)
        ldr r1, [r1]
        ldrh r1, [r1, #0xA] @TID
        b cont

shiny:
        mov r0, #0x0
        mov r1, r0
        mov r2, r0

cont:
        @X-pos
        ldr r0, =(0x20370BA)
        ldrh r0, [r0]
        str r0, [SP] @X-Pos

        @Y-pos
        ldr r0, =(0x20370BC)
        ldrh r0, [r0]
        str r0, [SP, #0x4] @Y-Pos

        @pal #
        ldr r0, =(0x20370BE)
        ldrh r0, [r0]
        str r0, [SP, #0x8] @pal #

        ldr r3, =(0x20370C0)
        ldrb r3, [r3]
        cmp r3, #0x1
        bne nonsil
        mov r3, #0x0
        str r3, [SP, #0xC] @occupacity
        b unkn

nonsil:
        ldr r3, =(0x0000FFFF)
        str r3, [SP, #0xC] @occupacity

unkn:
        @??? - No idea, but leave as 0s
        @possibly priority?
        ldr r0, =(0x20370C6)
        ldrb r0, [r0]
        str r0, [SP, #0x10]
        mov r0, #0x0
        str r0, [SP, #0x14]

        @species/sprite ID
        ldr r0, =(0x20370C2)
        ldrh r0, [r0]

        @front VS back
        ldr r3, =(0x20370C4)
        ldrb r3, [r3]

        @display func
        ldr r4, =(0x810BDAC +1)
        bl linker
        add SP, SP, #0x14
        pop {r0-r4, pc}

linker:
        bx r4

.align 2


Compiled version:
Code:

1F B5 85 B0 18 4A 12 78 06 2A 08 D0 17 48 64 24 62 43 12 18 12 88 16 49 09 68 49 89 02 E0 00 20 01 1C 02 1C 13 48 00 88 00 90 13 48 00 88 01 90 12 48 00 88 02 90 12 4B 1B 78 01 2B 02 D1 00 23 03 93 01 E0 0F 4B 03 93 0F 48 00 78 04 90 00 20 05 90 0E 48 00 88 0E 4B 1B 78 0E 4C 00 F0 02 F8 05 B0 1F BD 20 47 C0 46 B8 70 03 02 84 42 02 02 0C 50 00 03 BA 70 03 02 BC 70 03 02 BE 70 03 02 C0 70 03 02 FF FF 00 00 C6 70 03 02 C2 70 03 02 C4 70 03 02 AD BD 10 08



so, little question, cause I'm still learning.
Is it possible to modify this routine in order to display Item images? Is this display function able to handle them?
If not, what is the best way to show them?

Delta231 March 14th, 2018 9:33 PM

Quote:

Originally Posted by Petuuuhhh (Post 9854219)
Is there a way to make the turbo slower?

Just don't use the routine simple.

Skeli March 15th, 2018 5:25 AM

Quote:

Originally Posted by Petuuuhhh (Post 9854219)
Is there a way to make the turbo slower?

You could add a bunch of useless long loops to that routine, but I'm pretty sure that'd make the game lag as well.

Skeli March 15th, 2018 1:44 PM

Why do you want to prevent the player from using the turbo button? One of the main benefits to playing a rom is that you get a turbo button.

It would lag without turbo. Turbo would probably still speed the game up somewhat, but just not as much.

DarkPsychic March 16th, 2018 2:25 PM

Quote:

Originally Posted by Petuuuhhh (Post 9854753)
I want the player to get as authentic of an experience as possible when playing my hack, which means that if I can disable the Turbo button, I will. Is there an emulator that doesn't have a turbo button?

Thank you,

This should be asked in the Quick Questions thread.
I have told you before that even with asm this would be hard.
Because its on a emulator level.

AkameTheBulbasaur March 16th, 2018 3:34 PM

Quote:

Originally Posted by Petuuuhhh (Post 9854753)
I want the player to get as authentic of an experience as possible when playing my hack, which means that if I can disable the Turbo button, I will. Is there an emulator that doesn't have a turbo button?

Thank you,

I'm pretty sure No$GBA doesn't. You can speed up the emulation through the options menu, but as far as I know there isn't a button that you press to do that automatically.

I could be wrong about this so nobody sue me if there in fact is one xD

Sweet Scent Script
This is what I did with FBI's Field Moves ASM in this post.

I basically just made it so you could attract certain Pokemon in certain special areas with an increased shiny chance.

You will need FBI's Shiny Generator. Either use this one here or use the modified version if you want to have Synchronize's overworld effect here.

Then follow the steps for inserting a new field move, except you don't need to expand the table if you're replacing Sweet Scent's effect. Just replace the pointer C9 E0 0D 08 with the pointer to the first routine.

Also, you will need to go to 0x82E76 and change “20 78” to “06 E0”. Also go to 0x82E6C and change “0C 31” to “04 31”. This allows Special 0xAB to use the grass data when loading Wild Pokémon.

Anyway the script I made is here:
Spoiler:
#dyn 0x6B0000
#org @start
lockall
compare 0x4050 0x0
if true jump @Normal
compare 0x4050 0x1
if true jump @Celebi
compare 0x4050 0x2
if true jump @Hooh
compare 0x4050 0x3
if true jump @Lugia
compare 0x4050 0x4
if true jump @Moltres
compare 0x4050 0x5
if true jump @Articuno
compare 0x4050 0x6
if true jump @Zapdos
compare 0x4050 0x7
if true jump @Entei
compare 0x4050 0x8
if true jump @Raikou
compare 0x4050 0x9
if true jump @Suicune
compare 0x4050 0xA
if true jump @Mewtwo
release
end

#org @Normal
checkitem 0xEF 1
if true jump @SCharm
jump @NoCharm

#org @SCharm
random 0x10A
jump @SweetScent

#org @NoCharm
random 0x320
jump @SweetScent

#org @SweetScent
compare LASTRESULT 0x1
if true call @ShinySet
doanimation 0x33
release
end

#org @Celebi 'Forest
setvar 0x4054 CELEBI
setvar 0x4055 ROSELIA
setvar 0x4056 RALTS
setvar 0x4057 PARAS
jump @SetChance

#org @Hooh 'Volcano
setvar 0x4054 HO-OH
setvar 0x4055 SOLROCK
setvar 0x4056 NUMEL
setvar 0x4057 VULPIX
jump @SetChance

#org @Lugia 'Island
setvar 0x4054 LUGIA
setvar 0x4055 EEVEE
setvar 0x4056 MARILL
setvar 0x4057 CATERPIE
jump @SetChance

#org @Moltres 'Mountain
setvar 0x4054 MOLTRES
setvar 0x4055 RHYHORN
setvar 0x4056 MACHOP
setvar 0x4057 GEODUDE
jump @SetChance

#org @Articuno 'Tundra
setvar 0x4054 ARTICUNO
setvar 0x4055 DELIBIRD
setvar 0x4056 SPHEAL
setvar 0x4057 SWINUB
jump @SetChance

#org @Zapdos 'Savannah
setvar 0x4054 ZAPDOS
setvar 0x4055 TAUROS
setvar 0x4056 ELECTRIKE
setvar 0x4057 RATTATA
jump @SetChance

#org @Entei 'Ruins
setvar 0x4054 ENTEI
setvar 0x4055 EKANS
setvar 0x4056 ZUBAT
setvar 0x4057 BALTOY
jump @SetChance

#org @Suicune 'Ruins
setvar 0x4054 SUICUNE
setvar 0x4055 EKANS
setvar 0x4056 ZUBAT
setvar 0x4057 BALTOY
jump @SetChance

#org @Raikou 'Ruins
setvar 0x4054 RAIKOU
setvar 0x4055 EKANS
setvar 0x4056 ZUBAT
setvar 0x4057 BALTOY
jump @SetChance

#org @Mewtwo 'Settlement
setvar 0x4054 MEWTWO
setvar 0x4055 MAGNEMITE
setvar 0x4056 VOLTORB
setvar 0x4057 PICHU
jump @SetChance

#org @SetChance
random 0xFF
compare LASTRESULT 0x7F
if >= jump @Common
compare LASTRESULT 0x3F
if >= jump @Uncommon
compare LASTRESULT 0x1F
if >= jump @Rare
jump @SecretRare

#org @Common
copyvar 0x8000 0x4057
setvar 0x4041 0x1
checkitem 0xEF 1
if true jump @SCharmC
jump @NoCharmC

#org @SCharmC 'max: 40/400 = 10%
random 0x10A
comparevars LASTRESULT 0x4044
if <= call @ShinySet
jump @Battle

#org @NoCharmC 'max: 40/800 = 5%
random 0x320
comparevars LASTRESULT 0x4044
if <= call @ShinySet
jump @Battle

#org @Uncommon
copyvar 0x8000 0x4056
setvar 0x4041 0x2
checkitem 0xEF 1
if true jump @SCharmUC
jump @NoCharmUC

#org @SCharmUC 'max: 40/266 = 15%
random 0x10A
comparevars LASTRESULT 0x4045
if <= call @ShinySet
jump @Battle

#org @NoCharmUC 'max: 40/400 = 10%
random 0x190
comparevars LASTRESULT 0x4045
if <= call @ShinySet
jump @Battle

#org @Rare
copyvar 0x8000 0x4055
setvar 0x4041 0x3
checkitem 0xEF 1
if true jump @SCharmR
jump @NoCharmR

#org @SCharmR 'max: 40/200 = 20%
random 0xC8
comparevars LASTRESULT 0x4046
if <= call @ShinySet
jump @Battle

#org @NoCharmR 'max: 40/266 = 15%
random 0x10A
comparevars LASTRESULT 0x4046
if <= call @ShinySet
jump @Battle

#org @SecretRare
copyvar 0x8000 0x4054
setvar 0x4041 0x4
checkitem 0xEF 1
if true jump @SCharmR
jump @NoCharmR

#org @SCharmR 'max: 40/160 = 25%
random 0xA0
comparevars LASTRESULT 0x4047
if <= call @ShinySet
jump @Battle

#org @NoCharmR 'max: 40/200 = 20%
random 0xC8
comparevars LASTRESULT 0x4047
if <= call @ShinySet
jump @Battle

#org @Battle
doanimation 0x1
copyvar LASTRESULT 0x8000
showpokepic LASTRESULT 0xA 0x3
hidepokepic
battle LASTRESULT 0xA SITRUSBERRY
special BATTLE_INTERLACE
waitspecial
special2 LASTRESULT 0xB4
compare LASTRESULT 0x4
if true jump @Reset
compare 0x4041 0x1
if true jump @CommonPlus
compare 0x4041 0x2
if true jump @UncommonPlus
compare 0x4041 0x3
if true jump @RarePlus
compare 0x4041 0x4
if true jump @SRarePlus
release
end

#org @CommonPlus
compare 0x4044 0x28
if true jump @Return
addvar 0x4044 0x1
release
end

#org @UncommonPlus
compare 0x4045 0x28
if true jump @Return
addvar 0x4045 0x1
release
end

#org @RarePlus
compare 0x4046 0x28
if true jump @Return
addvar 0x4046 0x1
release
end

#org @SRarePlus
compare 0x4047 0x28
if true jump @Return
addvar 0x4047 0x1
release
end

#org @ShinySet
setvar 0x8003 0x1
return

#org @Reset
setvar 0x4044 0x0
setvar 0x4045 0x0
setvar 0x4046 0x0
setvar 0x4047 0x0
release
end

#org @Return
release
end


The CheckItem part was for the Shiny Charm, so if you have that then change the number to the index number for the Shiny Charm.

I also modified the Set Wild Battle command with this:
Spoiler:
/*Replace the pointer 69 C3 06 08 with the pointer to this +1*/
.text
.align 2
.thumb
.thumb_func

Main:
push {r4-r6, lr}
mov r4, r0
bl GetSpecies
ldr r5, =0x800D
cmp r0, r5
beq LastResult
b Return

GetSpecies:
ldr r2, .GetSpecies
bx r2

LastResult:
ldr r5, .Var800D
ldrh r0, [r5]

Return:
ldr r5, .Return
bx r5

.align 2
.GetSpecies: .word 0x080698F9
.Var800D: .word 0x020370D0
.Return: .word 0x0806C371


Basically all that does is let you use LASTRESULT for the Pokemon.

Diego98 March 27th, 2018 2:45 AM

Anyone can make a routine that counts the amount of a certain item in the bag and stores it in a variable? I know this can be made with loops but I think a routine is a better way to do this. Thanks anyway.

DrFuji March 27th, 2018 3:58 AM

Quote:

Originally Posted by Diego98 (Post 9858569)
Anyone can make a routine that counts the amount of a certain item in the bag and stores it in a variable? I know this can be made with loops but I think a routine is a better way to do this. Thanks anyway.

Spherical Ice made a routine for that.

Diego98 March 27th, 2018 11:44 AM

Quote:

Originally Posted by DrFuji (Post 9858582)

Thanks! Just what I was searching for.

pikachux2 April 4th, 2018 4:53 AM

Hey helpful people, you all might have seen my post about this in a thread under Rom Hacking. But anyway, I've never used ASM coding in my PKMN hacking career thus far. I'm making a game in which I only want double battles and have encountered a glitch in which if you start a double battle with 1 (not-fainted) Pokémon is your party, the game just clones that pokemon for your partner in battle... (not desired) I've come to the realization that the only way to keep this game double battles only Is to either fix this glitch by changing the battle engine (sounds too hard) or to find another solution.

Well, the solution I came up with was to possibly have an ASM call before each trainer that would change the bitfield's double battle bit of the trainer in question to 1 or 0 based on how many Pokémon the player has. Now again, I've never used ASM so I don't know if you have access to that certain part of the rom, but if you did this would be a great way of fixing my problem.

So any help would be awesome, thanks!

Delta231 April 4th, 2018 5:35 AM

Quote:

Originally Posted by pikachux2 (Post 9861696)
Hey helpful people, you all might have seen my post about this in a thread under Rom Hacking. But anyway, I've never used ASM coding in my PKMN hacking career thus far. I'm making a game in which I only want double battles and have encountered a glitch in which if you start a double battle with 1 (not-fainted) Pokémon is your party, the game just clones that pokemon for your partner in battle... (not desired) I've come to the realization that the only way to keep this game double battles only Is to either fix this glitch by changing the battle engine (sounds too hard) or to find another solution.

Well, the solution I came up with was to possibly have an ASM call before each trainer that would change the bitfield's double battle bit of the trainer in question to 1 or 0 based on how many Pokémon the player has. Now again, I've never used ASM so I don't know if you have access to that certain part of the rom, but if you did this would be a great way of fixing my problem.

So any help would be awesome, thanks!

https://github.com/jiangzhengwenjz/Double_wild_battle

Delta231 April 11th, 2018 8:02 AM

Quote:

Originally Posted by eaglesfan (Post 9864266)
I have a request. I followed this tutorial to make two frame animations in fire red. the only issue is with trainers the animation starts right out of the ball and with wild pokemon it starts at the beggining of the encounter and doesnt show the animation because the pokemon is not in sight when it starts. Would it be possible to create two animation tables and insert an asm routine that sets the pointer at 0x2349BC to point to animation table 1 by default or table 2 if a var or flag is set? If no one has time to make a routine like this could someone at least tell me if it is possible?

I will say not to implement it because it takes a lot of storage in you rom.

Delta231 April 12th, 2018 2:06 AM

Quote:

Originally Posted by eaglesfan (Post 9864290)
why would an asm routine take alot of storage?

If you are having 500 pokemon then multiply by x4 or even x8. That would actually take a lot of space. Even Emerald hackers also remove Animations.

xizqu April 13th, 2018 7:13 AM

Hello! Would it be possible to request a routine?

If possible, I would like a battle routine that only allows you to use a maximum of 6 itmes throughout a battle(ignoring the pokeball bag). This would get rid of potion spamming! :)

paccy April 21st, 2018 8:52 AM

Inherit Pokeball from Mother (Emerald)
So I'm learning asm and decided to see if I could implement passing down pokeballs like in 6th gen, and after a while I managed to make something that seems to work. Since this is basically my first go at writing asm feel free to point out better ways to do things and improve it.

There's is two parts to this, you have to give the egg its mother's pokeball and you have to keep the ball when it hatches. This is for Emerald only (Though I'm guessing it wouldn't be too hard to port to FR).

Give Egg Pokeball
How to insert:
Compile and put this into free space
Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

main:
    push {r5}
    ldr r0, =(0x3005D8C)    @Getting location of parents in daycare
    ldr r0, [r0]
    ldr r1, =0x3030
    add r0, r0, r1
    mov r5, r0
    ldr r3, pokemon_get_gender @Get gender of 1st parent
    bl linker
    cmp r0, #0xFE
    beq mother                @Branch if female
    mov r0, r5
    mov r5, #0x8C
    add r0, r0, r5
    mov r5, r0
    ldr r3, pokemon_get_gender @Get gender of 2nd parent
    bl linker
    cmp r0, #0xFE
    beq mother                @Branch if female

use_pokeball:
    mov r1, #4
    pop {r5}
    add r0, sp, #0x10
    strh r1, [r0]
    mov r4, sp

return:
    ldr r3, =(0x8070A50 +1)
    bl linker

mother:
    mov r0, r5
    mov r1, #0x26
    ldr r3, pokemon_getattr @get mother's pokeball
    bl linker
    mov r1, r0
    cmp r1, #1            @It's a masterball
    beq use_pokeball        @Use pokeball instead of master
    pop {r5}
    add r0, sp, #0x10
    strh r1, [r0]            @Store mother's pokeball
    mov r4, sp
    b return

linker:
    bx r3   

.align 2

@Functions:
pokemon_get_gender:
    .word 0x8069FC4 +1

pokemon_getattr:
    .word 0x806A518 +1

@At 0x70A48 write 00 48 00 47 XX+1 XX XX 08



and at 0x8070A48 write 00 48 00 47 XX XX XX 08
(where XX XX XX is the reverse hex pointer of where you put in the code +1)

How it works:
When given an egg it will check if either of the parents are female. If yes it will pass on the egg, unless it's a masterball.

Keep Ball when Hatching
How to insert:
Compile and put both of these into free space
Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

main:
        mov r0, r5                                @Doing things that we overwrote
        mov r1, #0x25
        ldr r3, pokemon_getattr @Get game of origin
        bl linker
        mov r1, r10
        strb r0, [r1]
        mov r0, r5
        mov r1, #0x26
        ldr r3, pokemon_getattr @Get the egg's pokeball
        bl linker
        ldr r1, =(0x20375D8)        @var 0x8000
        strh r0, [r1]                        @Store pokeball in 0x8000
        ldr r3, =(0x80713DC +1)
        bl linker

linker:
        bx r3       

.align 2

@Functions:
pokemon_getattr:
        .word 0x806A518 +1

@At 0x713D4 write 00 48 00 47 XX+1 XX XX 08



Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

main:
        mov r2, sp
        add r2, #0xE
        ldr r0, =(0x20375D8) @Get ball from 0x8000
        ldrh r0, [r0]
        strh r0, [r2]
        mov r0, r5
        mov r1, #0x26
        ldr r3, pokemon_setattr @Set pokeball
        bl linker
        ldr r3, =(0x8071536 +1)
        bl linker

linker:
        bx r3       

.align 2

@Functions:
pokemon_setattr:
        .word 0x806ACAC +1

@At 0x71528 write 00 4A 10 47 XX+1 XX XX 08



and at 0x80713D4 write 00 48 00 47 XX XX XX 08
(where XX XX XX is the reverse hex pointer of where you put in the first piece of code +1)
and at 0x8071528 write 00 4A 10 47 XX XX XX 08
(where XX XX XX is the reverse hex pointer of where you put in the second piece of code +1)

How it works:
When hatching some data doesn't seem to be transferred to the pokemon, the type of ball being one. The first routine simply stores the ball type to 0x8000 while the second retrieves and gives it to the pokemon where before a normal pokeball was given.

deoadiuvante April 21st, 2018 11:45 AM

Quote:

Originally Posted by jiangzhengwenjzw (Post 9229108)
Misc:

A EV-IV Display Screen


RENEWAL:
Spoiler:
The new version is here (no difference, but codes will be automatically inserted into the ROM):
FIRERED:

EMERALD:

Read Readme.md to know how to compile.

Quick Preview:

The EV-IV display here looks fantastic! Unfortunately, I am unsure how to insert it into a ROM (Emerald).

The readme file says I need to have "Devkitarm" and "make" installed and that "armips v0.8/0.9" is required.

Mainly, I just have no clue what those programs are and how I would get them installed correctly in order to compile and insert this code into my ROM. I believe I MAY have Devkitarm installed (from using DizzyEgg's Emerald Battle Engine Upgrade), but I'm not sure about "make" nor "armips".

Any help on this would be absolutely appreciated, otherwise it seems I may have a lot of basic research on my hands before I'm able to include this in my ROM (which I'm also unsure of where to start).

mattyman April 23rd, 2018 12:45 PM

Hi everyone. I was hoping someone could take a look at an asm routine and a script and tell me what i'm doing wrong. Here's the routine, originally made by FBI,

Spoiler:

.text
.align 2
.thumb
.thumb_func

main:
push {r0-r4, lr}
ldr r0, =(0x80568E0 +1)
str r0, [SP, #0x4]
ldr r1, =(0x300500C)
ldr r1, [r1]
mov r0, #0x0
mov r2, #0x0
mov r3, #0x0
ldr r4, =(0x20370D0)
strb r0, [r4]
ldr r4, =(0x809D954 +1)
bl linker

checkValidName:
ldr r0, =(0x300500C)
ldr r0, [r0]
ldrb r0, [r0]
cmp r0, #0xFF
beq invalid
cmp r0, #0x0
beq invalid

done:
pop {r0-r4, pc}

invalid:
ldr r0, =(0x20370D0)
mov r1, #0x1
strb r1, [r1]
pop {r0-r4, pc}

linker:
bx r4

.align 2


It is meant to rename the player from the overworld, but if the name is invalid (contains spaces), is sets 0x800D to 0x1. Everything works, except that last part. If I put a space in the name, it acts as if the name is valid and continues without changing the name.

Here is the script I wrote for it,

Spoiler:

#dynamic 0x800000

#org @main
lockall
callasm 0x825AB25
waitstate
compare 0x800D 0x1
if 0x1 call @invalid
msgbox @msg MSG_KEEPOPEN
closeonkeypress
releaseall
end

#org @invalid
msgbox @msginvalid MSG_KEEPOPEN
closeonkeypress
callasm 0x825AB25
waitstate
compare 0x800D 0x1
if 0x1 call @invalid
return

#org @msg
= Name set.

#org @msginvalid
= The chosen name was invalid.\pPlease choose a valid name.


Is it something wrong with the routine or my script?

Blah April 24th, 2018 10:35 AM

Quote:

Originally Posted by mattyman (Post 9868323)
Hi everyone. I was hoping someone could take a look at an asm routine and a script and tell me what i'm doing wrong. Here's the routine, originally made by FBI,

Spoiler:

.text
.align 2
.thumb
.thumb_func

main:
push {r0-r4, lr}
ldr r0, =(0x80568E0 +1)
str r0, [SP, #0x4]
ldr r1, =(0x300500C)
ldr r1, [r1]
mov r0, #0x0
mov r2, #0x0
mov r3, #0x0
ldr r4, =(0x20370D0)
strb r0, [r4]
ldr r4, =(0x809D954 +1)
bl linker

checkValidName:
ldr r0, =(0x300500C)
ldr r0, [r0]
ldrb r0, [r0]
cmp r0, #0xFF
beq invalid
cmp r0, #0x0
beq invalid

done:
pop {r0-r4, pc}

invalid:
ldr r0, =(0x20370D0)
mov r1, #0x1
strb r1, [r1]
pop {r0-r4, pc}

linker:
bx r4

.align 2


It is meant to rename the player from the overworld, but if the name is invalid (contains spaces), is sets 0x800D to 0x1. Everything works, except that last part. If I put a space in the name, it acts as if the name is valid and continues without changing the name.

Here is the script I wrote for it,

Spoiler:

#dynamic 0x800000

#org @main
lockall
callasm 0x825AB25
waitstate
compare 0x800D 0x1
if 0x1 call @invalid
msgbox @msg MSG_KEEPOPEN
closeonkeypress
releaseall
end

#org @invalid
msgbox @msginvalid MSG_KEEPOPEN
closeonkeypress
callasm 0x825AB25
waitstate
compare 0x800D 0x1
if 0x1 call @invalid
return

#org @msg
= Name set.

#org @msginvalid
= The chosen name was invalid.\pPlease choose a valid name.


Is it something wrong with the routine or my script?

The validity check in the routine is very naive. It simply checks if the first character is a space, or no name was written. You'd have to do some sort of while loop or similar to validate spaces.
Code:

checkValidName:
ldr r0, =(0x300500C)
ldr r0, [r0]
ldrb r2, [r0]
cmp r2, #0xff
beq invalid
mov r1, #0x0

loop:
cmp r1, #0x13 @whatever max limit is for a name 0xff inclusive
beq done
add r0, r0, r1
ldrb r2, [r0]
cmp r2, #0x0
beq invalid
add r1, r1, #0x1
b loop


Something like that...

mattyman April 26th, 2018 1:14 PM

Quote:

Originally Posted by FBI (Post 9868661)
The validity check in the routine is very naive. It simply checks if the first character is a space, or no name was written. You'd have to do some sort of while loop or similar to validate spaces.
Code:

checkValidName:
ldr r0, =(0x300500C)
ldr r0, [r0]
ldrb r2, [r0]
cmp r2, #0xff
beq invalid
mov r1, #0x0

loop:
cmp r1, #0x13 @whatever max limit is for a name 0xff inclusive
beq done
add r0, r0, r1
ldrb r2, [r0]
cmp r2, #0x0
beq invalid
add r1, r1, #0x1
b loop


Something like that...

Sorry that's actually what I meant, I just worded it poorly. In the original routine, if I type just a space and no name, it acts as though it is valid and then keeps the name the character had before.

AkameTheBulbasaur May 8th, 2018 10:29 PM

Quote:

Originally Posted by paccy (Post 9867408)
Inherit Pokeball from Mother (Emerald)

I have ported this to Fire Red!

Routine 1: Put 00 49 08 47 XX XX XX 08 at 0x46250
Spoiler:
/*Put 00 49 08 47 XX XX XX 08 at 0x46250*/
.text
.align 2
.thumb
.thumb_func

Main:
push {r5}
ldr r0, .SaveBlock
ldr r0, [r0]
ldr r1, =0x2F80
add r0, r0, r1
mov r5, r0
bl GetGender
cmp r0, #0xFE
beq Mother
mov r0, r5
mov r5, #0x8C
add r0, r0, r5
mov r5, r0
bl GetGender
cmp r0, #0xFE
beq Mother
b PokeBall

Mother:
mov r0, r5
mov r1, #0x26
bl Decrypt
mov r1, r0
cmp r1, #0x1
beq PokeBall
pop {r5}
add r0, sp, #0x10
strh r1, [r0]
mov r4, sp
b Return

PokeBall:
mov r1, #0x4
pop {r5}
add r0, sp, #0x10
strh r1, [r0]
mov r4, sp

Return:
add r4, r4, #0x13
ldr r0, .Return
bx r0

GetGender:
ldr r3, .GetGender
bx r3

Decrypt:
ldr r3, .Decrypt
bx r3

.align 2
.SaveBlock: .word 0x03005008
.GetGender: .word 0x0803F731
.Decrypt: .word 0x0803FBE9
.Return: .word 0x08046259


Routine 2: Put 00 48 00 47 XX XX XX 08 at 0x46D10
Spoiler:
/*Put 00 48 00 47 XX XX XX 08 at 0x46D10*/
.text
.align 2
.thumb
.thumb_func

Main:
mov r0, r5
mov r1, #0x25
mov r2, r10
bl Decrypt
mov r1, r10
strb r0, [r1]
mov r0, r5
mov r1, #0x26
bl Decrypt
ldr r1, .Var8000
strh r0, [r1]
ldr r3, .Return
bx r3

Decrypt:
ldr r3, .Decrypt
bx r3

.align 2
.Decrypt: .word 0x0803FBE9
.Var8000: .word 0x020370B8
.Return: .word 0x08046D19


Routine 3: 00 4A 10 47 XX XX XX 08 at 0x46DD0
Spoiler:
/*Put 00 4A 10 47 XX XX XX 08 at 0x46DD0*/
.text
.align 2
.thumb
.thumb_func

Main:
mov r2, sp
add r2, r2, #0xE
ldr r0, .Var8000
ldrh r0, [r0]
strh r0, [r2]
mov r0, r5
mov r1, #0x26
bl Encrypt
ldr r3, .Return
bx r3

Encrypt:
ldr r3, .Encrypt
bx r3

.align 2
.Var8000: .word 0x020370B8
.Encrypt: .word 0x0804037D
.Return: .word 0x08046DDF


I have also made a routine that will cause the PokeBall to be random. To use this:

1. Don't insert Routine 1.
2. Instead of Routine 2, insert the routine below.
3. Insert Routine 3 normally.

Routine: Put 00 48 00 47 XX XX XX 08 at 0x46D10
Spoiler:
/*Put 00 48 00 47 XX XX XX 08 at 0x46D10*/
.text
.align 2
.thumb
.thumb_func

Main:
mov r0, r5
mov r1, #0x25
mov r2, r10
bl Decrypt
mov r1, r10
strb r0, [r1]

GetBall:
push {r2-r3}
bl RNG
mov r2, #0xFF
mov r3, #0x16
mul r2, r3
sub r2, r2, #0x95
mov r3, #0x1
cmp r0, r2
ble StoreBall
mov r3, #0x2
mul r2, r3
cmp r0, r2
ble StoreBall
mov r3, #0x3
mul r2, r3
cmp r0, r2
ble StoreBall
mov r3, #0x4
mul r2, r3
cmp r0, r2
ble StoreBall
mov r3, #0x5
mul r2, r3
cmp r0, r2
ble StoreBall
mov r3, #0x6
mul r2, r3
cmp r0, r2
ble StoreBall
mov r3, #0x7
mul r2, r3
cmp r0, r2
ble StoreBall
mov r3, #0x8
mul r2, r3
cmp r0, r2
ble StoreBall
mov r3, #0x9
mul r2, r3
cmp r0, r2
ble StoreBall
mov r3, #0xA
mul r2, r3
cmp r0, r2
ble StoreBall
mov r3, #0xB
mul r2, r3
cmp r0, r2
ble StoreBall
mov r3, #0xC
mul r2, r3
add r2, r2, #0x3
cmp r0, r2
ble StoreBall
mov r3, #0x4
b StoreBall

StoreBall:
pop {r2}
mov r0, r3
pop {r3}
ldr r1, .Var8000
strh r0, [r1]
ldr r3, .Return
bx r3

RNG:
ldr r3, .RNG
bx r3

Decrypt:
ldr r3, .Decrypt
bx r3

.align 2
.Decrypt: .word 0x0803FBE9
.Var8000: .word 0x020370B8
.RNG: .word 0x08044EC9
.Return: .word 0x08046D19

Lancekoijerwillborough May 17th, 2018 5:14 AM

Quote:

Originally Posted by FBI (Post 8509300)

Wild Pokemon With custom attacks



Well, this took me longer than it should have lol. I initially just edited the wild Pokemon in RAM to have the moves I wanted, and used masterballs to capture it (i.e I didn't battle it).
Then I got a PP problem where the PP didn't match, so I wrote a routine to try and fix the PP problem. Then I talked to a friend on IRC, and he pointed out that I should make sure the Pokemon has the same moves in battle. Yeah, needless to say it didn't lol. So I ended up hacking the wild pokemon generator.

How to insert:

First compile this ASM routine.
ASM Routine:
Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

main:
        ldr r5, .VAR
        mov r4, #0x0

loop:
        mov r1, r5 @check if attacks are set
        ldrb r1, [r1]
        cmp r1, #0x0
        beq defaultMoves
        mov r1, #0x2 @calculate location of next attack
        mul r1, r1, r4
        add r1, r1, r5
        ldrh r1, [r1]
        mov r0, r8
        ldr r3, =(0x803E8B0 +1)
        bl linkerTwo
        add r4, r4, #0x1
        cmp r4, #0x4
        bne loop

noCrash:
        lsl r0, r0, #0x10
        mov r1, r9
        lsr r5, r1, #0x10
        ldr r3, [sp]
        ldr r1, = (0x803EA60 +1)
        cmp r0, r9
        bne linkerOne
        ldr r1, = (0x803EA56 +1)
        bx r1

defaultMoves:
        mov r0, r8
        ldr r3, =(0x803E8B0 +1)
        bl linkerTwo
        b noCrash

linkerTwo:
        bx r3

linkerOne:
        bx r1

.align 2

.VAR:
        .word 0x020370B8




compiled version:
Code:

0F 4D 00 24 29 1C 09 78 00 29 13 D0 02 21 61 43 49 19 09 88 40 46 0B 4B 00 F0 10 F8 01 34 04 2C F0 D1 00 04 49 46 0D 0C 00 9B 07 49 48 45 06 D1 06 49 08 47 03 4B 00 F0 01 F8 F2 E7 18 47 08 47 B8 70 03 02 B1 E8 03 08 61 EA 03 08 57 EA 03 08


Now go to 0x3EA46 and insert:
Code:

01 48 00 47 00 00 XX XX XX 08


Where XX XX XX is the reverse hex pointer to where you inserted the previously compiled routine.

How to use:
Set var 0x8000 to 0x0 to disable.
Variables 0x8000 to 0x8003 are the 4 custom attacks you want inserted.
So to set the first attack of the wild Pokemon to firepunch, I would setvar 0x8000 0x7.

Here's a present :3
http://i.imgur.com/LjzUa9a.png

EDIT: Attacks must be between 0x0-0xFFFF

Just want to report that none of these is working.

pikachux2 May 19th, 2018 4:35 AM

Hey again everybody. I'm trying to get this code:
https://github.com/jiangzhengwenjz/Double_wild_battle
Into my fire red game. Problem is the readme is having me install DevkitARM and Gnumake.. I I got a C in System Programing and can't for the life of me make this work. If anyone can help me I'd be grateful!

Delta231 May 19th, 2018 5:06 AM

Quote:

Originally Posted by pikachux2 (Post 9878457)
Hey again everybody. I'm trying to get this code:
https://github.com/jiangzhengwenjz/Double_wild_battle
Into my fire red game. Problem is the readme is having me install DevkitARM and Gnumake.. I I got a C in System Programing and can't for the life of me make this work. If anyone can help me I'd be grateful!

You need those inorder to insert them. Remember use DevkitPro v45 not 47.

Spherical Ice May 20th, 2018 8:09 AM

Stats on the Pokédex screen replacing the weight comparison




Code:

.thumb

@ credits to DoesntKnowHowToPlay and Squeetz

.equ rom, 0x08000000
.equ offset, 0x

.org 0x10611E, 0xFF
        .byte 0x43, 0xE0

.org 0x106370, 0xFF
        .byte 0x0, 0x48, 0x0, 0x47
        .word main + rom + 1

.org 0x106530, 0xFF
        .byte 0xCE, 0xE0

.org 0x452200, 0xFF
        .byte 0xA

.org offset, 0xFF
main:
    mov r5, #4
    str r5, [sp]
    str r6, [sp, #4]
    mov r0, r10
    cmp r0, #0
    beq unknown_base_stats

hp:
    mov r0, #0
    bl print_stat
    mov r3, #4 @ y co-ord
    str r3, [sp]
    mov r3, #0 @ x co-ord
    ldr r5, write_method
    bl call_via_r5

atk:
    mov r0, #1
    bl print_stat
    mov r3, #4 @ y co-ord
    str r3, [sp]
    mov r3, #0x2C @ x co-ord
    ldr r5, write_method
    bl call_via_r5

def:
    mov r0, #2
    bl print_stat
    mov r3, #18 @ y co-ord
    str r3, [sp]
    mov r3, #0 @ x co-ord
    ldr r5, write_method
    bl call_via_r5

spa:
    mov r0, #4
    bl print_stat
    mov r3, #18 @ y co-ord
    str r3, [sp]
    mov r3, #0x2C @ x co-ord
    ldr r5, write_method
    bl call_via_r5

spd:
    mov r0, #5
    bl print_stat
    mov r3, #32 @ y co-ord
    str r3, [sp]
    mov r3, #0 @ x co-ord
    ldr r5, write_method
    bl call_via_r5

spe:
    mov r0, #3
    bl print_stat
    mov r3, #32 @ y co-ord
    str r3, [sp]
    mov r3, #0x2C @ x co-ord
    ldr r5, write_method
    bl call_via_r5

print_ability_one:
    ldr r0, [sp, #0x1C]
    mov r3, #0x1C
    mul r0, r3
    ldr r1, base_stats
        ldr r1, [r1]
    mov r3, #0x16
    add r1, r1, r3
    add r1, r0, r1
    ldr r3, abilities
        ldr r3, [r3]
    ldrb r2, [r1]
    mov r1, #0xD
    mul r1, r2
    add r2, r1, r3
    ldr r1, [r7]
    add r1, #0x53
    ldrb r1, [r1]
    mov r0, r1
    mov r1, #0
    mov r3, #46
    str r3, [sp]
    mov r3, #0
    ldr r5, write_method
    bl call_via_r5

print_ability_two:
    ldr r0, [sp, #0x1C]
    mov r3, #0x1C
    mul r0, r3
    ldr r1, base_stats
        ldr r1, [r1]
    mov r3, #0x16
    add r1, r1, r3
    add r1, r0, r1
    ldrb r2, [r1, #1]
    ldrb r5, [r1, #0]
    ldr r3, abilities
        ldr r3, [r3]
    cmp r2, r5
    beq return
    cmp r2, #0
    beq return
    mov r1, #0xD
    mul r1, r2
    add r2, r1, r3

    ldr r1, [r7]
    add r1, #0x53
    ldrb r1, [r1]
    mov r0, r1
    mov r1, #0
    mov r3, #60
    str r3, [sp]
    mov r3, #0
    ldr r5, write_method
    bl call_via_r5
    b return

unknown_base_stats:
    mov r0, r1
    mov r1, #0
    ldr r2, str_unknown
    mov r3, #4 @ y co-ord
    str r3, [sp]
    mov r3, #0 @ x co-ord
    ldr r5, write_method
    bl call_via_r5

return:
    mov r5, #0
    ldr r0, return_loc
    bx r0

print_stat:
    push {lr}
    ldr r3, [sp, #0x20]
    mov r1, #0x1C
    mul r3, r1
    ldr r2, base_stats
        ldr r2, [r2]
    add r2, r3
    add r2, r0
    ldrb r1, [r2]
    mov r4, r0
    ldr r0, fcode_buffer2
    mov r3, #0
    cmp r1, #99
    bhi no_leading_zeroes
    cmp r1, #9
    bhi one_leading_zero

two_leading_zeroes:
    str r3, [r0]
    add r0, #1

one_leading_zero:
    str r3, [r0]
    add r0, #1

no_leading_zeroes:
    mov r3, #3
    ldr r5, int_to_str
    bl call_via_r5

    mov r2, r4
    ldr r0, displayed_string
    ldr r1, str_table
    lsl r2, r2, #2
    add r1, r2
    ldr r1, [r1]
    ldr r5, fdecoder
    bl call_via_r5
    ldr r1, [r7]
    add r1, #0x53
    ldrb r1, [r1]
    mov r0, r1
    mov r1, #0
    ldr r2, displayed_string
    pop {r5}

call_via_r5:
    bx r5

.align 2
    base_stats:            .word 0x1BC + rom
    abilities:              .word 0x1C0 + rom
    str_table:              .word table + rom
    str_unknown:            .word capture + rom
    fcode_buffer2:          .word 0x02021CD0
    displayed_string:      .word 0x02021D18
    int_to_str:            .word 0x08008E78|1
    fdecoder:              .word 0x08008FCC|1
    write_method:          .word 0x081047C8|1
    return_loc:            .word 0x08106380|1
table:
        .word stat_hp + rom
        .word stat_atk + rom
        .word stat_def + rom
        .word stat_spe + rom
        .word stat_spa + rom
        .word stat_spd + rom

stat_hp:
        .byte 0xC2, 0xCA, 0x0, 0x0, 0xFD, 0x2, 0xFF

stat_atk:
        .byte 0xBB, 0xE8, 0xDF, 0x0, 0xFD, 0x2, 0xFF

stat_def:
        .byte 0xBE, 0xD9, 0xDA, 0x0, 0xFD, 0x2, 0xFF

stat_spe:
        .byte 0xCD, 0xE4, 0xD9, 0x0, 0xFD, 0x2, 0xFF

stat_spa:
        .byte 0xCD, 0xE4, 0xBB, 0x0, 0xFD, 0x2, 0xFF

stat_spd:
        .byte 0xCD, 0xE4, 0xBE, 0x0, 0xFD, 0x2, 0xFF

capture:
        .byte 0xBD, 0xD5, 0xE4, 0xE8, 0xE9, 0xE6, 0xD9, 0x0, 0xDA, 0xE3, 0xE6, 0xFE, 0xE1, 0xE3, 0xE6, 0xD9, 0x0, 0xDD, 0xE2, 0xDA, 0xE3, 0xE6, 0xE1, 0xD5, 0xE8, 0xDD, 0xE3, 0xE2, 0xAB, 0xFF


Thanks to DoesntKnowHowToPlay for the base routine which I slightly edited / optimised, and to Squeetz for making the routine into a form that can be applied as a patch.

pikachux2 May 20th, 2018 8:48 AM

So I've extracted both Gnumake and devkitARM v45. I have the double battle code extracted as well. I've read the readmes for all these files and they definitely don't assume i'm a beginner. Has anyone ever done this and wanna do a quick step-by-step? Thanks again.

Neon Skylar May 21st, 2018 3:53 AM

Quote:

Originally Posted by Spherical Ice (Post 9878890)

Stats on the Pokdex screen replacing the weight comparison




Code:

.thumb

@ credits to DoesntKnowHowToPlay and Squeetz

.equ rom, 0x08000000
.equ offset, 0x

.org 0x10611E, 0xFF
        .byte 0x43, 0xE0

.org 0x106370, 0xFF
        .byte 0x0, 0x48, 0x0, 0x47
        .word main + rom + 1

.org 0x106530, 0xFF
        .byte 0xCE, 0xE0

.org 0x452200, 0xFF
        .byte 0xA

.org offset, 0xFF
main:
    mov r5, #4
    str r5, [sp]
    str r6, [sp, #4]
    mov r0, r10
    cmp r0, #0
    beq unknown_base_stats

hp:
    mov r0, #0
    bl print_stat
    mov r3, #4 @ y co-ord
    str r3, [sp]
    mov r3, #0 @ x co-ord
    ldr r5, write_method
    bl call_via_r5

atk:
    mov r0, #1
    bl print_stat
    mov r3, #4 @ y co-ord
    str r3, [sp]
    mov r3, #0x2C @ x co-ord
    ldr r5, write_method
    bl call_via_r5

def:
    mov r0, #2
    bl print_stat
    mov r3, #18 @ y co-ord
    str r3, [sp]
    mov r3, #0 @ x co-ord
    ldr r5, write_method
    bl call_via_r5

spa:
    mov r0, #4
    bl print_stat
    mov r3, #18 @ y co-ord
    str r3, [sp]
    mov r3, #0x2C @ x co-ord
    ldr r5, write_method
    bl call_via_r5

spd:
    mov r0, #5
    bl print_stat
    mov r3, #32 @ y co-ord
    str r3, [sp]
    mov r3, #0 @ x co-ord
    ldr r5, write_method
    bl call_via_r5

spe:
    mov r0, #3
    bl print_stat
    mov r3, #32 @ y co-ord
    str r3, [sp]
    mov r3, #0x2C @ x co-ord
    ldr r5, write_method
    bl call_via_r5

print_ability_one:
    ldr r0, [sp, #0x1C]
    mov r3, #0x1C
    mul r0, r3
    ldr r1, base_stats
        ldr r1, [r1]
    mov r3, #0x16
    add r1, r1, r3
    add r1, r0, r1
    ldr r3, abilities
        ldr r3, [r3]
    ldrb r2, [r1]
    mov r1, #0xD
    mul r1, r2
    add r2, r1, r3
    ldr r1, [r7]
    add r1, #0x53
    ldrb r1, [r1]
    mov r0, r1
    mov r1, #0
    mov r3, #46
    str r3, [sp]
    mov r3, #0
    ldr r5, write_method
    bl call_via_r5

print_ability_two:
    ldr r0, [sp, #0x1C]
    mov r3, #0x1C
    mul r0, r3
    ldr r1, base_stats
        ldr r1, [r1]
    mov r3, #0x16
    add r1, r1, r3
    add r1, r0, r1
    ldrb r2, [r1, #1]
    ldrb r5, [r1, #0]
    ldr r3, abilities
        ldr r3, [r3]
    cmp r2, r5
    beq return
    cmp r2, #0
    beq return
    mov r1, #0xD
    mul r1, r2
    add r2, r1, r3

    ldr r1, [r7]
    add r1, #0x53
    ldrb r1, [r1]
    mov r0, r1
    mov r1, #0
    mov r3, #60
    str r3, [sp]
    mov r3, #0
    ldr r5, write_method
    bl call_via_r5
    b return

unknown_base_stats:
    mov r0, r1
    mov r1, #0
    ldr r2, str_unknown
    mov r3, #4 @ y co-ord
    str r3, [sp]
    mov r3, #0 @ x co-ord
    ldr r5, write_method
    bl call_via_r5

return:
    mov r5, #0
    ldr r0, return_loc
    bx r0

print_stat:
    push {lr}
    ldr r3, [sp, #0x20]
    mov r1, #0x1C
    mul r3, r1
    ldr r2, base_stats
        ldr r2, [r2]
    add r2, r3
    add r2, r0
    ldrb r1, [r2]
    mov r4, r0
    ldr r0, fcode_buffer2
    mov r3, #0
    cmp r1, #99
    bhi no_leading_zeroes
    cmp r1, #9
    bhi one_leading_zero

two_leading_zeroes:
    str r3, [r0]
    add r0, #1

one_leading_zero:
    str r3, [r0]
    add r0, #1

no_leading_zeroes:
    mov r3, #3
    ldr r5, int_to_str
    bl call_via_r5

    mov r2, r4
    ldr r0, displayed_string
    ldr r1, str_table
    lsl r2, r2, #2
    add r1, r2
    ldr r1, [r1]
    ldr r5, fdecoder
    bl call_via_r5
    ldr r1, [r7]
    add r1, #0x53
    ldrb r1, [r1]
    mov r0, r1
    mov r1, #0
    ldr r2, displayed_string
    pop {r5}

call_via_r5:
    bx r5

.align 2
    base_stats:            .word 0x1BC + rom
    abilities:              .word 0x1C0 + rom
    str_table:              .word table + rom
    str_unknown:            .word capture + rom
    fcode_buffer2:          .word 0x02021CD0
    displayed_string:      .word 0x02021D18
    int_to_str:            .word 0x08008E78|1
    fdecoder:              .word 0x08008FCC|1
    write_method:          .word 0x081047C8|1
    return_loc:            .word 0x08106380|1
table:
        .word stat_hp + rom
        .word stat_atk + rom
        .word stat_def + rom
        .word stat_spe + rom
        .word stat_spa + rom
        .word stat_spd + rom

stat_hp:
        .byte 0xC2, 0xCA, 0x0, 0x0, 0xFD, 0x2, 0xFF

stat_atk:
        .byte 0xBB, 0xE8, 0xDF, 0x0, 0xFD, 0x2, 0xFF

stat_def:
        .byte 0xBE, 0xD9, 0xDA, 0x0, 0xFD, 0x2, 0xFF

stat_spe:
        .byte 0xCD, 0xE4, 0xD9, 0x0, 0xFD, 0x2, 0xFF

stat_spa:
        .byte 0xCD, 0xE4, 0xBB, 0x0, 0xFD, 0x2, 0xFF

stat_spd:
        .byte 0xCD, 0xE4, 0xBE, 0x0, 0xFD, 0x2, 0xFF

capture:
        .byte 0xBD, 0xD5, 0xE4, 0xE8, 0xE9, 0xE6, 0xD9, 0x0, 0xDA, 0xE3, 0xE6, 0xFE, 0xE1, 0xE3, 0xE6, 0xD9, 0x0, 0xDD, 0xE2, 0xDA, 0xE3, 0xE6, 0xE1, 0xD5, 0xE8, 0xDD, 0xE3, 0xE2, 0xAB, 0xFF


Thanks to DoesntKnowHowToPlay for the base routine which I slightly edited / optimised, and to Squeetz for making the routine into a form that needs less proir hex editing to insert.

I like this idea, it looks great the pokedex .. when this list the routine you leave the explanation of how to insert it: D

Spherical Ice May 21st, 2018 5:00 AM

Quote:

Originally Posted by Neon Skylar (Post 9879223)
I like this idea, it looks great the pokedex .. when this list the routine you leave the explanation of how to insert it: D

Type in the offset you wish to insert the routine at next to the .equ offset, 0x keyword in the .asm file. Save the .asm file, and then assemble it using a thumb assembler. Open the produced .bin file in a hex editor, along with your ROM. Go to each .org keyword in the routine, and copy the address beside it (for example, 10611E). Go to each of these addresses in both your ROM and .bin file, and copy the non-FF bytes from the .bin file to the same location as your ROM. Repeat this until you've made all of these changes. Then go to the offset you typed at the top of the routine, next to .equ offset, 0x, and, again, copy the bytes from the .bin file to your ROM. Save your changes, and test in game.

I hope that helps.

Neon Skylar May 21st, 2018 5:31 AM

Quote:

Originally Posted by Spherical Ice (Post 9879252)
Type in the offset you wish to insert the routine at next to the .equ offset, 0x keyword in the .asm file. Save the .asm file, and then assemble it using a thumb assembler. Open the produced .bin file in a hex editor, along with your ROM. Go to each .org keyword in the routine, and copy the address beside it (for example, 10611E). Go to each of these addresses in both your ROM and .bin file, and copy the non-FF bytes from the .bin file to the same location as your ROM. Repeat this until you've made all of these changes. Then go to the offset you typed at the top of the routine, next to .equ offset, 0x, and, again, copy the bytes from the .bin file to your ROM. Save your changes, and test in game.

I hope that helps.

1.- Copy and paste the routine in a text editor.

2- On the line where it says ".equ offset, 0x" I put the address (in my case it is B00000)

3.- I keep the routine and name it as .asm (in my case, Dex.asm)

4.- I go to the thumb folder and I put my Dex.asm to Dex.bin

5.- Then I open with HxD a clean rom and the Dex.bin

.....

Until this step can I understand .. what should I do now? explain me with a little more detail and I hope I do not bother much ...

Lance Koijer 2.0 May 21st, 2018 6:15 AM

Quote:

Originally Posted by Xencleamas (Post 9821663)
I have modified and enhanced azurile13's (credits and kudos to him) routine to make this supported on the Compiler's THUMB.bat. These are the things I modified:
  • Added routines creating the hooks that are to be copy-pasted on their respective locations. There are 11 hooks.
  • Added the master location of the routine in which the hooks will create locations for those routines. Insert your free space on .equ MyLoc. Format: 0x###### (Hexadecimal Number)
  • Created and added a new index list of Pokémon up to Generation VI including the formes in style of KDS/Chacha Dinosaur from the filenames of MrDollSteak's sprites in his Sugimori and Gen VI threads. I think there is no master index list for Generation VII. If there is, please PM me and I will add those.
  • With the list created as stated above, you will just have to create your own Regional Pokédex by copy-pasting from your Excel and Notepad file to below "regional_dex_order" and .hword 0x0000 should be first in the list. Make sure the names are all CAPS-LOCKED. In case of Nidorans, Farfetch'd, Mr. Mime, Ho-Oh, Mime Jr., Porygon-Z, and Flabébé, their characters are changed so you'll have to look for them in the master list. NOTE: Cohagrigus have been filtered out and changed into asterisks (*). Remember to correct its name before generating the binary file otherwise the .asm file won't work.

Custom Regional Pokédex for FireRed:
Spoiler:
Code:

.thumb
.align

.equ number_of_mons_in_regional_dex, 202 @or however long you wanted your regional dex to be
.equ number_of_mons_in_national_dex, 386
.equ MyLoc, 0x888888 @insert your location here
.equ RomAreaOffset,        0x8000000

@Kanto

.equ UNKNOWN, 0x0
.equ BULBASAUR, 0x1
.equ IVYSAUR, 0x2
.equ VENUSAUR, 0x3
.equ CHARMANDER, 0x4
.equ CHARMELEON, 0x5
.equ CHARIZARD, 0x6
.equ SQUIRTLE, 0x7
.equ WARTORTLE, 0x8
.equ BLASTOISE, 0x9
.equ CATERPIE, 0xA
.equ METAPOD, 0xB
.equ BUTTERFREE, 0xC
.equ WEEDLE, 0xD
.equ KAKUNA, 0xE
.equ BEEDRILL, 0xF
.equ PIDGEY, 0x10
.equ PIDGEOTTO, 0x11
.equ PIDGEOT, 0x12
.equ RATTATA, 0x13
.equ RATICATE, 0x14
.equ SPEAROW, 0x15
.equ FEAROW, 0x16
.equ EKANS, 0x17
.equ ARBOK, 0x18
.equ PIKACHU, 0x19
.equ RAICHU, 0x1A
.equ SANDSHREW, 0x1B
.equ SANDSLASH, 0x1C
.equ NIDORAN_F, 0x1D
.equ NIDORINA, 0x1E
.equ NIDOQUEEN, 0x1F
.equ NIDORAN_M, 0x20
.equ NIDORINO, 0x21
.equ NIDOKING, 0x22
.equ CLEFAIRY, 0x23
.equ CLEFABLE, 0x24
.equ VULPIX, 0x25
.equ NINETALES, 0x26
.equ JIGGLYPUFF, 0x27
.equ WIGGLYTUFF, 0x28
.equ ZUBAT, 0x29
.equ GOLBAT, 0x2A
.equ ODDISH, 0x2B
.equ GLOOM, 0x2C
.equ VILEPLUME, 0x2D
.equ PARAS, 0x2E
.equ PARASECT, 0x2F
.equ VENONAT, 0x30
.equ VENOMOTH, 0x31
.equ DIGLETT, 0x32
.equ DUGTRIO, 0x33
.equ MEOWTH, 0x34
.equ PERSIAN, 0x35
.equ PSYDUCK, 0x36
.equ GOLDUCK, 0x37
.equ MANKEY, 0x38
.equ PRIMEAPE, 0x39
.equ GROWLITHE, 0x3A
.equ ARCANINE, 0x3B
.equ POLIWAG, 0x3C
.equ POLIWHIRL, 0x3D
.equ POLIWRATH, 0x3E
.equ ABRA, 0x3F
.equ KADABRA, 0x40
.equ ALAKAZAM, 0x41
.equ MACHOP, 0x42
.equ MACHOKE, 0x43
.equ MACHAMP, 0x44
.equ BELLSPROUT, 0x45
.equ WEEPINBELL, 0x46
.equ VICTREEBEL, 0x47
.equ TENTACOOL, 0x48
.equ TENTACRUEL, 0x49
.equ GEODUDE, 0x4A
.equ GRAVELER, 0x4B
.equ GOLEM, 0x4C
.equ PONYTA, 0x4D
.equ RAPIDASH, 0x4E
.equ SLOWPOKE, 0x4F
.equ SLOWBRO, 0x50
.equ MAGNEMITE, 0x51
.equ MAGNETON, 0x52
.equ FARFETCH_D, 0x53
.equ DODUO, 0x54
.equ DODRIO, 0x55
.equ SEEL, 0x56
.equ DEWGONG, 0x57
.equ GRIMER, 0x58
.equ MUK, 0x59
.equ SHELLDER, 0x5A
.equ CLOYSTER, 0x5B
.equ GASTLY, 0x5C
.equ HAUNTER, 0x5D
.equ GENGAR, 0x5E
.equ ONIX, 0x5F
.equ DROWZEE, 0x60
.equ HYPNO, 0x61
.equ KRABBY, 0x62
.equ KINGLER, 0x63
.equ VOLTORB, 0x64
.equ ELECTRODE, 0x65
.equ EXEGGCUTE, 0x66
.equ EXEGGUTOR, 0x67
.equ CUBONE, 0x68
.equ MAROWAK, 0x69
.equ HITMONLEE, 0x6A
.equ HITMONCHAN, 0x6B
.equ LICKITUNG, 0x6C
.equ KOFFING, 0x6D
.equ WEEZING, 0x6E
.equ RHYHORN, 0x6F
.equ RHYDON, 0x70
.equ CHANSEY, 0x71
.equ TANGELA, 0x72
.equ KANGASKHAN, 0x73
.equ HORSEA, 0x74
.equ SEADRA, 0x75
.equ GOLDEEN, 0x76
.equ SEAKING, 0x77
.equ STARYU, 0x78
.equ STARMIE, 0x79
.equ MR_MIME, 0x7A
.equ SCYTHER, 0x7B
.equ JYNX, 0x7C
.equ ELECTABUZZ, 0x7D
.equ MAGMAR, 0x7E
.equ PINSIR, 0x7F
.equ TAUROS, 0x80
.equ MAGIKARP, 0x81
.equ GYARADOS, 0x82
.equ LAPRAS, 0x83
.equ DITTO, 0x84
.equ EEVEE, 0x85
.equ VAPOREON, 0x86
.equ JOLTEON, 0x87
.equ FLAREON, 0x88
.equ PORYGON, 0x89
.equ OMANYTE, 0x8A
.equ OMASTAR, 0x8B
.equ KABUTO, 0x8C
.equ KABUTOPS, 0x8D
.equ AERODACTYL, 0x8E
.equ SNORLAX, 0x8F
.equ ARTICUNO, 0x90
.equ ZAPDOS, 0x91
.equ MOLTRES, 0x92
.equ DRATINI, 0x93
.equ DRAGONAIR, 0x94
.equ DRAGONITE, 0x95
.equ MEWTWO, 0x96
.equ MEW, 0x97
.equ CHIKORITA, 0x98
.equ BAYLEEF, 0x99
.equ MEGANIUM, 0x9A
.equ CYNDAQUIL, 0x9B
.equ QUILAVA, 0x9C
.equ TYPHLOSION, 0x9D
.equ TOTODILE, 0x9E
.equ CROCONAW, 0x9F
.equ FERALIGATR, 0xA0
.equ SENTRET, 0xA1
.equ FURRET, 0xA2
.equ HOOTHOOT, 0xA3
.equ NOCTOWL, 0xA4
.equ LEDYBA, 0xA5
.equ LEDIAN, 0xA6
.equ SPINARAK, 0xA7
.equ ARIADOS, 0xA8
.equ CROBAT, 0xA9
.equ CHINCHOU, 0xAA
.equ LANTURN, 0xAB
.equ PICHU, 0xAC
.equ CLEFFA, 0xAD
.equ IGGLYBUFF, 0xAE
.equ TOGEPI, 0xAF
.equ TOGETIC, 0xB0
.equ NATU, 0xB1
.equ XATU, 0xB2
.equ MAREEP, 0xB3
.equ FLAAFFY, 0xB4
.equ AMPHAROS, 0xB5
.equ BELLOSSOM, 0xB6
.equ MARILL, 0xB7
.equ AZUMARILL, 0xB8
.equ SUDOWOODO, 0xB9
.equ POLITOED, 0xBA
.equ HOPPIP, 0xBB
.equ SKIPLOOM, 0xBC
.equ JUMPLUFF, 0xBD
.equ AIPOM, 0xBE
.equ SUNKERN, 0xBF
.equ SUNFLORA, 0xC0
.equ YANMA, 0xC1
.equ WOOPER, 0xC2
.equ QUAGSIRE, 0xC3
.equ ESPEON, 0xC4
.equ UMBREON, 0xC5
.equ MURKROW, 0xC6
.equ SLOWKING, 0xC7
.equ MISDREAVUS, 0xC8
.equ UNOWN, 0xC9
.equ WOBBUFFET, 0xCA
.equ GIRAFARIG, 0xCB
.equ PINECO, 0xCC
.equ FORRETRESS, 0xCD
.equ DUNSPARCE, 0xCE
.equ GLIGAR, 0xCF
.equ STEELIX, 0xD0
.equ SNUBBULL, 0xD1
.equ GRANBULL, 0xD2
.equ QWILFISH, 0xD3
.equ SCIZOR, 0xD4
.equ SHUCKLE, 0xD5
.equ HERACROSS, 0xD6
.equ SNEASEL, 0xD7
.equ TEDDIURSA, 0xD8
.equ URSARING, 0xD9
.equ SLUGMA, 0xDA
.equ MAGCARGO, 0xDB
.equ SWINUB, 0xDC
.equ PILOSWINE, 0xDD
.equ CORSOLA, 0xDE
.equ REMORAID, 0xDF
.equ OCTILLERY, 0xE0
.equ DELIBIRD, 0xE1
.equ MANTINE, 0xE2
.equ SKARMORY, 0xE3
.equ HOUNDOUR, 0xE4
.equ HOUNDOOM, 0xE5
.equ KINGDRA, 0xE6
.equ PHANPY, 0xE7
.equ DONPHAN, 0xE8
.equ PORYGON2, 0xE9
.equ STANTLER, 0xEA
.equ SMEARGLE, 0xEB
.equ TYROGUE, 0xEC
.equ HITMONTOP, 0xED
.equ SMOOCHUM, 0xEE
.equ ELEKID, 0xEF
.equ MAGBY, 0xF0
.equ MILTANK, 0xF1
.equ BLISSEY, 0xF2
.equ RAIKOU, 0xF3
.equ ENTEI, 0xF4
.equ SUICUNE, 0xF5
.equ LARVITAR, 0xF6
.equ PUPITAR, 0xF7
.equ TYRANITAR, 0xF8
.equ LUGIA, 0xF9
.equ HO_OH, 0xFA
.equ CELEBI, 0xFB
.equ NOPE, 0xFC
.equ NOPE, 0xFD
.equ NOPE, 0xFE
.equ NOPE, 0xFF
.equ NOPE, 0x100
.equ NOPE, 0x101
.equ NOPE, 0x102
.equ NOPE, 0x103
.equ NOPE, 0x104
.equ NOPE, 0x105
.equ NOPE, 0x106
.equ NOPE, 0x107
.equ NOPE, 0x108
.equ NOPE, 0x109
.equ NOPE, 0x10A
.equ NOPE, 0x10B
.equ NOPE, 0x10C
.equ NOPE, 0x10D
.equ NOPE, 0x10E
.equ NOPE, 0x10F
.equ NOPE, 0x110
.equ NOPE, 0x111
.equ NOPE, 0x112
.equ NOPE, 0x113
.equ NOPE, 0x114
.equ TREECKO, 0x115
.equ GROVYLE, 0x116
.equ SCEPTILE, 0x117
.equ TORCHIC, 0x118
.equ COMBUSKEN, 0x119
.equ BLAZIKEN, 0x11A
.equ MUDKIP, 0x11B
.equ MARSHTOMP, 0x11C
.equ SWAMPERT, 0x11D
.equ POOCHYENA, 0x11E
.equ MIGHTYENA, 0x11F
.equ ZIGZAGOON, 0x120
.equ LINOONE, 0x121
.equ WURMPLE, 0x122
.equ SILCOON, 0x123
.equ BEAUTIFLY, 0x124
.equ CASCOON, 0x125
.equ DUSTOX, 0x126
.equ LOTAD, 0x127
.equ LOMBRE, 0x128
.equ LUDICOLO, 0x129
.equ SEEDOT, 0x12A
.equ NUZLEAF, 0x12B
.equ SHIFTRY, 0x12C
.equ NINCADA, 0x12D
.equ NINJASK, 0x12E
.equ SHEDINJA, 0x12F
.equ TAILLOW, 0x130
.equ SWELLOW, 0x131
.equ SHROOMISH, 0x132
.equ BRELOOM, 0x133
.equ SPINDA, 0x134
.equ WINGULL, 0x135
.equ PELIPPER, 0x136
.equ SURSKIT, 0x137
.equ MASQUERAIN, 0x138
.equ WAILMER, 0x139
.equ WAILORD, 0x13A
.equ SKITTY, 0x13B
.equ DELCATTY, 0x13C
.equ KECLEON, 0x13D
.equ BALTOY, 0x13E
.equ CLAYDOL, 0x13F
.equ NOSEPASS, 0x140
.equ TORKOAL, 0x141
.equ SABLEYE, 0x142
.equ BARBOACH, 0x143
.equ WHISCASH, 0x144
.equ LUVDISC, 0x145
.equ CORPHISH, 0x146
.equ CRAWDAUNT, 0x147
.equ FEEBAS, 0x148
.equ MILOTIC, 0x149
.equ CARVANHA, 0x14A
.equ SHARPEDO, 0x14B
.equ TRAPINCH, 0x14C
.equ VIBRAVA, 0x14D
.equ FLYGON, 0x14E
.equ MAKUHITA, 0x14F
.equ HARIYAMA, 0x150
.equ ELECTRIKE, 0x151
.equ MANECTRIC, 0x152
.equ NUMEL, 0x153
.equ CAMERUPT, 0x154
.equ SPHEAL, 0x155
.equ SEALEO, 0x156
.equ WALREIN, 0x157
.equ CACNEA, 0x158
.equ CACTURNE, 0x159
.equ SNORUNT, 0x15A
.equ GLALIE, 0x15B
.equ LUNATONE, 0x15C
.equ SOLROCK, 0x15D
.equ AZURILL, 0x15E
.equ SPOINK, 0x15F
.equ GRUMPIG, 0x160
.equ PLUSLE, 0x161
.equ MINUN, 0x162
.equ MAWILE, 0x163
.equ MEDITITE, 0x164
.equ MEDICHAM, 0x165
.equ SWABLU, 0x166
.equ ALTARIA, 0x167
.equ WYNAUT, 0x168
.equ DUSKULL, 0x169
.equ DUSCLOPS, 0x16A
.equ ROSELIA, 0x16B
.equ SLAKOTH, 0x16C
.equ VIGOROTH, 0x16D
.equ SLAKING, 0x16E
.equ GULPIN, 0x16F
.equ SWALOT, 0x170
.equ TROPIUS, 0x171
.equ WHISMUR, 0x172
.equ LOUDRED, 0x173
.equ EXPLOUD, 0x174
.equ CLAMPERL, 0x175
.equ HUNTAIL, 0x176
.equ GOREBYSS, 0x177
.equ ABSOL, 0x178
.equ SHUPPET, 0x179
.equ BANETTE, 0x17A
.equ SEVIPER, 0x17B
.equ ZANGOOSE, 0x17C
.equ RELICANTH, 0x17D
.equ ARON, 0x17E
.equ LAIRON, 0x17F
.equ AGGRON, 0x180
.equ CASTFORM, 0x181
.equ VOLBEAT, 0x182
.equ ILLUMISE, 0x183
.equ LILEEP, 0x184
.equ CRADILY, 0x185
.equ ANORITH, 0x186
.equ ARMALDO, 0x187
.equ RALTS, 0x188
.equ KIRLIA, 0x189
.equ GARDEVOIR, 0x18A
.equ BAGON, 0x18B
.equ SHELGON, 0x18C
.equ SALAMENCE, 0x18D
.equ BELDUM, 0x18E
.equ METANG, 0x18F
.equ METAGROSS, 0x190
.equ REGIROCK, 0x191
.equ REGICE, 0x192
.equ REGISTEEL, 0x193
.equ KYOGRE, 0x194
.equ GROUDON, 0x195
.equ RAYQUAZA, 0x196
.equ LATIAS, 0x197
.equ LATIOS, 0x198
.equ JIRACHI, 0x199
.equ DEOXYS, 0x19A
.equ CHIMECHO, 0x19B
.equ EGG, 0x19C
.equ UNOWN_B, 0x19D
.equ UNOWN_C, 0x19E
.equ UNOWN_D, 0x19F
.equ UNOWN_E, 0x1A0
.equ UNOWN_F, 0x1A1
.equ UNOWN_G, 0x1A2
.equ UNOWN_H, 0x1A3
.equ UNOWN_I, 0x1A4
.equ UNOWN_J, 0x1A5
.equ UNOWN_K, 0x1A6
.equ UNOWN_L, 0x1A7
.equ UNOWN_M, 0x1A8
.equ UNOWN_N, 0x1A9
.equ UNOWN_O, 0x1AA
.equ UNOWN_P, 0x1AB
.equ UNOWN_Q, 0x1AC
.equ UNOWN_R, 0x1AD
.equ UNOWN_S, 0x1AE
.equ UNOWN_T, 0x1AF
.equ UNOWN_U, 0x1B0
.equ UNOWN_V, 0x1B1
.equ UNOWN_W, 0x1B2
.equ UNOWN_X, 0x1B3
.equ UNOWN_Y, 0x1B4
.equ UNOWN_Z, 0x1B5
.equ UNOWN_EXCLAMATION, 0x1B6
.equ UNOWN_QUESTION, 0x1B7
.equ TURTWIG, 0x1B8
.equ GROTLE, 0x1B9
.equ TORTERRA, 0x1BA
.equ CHIMCHAR, 0x1BB
.equ MONFERNO, 0x1BC
.equ INFERNAPE, 0x1BD
.equ PIPLUP, 0x1BE
.equ PRINPLUP, 0x1BF
.equ EMPOLEON, 0x1C0
.equ STARLY, 0x1C1
.equ STARAVIA, 0x1C2
.equ STARAPTOR, 0x1C3
.equ BIDOOF, 0x1C4
.equ BIBAREL, 0x1C5
.equ KRICKETOT, 0x1C6
.equ KRICKETUNE, 0x1C7
.equ SHINX, 0x1C8
.equ LUXIO, 0x1C9
.equ LUXRAY, 0x1CA
.equ BUDEW, 0x1CB
.equ ROSERADE, 0x1CC
.equ CRANIDOS, 0x1CD
.equ RAMPARDOS, 0x1CE
.equ SHIELDON, 0x1CF
.equ BASTIODON, 0x1D0
.equ BURMY, 0x1D1
.equ WORMADAM, 0x1D2
.equ MOTHIM, 0x1D3
.equ COMBEE, 0x1D4
.equ VESPIQUEN, 0x1D5
.equ PACHIRISU, 0x1D6
.equ BUIZEL, 0x1D7
.equ FLOATZEL, 0x1D8
.equ CHERUBI, 0x1D9
.equ CHERRIM, 0x1DA
.equ SHELLOS, 0x1DB
.equ GASTRODON, 0x1DC
.equ AMBIPOM, 0x1DD
.equ DRIFLOON, 0x1DE
.equ DRIFBLIM, 0x1DF
.equ BUNEARY, 0x1E0
.equ LOPUNNY, 0x1E1
.equ MISMAGIUS, 0x1E2
.equ HONCHKROW, 0x1E3
.equ GLAMEOW, 0x1E4
.equ PURUGLY, 0x1E5
.equ CHINGLING, 0x1E6
.equ STUNKY, 0x1E7
.equ SKUNTANK, 0x1E8
.equ BRONZOR, 0x1E9
.equ BRONZONG, 0x1EA
.equ BONSLY, 0x1EB
.equ MIME_JR, 0x1EC
.equ HAPPINY, 0x1ED
.equ CHATOT, 0x1EE
.equ SPIRITOMB, 0x1EF
.equ GIBLE, 0x1F0
.equ GABITE, 0x1F1
.equ GARCHOMP, 0x1F2
.equ MUNCHLAX, 0x1F3
.equ RIOLU, 0x1F4
.equ LUCARIO, 0x1F5
.equ HIPPOPOTAS, 0x1F6
.equ HIPPOWDON, 0x1F7
.equ SKORUPI, 0x1F8
.equ DRAPION, 0x1F9
.equ CROAGUNK, 0x1FA
.equ TOXICROAK, 0x1FB
.equ CARNIVINE, 0x1FC
.equ FINNEON, 0x1FD
.equ LUMINEON, 0x1FE
.equ MANTYKE, 0x1FF
.equ SNOVER, 0x200
.equ ABOMASNOW, 0x201
.equ WEAVILE, 0x202
.equ MAGNEZONE, 0x203
.equ LICKILICKY, 0x204
.equ RHYPERIOR, 0x205
.equ TANGROWTH, 0x206
.equ ELECTIVIRE, 0x207
.equ MAGMORTAR, 0x208
.equ TOGEKISS, 0x209
.equ YANMEGA, 0x20A
.equ LEAFEON, 0x20B
.equ GLACEON, 0x20C
.equ GLISCOR, 0x20D
.equ MAMOSWINE, 0x20E
.equ PORYGON_Z, 0x20F
.equ GALLADE, 0x210
.equ PROBOPASS, 0x211
.equ DUSKNOIR, 0x212
.equ FROSLASS, 0x213
.equ ROTOM, 0x214
.equ UXIE, 0x215
.equ MESPRIT, 0x216
.equ AZELF, 0x217
.equ DIALGA, 0x218
.equ PALKIA, 0x219
.equ HEATRAN, 0x21A
.equ REGIGIGAS, 0x21B
.equ GIRATINA, 0x21C
.equ CRESSELIA, 0x21D
.equ PHIONE, 0x21E
.equ MANAPHY, 0x21F
.equ DARKRAI, 0x220
.equ SHAYMIN, 0x221
.equ ARCEUS, 0x222
.equ BURMY_SAND, 0x223
.equ BURMY_TRASH, 0x224
.equ WORMADAM_SAND, 0x225
.equ WORMADAM_THRASH, 0x226
.equ SHELLOS_EAST, 0x227
.equ GASTRODON_EAST, 0x228
.equ ROTOM_HEAT, 0x229
.equ ROTOM_WASH, 0x22A
.equ ROTOM_FROST, 0x22B
.equ ROTOM_FAN, 0x22C
.equ ROTOM_MOW, 0x22D
.equ GIRATINA_ORIGIN, 0x22E
.equ SHAYMIN_SKY, 0x22F
.equ ARCEUS_FIGHT, 0x230
.equ ARCEUS_FLYING, 0x231
.equ ARCEUS_POISON, 0x232
.equ ARCEUS_GROUND, 0x233
.equ ARCEUS_ROCK, 0x234
.equ ARCEUS_BUG, 0x235
.equ ARCEUS_GHOST, 0x236
.equ ARCEUS_STEEL, 0x237
.equ ARCEUS_UNKNOWN, 0x238
.equ ARCEUS_FIRE, 0x239
.equ ARCEUS_WATER, 0x23A
.equ ARCEUS_GRASS, 0x23B
.equ ARCEUS_ELECTRIC, 0x23C
.equ ARCEUS_PSYCHIC, 0x23D
.equ ARCEUS_ICE, 0x23E
.equ ARCEUS_DRAGON, 0x23F
.equ ARCEUS_DARK, 0x240
.equ ARCEUS_FAIRY, 0x241
.equ VICTINI, 0x242
.equ SNIVY, 0x243
.equ SERVINE, 0x244
.equ SERPERIOR, 0x245
.equ TEPIG, 0x246
.equ PIGNITE, 0x247
.equ EMBOAR, 0x248
.equ OSHAWOTT, 0x249
.equ DEWOTT, 0x24A
.equ SAMUROTT, 0x24B
.equ PATRAT, 0x24C
.equ WATCHOG, 0x24D
.equ LILLIPUP, 0x24E
.equ HERDIER, 0x24F
.equ STOUTLAND, 0x250
.equ PURRLOIN, 0x251
.equ LIEPARD, 0x252
.equ PANSAGE, 0x253
.equ SIMISAGE, 0x254
.equ PANSEAR, 0x255
.equ SIMISEAR, 0x256
.equ PANPOUR, 0x257
.equ SIMIPOUR, 0x258
.equ MUNNA, 0x259
.equ MUSHARNA, 0x25A
.equ PIDOVE, 0x25B
.equ TRANQUILL, 0x25C
.equ UNFEZANT, 0x25D
.equ BLITZLE, 0x25E
.equ ZEBSTRIKA, 0x25F
.equ ROGGENROLA, 0x260
.equ BOLDORE, 0x261
.equ GIGALITH, 0x262
.equ WOOBAT, 0x263
.equ SWOOBAT, 0x264
.equ DRILBUR, 0x265
.equ EXCADRILL, 0x266
.equ AUDINO, 0x267
.equ TIMBURR, 0x268
.equ GURDURR, 0x269
.equ CONKELDURR, 0x26A
.equ TYMPOLE, 0x26B
.equ PALPITOAD, 0x26C
.equ SEISMITOAD, 0x26D
.equ THROH, 0x26E
.equ SAWK, 0x26F
.equ SEWADDLE, 0x270
.equ SWADLOON, 0x271
.equ LEAVANNY, 0x272
.equ VENIPEDE, 0x273
.equ WHIRLIPEDE, 0x274
.equ SCOLIPEDE, 0x275
.equ COTTONEE, 0x276
.equ WHIMSICOTT, 0x277
.equ PETILIL, 0x278
.equ LILLIGANT, 0x279
.equ BASCULIN, 0x27A
.equ SANDILE, 0x27B
.equ KROKOROK, 0x27C
.equ KROOKODILE, 0x27D
.equ DARUMAKA, 0x27E
.equ DARMANITAN, 0x27F
.equ MARACTUS, 0x280
.equ DWEBBLE, 0x281
.equ CRUSTLE, 0x282
.equ SCRAGGY, 0x283
.equ SCRAFTY, 0x284
.equ SIGILYPH, 0x285
.equ YAMASK, 0x286
.equ COHAGRIGUS, 0x287
.equ TIRTOUGA, 0x288
.equ CARRACOSTA, 0x289
.equ ARCHEN, 0x28A
.equ ARCHEOPS, 0x28B
.equ TRUBBISH, 0x28C
.equ GARBODOR, 0x28D
.equ ZORUA, 0x28E
.equ ZOROARK, 0x28F
.equ MINCCINO, 0x290
.equ CINCCINO, 0x291
.equ GOTHITA, 0x292
.equ GOTHORITA, 0x293
.equ GOTHITELLE, 0x294
.equ SOLOSIS, 0x295
.equ DUOSION, 0x296
.equ REUNICLUS, 0x297
.equ DUCKLETT, 0x298
.equ SWANNA, 0x299
.equ VANILLITE, 0x29A
.equ VANILLISH, 0x29B
.equ VANILLUXE, 0x29C
.equ DEERLING, 0x29D
.equ SAWSBUCK, 0x29E
.equ EMOLGA, 0x29F
.equ KARRABLAST, 0x2A0
.equ ESCAVALIER, 0x2A1
.equ FOONGUS, 0x2A2
.equ AMOONGUSS, 0x2A3
.equ FRILLISH, 0x2A4
.equ JELLICENT, 0x2A5
.equ ALOMOMOLA, 0x2A6
.equ JOLTIK, 0x2A7
.equ GALVANTULA, 0x2A8
.equ FERROSEED, 0x2A9
.equ FERROTHORN, 0x2AA
.equ KLINK, 0x2AB
.equ KLANG, 0x2AC
.equ KLINKLANG, 0x2AD
.equ TYNAMO, 0x2AE
.equ EELEKTRIK, 0x2AF
.equ EELEKTROSS, 0x2B0
.equ ELGYEM, 0x2B1
.equ BEHEEYEM, 0x2B2
.equ LITWICK, 0x2B3
.equ LAMPENT, 0x2B4
.equ CHANDELURE, 0x2B5
.equ AXEW, 0x2B6
.equ FRAXURE, 0x2B7
.equ HAXORUS, 0x2B8
.equ CUBCHOO, 0x2B9
.equ BEARTIC, 0x2BA
.equ CRYOGONAL, 0x2BB
.equ SHELMET, 0x2BC
.equ ACCELGOR, 0x2BD
.equ STUNFISK, 0x2BE
.equ MIENFOO, 0x2BF
.equ MIENSHAO, 0x2C0
.equ DRUDDIGON, 0x2C1
.equ GOLETT, 0x2C2
.equ GOLURK, 0x2C3
.equ PAWNIARD, 0x2C4
.equ BISHARP, 0x2C5
.equ BOUFFALANT, 0x2C6
.equ RUFFLET, 0x2C7
.equ BRAVIARY, 0x2C8
.equ VULLABY, 0x2C9
.equ MANDIBUZZ, 0x2CA
.equ HEATMOR, 0x2CB
.equ DURANT, 0x2CC
.equ DEINO, 0x2CD
.equ ZWEILOUS, 0x2CE
.equ HYDREIGON, 0x2CF
.equ LARVESTA, 0x2D0
.equ VOLCARONA, 0x2D1
.equ COBALION, 0x2D2
.equ TERRAKION, 0x2D3
.equ VIRIZION, 0x2D4
.equ TORNADUS, 0x2D5
.equ THUNDURUS, 0x2D6
.equ RESHIRAM, 0x2D7
.equ ZEKROM, 0x2D8
.equ LANDORUS, 0x2D9
.equ KYUREM, 0x2DA
.equ KELDEO, 0x2DB
.equ MELOETTA, 0x2DC
.equ GENESECT, 0x2DD
.equ BASCULIN_BLUE, 0x2DE
.equ DARMANITAN_ZEN, 0x2DF
.equ DEERLING_SUMMER, 0x2E0
.equ DEERLING_AUTUMN, 0x2E1
.equ DEERLING_WINTER, 0x2E2
.equ SAWSBUCK_SUMMER, 0x2E3
.equ SAWSBUCK_AUTUMN, 0x2E4
.equ SAWSBUCK_WINTER, 0x2E5
.equ KYUREM_WHITE, 0x2E6
.equ KYUREM_BLACK, 0x2E7
.equ MELOETTA_PIROUETTE, 0x2E8
.equ GENESECT_SHOCK, 0x2E9
.equ GENESECT_BURN, 0x2EA
.equ GENESECT_CHILL, 0x2EB
.equ GENESECT_DOUSE, 0x2EC
.equ TORNADUS_THERIAN, 0x2ED
.equ THUNDURUS_THERIAN, 0x2EE
.equ LANDORUS_THERIAN, 0x2EF
.equ KELDEO_RESOLUTE, 0x2F0
.equ CHESPIN, 0x2F1
.equ QUILLADIN, 0x2F2
.equ CHESNAUGHT, 0x2F3
.equ FENNEKIN, 0x2F4
.equ BRAIXEN, 0x2F5
.equ DELPHOX, 0x2F6
.equ FROAKIE, 0x2F7
.equ FROGADIER, 0x2F8
.equ GRENINJA, 0x2F9
.equ BUNNELBY, 0x2FA
.equ DIGGERSBY, 0x2FB
.equ FLETCHLING, 0x2FC
.equ FLETCHINDER, 0x2FD
.equ TALONFLAME, 0x2FE
.equ SCATTERBUG, 0x2FF
.equ SPEWPA, 0x300
.equ VIVILLON, 0x301
.equ LITLEO, 0x302
.equ PYROAR, 0x303
.equ FLABEBE, 0x304
.equ FLOETTE, 0x305
.equ FLORGES, 0x306
.equ SKIDDO, 0x307
.equ GOGOAT, 0x308
.equ PANCHAM, 0x309
.equ PANGORO, 0x30A
.equ FURFROU, 0x30B
.equ ESPURR, 0x30C
.equ MEOWSTIC, 0x30D
.equ HONEDGE, 0x30E
.equ DOUBLADE, 0x30F
.equ AEGISLASH, 0x310
.equ SPRITZEE, 0x311
.equ AROMATISSE, 0x312
.equ SWIRLIX, 0x313
.equ SLURPUFF, 0x314
.equ INKAY, 0x315
.equ MALAMAR, 0x316
.equ BINACLE, 0x317
.equ BARBARACLE, 0x318
.equ SKRELP, 0x319
.equ DRAGALGE, 0x31A
.equ CLAUNCHER, 0x31B
.equ CLAWITZER, 0x31C
.equ HELIOPTILE, 0x31D
.equ HELIOLISK, 0x31E
.equ TYRUNT, 0x31F
.equ TYRANTRUM, 0x320
.equ AMAURA, 0x321
.equ AURORUS, 0x322
.equ SYLVEON, 0x323
.equ HAWLUCHA, 0x324
.equ DEDENNE, 0x325
.equ CARBINK, 0x326
.equ GOOMY, 0x327
.equ SLIGGOO, 0x328
.equ GOODRA, 0x329
.equ KLEFKI, 0x32A
.equ PHANTUMP, 0x32B
.equ TREVENANT, 0x32C
.equ PUMPKABOO, 0x32D
.equ GOURGEIST, 0x32E
.equ BERGMITE, 0x32F
.equ AVALUGG, 0x330
.equ NOIBAT, 0x331
.equ NOIVERN, 0x332
.equ XERNEAS, 0x333
.equ YVELTAL, 0x334
.equ ZYGARDE, 0x335
.equ DIANCIE, 0x336
.equ HOOPA, 0x337
.equ VOLCANION, 0x338
.equ PYROAR_FEMALE, 0x339
.equ FLABEBE_WHITE, 0x33A
.equ FLABEBE_YELLOW, 0x33B
.equ FLABEBE_ORANGE, 0x33C
.equ FLABEBE_BLUE, 0x33D
.equ FLOETTE_WHITE, 0x33E
.equ FLOETTE_YELLOW, 0x33F
.equ FLOETTE_ORANGE, 0x340
.equ FLOETTE_BLUE, 0x341
.equ FLORGES_WHITE, 0x342
.equ FLORGES_YELLOW, 0x343
.equ FLORGES_ORANGE, 0x344
.equ FLORGES_BLUE, 0x345
.equ MEOWSTIC_FEMALE, 0x346
.equ AEGISLASH_BLADE, 0x347
.equ PUMPKABOO_2, 0x348
.equ PUMPKABOO_3, 0x349
.equ PUMPKABOO_4, 0x34A
.equ GOURGEIST_2, 0x34B
.equ GOURGEIST_3, 0x34C
.equ GOURGEIST_4, 0x34D
.equ HOOPA_UNBOUND, 0x34E
.equ VENUSAUR_MEGA, 0x34F
.equ CHARIZARD_MEGAX, 0x350
.equ CHARIZARD_MEGAY, 0x351
.equ BLASTOISE_MEGA, 0x352
.equ BEEDRILL_MEGA, 0x353
.equ PIDGEOT_MEGA, 0x354
.equ ALAKAZAM_MEGA, 0x355
.equ SLOWBRO_MEGA, 0x356
.equ GENGAR_MEGA, 0x357
.equ KANGASKHAN_MEGA, 0x358
.equ PINSIR_MEGA, 0x359
.equ GYARADOS_MEGA, 0x35A
.equ AERODACTYL_MEGA, 0x35B
.equ MEWTWO_MEGAX, 0x35C
.equ MEWTWO_MEGAY, 0x35D
.equ AMPHAROS_MEGA, 0x35E
.equ STEELIX_MEGA, 0x35F
.equ SCIZOR_MEGA, 0x360
.equ HERACROSS_MEGA, 0x361
.equ HOUNDOOM_MEGA, 0x362
.equ TYRANITAR_MEGA, 0x363
.equ SCEPTILE_MEGA, 0x364
.equ BLAZIKEN_MEGA, 0x365
.equ SWAMPERT_MEGA, 0x366
.equ GARDEVOIR_MEGA, 0x367
.equ SABLEYE_MEGA, 0x368
.equ MAWILE_MEGA, 0x369
.equ AGGRON_MEGA, 0x36A
.equ MEDICHAM_MEGA, 0x36B
.equ MANECTRIC_MEGA, 0x36C
.equ SHARPEDO_MEGA, 0x36D
.equ CAMERUPT_MEGA, 0x36E
.equ ALTARIA_MEGA, 0x36F
.equ BANETTE_MEGA, 0x370
.equ ABSOL_MEGA, 0x371
.equ GLALIE_MEGA, 0x372
.equ SALAMENCE_MEGA, 0x373
.equ METAGROSS_MEGA, 0x374
.equ NOPE, 0x375 @Dunno why but maybe a new Latias out from the Soul Dew routine
.equ NOPE, 0x376 @Dunno why but maybe a new Latios out from the Soul Dew routine
.equ LATIAS_MEGA, 0x377
.equ LATIOS_MEGA, 0x378
.equ RAYQUAZA_MEGA, 0x379
.equ LOPUNNY_MEGA, 0x37A
.equ GARCHOMP_MEGA, 0x37B
.equ LUCARIO_MEGA, 0x37C
.equ ABOMASNOW_MEGA, 0x37D
.equ GALLADE_MEGA, 0x37E
.equ AUDINO_MEGA, 0x37F
.equ DIANCIE_MEGA, 0x380
.equ DEOXYS_NORMAL, 0x381 @Renewal of Deoxys' index
.equ DEOXYS_ATTACK, 0x382 @Renewal of Deoxys' index
.equ DEOXYS_DEFENSE, 0x383 @Renewal of Deoxys' index
.equ DEXOYS_SPEED, 0x384 @Renewal of Deoxys' index
.equ NOPE, 0x385 @Generation VII Pokemon starts here

.org 0x43F90, 0xFF
ldr r1, Hook3
bx r1
.align 2
Hook3: .word RomAreaOffset+dex_seeable_mon_hook+1

.org 0x88EDC, 0xFF
ldr r1, Hook6
bx r1
.align 2
Hook6: .word RomAreaOffset+dex_regional_count_hook+1

.org 0xCE91A, 0xFF
ldr r1, Hook4
bx r1
.align 2
Hook4: .word RomAreaOffset+dex_evolution_fix_hook+1

.org 0x10352C, 0xFF
ldr r1, Hook7
bx r1
.align 2
Hook7: .word RomAreaOffset+dex_display_hook+1

.org 0x10356C, 0xFF
ldr r0, Hook8
bx r0
.align 2
Hook8: .word RomAreaOffset+regional_dex_hook+1

.org 0x1035B4, 0xFF
ldr r1, Hook9
bx r1
.align 2
Hook9: .word RomAreaOffset+store_last_dex_seen_hook+1

.org 0x1035F4, 0xFF
ldr r0, HookA
bx r0
.align 2
HookA: .word RomAreaOffset+lazy_regional_dex_end_hook+1

.org 0x104A66, 0xFF
ldr r1, HookB
bx r1
.align 2
HookB: .word RomAreaOffset+display_regional_num_hook+1

.org 0x104BBC, 0xFF
ldr r2, Hook5
bx r2
.align 2
Hook5: .word RomAreaOffset+dex_display_counts_hook+1

.org 0x106810, 0xFF
ldr r1, Hook2
bx r1
.align 2
Hook2: .word RomAreaOffset+habitat_dex_regional_limit_hook+1

.org 0x106B84, 0xFF
ldr r1, Hook1
bx r1
.align 2
Hook1: .word RomAreaOffset+data_on_capture_hook+1

.org MyLoc, 0xFF
data_on_capture_hook:        @0x08106B84 via r1
        bl species_to_regional_dex_number
        cmp r0, #0x0
        bne capture_display_return
        ldr r0, add_task_no_capture_display
        bx r0

capture_display_return:
        ldr r0, add_task_capture_display
        bx r0

.align 2
.pool

.align 2

habitat_dex_regional_limit_hook:        @0x08106810 via r1
        push {r4, lr}
        mov r4, r0
        bl haz_national_dex_bool
        cmp r0, #0x1
        beq habitat_dex_regional_limit_return        @valid
        mov r0, r4
        bl species_to_regional_dex_number
        cmp r0, #0x0
        beq habitat_dex_regional_limit_return        @not in regional dex, return 0
        mov r0, #0x1

habitat_dex_regional_limit_return:
        pop {r4}
        pop {r1}
        bx r1

.align 2
.pool

.align 2

dex_seeable_mon_hook:        @0x08043F90 via r1
        push {r4, lr}
        mov r4, r0
        bl haz_national_dex_bool
        cmp r0, #0x0
        beq only_regional_numbered
@national
        mov r0, r4
        bl species_to_national_dex_number_1
        b dex_seeable_mon_check_valid_species

only_regional_numbered:
        mov r0, r4
        bl species_to_regional_dex_number

dex_seeable_mon_check_valid_species:
        cmp r0, #0x0
        bne dex_seeable_mon_return
        ldr r0, full_halfword

dex_seeable_mon_return:
        pop {r4}
        pop {r1}
        bx r1
.align
full_halfword:        .word 0xFFFF

.align 2
.pool

.align 2

dex_evolution_fix_hook:        @0x080CE91A via r1
        bl species_to_regional_dex_number
        cmp r0, #0x0        @not in regional dex, invalid
        beq dex_evolution_failure
        ldr r0, dex_evolution_success_return
        bx r0

dex_evolution_failure:
        mov r0, #0x11
        strh r0, [r5, #0x8]
        mov r2, #0x1
        ldr r1, dex_evolution_failure_return
        bx r1

.align 2
.pool

.align 2

dex_display_counts_hook:        @0x08104BBC via r2
        @r0: mode
        push {lr}
        cmp r1, #0x0
        beq call_regional_count
        bl national_pokedex_count
        b dex_display_counts_return

call_regional_count:
        bl dex_regional_count_hook

dex_display_counts_return:
        pop {pc}

.align 2
.pool

.align 2

dex_regional_count_hook:        @0x08088EDC via r1
        push {r4-r6, lr}
        mov r6, r0        @mode
        mov r4, #0x1        @loop
        mov r5, #0x0        @counter

dex_regional_count_loop:
        lsl r0, r4, #0x1        @loop times 2
        adr r1, regional_dex_order
        ldrh r0, [r1, r0]        @req species
        mov r1, r6        @mode
        mov r2, #0x1        @input is SPECIES
        bl dex_flag_check
        add r5, r5, r0
        add r4, #0x1
        ldr r0, regional_dex_limit
        cmp r4, r0
        blo dex_regional_count_loop
        mov r0, r5
        pop {r4-r6, pc}

.align 2
.pool

.align 2

dex_display_hook:        @0x0810352C via r1
        ldr r1, regional_dex_limit
        cmp r0, #0x0
        beq store_dex_limit_and_return
        ldr r1, national_dex_limit

store_dex_limit_and_return:
        str r1, [sp, #0x0]
        ldr r0, regional_dex_limit_return
        bx r0

.align 2
.pool

.align 2

regional_dex_hook:        @0x0810356C via r0
        mov r4, r8
        add r4, #0x1
        lsl r0, r4, #0x1        @index times 2
        adr r1, regional_dex_order
        ldrh r0, [r1, r0]
        bl species_to_national_dex_number_1
        mov r5, r0
        mov r1, #0x0
        ldr r2, regional_dex_hook_return
        bx r2

.align 2
.pool

.align 2

store_last_dex_seen_hook:        @0x081035B4 via r1
        str r0, [r2]
        mov r10, r4
        mov r4, r3
        ldr r0, def_store_string_dex_number
        bx r0

.align 2
.pool

.align 2

lazy_regional_dex_end_hook:        @0x081035F4 via r0
        mov r0, r8
        ldr r1, regional_dex_limit
        cmp r0, r1
        blo regional_dex_hook
        ldr r0, end_dex_display_return
        bx r0

.align 2
.pool

.align 2

display_regional_num_hook:        @0x08104A66 via r1
        mov r5, r0        @save species
        bl haz_national_dex_bool
        cmp r0, #0x0
        beq use_regional_dex_ordering
        ldr r1, dex_malloc_ptr
        ldr r1, [r1]
        add r1, #0x42
        ldrb r1, [r1]
        cmp r1, #0x0        @check if looking at regional dex
        beq use_regional_dex_ordering
        mov r0, r5
        bl species_to_national_dex_number_1
        b display_dex_number_return

use_regional_dex_ordering:
        mov r0, r5
        bl species_to_regional_dex_number       

display_dex_number_return:
        mov r5, r0
        ldr r0, dex_number_display_return
        bx r0

species_to_regional_dex_number:
        adr r3, regional_dex_order
        mov r2, r0        @req species
        mov r0, #0x0        @loop counter
find_regional_number_loop:
        lsl r1, r0, #0x1
        ldrh r1, [r3, r1]
        cmp r1, r2
        beq species_to_regional_dex_return
        add r0, #0x1
        ldr r1, regional_dex_limit
        cmp r0, r1
        bls find_regional_number_loop
        mov r0, #0x0        @not in dex: set number to 0
species_to_regional_dex_return:
        bx lr

species_to_national_dex_number_1:
        ldr r1, f_species_to_nat_dex
        bx r1
.align
f_species_to_nat_dex:        .word 0x08043298 + 1

haz_national_dex_bool:
        ldr r0, f_haz_national_check
        bx r0
.align
f_haz_national_check:        .word 0x0806E25C + 1

dex_flag_check:
        ldr r3, f_dex_flag_check
        bx r3
.align
f_dex_flag_check:        .word 0x08104AB0 + 1

national_pokedex_count:
        ldr r1, f_national_pokedex_count
        bx r1
.align
f_national_pokedex_count:        .word 0x08088E8C + 1

.align
add_task_no_capture_display:        .word 0x08106B90 + 1
add_task_capture_display:        .word 0x08106BA4 + 1
dex_evolution_success_return:        .word 0x080CE948 + 1
dex_evolution_failure_return:        .word 0x080CE924 + 1
regional_dex_limit:        .word number_of_mons_in_regional_dex
national_dex_limit:        .word number_of_mons_in_national_dex
regional_dex_limit_return:        .word 0x0810353a + 1
regional_dex_hook_return:        .word 0x08103578 + 1
def_store_string_dex_number:        .word 0x081035D6 + 1
end_dex_display_return:        .word 0x08103906 + 1
dex_malloc_ptr:                        .word 0x0203ACF0
dex_number_display_return:        .word 0x08104A70 + 1

regional_dex_order:
.hword        0x0000
.hword        TREECKO
.hword        GROVYLE
.hword        SCEPTILE
.hword        TORCHIC
.hword        COMBUSKEN
.hword        BLAZIKEN
.hword        MUDKIP
.hword        MARSHTOMP
.hword        SWAMPERT
.hword        POOCHYENA
.hword        MIGHTYENA
.hword        ZIGZAGOON
.hword        LINOONE
.hword        WURMPLE
.hword        SILCOON
.hword        BEAUTIFLY
.hword        CASCOON
.hword        DUSTOX
.hword        LOTAD
.hword        LOMBRE
.hword        LUDICOLO
.hword        SEEDOT
.hword        NUZLEAF
.hword        SHIFTRY
.hword        TAILLOW
.hword        SWELLOW
.hword        WINGULL
.hword        PELIPPER
.hword        RALTS
.hword        KIRLIA
.hword        GARDEVOIR
.hword        SURSKIT
.hword        MASQUERAIN
.hword        SHROOMISH
.hword        BRELOOM
.hword        SLAKOTH
.hword        VIGOROTH
.hword        SLAKING
.hword        ABRA
.hword        KADABRA
.hword        ALAKAZAM
.hword        NINCADA
.hword        NINJASK
.hword        SHEDINJA
.hword        WHISMUR
.hword        LOUDRED
.hword        EXPLOUD
.hword        MAKUHITA
.hword        HARIYAMA
.hword        GOLDEEN
.hword        SEAKING
.hword        MAGIKARP
.hword        GYARADOS
.hword        AZURILL
.hword        MARILL
.hword        AZUMARILL
.hword        GEODUDE
.hword        GRAVELER
.hword        GOLEM
.hword        NOSEPASS
.hword        SKITTY
.hword        DELCATTY
.hword        ZUBAT
.hword        GOLBAT
.hword        CROBAT
.hword        TENTACOOL
.hword        TENTACRUEL
.hword        SABLEYE
.hword        MAWILE
.hword        ARON
.hword        LAIRON
.hword        AGGRON
.hword        MACHOP
.hword        MACHOKE
.hword        MACHAMP
.hword        MEDITITE
.hword        MEDICHAM
.hword        ELECTRIKE
.hword        MANECTRIC
.hword        PLUSLE
.hword        MINUN
.hword        MAGNEMITE
.hword        MAGNETON
.hword        VOLTORB
.hword        ELECTRODE
.hword        VOLBEAT
.hword        ILLUMISE
.hword        ODDISH
.hword        GLOOM
.hword        VILEPLUME
.hword        BELLOSSOM
.hword        DODUO
.hword        DODRIO
.hword        ROSELIA
.hword        GULPIN
.hword        SWALOT
.hword        CARVANHA
.hword        SHARPEDO
.hword        WAILMER
.hword        WAILORD
.hword        NUMEL
.hword        CAMERUPT
.hword        SLUGMA
.hword        MAGCARGO
.hword        TORKOAL
.hword        GRIMER
.hword        MUK
.hword        KOFFING
.hword        WEEZING
.hword        SPOINK
.hword        GRUMPIG
.hword        SANDSHREW
.hword        SANDSLASH
.hword        SPINDA
.hword        SKARMORY
.hword        TRAPINCH
.hword        VIBRAVA
.hword        FLYGON
.hword        CACNEA
.hword        CACTURNE
.hword        SWABLU
.hword        ALTARIA
.hword        ZANGOOSE
.hword        SEVIPER
.hword        LUNATONE
.hword        SOLROCK
.hword        BARBOACH
.hword        WHISCASH
.hword        CORPHISH
.hword        CRAWDAUNT
.hword        BALTOY
.hword        CLAYDOL
.hword        LILEEP
.hword        CRADILY
.hword        ANORITH
.hword        ARMALDO
.hword        IGGLYBUFF
.hword        JIGGLYPUFF
.hword        WIGGLYTUFF
.hword        FEEBAS
.hword        MILOTIC
.hword        CASTFORM
.hword        STARYU
.hword        STARMIE
.hword        KECLEON
.hword        SHUPPET
.hword        BANETTE
.hword        DUSKULL
.hword        DUSCLOPS
.hword        TROPIUS
.hword        CHIMECHO
.hword        ABSOL
.hword        VULPIX
.hword        NINETALES
.hword        PICHU
.hword        PIKACHU
.hword        RAICHU
.hword        PSYDUCK
.hword        GOLDUCK
.hword        WYNAUT
.hword        WOBBUFFET
.hword        NATU
.hword        XATU
.hword        GIRAFARIG
.hword        PHANPY
.hword        DONPHAN
.hword        PINSIR
.hword        HERACROSS
.hword        RHYHORN
.hword        RHYDON
.hword        SNORUNT
.hword        GLALIE
.hword        SPHEAL
.hword        SEALEO
.hword        WALREIN
.hword        CLAMPERL
.hword        HUNTAIL
.hword        GOREBYSS
.hword        RELICANTH
.hword        CORSOLA
.hword        CHINCHOU
.hword        LANTURN
.hword        LUVDISC
.hword        HORSEA
.hword        SEADRA
.hword        KINGDRA
.hword        BAGON
.hword        SHELGON
.hword        SALAMENCE
.hword        BELDUM
.hword        METANG
.hword        METAGROSS
.hword        REGIROCK
.hword        REGICE
.hword        REGISTEEL
.hword        LATIAS
.hword        LATIOS
.hword        KYOGRE
.hword        GROUDON
.hword        RAYQUAZA
.hword        JIRACHI
.hword        DEOXYS



hello... it was indeeed a nice recoding of yours...

I have questions though, does the byte on the equ. part is the actual index number of that Pokémon or that is what can be seen in National Dex. I have, however, made the arrangement that all mons first and the the forms will be the last slot.. by doing that, do I have to edit the index and replace it with the corresponding pokemon index?

Also, does it support forms now? Liké Flabebe but they will share the same index number.

EDIT: I have tried to compile all these to my THUMB Assembler but I got no luck because the code is too many that the compiler can't manage to assemble lol. Is there anyway I can compile it? I tried CMD and what I always get is error... tried piece-by-piece assembly but still the compiler can't process it.

Spherical Ice May 21st, 2018 10:40 AM

Quote:

Originally Posted by Neon Skylar (Post 9879263)
1.- Copy and paste the routine in a text editor.

2- On the line where it says ".equ offset, 0x" I put the address (in my case it is B00000)

3.- I keep the routine and name it as .asm (in my case, Dex.asm)

4.- I go to the thumb folder and I put my Dex.asm to Dex.bin

5.- Then I open with HxD a clean rom and the Dex.bin

.....

Until this step can I understand .. what should I do now? explain me with a little more detail and I hope I do not bother much ...

Open your ROM (not a clean one, the one you actually want to insert it into) and Dex.bin in HxD.

Go to 0x10611E in both Dex.bin and your ROM, copy the bytes from Dex.bin, and paste them in your ROM.
Go to 0x106370 in both Dex.bin and your ROM, copy the bytes from Dex.bin, and paste them in your ROM.
Go to 0x106530 in both Dex.bin and your ROM, copy the bytes from Dex.bin, and paste them in your ROM.
Go to 0x452200 in both Dex.bin and your ROM, copy the bytes from Dex.bin, and paste them in your ROM.
Go to the address you put next to .equ offset, 0xB00000. in both Dex.bin and your ROM, copy the bytes from Dex.bin, and paste them in your ROM.
Save your ROM.

Neon Skylar May 21st, 2018 12:37 PM

Quote:

Originally Posted by Spherical Ice (Post 9879380)
Open your ROM (not a clean one, the one you actually want to insert it into) and Dex.bin in HxD.

Go to 0x10611E in both Dex.bin and your ROM, copy the bytes from Dex.bin, and paste them in your ROM.
Go to 0x106370 in both Dex.bin and your ROM, copy the bytes from Dex.bin, and paste them in your ROM.
Go to 0x106530 in both Dex.bin and your ROM, copy the bytes from Dex.bin, and paste them in your ROM.
Go to 0x452200 in both Dex.bin and your ROM, copy the bytes from Dex.bin, and paste them in your ROM.
Go to the address you put next to .equ offset, 0xB00000. in both Dex.bin and your ROM, copy the bytes from Dex.bin, and paste them in your ROM.
Save your ROM.

Muchaaaaas Gracias Hermano :D it worked perfectly

Dr. Seuss May 21st, 2018 1:40 PM

I have a request. i'm not sure if that is possible or if it was already created, but. Is there a way to create a custom giveegg? I mean, I'd like to create an event that gives the player a Pokemon egg. and that egg will hatch with an specific shiny rate and custom moves. Like the Odd Egg you receive in GSC from the Day-care man that hatches knowing Dizzy Punch.

Diego98 May 22nd, 2018 2:54 AM

I have a request that I'm pretty sure it's possible. I want a routine that modify the giveitem command (or something similar) in order to give the specified amount in a var of certain item. Example: The var 0x8000 is set to 3, then execute the giveitem command and it gives 3 items.

Spherical Ice May 22nd, 2018 4:49 AM

Quote:

Originally Posted by Diego98 (Post 9879570)
I have a request that I'm pretty sure it's possible. I want a routine that modify the giveitem command (or something similar) in order to give the specified amount in a var of certain item. Example: The var 0x8000 is set to 3, then execute the giveitem command and it gives 3 items.

I'm fairly certain the giveitem command lets you do this already, certainly just additem should. Just use the variable number in place of the value.

So for example:

Code:

setvar 0x8004 0xA
giveitem ITEM_POTION 0x8004 MSG_OBTAIN


would give you 10 Potions.

pikachux2 May 28th, 2018 12:45 PM

Quote:

Originally Posted by Spherical Ice (Post 9879597)
I'm fairly certain the giveitem command lets you do this already, certainly just additem should. Just use the variable number in place of the value.

So for example:

Code:

setvar 0x8004 0xA
giveitem ITEM_POTION 0x8004 MSG_OBTAIN


would give you 10 Potions.

I'm not sure about the giveitem command... However the givemoney command does have this problem in which you cannot give a variable as the value. The game takes the value of the variable number not what the variable itself is pointing to. This is a problem for me also, and I was wondering if it is a problem ASM can solve.

ghoulslash May 31st, 2018 9:51 AM

I've been a bit on and off with rom hacking, but here's something I threw together recently:

Expanding Number of Buffers [FR]
Background info for those who are curious:
Spoiler:

The fdecoder function loads a ram or rom address from a table based on the byte following 0xFD in the string to display. There are 13 entries to this table (located at 0x08231e70) corresponding to buffers 00 through 0D. Buffer00 loads from 0x02022100, buffer01 loads the player name, buffers02-04 are the typical buffers used in scripts (eg. buffernumber), buffer06 is the rivlal's name, and buffers07 through buffer0D load a fixed string which hold useless names for ruby and sapphire (AQUA, MAGMA, etc).

This routine overwrites buffer07 through buffer0D, as they contain pointers to fixed strings corresponding to names in ruby and sapphire. This same feature could be achieved with a simple bufferstring, not that team aqua or magma show up in Fire Red anyways.

The following routine replaces the buffer table entries to store to/load from custom RAM, allowing the expanded usage of buffernumber, bufferstring, etc. You can also use ASM to buffer your own hex characters, but make sure the RAM ends with a 0xFF or else the game will load characters until it finds a 0xFF in the ram.

This hack requires the JPANs save block hack (I suppose you could use other free RAM outside of the save block area if you don't mind losing buffered values between saves)

It allows for up to 7 more buffer locations. Currently, there are 3 buffers of 4 bytes each and 4 buffers of 16 bytes each for numbers and strings, respectively. Feel free to change them, I tried to make the assembly routine easy to edit to accommodate various ram blocks. You can certainly buffer more than 4 characters into one of the 4-byte buffers, but it will overwrite anything else you have buffered afterwards. If you want to change the number of 4 vs. 16 byte buffers, just be sure to change the SetX+Y values appropriately.

Each script buffer command loads a table of buffer RAM pointers for buffers02-04, each from separate locations, obnoxiously enough. Just be sure to copy the data from the compiled routine into your ROM at each script section.

Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func
.global ExpandedBuffers

.equ Offset, 0xYYYYYY      @ where function will be inserted into ROM (no 0x08 in front!)
.equ Set1, 0x0203c000        @ first block of RAM, 3 sets of 4 bytes each (12 bytes)
.equ Set2, 0x0203C00c        @ second block of RAM, 4 sets of 16 bytes each (64 bytes)

.equ ROM, 0x08000000

.org 0x6bcc0                        @ bufferpokemon
.word RAMTable+ROM

.org 0x6bd08                        @ bufferfirstpokemon
.word RAMTable+ROM

.org 0x6bd54                        @ bufferpartypokemon
.word RAMTable+ROM

.org 0x6bd8c                        @ bufferitem
.word RAMTable+ROM

.org 0x6be88                        @ bufferattack
.word RAMTable+ROM

.org 0x6bed0                        @ buffernumber
.word RAMTable+ROM

.org 0x6bf0c                        @ bufferstd
.word RAMTable+ROM

.org 0x6bf38                        @ bufferstring
.word RAMTable+ROM

.org 0x231e8c
.word Offset+1+ROM
.word Start08+1+ROM
.word Start09+1+ROM
.word Start0A+1+ROM
.word Start0B+1+ROM
.word Start0C+1+ROM
.word Start0D+1+ROM

.org Offset
Start07:
        ldr r0, =(Set1)        @4 byte buffer
        b Return

Start08:
        ldr r0, =(Set1 +4)        @4byte buffer
        b Return

Start09:
        ldr r0, =(Set1 +8)        @4byte buffer
        b Return

Start0A:
        ldr r0, =(Set2)        @16 byte buffer
        b Return

Start0B:
        ldr r0, =(Set2 +16)        @16byte buffer
        b Return

Start0C:
        ldr r0, =(Set2 +32)        @16byte buffer
        b Return

Start0D:
        ldr r0, =(Set2 +48)        @16 byte buffer

Return:
        bx lr

RAMTable:
.word 0x02021cd0        @FD 02 = buffer0
.word 0x02021cf0
.word 0x02021d04
.word 0x00000000
.word 0x00000000
.word Set1                        @FD 07 = buffer 0x5 in XSE
.word Set1+4
.word Set1+8
.word Set2
.word Set2+16
.word Set2+32
.word Set2+48

.align 2




I tested a few of them but not all, so please let me know if there are any bugs.

UltimaSoul June 1st, 2018 9:19 AM

Quote:

Originally Posted by Xencleamas (Post 9821663)
I have modified and enhanced azurile13's (credits and kudos to him) routine to make this supported on the Compiler's THUMB.bat. These are the things I modified:
  • Added routines creating the hooks that are to be copy-pasted on their respective locations. There are 11 hooks.
  • Added the master location of the routine in which the hooks will create locations for those routines. Insert your free space on .equ MyLoc. Format: 0x###### (Hexadecimal Number)
  • Created and added a new index list of Pokémon up to Generation VI including the formes in style of KDS/Chacha Dinosaur from the filenames of MrDollSteak's sprites in his Sugimori and Gen VI threads. I think there is no master index list for Generation VII. If there is, please PM me and I will add those.
  • With the list created as stated above, you will just have to create your own Regional Pokédex by copy-pasting from your Excel and Notepad file to below "regional_dex_order" and .hword 0x0000 should be first in the list. Make sure the names are all CAPS-LOCKED. In case of Nidorans, Farfetch'd, Mr. Mime, Ho-Oh, Mime Jr., Porygon-Z, and Flabébé, their characters are changed so you'll have to look for them in the master list. NOTE: Cohagrigus have been filtered out and changed into asterisks (*). Remember to correct its name before generating the binary file otherwise the .asm file won't work.

Custom Regional Pokédex for FireRed:
Spoiler:
Code:

.thumb
.align

.equ number_of_mons_in_regional_dex, 202 @or however long you wanted your regional dex to be
.equ number_of_mons_in_national_dex, 386
.equ MyLoc, 0x888888 @insert your location here
.equ RomAreaOffset,        0x8000000

@Kanto

.equ UNKNOWN, 0x0
.equ BULBASAUR, 0x1
.equ IVYSAUR, 0x2
.equ VENUSAUR, 0x3
.equ CHARMANDER, 0x4
.equ CHARMELEON, 0x5
.equ CHARIZARD, 0x6
.equ SQUIRTLE, 0x7
.equ WARTORTLE, 0x8
.equ BLASTOISE, 0x9
.equ CATERPIE, 0xA
.equ METAPOD, 0xB
.equ BUTTERFREE, 0xC
.equ WEEDLE, 0xD
.equ KAKUNA, 0xE
.equ BEEDRILL, 0xF
.equ PIDGEY, 0x10
.equ PIDGEOTTO, 0x11
.equ PIDGEOT, 0x12
.equ RATTATA, 0x13
.equ RATICATE, 0x14
.equ SPEAROW, 0x15
.equ FEAROW, 0x16
.equ EKANS, 0x17
.equ ARBOK, 0x18
.equ PIKACHU, 0x19
.equ RAICHU, 0x1A
.equ SANDSHREW, 0x1B
.equ SANDSLASH, 0x1C
.equ NIDORAN_F, 0x1D
.equ NIDORINA, 0x1E
.equ NIDOQUEEN, 0x1F
.equ NIDORAN_M, 0x20
.equ NIDORINO, 0x21
.equ NIDOKING, 0x22
.equ CLEFAIRY, 0x23
.equ CLEFABLE, 0x24
.equ VULPIX, 0x25
.equ NINETALES, 0x26
.equ JIGGLYPUFF, 0x27
.equ WIGGLYTUFF, 0x28
.equ ZUBAT, 0x29
.equ GOLBAT, 0x2A
.equ ODDISH, 0x2B
.equ GLOOM, 0x2C
.equ VILEPLUME, 0x2D
.equ PARAS, 0x2E
.equ PARASECT, 0x2F
.equ VENONAT, 0x30
.equ VENOMOTH, 0x31
.equ DIGLETT, 0x32
.equ DUGTRIO, 0x33
.equ MEOWTH, 0x34
.equ PERSIAN, 0x35
.equ PSYDUCK, 0x36
.equ GOLDUCK, 0x37
.equ MANKEY, 0x38
.equ PRIMEAPE, 0x39
.equ GROWLITHE, 0x3A
.equ ARCANINE, 0x3B
.equ POLIWAG, 0x3C
.equ POLIWHIRL, 0x3D
.equ POLIWRATH, 0x3E
.equ ABRA, 0x3F
.equ KADABRA, 0x40
.equ ALAKAZAM, 0x41
.equ MACHOP, 0x42
.equ MACHOKE, 0x43
.equ MACHAMP, 0x44
.equ BELLSPROUT, 0x45
.equ WEEPINBELL, 0x46
.equ VICTREEBEL, 0x47
.equ TENTACOOL, 0x48
.equ TENTACRUEL, 0x49
.equ GEODUDE, 0x4A
.equ GRAVELER, 0x4B
.equ GOLEM, 0x4C
.equ PONYTA, 0x4D
.equ RAPIDASH, 0x4E
.equ SLOWPOKE, 0x4F
.equ SLOWBRO, 0x50
.equ MAGNEMITE, 0x51
.equ MAGNETON, 0x52
.equ FARFETCH_D, 0x53
.equ DODUO, 0x54
.equ DODRIO, 0x55
.equ SEEL, 0x56
.equ DEWGONG, 0x57
.equ GRIMER, 0x58
.equ MUK, 0x59
.equ SHELLDER, 0x5A
.equ CLOYSTER, 0x5B
.equ GASTLY, 0x5C
.equ HAUNTER, 0x5D
.equ GENGAR, 0x5E
.equ ONIX, 0x5F
.equ DROWZEE, 0x60
.equ HYPNO, 0x61
.equ KRABBY, 0x62
.equ KINGLER, 0x63
.equ VOLTORB, 0x64
.equ ELECTRODE, 0x65
.equ EXEGGCUTE, 0x66
.equ EXEGGUTOR, 0x67
.equ CUBONE, 0x68
.equ MAROWAK, 0x69
.equ HITMONLEE, 0x6A
.equ HITMONCHAN, 0x6B
.equ LICKITUNG, 0x6C
.equ KOFFING, 0x6D
.equ WEEZING, 0x6E
.equ RHYHORN, 0x6F
.equ RHYDON, 0x70
.equ CHANSEY, 0x71
.equ TANGELA, 0x72
.equ KANGASKHAN, 0x73
.equ HORSEA, 0x74
.equ SEADRA, 0x75
.equ GOLDEEN, 0x76
.equ SEAKING, 0x77
.equ STARYU, 0x78
.equ STARMIE, 0x79
.equ MR_MIME, 0x7A
.equ SCYTHER, 0x7B
.equ JYNX, 0x7C
.equ ELECTABUZZ, 0x7D
.equ MAGMAR, 0x7E
.equ PINSIR, 0x7F
.equ TAUROS, 0x80
.equ MAGIKARP, 0x81
.equ GYARADOS, 0x82
.equ LAPRAS, 0x83
.equ DITTO, 0x84
.equ EEVEE, 0x85
.equ VAPOREON, 0x86
.equ JOLTEON, 0x87
.equ FLAREON, 0x88
.equ PORYGON, 0x89
.equ OMANYTE, 0x8A
.equ OMASTAR, 0x8B
.equ KABUTO, 0x8C
.equ KABUTOPS, 0x8D
.equ AERODACTYL, 0x8E
.equ SNORLAX, 0x8F
.equ ARTICUNO, 0x90
.equ ZAPDOS, 0x91
.equ MOLTRES, 0x92
.equ DRATINI, 0x93
.equ DRAGONAIR, 0x94
.equ DRAGONITE, 0x95
.equ MEWTWO, 0x96
.equ MEW, 0x97
.equ CHIKORITA, 0x98
.equ BAYLEEF, 0x99
.equ MEGANIUM, 0x9A
.equ CYNDAQUIL, 0x9B
.equ QUILAVA, 0x9C
.equ TYPHLOSION, 0x9D
.equ TOTODILE, 0x9E
.equ CROCONAW, 0x9F
.equ FERALIGATR, 0xA0
.equ SENTRET, 0xA1
.equ FURRET, 0xA2
.equ HOOTHOOT, 0xA3
.equ NOCTOWL, 0xA4
.equ LEDYBA, 0xA5
.equ LEDIAN, 0xA6
.equ SPINARAK, 0xA7
.equ ARIADOS, 0xA8
.equ CROBAT, 0xA9
.equ CHINCHOU, 0xAA
.equ LANTURN, 0xAB
.equ PICHU, 0xAC
.equ CLEFFA, 0xAD
.equ IGGLYBUFF, 0xAE
.equ TOGEPI, 0xAF
.equ TOGETIC, 0xB0
.equ NATU, 0xB1
.equ XATU, 0xB2
.equ MAREEP, 0xB3
.equ FLAAFFY, 0xB4
.equ AMPHAROS, 0xB5
.equ BELLOSSOM, 0xB6
.equ MARILL, 0xB7
.equ AZUMARILL, 0xB8
.equ SUDOWOODO, 0xB9
.equ POLITOED, 0xBA
.equ HOPPIP, 0xBB
.equ SKIPLOOM, 0xBC
.equ JUMPLUFF, 0xBD
.equ AIPOM, 0xBE
.equ SUNKERN, 0xBF
.equ SUNFLORA, 0xC0
.equ YANMA, 0xC1
.equ WOOPER, 0xC2
.equ QUAGSIRE, 0xC3
.equ ESPEON, 0xC4
.equ UMBREON, 0xC5
.equ MURKROW, 0xC6
.equ SLOWKING, 0xC7
.equ MISDREAVUS, 0xC8
.equ UNOWN, 0xC9
.equ WOBBUFFET, 0xCA
.equ GIRAFARIG, 0xCB
.equ PINECO, 0xCC
.equ FORRETRESS, 0xCD
.equ DUNSPARCE, 0xCE
.equ GLIGAR, 0xCF
.equ STEELIX, 0xD0
.equ SNUBBULL, 0xD1
.equ GRANBULL, 0xD2
.equ QWILFISH, 0xD3
.equ SCIZOR, 0xD4
.equ SHUCKLE, 0xD5
.equ HERACROSS, 0xD6
.equ SNEASEL, 0xD7
.equ TEDDIURSA, 0xD8
.equ URSARING, 0xD9
.equ SLUGMA, 0xDA
.equ MAGCARGO, 0xDB
.equ SWINUB, 0xDC
.equ PILOSWINE, 0xDD
.equ CORSOLA, 0xDE
.equ REMORAID, 0xDF
.equ OCTILLERY, 0xE0
.equ DELIBIRD, 0xE1
.equ MANTINE, 0xE2
.equ SKARMORY, 0xE3
.equ HOUNDOUR, 0xE4
.equ HOUNDOOM, 0xE5
.equ KINGDRA, 0xE6
.equ PHANPY, 0xE7
.equ DONPHAN, 0xE8
.equ PORYGON2, 0xE9
.equ STANTLER, 0xEA
.equ SMEARGLE, 0xEB
.equ TYROGUE, 0xEC
.equ HITMONTOP, 0xED
.equ SMOOCHUM, 0xEE
.equ ELEKID, 0xEF
.equ MAGBY, 0xF0
.equ MILTANK, 0xF1
.equ BLISSEY, 0xF2
.equ RAIKOU, 0xF3
.equ ENTEI, 0xF4
.equ SUICUNE, 0xF5
.equ LARVITAR, 0xF6
.equ PUPITAR, 0xF7
.equ TYRANITAR, 0xF8
.equ LUGIA, 0xF9
.equ HO_OH, 0xFA
.equ CELEBI, 0xFB
.equ NOPE, 0xFC
.equ NOPE, 0xFD
.equ NOPE, 0xFE
.equ NOPE, 0xFF
.equ NOPE, 0x100
.equ NOPE, 0x101
.equ NOPE, 0x102
.equ NOPE, 0x103
.equ NOPE, 0x104
.equ NOPE, 0x105
.equ NOPE, 0x106
.equ NOPE, 0x107
.equ NOPE, 0x108
.equ NOPE, 0x109
.equ NOPE, 0x10A
.equ NOPE, 0x10B
.equ NOPE, 0x10C
.equ NOPE, 0x10D
.equ NOPE, 0x10E
.equ NOPE, 0x10F
.equ NOPE, 0x110
.equ NOPE, 0x111
.equ NOPE, 0x112
.equ NOPE, 0x113
.equ NOPE, 0x114
.equ TREECKO, 0x115
.equ GROVYLE, 0x116
.equ SCEPTILE, 0x117
.equ TORCHIC, 0x118
.equ COMBUSKEN, 0x119
.equ BLAZIKEN, 0x11A
.equ MUDKIP, 0x11B
.equ MARSHTOMP, 0x11C
.equ SWAMPERT, 0x11D
.equ POOCHYENA, 0x11E
.equ MIGHTYENA, 0x11F
.equ ZIGZAGOON, 0x120
.equ LINOONE, 0x121
.equ WURMPLE, 0x122
.equ SILCOON, 0x123
.equ BEAUTIFLY, 0x124
.equ CASCOON, 0x125
.equ DUSTOX, 0x126
.equ LOTAD, 0x127
.equ LOMBRE, 0x128
.equ LUDICOLO, 0x129
.equ SEEDOT, 0x12A
.equ NUZLEAF, 0x12B
.equ SHIFTRY, 0x12C
.equ NINCADA, 0x12D
.equ NINJASK, 0x12E
.equ SHEDINJA, 0x12F
.equ TAILLOW, 0x130
.equ SWELLOW, 0x131
.equ SHROOMISH, 0x132
.equ BRELOOM, 0x133
.equ SPINDA, 0x134
.equ WINGULL, 0x135
.equ PELIPPER, 0x136
.equ SURSKIT, 0x137
.equ MASQUERAIN, 0x138
.equ WAILMER, 0x139
.equ WAILORD, 0x13A
.equ SKITTY, 0x13B
.equ DELCATTY, 0x13C
.equ KECLEON, 0x13D
.equ BALTOY, 0x13E
.equ CLAYDOL, 0x13F
.equ NOSEPASS, 0x140
.equ TORKOAL, 0x141
.equ SABLEYE, 0x142
.equ BARBOACH, 0x143
.equ WHISCASH, 0x144
.equ LUVDISC, 0x145
.equ CORPHISH, 0x146
.equ CRAWDAUNT, 0x147
.equ FEEBAS, 0x148
.equ MILOTIC, 0x149
.equ CARVANHA, 0x14A
.equ SHARPEDO, 0x14B
.equ TRAPINCH, 0x14C
.equ VIBRAVA, 0x14D
.equ FLYGON, 0x14E
.equ MAKUHITA, 0x14F
.equ HARIYAMA, 0x150
.equ ELECTRIKE, 0x151
.equ MANECTRIC, 0x152
.equ NUMEL, 0x153
.equ CAMERUPT, 0x154
.equ SPHEAL, 0x155
.equ SEALEO, 0x156
.equ WALREIN, 0x157
.equ CACNEA, 0x158
.equ CACTURNE, 0x159
.equ SNORUNT, 0x15A
.equ GLALIE, 0x15B
.equ LUNATONE, 0x15C
.equ SOLROCK, 0x15D
.equ AZURILL, 0x15E
.equ SPOINK, 0x15F
.equ GRUMPIG, 0x160
.equ PLUSLE, 0x161
.equ MINUN, 0x162
.equ MAWILE, 0x163
.equ MEDITITE, 0x164
.equ MEDICHAM, 0x165
.equ SWABLU, 0x166
.equ ALTARIA, 0x167
.equ WYNAUT, 0x168
.equ DUSKULL, 0x169
.equ DUSCLOPS, 0x16A
.equ ROSELIA, 0x16B
.equ SLAKOTH, 0x16C
.equ VIGOROTH, 0x16D
.equ SLAKING, 0x16E
.equ GULPIN, 0x16F
.equ SWALOT, 0x170
.equ TROPIUS, 0x171
.equ WHISMUR, 0x172
.equ LOUDRED, 0x173
.equ EXPLOUD, 0x174
.equ CLAMPERL, 0x175
.equ HUNTAIL, 0x176
.equ GOREBYSS, 0x177
.equ ABSOL, 0x178
.equ SHUPPET, 0x179
.equ BANETTE, 0x17A
.equ SEVIPER, 0x17B
.equ ZANGOOSE, 0x17C
.equ RELICANTH, 0x17D
.equ ARON, 0x17E
.equ LAIRON, 0x17F
.equ AGGRON, 0x180
.equ CASTFORM, 0x181
.equ VOLBEAT, 0x182
.equ ILLUMISE, 0x183
.equ LILEEP, 0x184
.equ CRADILY, 0x185
.equ ANORITH, 0x186
.equ ARMALDO, 0x187
.equ RALTS, 0x188
.equ KIRLIA, 0x189
.equ GARDEVOIR, 0x18A
.equ BAGON, 0x18B
.equ SHELGON, 0x18C
.equ SALAMENCE, 0x18D
.equ BELDUM, 0x18E
.equ METANG, 0x18F
.equ METAGROSS, 0x190
.equ REGIROCK, 0x191
.equ REGICE, 0x192
.equ REGISTEEL, 0x193
.equ KYOGRE, 0x194
.equ GROUDON, 0x195
.equ RAYQUAZA, 0x196
.equ LATIAS, 0x197
.equ LATIOS, 0x198
.equ JIRACHI, 0x199
.equ DEOXYS, 0x19A
.equ CHIMECHO, 0x19B
.equ EGG, 0x19C
.equ UNOWN_B, 0x19D
.equ UNOWN_C, 0x19E
.equ UNOWN_D, 0x19F
.equ UNOWN_E, 0x1A0
.equ UNOWN_F, 0x1A1
.equ UNOWN_G, 0x1A2
.equ UNOWN_H, 0x1A3
.equ UNOWN_I, 0x1A4
.equ UNOWN_J, 0x1A5
.equ UNOWN_K, 0x1A6
.equ UNOWN_L, 0x1A7
.equ UNOWN_M, 0x1A8
.equ UNOWN_N, 0x1A9
.equ UNOWN_O, 0x1AA
.equ UNOWN_P, 0x1AB
.equ UNOWN_Q, 0x1AC
.equ UNOWN_R, 0x1AD
.equ UNOWN_S, 0x1AE
.equ UNOWN_T, 0x1AF
.equ UNOWN_U, 0x1B0
.equ UNOWN_V, 0x1B1
.equ UNOWN_W, 0x1B2
.equ UNOWN_X, 0x1B3
.equ UNOWN_Y, 0x1B4
.equ UNOWN_Z, 0x1B5
.equ UNOWN_EXCLAMATION, 0x1B6
.equ UNOWN_QUESTION, 0x1B7
.equ TURTWIG, 0x1B8
.equ GROTLE, 0x1B9
.equ TORTERRA, 0x1BA
.equ CHIMCHAR, 0x1BB
.equ MONFERNO, 0x1BC
.equ INFERNAPE, 0x1BD
.equ PIPLUP, 0x1BE
.equ PRINPLUP, 0x1BF
.equ EMPOLEON, 0x1C0
.equ STARLY, 0x1C1
.equ STARAVIA, 0x1C2
.equ STARAPTOR, 0x1C3
.equ BIDOOF, 0x1C4
.equ BIBAREL, 0x1C5
.equ KRICKETOT, 0x1C6
.equ KRICKETUNE, 0x1C7
.equ SHINX, 0x1C8
.equ LUXIO, 0x1C9
.equ LUXRAY, 0x1CA
.equ BUDEW, 0x1CB
.equ ROSERADE, 0x1CC
.equ CRANIDOS, 0x1CD
.equ RAMPARDOS, 0x1CE
.equ SHIELDON, 0x1CF
.equ BASTIODON, 0x1D0
.equ BURMY, 0x1D1
.equ WORMADAM, 0x1D2
.equ MOTHIM, 0x1D3
.equ COMBEE, 0x1D4
.equ VESPIQUEN, 0x1D5
.equ PACHIRISU, 0x1D6
.equ BUIZEL, 0x1D7
.equ FLOATZEL, 0x1D8
.equ CHERUBI, 0x1D9
.equ CHERRIM, 0x1DA
.equ SHELLOS, 0x1DB
.equ GASTRODON, 0x1DC
.equ AMBIPOM, 0x1DD
.equ DRIFLOON, 0x1DE
.equ DRIFBLIM, 0x1DF
.equ BUNEARY, 0x1E0
.equ LOPUNNY, 0x1E1
.equ MISMAGIUS, 0x1E2
.equ HONCHKROW, 0x1E3
.equ GLAMEOW, 0x1E4
.equ PURUGLY, 0x1E5
.equ CHINGLING, 0x1E6
.equ STUNKY, 0x1E7
.equ SKUNTANK, 0x1E8
.equ BRONZOR, 0x1E9
.equ BRONZONG, 0x1EA
.equ BONSLY, 0x1EB
.equ MIME_JR, 0x1EC
.equ HAPPINY, 0x1ED
.equ CHATOT, 0x1EE
.equ SPIRITOMB, 0x1EF
.equ GIBLE, 0x1F0
.equ GABITE, 0x1F1
.equ GARCHOMP, 0x1F2
.equ MUNCHLAX, 0x1F3
.equ RIOLU, 0x1F4
.equ LUCARIO, 0x1F5
.equ HIPPOPOTAS, 0x1F6
.equ HIPPOWDON, 0x1F7
.equ SKORUPI, 0x1F8
.equ DRAPION, 0x1F9
.equ CROAGUNK, 0x1FA
.equ TOXICROAK, 0x1FB
.equ CARNIVINE, 0x1FC
.equ FINNEON, 0x1FD
.equ LUMINEON, 0x1FE
.equ MANTYKE, 0x1FF
.equ SNOVER, 0x200
.equ ABOMASNOW, 0x201
.equ WEAVILE, 0x202
.equ MAGNEZONE, 0x203
.equ LICKILICKY, 0x204
.equ RHYPERIOR, 0x205
.equ TANGROWTH, 0x206
.equ ELECTIVIRE, 0x207
.equ MAGMORTAR, 0x208
.equ TOGEKISS, 0x209
.equ YANMEGA, 0x20A
.equ LEAFEON, 0x20B
.equ GLACEON, 0x20C
.equ GLISCOR, 0x20D
.equ MAMOSWINE, 0x20E
.equ PORYGON_Z, 0x20F
.equ GALLADE, 0x210
.equ PROBOPASS, 0x211
.equ DUSKNOIR, 0x212
.equ FROSLASS, 0x213
.equ ROTOM, 0x214
.equ UXIE, 0x215
.equ MESPRIT, 0x216
.equ AZELF, 0x217
.equ DIALGA, 0x218
.equ PALKIA, 0x219
.equ HEATRAN, 0x21A
.equ REGIGIGAS, 0x21B
.equ GIRATINA, 0x21C
.equ CRESSELIA, 0x21D
.equ PHIONE, 0x21E
.equ MANAPHY, 0x21F
.equ DARKRAI, 0x220
.equ SHAYMIN, 0x221
.equ ARCEUS, 0x222
.equ BURMY_SAND, 0x223
.equ BURMY_TRASH, 0x224
.equ WORMADAM_SAND, 0x225
.equ WORMADAM_THRASH, 0x226
.equ SHELLOS_EAST, 0x227
.equ GASTRODON_EAST, 0x228
.equ ROTOM_HEAT, 0x229
.equ ROTOM_WASH, 0x22A
.equ ROTOM_FROST, 0x22B
.equ ROTOM_FAN, 0x22C
.equ ROTOM_MOW, 0x22D
.equ GIRATINA_ORIGIN, 0x22E
.equ SHAYMIN_SKY, 0x22F
.equ ARCEUS_FIGHT, 0x230
.equ ARCEUS_FLYING, 0x231
.equ ARCEUS_POISON, 0x232
.equ ARCEUS_GROUND, 0x233
.equ ARCEUS_ROCK, 0x234
.equ ARCEUS_BUG, 0x235
.equ ARCEUS_GHOST, 0x236
.equ ARCEUS_STEEL, 0x237
.equ ARCEUS_UNKNOWN, 0x238
.equ ARCEUS_FIRE, 0x239
.equ ARCEUS_WATER, 0x23A
.equ ARCEUS_GRASS, 0x23B
.equ ARCEUS_ELECTRIC, 0x23C
.equ ARCEUS_PSYCHIC, 0x23D
.equ ARCEUS_ICE, 0x23E
.equ ARCEUS_DRAGON, 0x23F
.equ ARCEUS_DARK, 0x240
.equ ARCEUS_FAIRY, 0x241
.equ VICTINI, 0x242
.equ SNIVY, 0x243
.equ SERVINE, 0x244
.equ SERPERIOR, 0x245
.equ TEPIG, 0x246
.equ PIGNITE, 0x247
.equ EMBOAR, 0x248
.equ OSHAWOTT, 0x249
.equ DEWOTT, 0x24A
.equ SAMUROTT, 0x24B
.equ PATRAT, 0x24C
.equ WATCHOG, 0x24D
.equ LILLIPUP, 0x24E
.equ HERDIER, 0x24F
.equ STOUTLAND, 0x250
.equ PURRLOIN, 0x251
.equ LIEPARD, 0x252
.equ PANSAGE, 0x253
.equ SIMISAGE, 0x254
.equ PANSEAR, 0x255
.equ SIMISEAR, 0x256
.equ PANPOUR, 0x257
.equ SIMIPOUR, 0x258
.equ MUNNA, 0x259
.equ MUSHARNA, 0x25A
.equ PIDOVE, 0x25B
.equ TRANQUILL, 0x25C
.equ UNFEZANT, 0x25D
.equ BLITZLE, 0x25E
.equ ZEBSTRIKA, 0x25F
.equ ROGGENROLA, 0x260
.equ BOLDORE, 0x261
.equ GIGALITH, 0x262
.equ WOOBAT, 0x263
.equ SWOOBAT, 0x264
.equ DRILBUR, 0x265
.equ EXCADRILL, 0x266
.equ AUDINO, 0x267
.equ TIMBURR, 0x268
.equ GURDURR, 0x269
.equ CONKELDURR, 0x26A
.equ TYMPOLE, 0x26B
.equ PALPITOAD, 0x26C
.equ SEISMITOAD, 0x26D
.equ THROH, 0x26E
.equ SAWK, 0x26F
.equ SEWADDLE, 0x270
.equ SWADLOON, 0x271
.equ LEAVANNY, 0x272
.equ VENIPEDE, 0x273
.equ WHIRLIPEDE, 0x274
.equ SCOLIPEDE, 0x275
.equ COTTONEE, 0x276
.equ WHIMSICOTT, 0x277
.equ PETILIL, 0x278
.equ LILLIGANT, 0x279
.equ BASCULIN, 0x27A
.equ SANDILE, 0x27B
.equ KROKOROK, 0x27C
.equ KROOKODILE, 0x27D
.equ DARUMAKA, 0x27E
.equ DARMANITAN, 0x27F
.equ MARACTUS, 0x280
.equ DWEBBLE, 0x281
.equ CRUSTLE, 0x282
.equ SCRAGGY, 0x283
.equ SCRAFTY, 0x284
.equ SIGILYPH, 0x285
.equ YAMASK, 0x286
.equ COHAGRIGUS, 0x287
.equ TIRTOUGA, 0x288
.equ CARRACOSTA, 0x289
.equ ARCHEN, 0x28A
.equ ARCHEOPS, 0x28B
.equ TRUBBISH, 0x28C
.equ GARBODOR, 0x28D
.equ ZORUA, 0x28E
.equ ZOROARK, 0x28F
.equ MINCCINO, 0x290
.equ CINCCINO, 0x291
.equ GOTHITA, 0x292
.equ GOTHORITA, 0x293
.equ GOTHITELLE, 0x294
.equ SOLOSIS, 0x295
.equ DUOSION, 0x296
.equ REUNICLUS, 0x297
.equ DUCKLETT, 0x298
.equ SWANNA, 0x299
.equ VANILLITE, 0x29A
.equ VANILLISH, 0x29B
.equ VANILLUXE, 0x29C
.equ DEERLING, 0x29D
.equ SAWSBUCK, 0x29E
.equ EMOLGA, 0x29F
.equ KARRABLAST, 0x2A0
.equ ESCAVALIER, 0x2A1
.equ FOONGUS, 0x2A2
.equ AMOONGUSS, 0x2A3
.equ FRILLISH, 0x2A4
.equ JELLICENT, 0x2A5
.equ ALOMOMOLA, 0x2A6
.equ JOLTIK, 0x2A7
.equ GALVANTULA, 0x2A8
.equ FERROSEED, 0x2A9
.equ FERROTHORN, 0x2AA
.equ KLINK, 0x2AB
.equ KLANG, 0x2AC
.equ KLINKLANG, 0x2AD
.equ TYNAMO, 0x2AE
.equ EELEKTRIK, 0x2AF
.equ EELEKTROSS, 0x2B0
.equ ELGYEM, 0x2B1
.equ BEHEEYEM, 0x2B2
.equ LITWICK, 0x2B3
.equ LAMPENT, 0x2B4
.equ CHANDELURE, 0x2B5
.equ AXEW, 0x2B6
.equ FRAXURE, 0x2B7
.equ HAXORUS, 0x2B8
.equ CUBCHOO, 0x2B9
.equ BEARTIC, 0x2BA
.equ CRYOGONAL, 0x2BB
.equ SHELMET, 0x2BC
.equ ACCELGOR, 0x2BD
.equ STUNFISK, 0x2BE
.equ MIENFOO, 0x2BF
.equ MIENSHAO, 0x2C0
.equ DRUDDIGON, 0x2C1
.equ GOLETT, 0x2C2
.equ GOLURK, 0x2C3
.equ PAWNIARD, 0x2C4
.equ BISHARP, 0x2C5
.equ BOUFFALANT, 0x2C6
.equ RUFFLET, 0x2C7
.equ BRAVIARY, 0x2C8
.equ VULLABY, 0x2C9
.equ MANDIBUZZ, 0x2CA
.equ HEATMOR, 0x2CB
.equ DURANT, 0x2CC
.equ DEINO, 0x2CD
.equ ZWEILOUS, 0x2CE
.equ HYDREIGON, 0x2CF
.equ LARVESTA, 0x2D0
.equ VOLCARONA, 0x2D1
.equ COBALION, 0x2D2
.equ TERRAKION, 0x2D3
.equ VIRIZION, 0x2D4
.equ TORNADUS, 0x2D5
.equ THUNDURUS, 0x2D6
.equ RESHIRAM, 0x2D7
.equ ZEKROM, 0x2D8
.equ LANDORUS, 0x2D9
.equ KYUREM, 0x2DA
.equ KELDEO, 0x2DB
.equ MELOETTA, 0x2DC
.equ GENESECT, 0x2DD
.equ BASCULIN_BLUE, 0x2DE
.equ DARMANITAN_ZEN, 0x2DF
.equ DEERLING_SUMMER, 0x2E0
.equ DEERLING_AUTUMN, 0x2E1
.equ DEERLING_WINTER, 0x2E2
.equ SAWSBUCK_SUMMER, 0x2E3
.equ SAWSBUCK_AUTUMN, 0x2E4
.equ SAWSBUCK_WINTER, 0x2E5
.equ KYUREM_WHITE, 0x2E6
.equ KYUREM_BLACK, 0x2E7
.equ MELOETTA_PIROUETTE, 0x2E8
.equ GENESECT_SHOCK, 0x2E9
.equ GENESECT_BURN, 0x2EA
.equ GENESECT_CHILL, 0x2EB
.equ GENESECT_DOUSE, 0x2EC
.equ TORNADUS_THERIAN, 0x2ED
.equ THUNDURUS_THERIAN, 0x2EE
.equ LANDORUS_THERIAN, 0x2EF
.equ KELDEO_RESOLUTE, 0x2F0
.equ CHESPIN, 0x2F1
.equ QUILLADIN, 0x2F2
.equ CHESNAUGHT, 0x2F3
.equ FENNEKIN, 0x2F4
.equ BRAIXEN, 0x2F5
.equ DELPHOX, 0x2F6
.equ FROAKIE, 0x2F7
.equ FROGADIER, 0x2F8
.equ GRENINJA, 0x2F9
.equ BUNNELBY, 0x2FA
.equ DIGGERSBY, 0x2FB
.equ FLETCHLING, 0x2FC
.equ FLETCHINDER, 0x2FD
.equ TALONFLAME, 0x2FE
.equ SCATTERBUG, 0x2FF
.equ SPEWPA, 0x300
.equ VIVILLON, 0x301
.equ LITLEO, 0x302
.equ PYROAR, 0x303
.equ FLABEBE, 0x304
.equ FLOETTE, 0x305
.equ FLORGES, 0x306
.equ SKIDDO, 0x307
.equ GOGOAT, 0x308
.equ PANCHAM, 0x309
.equ PANGORO, 0x30A
.equ FURFROU, 0x30B
.equ ESPURR, 0x30C
.equ MEOWSTIC, 0x30D
.equ HONEDGE, 0x30E
.equ DOUBLADE, 0x30F
.equ AEGISLASH, 0x310
.equ SPRITZEE, 0x311
.equ AROMATISSE, 0x312
.equ SWIRLIX, 0x313
.equ SLURPUFF, 0x314
.equ INKAY, 0x315
.equ MALAMAR, 0x316
.equ BINACLE, 0x317
.equ BARBARACLE, 0x318
.equ SKRELP, 0x319
.equ DRAGALGE, 0x31A
.equ CLAUNCHER, 0x31B
.equ CLAWITZER, 0x31C
.equ HELIOPTILE, 0x31D
.equ HELIOLISK, 0x31E
.equ TYRUNT, 0x31F
.equ TYRANTRUM, 0x320
.equ AMAURA, 0x321
.equ AURORUS, 0x322
.equ SYLVEON, 0x323
.equ HAWLUCHA, 0x324
.equ DEDENNE, 0x325
.equ CARBINK, 0x326
.equ GOOMY, 0x327
.equ SLIGGOO, 0x328
.equ GOODRA, 0x329
.equ KLEFKI, 0x32A
.equ PHANTUMP, 0x32B
.equ TREVENANT, 0x32C
.equ PUMPKABOO, 0x32D
.equ GOURGEIST, 0x32E
.equ BERGMITE, 0x32F
.equ AVALUGG, 0x330
.equ NOIBAT, 0x331
.equ NOIVERN, 0x332
.equ XERNEAS, 0x333
.equ YVELTAL, 0x334
.equ ZYGARDE, 0x335
.equ DIANCIE, 0x336
.equ HOOPA, 0x337
.equ VOLCANION, 0x338
.equ PYROAR_FEMALE, 0x339
.equ FLABEBE_WHITE, 0x33A
.equ FLABEBE_YELLOW, 0x33B
.equ FLABEBE_ORANGE, 0x33C
.equ FLABEBE_BLUE, 0x33D
.equ FLOETTE_WHITE, 0x33E
.equ FLOETTE_YELLOW, 0x33F
.equ FLOETTE_ORANGE, 0x340
.equ FLOETTE_BLUE, 0x341
.equ FLORGES_WHITE, 0x342
.equ FLORGES_YELLOW, 0x343
.equ FLORGES_ORANGE, 0x344
.equ FLORGES_BLUE, 0x345
.equ MEOWSTIC_FEMALE, 0x346
.equ AEGISLASH_BLADE, 0x347
.equ PUMPKABOO_2, 0x348
.equ PUMPKABOO_3, 0x349
.equ PUMPKABOO_4, 0x34A
.equ GOURGEIST_2, 0x34B
.equ GOURGEIST_3, 0x34C
.equ GOURGEIST_4, 0x34D
.equ HOOPA_UNBOUND, 0x34E
.equ VENUSAUR_MEGA, 0x34F
.equ CHARIZARD_MEGAX, 0x350
.equ CHARIZARD_MEGAY, 0x351
.equ BLASTOISE_MEGA, 0x352
.equ BEEDRILL_MEGA, 0x353
.equ PIDGEOT_MEGA, 0x354
.equ ALAKAZAM_MEGA, 0x355
.equ SLOWBRO_MEGA, 0x356
.equ GENGAR_MEGA, 0x357
.equ KANGASKHAN_MEGA, 0x358
.equ PINSIR_MEGA, 0x359
.equ GYARADOS_MEGA, 0x35A
.equ AERODACTYL_MEGA, 0x35B
.equ MEWTWO_MEGAX, 0x35C
.equ MEWTWO_MEGAY, 0x35D
.equ AMPHAROS_MEGA, 0x35E
.equ STEELIX_MEGA, 0x35F
.equ SCIZOR_MEGA, 0x360
.equ HERACROSS_MEGA, 0x361
.equ HOUNDOOM_MEGA, 0x362
.equ TYRANITAR_MEGA, 0x363
.equ SCEPTILE_MEGA, 0x364
.equ BLAZIKEN_MEGA, 0x365
.equ SWAMPERT_MEGA, 0x366
.equ GARDEVOIR_MEGA, 0x367
.equ SABLEYE_MEGA, 0x368
.equ MAWILE_MEGA, 0x369
.equ AGGRON_MEGA, 0x36A
.equ MEDICHAM_MEGA, 0x36B
.equ MANECTRIC_MEGA, 0x36C
.equ SHARPEDO_MEGA, 0x36D
.equ CAMERUPT_MEGA, 0x36E
.equ ALTARIA_MEGA, 0x36F
.equ BANETTE_MEGA, 0x370
.equ ABSOL_MEGA, 0x371
.equ GLALIE_MEGA, 0x372
.equ SALAMENCE_MEGA, 0x373
.equ METAGROSS_MEGA, 0x374
.equ NOPE, 0x375 @Dunno why but maybe a new Latias out from the Soul Dew routine
.equ NOPE, 0x376 @Dunno why but maybe a new Latios out from the Soul Dew routine
.equ LATIAS_MEGA, 0x377
.equ LATIOS_MEGA, 0x378
.equ RAYQUAZA_MEGA, 0x379
.equ LOPUNNY_MEGA, 0x37A
.equ GARCHOMP_MEGA, 0x37B
.equ LUCARIO_MEGA, 0x37C
.equ ABOMASNOW_MEGA, 0x37D
.equ GALLADE_MEGA, 0x37E
.equ AUDINO_MEGA, 0x37F
.equ DIANCIE_MEGA, 0x380
.equ DEOXYS_NORMAL, 0x381 @Renewal of Deoxys' index
.equ DEOXYS_ATTACK, 0x382 @Renewal of Deoxys' index
.equ DEOXYS_DEFENSE, 0x383 @Renewal of Deoxys' index
.equ DEXOYS_SPEED, 0x384 @Renewal of Deoxys' index
.equ NOPE, 0x385 @Generation VII Pokemon starts here

.org 0x43F90, 0xFF
ldr r1, Hook3
bx r1
.align 2
Hook3: .word RomAreaOffset+dex_seeable_mon_hook+1

.org 0x88EDC, 0xFF
ldr r1, Hook6
bx r1
.align 2
Hook6: .word RomAreaOffset+dex_regional_count_hook+1

.org 0xCE91A, 0xFF
ldr r1, Hook4
bx r1
.align 2
Hook4: .word RomAreaOffset+dex_evolution_fix_hook+1

.org 0x10352C, 0xFF
ldr r1, Hook7
bx r1
.align 2
Hook7: .word RomAreaOffset+dex_display_hook+1

.org 0x10356C, 0xFF
ldr r0, Hook8
bx r0
.align 2
Hook8: .word RomAreaOffset+regional_dex_hook+1

.org 0x1035B4, 0xFF
ldr r1, Hook9
bx r1
.align 2
Hook9: .word RomAreaOffset+store_last_dex_seen_hook+1

.org 0x1035F4, 0xFF
ldr r0, HookA
bx r0
.align 2
HookA: .word RomAreaOffset+lazy_regional_dex_end_hook+1

.org 0x104A66, 0xFF
ldr r1, HookB
bx r1
.align 2
HookB: .word RomAreaOffset+display_regional_num_hook+1

.org 0x104BBC, 0xFF
ldr r2, Hook5
bx r2
.align 2
Hook5: .word RomAreaOffset+dex_display_counts_hook+1

.org 0x106810, 0xFF
ldr r1, Hook2
bx r1
.align 2
Hook2: .word RomAreaOffset+habitat_dex_regional_limit_hook+1

.org 0x106B84, 0xFF
ldr r1, Hook1
bx r1
.align 2
Hook1: .word RomAreaOffset+data_on_capture_hook+1

.org MyLoc, 0xFF
data_on_capture_hook:        @0x08106B84 via r1
        bl species_to_regional_dex_number
        cmp r0, #0x0
        bne capture_display_return
        ldr r0, add_task_no_capture_display
        bx r0

capture_display_return:
        ldr r0, add_task_capture_display
        bx r0

.align 2
.pool

.align 2

habitat_dex_regional_limit_hook:        @0x08106810 via r1
        push {r4, lr}
        mov r4, r0
        bl haz_national_dex_bool
        cmp r0, #0x1
        beq habitat_dex_regional_limit_return        @valid
        mov r0, r4
        bl species_to_regional_dex_number
        cmp r0, #0x0
        beq habitat_dex_regional_limit_return        @not in regional dex, return 0
        mov r0, #0x1

habitat_dex_regional_limit_return:
        pop {r4}
        pop {r1}
        bx r1

.align 2
.pool

.align 2

dex_seeable_mon_hook:        @0x08043F90 via r1
        push {r4, lr}
        mov r4, r0
        bl haz_national_dex_bool
        cmp r0, #0x0
        beq only_regional_numbered
@national
        mov r0, r4
        bl species_to_national_dex_number_1
        b dex_seeable_mon_check_valid_species

only_regional_numbered:
        mov r0, r4
        bl species_to_regional_dex_number

dex_seeable_mon_check_valid_species:
        cmp r0, #0x0
        bne dex_seeable_mon_return
        ldr r0, full_halfword

dex_seeable_mon_return:
        pop {r4}
        pop {r1}
        bx r1
.align
full_halfword:        .word 0xFFFF

.align 2
.pool

.align 2

dex_evolution_fix_hook:        @0x080CE91A via r1
        bl species_to_regional_dex_number
        cmp r0, #0x0        @not in regional dex, invalid
        beq dex_evolution_failure
        ldr r0, dex_evolution_success_return
        bx r0

dex_evolution_failure:
        mov r0, #0x11
        strh r0, [r5, #0x8]
        mov r2, #0x1
        ldr r1, dex_evolution_failure_return
        bx r1

.align 2
.pool

.align 2

dex_display_counts_hook:        @0x08104BBC via r2
        @r0: mode
        push {lr}
        cmp r1, #0x0
        beq call_regional_count
        bl national_pokedex_count
        b dex_display_counts_return

call_regional_count:
        bl dex_regional_count_hook

dex_display_counts_return:
        pop {pc}

.align 2
.pool

.align 2

dex_regional_count_hook:        @0x08088EDC via r1
        push {r4-r6, lr}
        mov r6, r0        @mode
        mov r4, #0x1        @loop
        mov r5, #0x0        @counter

dex_regional_count_loop:
        lsl r0, r4, #0x1        @loop times 2
        adr r1, regional_dex_order
        ldrh r0, [r1, r0]        @req species
        mov r1, r6        @mode
        mov r2, #0x1        @input is SPECIES
        bl dex_flag_check
        add r5, r5, r0
        add r4, #0x1
        ldr r0, regional_dex_limit
        cmp r4, r0
        blo dex_regional_count_loop
        mov r0, r5
        pop {r4-r6, pc}

.align 2
.pool

.align 2

dex_display_hook:        @0x0810352C via r1
        ldr r1, regional_dex_limit
        cmp r0, #0x0
        beq store_dex_limit_and_return
        ldr r1, national_dex_limit

store_dex_limit_and_return:
        str r1, [sp, #0x0]
        ldr r0, regional_dex_limit_return
        bx r0

.align 2
.pool

.align 2

regional_dex_hook:        @0x0810356C via r0
        mov r4, r8
        add r4, #0x1
        lsl r0, r4, #0x1        @index times 2
        adr r1, regional_dex_order
        ldrh r0, [r1, r0]
        bl species_to_national_dex_number_1
        mov r5, r0
        mov r1, #0x0
        ldr r2, regional_dex_hook_return
        bx r2

.align 2
.pool

.align 2

store_last_dex_seen_hook:        @0x081035B4 via r1
        str r0, [r2]
        mov r10, r4
        mov r4, r3
        ldr r0, def_store_string_dex_number
        bx r0

.align 2
.pool

.align 2

lazy_regional_dex_end_hook:        @0x081035F4 via r0
        mov r0, r8
        ldr r1, regional_dex_limit
        cmp r0, r1
        blo regional_dex_hook
        ldr r0, end_dex_display_return
        bx r0

.align 2
.pool

.align 2

display_regional_num_hook:        @0x08104A66 via r1
        mov r5, r0        @save species
        bl haz_national_dex_bool
        cmp r0, #0x0
        beq use_regional_dex_ordering
        ldr r1, dex_malloc_ptr
        ldr r1, [r1]
        add r1, #0x42
        ldrb r1, [r1]
        cmp r1, #0x0        @check if looking at regional dex
        beq use_regional_dex_ordering
        mov r0, r5
        bl species_to_national_dex_number_1
        b display_dex_number_return

use_regional_dex_ordering:
        mov r0, r5
        bl species_to_regional_dex_number       

display_dex_number_return:
        mov r5, r0
        ldr r0, dex_number_display_return
        bx r0

species_to_regional_dex_number:
        adr r3, regional_dex_order
        mov r2, r0        @req species
        mov r0, #0x0        @loop counter
find_regional_number_loop:
        lsl r1, r0, #0x1
        ldrh r1, [r3, r1]
        cmp r1, r2
        beq species_to_regional_dex_return
        add r0, #0x1
        ldr r1, regional_dex_limit
        cmp r0, r1
        bls find_regional_number_loop
        mov r0, #0x0        @not in dex: set number to 0
species_to_regional_dex_return:
        bx lr

species_to_national_dex_number_1:
        ldr r1, f_species_to_nat_dex
        bx r1
.align
f_species_to_nat_dex:        .word 0x08043298 + 1

haz_national_dex_bool:
        ldr r0, f_haz_national_check
        bx r0
.align
f_haz_national_check:        .word 0x0806E25C + 1

dex_flag_check:
        ldr r3, f_dex_flag_check
        bx r3
.align
f_dex_flag_check:        .word 0x08104AB0 + 1

national_pokedex_count:
        ldr r1, f_national_pokedex_count
        bx r1
.align
f_national_pokedex_count:        .word 0x08088E8C + 1

.align
add_task_no_capture_display:        .word 0x08106B90 + 1
add_task_capture_display:        .word 0x08106BA4 + 1
dex_evolution_success_return:        .word 0x080CE948 + 1
dex_evolution_failure_return:        .word 0x080CE924 + 1
regional_dex_limit:        .word number_of_mons_in_regional_dex
national_dex_limit:        .word number_of_mons_in_national_dex
regional_dex_limit_return:        .word 0x0810353a + 1
regional_dex_hook_return:        .word 0x08103578 + 1
def_store_string_dex_number:        .word 0x081035D6 + 1
end_dex_display_return:        .word 0x08103906 + 1
dex_malloc_ptr:                        .word 0x0203ACF0
dex_number_display_return:        .word 0x08104A70 + 1

regional_dex_order:
.hword        0x0000
.hword        TREECKO
.hword        GROVYLE
.hword        SCEPTILE
.hword        TORCHIC
.hword        COMBUSKEN
.hword        BLAZIKEN
.hword        MUDKIP
.hword        MARSHTOMP
.hword        SWAMPERT
.hword        POOCHYENA
.hword        MIGHTYENA
.hword        ZIGZAGOON
.hword        LINOONE
.hword        WURMPLE
.hword        SILCOON
.hword        BEAUTIFLY
.hword        CASCOON
.hword        DUSTOX
.hword        LOTAD
.hword        LOMBRE
.hword        LUDICOLO
.hword        SEEDOT
.hword        NUZLEAF
.hword        SHIFTRY
.hword        TAILLOW
.hword        SWELLOW
.hword        WINGULL
.hword        PELIPPER
.hword        RALTS
.hword        KIRLIA
.hword        GARDEVOIR
.hword        SURSKIT
.hword        MASQUERAIN
.hword        SHROOMISH
.hword        BRELOOM
.hword        SLAKOTH
.hword        VIGOROTH
.hword        SLAKING
.hword        ABRA
.hword        KADABRA
.hword        ALAKAZAM
.hword        NINCADA
.hword        NINJASK
.hword        SHEDINJA
.hword        WHISMUR
.hword        LOUDRED
.hword        EXPLOUD
.hword        MAKUHITA
.hword        HARIYAMA
.hword        GOLDEEN
.hword        SEAKING
.hword        MAGIKARP
.hword        GYARADOS
.hword        AZURILL
.hword        MARILL
.hword        AZUMARILL
.hword        GEODUDE
.hword        GRAVELER
.hword        GOLEM
.hword        NOSEPASS
.hword        SKITTY
.hword        DELCATTY
.hword        ZUBAT
.hword        GOLBAT
.hword        CROBAT
.hword        TENTACOOL
.hword        TENTACRUEL
.hword        SABLEYE
.hword        MAWILE
.hword        ARON
.hword        LAIRON
.hword        AGGRON
.hword        MACHOP
.hword        MACHOKE
.hword        MACHAMP
.hword        MEDITITE
.hword        MEDICHAM
.hword        ELECTRIKE
.hword        MANECTRIC
.hword        PLUSLE
.hword        MINUN
.hword        MAGNEMITE
.hword        MAGNETON
.hword        VOLTORB
.hword        ELECTRODE
.hword        VOLBEAT
.hword        ILLUMISE
.hword        ODDISH
.hword        GLOOM
.hword        VILEPLUME
.hword        BELLOSSOM
.hword        DODUO
.hword        DODRIO
.hword        ROSELIA
.hword        GULPIN
.hword        SWALOT
.hword        CARVANHA
.hword        SHARPEDO
.hword        WAILMER
.hword        WAILORD
.hword        NUMEL
.hword        CAMERUPT
.hword        SLUGMA
.hword        MAGCARGO
.hword        TORKOAL
.hword        GRIMER
.hword        MUK
.hword        KOFFING
.hword        WEEZING
.hword        SPOINK
.hword        GRUMPIG
.hword        SANDSHREW
.hword        SANDSLASH
.hword        SPINDA
.hword        SKARMORY
.hword        TRAPINCH
.hword        VIBRAVA
.hword        FLYGON
.hword        CACNEA
.hword        CACTURNE
.hword        SWABLU
.hword        ALTARIA
.hword        ZANGOOSE
.hword        SEVIPER
.hword        LUNATONE
.hword        SOLROCK
.hword        BARBOACH
.hword        WHISCASH
.hword        CORPHISH
.hword        CRAWDAUNT
.hword        BALTOY
.hword        CLAYDOL
.hword        LILEEP
.hword        CRADILY
.hword        ANORITH
.hword        ARMALDO
.hword        IGGLYBUFF
.hword        JIGGLYPUFF
.hword        WIGGLYTUFF
.hword        FEEBAS
.hword        MILOTIC
.hword        CASTFORM
.hword        STARYU
.hword        STARMIE
.hword        KECLEON
.hword        SHUPPET
.hword        BANETTE
.hword        DUSKULL
.hword        DUSCLOPS
.hword        TROPIUS
.hword        CHIMECHO
.hword        ABSOL
.hword        VULPIX
.hword        NINETALES
.hword        PICHU
.hword        PIKACHU
.hword        RAICHU
.hword        PSYDUCK
.hword        GOLDUCK
.hword        WYNAUT
.hword        WOBBUFFET
.hword        NATU
.hword        XATU
.hword        GIRAFARIG
.hword        PHANPY
.hword        DONPHAN
.hword        PINSIR
.hword        HERACROSS
.hword        RHYHORN
.hword        RHYDON
.hword        SNORUNT
.hword        GLALIE
.hword        SPHEAL
.hword        SEALEO
.hword        WALREIN
.hword        CLAMPERL
.hword        HUNTAIL
.hword        GOREBYSS
.hword        RELICANTH
.hword        CORSOLA
.hword        CHINCHOU
.hword        LANTURN
.hword        LUVDISC
.hword        HORSEA
.hword        SEADRA
.hword        KINGDRA
.hword        BAGON
.hword        SHELGON
.hword        SALAMENCE
.hword        BELDUM
.hword        METANG
.hword        METAGROSS
.hword        REGIROCK
.hword        REGICE
.hword        REGISTEEL
.hword        LATIAS
.hword        LATIOS
.hword        KYOGRE
.hword        GROUDON
.hword        RAYQUAZA
.hword        JIRACHI
.hword        DEOXYS



This works really well, so I thank all of you that contributed to making this.

I have a question if it's possible to modify this so that in the Search Modes (Alphabetical, Type, etc.) it's able to display the Pokemon added to the regional dex. It only appears to still display only the original 151 in those Modes.

Xencleamas June 2nd, 2018 4:08 AM

Quote:

Originally Posted by UltimaSoul (Post 9883968)
This works really well, so I thank all of you that contributed to making this.

I have a question if it's possible to modify this so that in the Search Modes (Alphabetical, Type, etc.) it's able to display the Pokemon added to the regional dex. It only appears to still display only the original 151 in those Modes.

You can also modify and expand those. Check this post: https://www.pokecommunity.com/showpost.php?p=9182559&postcount=827

Quote:

Originally Posted by Lance Koijer 2.0 (Post 9879268)
hello... it was indeeed a nice recoding of yours...

I have questions though, does the byte on the equ. part is the actual index number of that Pokémon or that is what can be seen in National Dex. I have, however, made the arrangement that all mons first and the the forms will be the last slot.. by doing that, do I have to edit the index and replace it with the corresponding pokemon index?

Also, does it support forms now? Liké Flabebe but they will share the same index number.

EDIT: I have tried to compile all these to my THUMB Assembler but I got no luck because the code is too many that the compiler can't manage to assemble lol. Is there anyway I can compile it? I tried CMD and what I always get is error... tried piece-by-piece assembly but still the compiler can't process it.

Slr, it is now I saw this. Yes. Those are in their actual index number. If you have custom index list, then of course you have to change it on your own. I just followed the index numbers based on MrDollSteak's and thedarkdragon's sprites. Forms actually work through different indexes such as Rotom with an exception of Castform (also Cherrim and Aegislash?). They just need to have same Pokedex slot.

Can you also get which lines are getting the error? This vanilla modified coding of mine works well. PM me if you have errors rather than discussing it here.

UltimaSoul June 2nd, 2018 8:13 AM

Quote:

Originally Posted by Xencleamas (Post 9884353)
You can also modify and expand those. Check this post:

To clarify, it seems if the National Dex flag is set, it allows all Pokemon to display in the Search Modes which makes sense. Before it is set, only the 151 are able to be seen.

I haven't added any new Pokemon yet so I don't think I need to expand, but I have made it so that Gen 2 related Pokemon appear with their families in the regional dex.

The order isn't what I want to edit, but just the trigger for displaying Pokemon that get added to the regional dex. It seems there is only one pointer to each table as well so there's probably something that changes what gets displayed based on the National Dex flag.

Lance Koijer 2.0 June 2nd, 2018 8:14 AM

Quote:

Originally Posted by Xencleamas (Post 9884353)
You can also modify and expand those. Check this post: https://www.pokecommunity.com/showpost.php?p=9182559&postcount=827



Slr, it is now I saw this. Yes. Those are in their actual index number. If you have custom index list, then of course you have to change it on your own. I just followed the index numbers based on MrDollSteak's and thedarkdragon's sprites. Forms actually work through different indexes such as Rotom with an exception of Castform (also Cherrim and Aegislash?). They just need to have same Pokedex slot.

Can you also get which lines are getting the error? This vanilla modified coding of mine works well. PM me if you have errors rather than discussing it here.

Hello, by Pokédex slot, what do you mean? Do I have to make the index number the same in National Dex Order?

luuma June 2nd, 2018 5:00 PM

Quote:

Originally Posted by Spherical Ice (Post 9826749)

Deposit entire team but one



Just going to publish this combination of two routines and a script excerpt that you can use to let the player select one Pokémon from their team, and then deposit the rest of their team.

Spoiler: Script
Code:

...
countpokemon
callasm ROUTINE_ONE+1
compare LASTRESULT 0x1
if B_<> goto @snippet1
msgbox @string1 MSG_NORMAL
call @snippet2
callasm ROUTINE_TWO+1
textcolor 0x2 // black
bufferpartypokemon 0x0 0x0
bufferboxname 0x1 0x4035
checkflag 0x834
if 0x1 goto @snippet3
msgbox @string2 MSG_NORMAL
goto @snippet4

//---------------
#org @snippet1
msgbox @string3 MSG_NORMAL
release
end

//---------------
#org @snippet2
special 0x9F
waitstate
special2 LASTRESULT 0x147
compare LASTRESULT 0x19C
if 0x1 goto @egg
compare 0x8004 0x5
if 0x2 goto @exited_out
return

//---------------
#org @snippet3
msgbox @string4 MSG_NORMAL
goto @snippet4

//---------------
#org @snippet4
...

//---------
// Strings
//---------
#org @string1
= You are only allowed to bring one\nPOKéMON.\pPlease select which one you would\nlike to bring.

#org @string2
= [buffer1] will join you.\pThe rest of your team was\ntransferred to SOMEONE's PC.\pThey were placed starting\nin BOX ["][buffer2]."

#org @string3
= You are only allowed to bring one\nPOKéMON.\pNormally, we would offer to deposit\nthe rest of your team into a BOX.\pHowever, it seems like all of your\nBOXES are full.\pPlease make room and return later.

#org @string4
= [buffer1] will join you.\pThe rest of your team was\ntransferred to BILL's PC.\pThey were placed starting\nin BOX ["][buffer2]."




Spoiler: ROUTINE_ONE
Code:

.thumb

@ This routine loops through the player's boxes to make sure there is room in a given box to deposit the entire team

main:
    push {r4-r7, lr}
    ldr r0, =(0x020370D0) @ var_800D
    ldrh r0, [r0]
    sub r0, #2 @ party size - 1
    mov r4, r0
    mov r5, #0

box_loop:
    mov r6, #0 @ box_id
    mov r7, #0 @ pos_in_box

pokemon_in_box_loop:
    mov r0, r6
    mov r1, r7
    ldr r3, =(0x0808BD30+1) @ pokemon_by_box_and_position
    bl call_via_r3
    mov r1, #0xB @ req_species
    ldr r3, =(0x0803FD44+1) @ pokemon_getattr_encrypted
    bl call_via_r3
    cmp r0, #0
    beq empty_space_found

next_loop:
    add r7, #1
    cmp r7, #30
    bls pokemon_in_box_loop

completed_current_box:
    add r6, #1
    cmp r6, #14
    bge not_enough_space
    mov r7, #0
    b pokemon_in_box_loop

empty_space_found:
    add r5, #1
    cmp r5, r4
    bls next_loop

enough_space:
    mov r0, #1
    b end

not_enough_space:
    mov r0, #0

end:
    ldr r1, =(0x020370D0) @ var_800D
    str r0, [r1]
    pop {r4-r7}
    pop {r3}

call_via_r3:
    bx r3

.pool




Spoiler: ROUTINE_TWO
Code:

.thumb

@ This routine loops through the player's party, depositing every slot (slot 0 to 5) except for the slot number in var 8004
@ It then copies the Pokémon in the remaining slot to slot 0, and then erases each Pokémon from slots 1 to 5

main:
    push {r4-r6,lr}
    ldr r4, =(0x020370C0) @ var_8004
    ldrh r4, [r4]
    ldr r5, =(0x02024284) @ party_player
    mov r6, #0

loop:
    cmp r6, #6
    beq continue
    cmp r6, r4
    beq skip
    mov r1, #0x64
    mul r1, r6
    add r0, r1, r5
    ldr r3, =(0x08040B90|1) @ pokemon_add_to_pc
    bl call_via_r3

skip:
    add r6, #1
    b loop

continue:
    mov r1, #0x64
    mul r1, r4
    add r1, r5
    mov r0, r5
    mov r2, #0x64
    ldr r3, =(0x081E5E78|1) @ memcpy
    bl call_via_r3
    ldr r0, =(0x02024284+0x64) @ second Pokémon party address
    ldr r1, =(0x081F42A0) @ just a random 500 (dec) 00 bytes in the ROM
    ldrh r2, =(0x1F4)
    ldr r3, =(0x081E5E78|1) @ memcpy
    bl call_via_r3
    pop {r4-r6}
    pop {r3}

call_via_r3:
    bx r3

.pool




Edit: I've adapted these new routines for emerald and they work a goddamn treat!

I got all the offsets I'm using from the .map file of the pokeemerald disassembly (and from just searching for copies of the offsets spherical had found in a vanilla rom)

Here's what I've changed (in bold)::
Spoiler: Script
Code:

...
countpokemon
callasm ROUTINE_ONE+1
compare LASTRESULT 0x1
if 0x5 goto @snippet1
msgbox @string1 MSG_NORMAL
call @snippet2
callasm ROUTINE_TWO+1
bufferpartypokemon 0x0 0x0
bufferboxname 0x1 0x4036
goto @snippet4

//---------------
#org @snippet2
special 0xa2
waitstate
Compare 0x8004 0xff
if 0x1 goto @fail
special2 lastresult 0x149
compare lastresult 0x19c
if 0x1 goto 0x8209b46//name rater saying "now now that is merely an egg

return

//---------------
#org @fail
msgbox @string5 MSG_NORMAL
release
end

#org @string5
= Oh well, come back soon.




Routine 1:
Spoiler:
Code:

.thumb

main:
    push {r4-r7, lr}
    ldr r0, =(0x020375f0) @ var_800D
    ldrh r0, [r0]
    sub r0, #2 @ party size - 1
    mov r4, r0
    mov r5, #0

box_loop:
    mov r6, #0 @ box_id
    mov r7, #0 @ pos_in_box

pokemon_in_box_loop:
    mov r0, r6
    mov r1, r7
    ldr r3, =(0x080d2094+1) @ pokemon_by_box_and_position (getboxedmonptr)
    bl call_via_r3
    mov r1, #0xB @ req_species
    ldr r3, =(0x0806a674+1) @ pokemon_getattr_encrypted (getboxmondata)
    bl call_via_r3
    cmp r0, #0
    beq empty_space_found

next_loop:
    add r7, #1
    cmp r7, #30
    bls pokemon_in_box_loop

completed_current_box:
    add r6, #1
    cmp r6, #14
    bge not_enough_space
    mov r7, #0
    b pokemon_in_box_loop

empty_space_found:
    add r5, #1
    cmp r5, r4
    bls next_loop

enough_space:
    mov r0, #1
    b end

not_enough_space:
    mov r0, #0

end:
    ldr r1, =(0x020375f0) @ var_800D
    str r0, [r1]
    pop {r4-r7}
    pop {r3}

call_via_r3:
    bx r3

.pool




Routine 2
Spoiler:
Code:

.thumb

main:
    push {r4-r6,lr}
   ldr r4, =(0x020375e0) @ var_8004
    ldrh r4, [r4]
    ldr r5, =(0x020244ec) @ party_player

    mov r6, #0

loop:
    cmp r6, #6
    beq continue
    cmp r6, r4
    beq skip
    mov r1, #0x64
    mul r1, r6
    add r0, r1, r5
    ldr r3, =(0x0806b490|1) @ pokemon_add_to_pc
    bl call_via_r3

skip:
    add r6, #1
    b loop

continue:
    mov r1, #0x64
    mul r1, r4
    add r1, r5
    mov r0, r5
    mov r2, #0x64
    ldr r3, =(0x082e93d4|1) @ memcpy
    bl call_via_r3
    ldr r0, =(0x020244ec+0x64) @ second Pokémon party address
    ldr r1, =(0x082e9804) @ just a random 500 (dec) 00 bytes in the ROM

    ldrh r2, =(0x1F4)
    ldr r3, =(0x082e93d4|1) @ memcpy
    bl call_via_r3
    pop {r4-r6}
    pop {r3}

call_via_r3:
    bx r3

.pool



Spherical Ice June 3rd, 2018 7:31 AM

Quote:

Originally Posted by luuma (Post 9884662)
I've managed to adapt routine 2 for emerald, but routine 1 is still not checking for filled boxes correctly. Keeps coming back as fine when there isn't any space left. Which isn't really a huge issue, it's a very unlikely outlier case, but it's still not great.

Does this only happen with your Emerald port, or is it an issue with my routine too? Because I've just tested it in my ROM and it works properly with all 14 boxes being full or having less than 5 empty spaces (or however many it takes to empty the party).

Quote:

Originally Posted by luuma (Post 9884662)
Another thing I should mention is that you need a failsafe for special 0x9f/0xa2 in the .xse script in case the player presses B or cancels, or the routine will try to carry on while producing a bad egg. Include
Code:

Compare 0x8004 0xff
if 0x1 goto @fail


after the waitstate command

Yup, I myself noticed this when troubleshooting in my hack. Another edge case that is worth noting that you missed out is if the player selects an Egg: I'll update the FR script, and I assume an equivalent to special 0x147 exists in Emerald which you can use.

luuma June 3rd, 2018 8:09 AM

Quote:

Originally Posted by Spherical Ice (Post 9884864)
Does this only happen with your Emerald port, or is it an issue with my routine too?

Presumably just my emerald port, sorry to have bothered you. I'll give the asms in emerald a look this eve, I assumed FR 0x8BA18 was the same routine as EM 0xd1d30 because they were described in the same way in documentation, but I'm now realising I haven't even checked. Will take a look at the actual contents of the fr asm linked this eve and see if I can find anything similar in emerald

I'm guessing you've tried with e.g 2 pokemon in party needing depositing with 2 empty spaces cause besides that, I think thatcould be the only difference with how we tested. I'll try that myself too (would make little sense if that was the reason but still worth a look)

Thanks for spotting that I needed a failsafe for eggs! Emerald special is 0x149 iirc in this case, before I forget



Edit: I actually think I have a question for you!
Am i being dumb as hell or could I make routine 2 delete all pokemon but one by simply cutting out the one part that actively transfers to a pc box? my asm knowledge is appalling but I can just cut out
ldr r3, =(0x0806b490|1) @ pokemon_add_to_pc
right? the lines above are just lining up to use that routine on the correct pokemon, as far as i can tell

Spherical Ice June 3rd, 2018 1:41 PM

Quote:

Originally Posted by luuma (Post 9884870)
I actually think I have a question for you!
Am i being dumb as hell or could I make routine 2 delete all pokemon but one by simply cutting out the one part that actively transfers to a pc box? my asm knowledge is appalling but I can just cut out
ldr r3, =(0x0806b490|1) @ pokemon_add_to_pc
right? the lines above are just lining up to use that routine on the correct pokemon, as far as i can tell

Oh, my bad, I did some further testing and it does indeed not work properly. I can give rewriting it a go.

As for your question, routine 2 is supposed to:

- Take the pokemon slot number in 0x8004 that was received by the special called before this routine
- Loop through the all six slots of the player's party
-- Deposit the current slot's Pokémon to the box if it is not equal to the slot in 0x8004
- Copy the data of the Pokémon in the slot in 0x8004 and paste it in the first slot of the party
- Copy 500 00 bytes and paste them at the second slot of the party, erasing the rest of the player's party, to avoid the Pokémon from being duplicated if its slot was not the first slot

luuma June 3rd, 2018 4:19 PM

Quote:

Originally Posted by Spherical Ice (Post 9884980)
Oh, my bad, I did some further testing and it does indeed not work properly. I can give rewriting it a go.

As for your question, routine 2 is supposed to:

That would be awesome but it's not something I really need that much. I can just put it in as a bug report honestly. twelve years down the line we'll maybe see some poor soul on the wayback machine losing a high level pokemon to whatever trash they were ev grinding

Alright to get my deletion routine I've just changed cmp r6 #6 to cmp r6 #0. Not exactly efficient but it's a neat trick for anyone who wants all but their first mon to get deleted at some point (like I do).

Many thanks for routine 2, it is a beaut!

Spherical Ice June 5th, 2018 6:39 AM

Quote:

Originally Posted by luuma (Post 9885017)
That would be awesome but it's not something I really need that much. I can just put it in as a bug report honestly. twelve years down the line we'll maybe see some poor soul on the wayback machine losing a high level pokemon to whatever trash they were ev grinding

Alright to get my deletion routine I've just changed cmp r6 #6 to cmp r6 #0. Not exactly efficient but it's a neat trick for anyone who wants all but their first mon to get deleted at some point (like I do).

Many thanks for routine 2, it is a beaut!

I've rewritten routine 1 and it seems like it's working properly now, from the tests I've done.

Code:

.thumb

main:
    push {r4-r7, lr}
    ldr r0, =(0x020370D0) @ var_800D
    ldrh r0, [r0]
    sub r0, #2 @ party size - 1
    mov r4, r0
    mov r5, #0

box_loop:
    mov r6, #0 @ box_id
    mov r7, #0 @ pos_in_box

pokemon_in_box_loop:
    mov r0, r6
    mov r1, r7
    ldr r3, =(0x0808BD30+1) @ pokemon_by_box_and_position
    bl call_via_r3
    mov r1, #0xB @ req_species
    ldr r3, =(0x0803FD44+1) @ pokemon_getattr_encrypted
    bl call_via_r3
    cmp r0, #0
    beq empty_space_found

next_loop:
    add r7, #1
    cmp r7, #30
    bls pokemon_in_box_loop

completed_current_box:
    add r6, #1
    cmp r6, #14
    bge not_enough_space
    mov r7, #0
    b pokemon_in_box_loop

empty_space_found:
    add r5, #1
    cmp r5, r4
    bls next_loop

enough_space:
    mov r0, #1
    b end

not_enough_space:
    mov r0, #0

end:
    ldr r1, =(0x020370D0) @ var_800D
    str r0, [r1]
    pop {r4-r7}
    pop {r3}

call_via_r3:
    bx r3

.pool


I've updated my initial post with the routines as well. You should be able to port this to Emerald quite easily.

luuma June 5th, 2018 9:48 AM

Quote:

Originally Posted by Spherical Ice (Post 9885684)
I've rewritten routine 1 and it seems like it's working properly now, from the tests I've done.

Awesome job! Here it is for emerald, and it also works perfectly here as far as I can tell.
Code:

.thumb

main:
    push {r4-r7, lr}
    ldr r0, =(0x020375f0) @ var_800D
    ldrh r0, [r0]
    sub r0, #2 @ party size - 1
    mov r4, r0
    mov r5, #0

box_loop:
    mov r6, #0 @ box_id
    mov r7, #0 @ pos_in_box

pokemon_in_box_loop:
    mov r0, r6
    mov r1, r7
    ldr r3, =(0x080d2094+1) @ pokemon_by_box_and_position (getboxedmonptr)
    bl call_via_r3
    mov r1, #0xB @ req_species
    ldr r3, =(0x0806a674+1) @ pokemon_getattr_encrypted (getboxmondata)
    bl call_via_r3
    cmp r0, #0
    beq empty_space_found

next_loop:
    add r7, #1
    cmp r7, #30
    bls pokemon_in_box_loop

completed_current_box:
    add r6, #1
    cmp r6, #14
    bge not_enough_space
    mov r7, #0
    b pokemon_in_box_loop

empty_space_found:
    add r5, #1
    cmp r5, r4
    bls next_loop

enough_space:
    mov r0, #1
    b end

not_enough_space:
    mov r0, #0

end:
    ldr r1, =(0x020375f0) @ var_800D
    str r0, [r1]
    pop {r4-r7}
    pop {r3}

call_via_r3:
    bx r3

.pool



Lancekoijerwillborough June 11th, 2018 1:53 AM

Quote:

Originally Posted by chestertagat (Post 9705759)
I don't know if anyone here has already posted this one,
But i'm sure someone researched this and used it in their hack. (BTW It's Glazed if you don't know)
Credits to: TheCreatorofGlazed for the wonderful Idea, BluRose for the Initialization and Touched Sensei for everything else.

Here it is:

[FR] Text Display Input Routine
Basically what this do is get an input from user via naming_function and stores it somewhere in the ram then compare it to some string you can define.

Note: I'm not GOOD at ASM so don't judge me if i said something wrong or explained something wrong. Please point it out instead . It's just that those ones who I asked to help me are very GOOOOOOOOOOOOD at ASM.
Routine:
Spoiler:
Code:

.text
.align 2

main:
        push {r4, lr}
        sub sp, #8
        mov r0, #0x4              @Type: 0-4 , 4=rival 3=Pokemon
        ldr r1, fcode_buffer
        mov r2, #0
        mov r3, #0
        mov r4, #0
        str r4, [sp]
        adr r4, continue
                add r4, #1
        str r4, [sp, #4]
        ldr r4, display_text
        bl call_via_r4
        add sp, #8
        pop {r4, pc}

.align 2
display_text: .word 0x0809d954|1

continue:
        push {r4, lr}
        ldr r0,fcode_buffer
        ldr r1, real_password
        ldr r1, [r1]
                ldr r4, strcomp
        bl call_via_r4
        cmp r0, #0
        beq matched
        mov r0, #0
        b return

matched:
        mov r0, #1

return:
                ldr r1, var_800D
        strh r0, [r1]
        ldr r4, =0x080568E0|1
        bl call_via_r4
        pop {r4, pc}

call_via_r4:
        bx r4

.align 2
strcomp:      .word 0x08008E28|1
fcode_buffer: .word 0x02021CE0
real_password:.word 0x03000EB0+0x64
var_800D:    .word 0x020370D0



Instruction:
Spoiler:

You can define your password by putting :
loadpointer 0 @password
before the callasm. (note: you can't set your password more than the max Characters in the Input or else it will fail)
#org @password
= yourpass (yes you treat it like a msgstring and also remember the note above)
and what does this do if the input matches your password?
it sets var 0x800D to 1
and if not ViceVersa
and also. instead of defining the password on your script , you can point it out at any address in the rom as long as it's a string that is not more than the max input char.
you can do that by changing the label real_password to the address of your password.

That's it .
and another one , You can also change the "Rival's Name" text or "PKMN name" if you found out how to do that . It'll be really helpful :)
This Routine can be used for many things not just for Password System. You can use it to name People in your game , It's up to you.

and also feel free to ask what is what :D

Hello everyone, I edited this routine to support the byte manipulation using vars so we don't have to shift bits just for us to use icon above 0xFF.

Spoiler:

Code:

.text
.align 2

main:
        push {r4, lr}
        sub sp, #8
        ldr r0, var_8000              @set this to 0x1 or 0x2 for Pokemon_nicknaming and 0x4 for rival (if you change it to Rival im not sure if it will require additional args)
        ldrb r0, [r0]
        ldr r1, fcode_buffer
        ldr r2, var_8001
        ldrh r2, [r2]
        mov r3, #0
        mov r4, #0
        str r4, [sp]
        adr r4, continue
        add r4, #1
        str r4, [sp, #4]
        ldr r4, display_text
        bl call_via_r4
        add sp, #8
        pop {r4, pc}

.align 2
display_text: .word 0x0809d954|1

continue:
        push {r4, lr}
        ldr r0,fcode_buffer
        ldr r1, real_password
        ldr r1, [r1]
                ldr r4, strcomp
        bl call_via_r4
        cmp r0, #0
        beq matched
        mov r0, #0
        b return

matched:
        mov r0, #1

return:
                ldr r1, var_800D
        strh r0, [r1]
        ldr r4, =0x080568E0|1
        bl call_via_r4
        pop {r4, pc}

call_via_r4:
        bx r4

.align 2
strcomp:      .word 0x08008E28|1
fcode_buffer: .word 0x02021CE0
real_password:.word 0x03000EB0+0x64
var_800D:    .word 0x020370D0
var_8000:    .word 0x020370B8
var_8001:    .word 0x020370BA




For Variable 0x8000:
set it to 3 if you want Pokemon icons to be used
set it to anything if you want other formats (do not use bytes above 0x04 if you haven't expanded the table yet)

For Variable 0x8001:
Set it to the index number of your desired Pokemon Icon.

Do not forget to add "waitstate" command after calling the ASM.

Doing this will save you some spaces as you don't have to make many routines if you are wanting for a multiple password formats.

All credits goes to chestertagat and BluRose.

UltimaSoul June 20th, 2018 6:17 PM

Quote:

Originally Posted by Xencleamas (Post 9821663)
I have modified and enhanced azurile13's (credits and kudos to him) routine to make this supported on the Compiler's THUMB.bat. These are the things I modified:
  • Added routines creating the hooks that are to be copy-pasted on their respective locations. There are 11 hooks.
  • Added the master location of the routine in which the hooks will create locations for those routines. Insert your free space on .equ MyLoc. Format: 0x###### (Hexadecimal Number)
  • Created and added a new index list of Pokmon up to Generation VI including the formes in style of KDS/Chacha Dinosaur from the filenames of MrDollSteak's sprites in his Sugimori and Gen VI threads. I think there is no master index list for Generation VII. If there is, please PM me and I will add those.
  • With the list created as stated above, you will just have to create your own Regional Pokdex by copy-pasting from your Excel and Notepad file to below "regional_dex_order" and .hword 0x0000 should be first in the list. Make sure the names are all CAPS-LOCKED. In case of Nidorans, Farfetch'd, Mr. Mime, Ho-Oh, Mime Jr., Porygon-Z, and Flabb, their characters are changed so you'll have to look for them in the master list. NOTE: Cohagrigus have been filtered out and changed into asterisks (*). Remember to correct its name before generating the binary file otherwise the .asm file won't work.

Custom Regional Pokdex for FireRed:
Spoiler:
Code:

.thumb
.align

.equ number_of_mons_in_regional_dex, 202 @or however long you wanted your regional dex to be
.equ number_of_mons_in_national_dex, 386
.equ MyLoc, 0x888888 @insert your location here
.equ RomAreaOffset,        0x8000000

@Kanto

.equ UNKNOWN, 0x0
.equ BULBASAUR, 0x1
.equ IVYSAUR, 0x2
.equ VENUSAUR, 0x3
.equ CHARMANDER, 0x4
.equ CHARMELEON, 0x5
.equ CHARIZARD, 0x6
.equ SQUIRTLE, 0x7
.equ WARTORTLE, 0x8
.equ BLASTOISE, 0x9
.equ CATERPIE, 0xA
.equ METAPOD, 0xB
.equ BUTTERFREE, 0xC
.equ WEEDLE, 0xD
.equ KAKUNA, 0xE
.equ BEEDRILL, 0xF
.equ PIDGEY, 0x10
.equ PIDGEOTTO, 0x11
.equ PIDGEOT, 0x12
.equ RATTATA, 0x13
.equ RATICATE, 0x14
.equ SPEAROW, 0x15
.equ FEAROW, 0x16
.equ EKANS, 0x17
.equ ARBOK, 0x18
.equ PIKACHU, 0x19
.equ RAICHU, 0x1A
.equ SANDSHREW, 0x1B
.equ SANDSLASH, 0x1C
.equ NIDORAN_F, 0x1D
.equ NIDORINA, 0x1E
.equ NIDOQUEEN, 0x1F
.equ NIDORAN_M, 0x20
.equ NIDORINO, 0x21
.equ NIDOKING, 0x22
.equ CLEFAIRY, 0x23
.equ CLEFABLE, 0x24
.equ VULPIX, 0x25
.equ NINETALES, 0x26
.equ JIGGLYPUFF, 0x27
.equ WIGGLYTUFF, 0x28
.equ ZUBAT, 0x29
.equ GOLBAT, 0x2A
.equ ODDISH, 0x2B
.equ GLOOM, 0x2C
.equ VILEPLUME, 0x2D
.equ PARAS, 0x2E
.equ PARASECT, 0x2F
.equ VENONAT, 0x30
.equ VENOMOTH, 0x31
.equ DIGLETT, 0x32
.equ DUGTRIO, 0x33
.equ MEOWTH, 0x34
.equ PERSIAN, 0x35
.equ PSYDUCK, 0x36
.equ GOLDUCK, 0x37
.equ MANKEY, 0x38
.equ PRIMEAPE, 0x39
.equ GROWLITHE, 0x3A
.equ ARCANINE, 0x3B
.equ POLIWAG, 0x3C
.equ POLIWHIRL, 0x3D
.equ POLIWRATH, 0x3E
.equ ABRA, 0x3F
.equ KADABRA, 0x40
.equ ALAKAZAM, 0x41
.equ MACHOP, 0x42
.equ MACHOKE, 0x43
.equ MACHAMP, 0x44
.equ BELLSPROUT, 0x45
.equ WEEPINBELL, 0x46
.equ VICTREEBEL, 0x47
.equ TENTACOOL, 0x48
.equ TENTACRUEL, 0x49
.equ GEODUDE, 0x4A
.equ GRAVELER, 0x4B
.equ GOLEM, 0x4C
.equ PONYTA, 0x4D
.equ RAPIDASH, 0x4E
.equ SLOWPOKE, 0x4F
.equ SLOWBRO, 0x50
.equ MAGNEMITE, 0x51
.equ MAGNETON, 0x52
.equ FARFETCH_D, 0x53
.equ DODUO, 0x54
.equ DODRIO, 0x55
.equ SEEL, 0x56
.equ DEWGONG, 0x57
.equ GRIMER, 0x58
.equ MUK, 0x59
.equ SHELLDER, 0x5A
.equ CLOYSTER, 0x5B
.equ GASTLY, 0x5C
.equ HAUNTER, 0x5D
.equ GENGAR, 0x5E
.equ ONIX, 0x5F
.equ DROWZEE, 0x60
.equ HYPNO, 0x61
.equ KRABBY, 0x62
.equ KINGLER, 0x63
.equ VOLTORB, 0x64
.equ ELECTRODE, 0x65
.equ EXEGGCUTE, 0x66
.equ EXEGGUTOR, 0x67
.equ CUBONE, 0x68
.equ MAROWAK, 0x69
.equ HITMONLEE, 0x6A
.equ HITMONCHAN, 0x6B
.equ LICKITUNG, 0x6C
.equ KOFFING, 0x6D
.equ WEEZING, 0x6E
.equ RHYHORN, 0x6F
.equ RHYDON, 0x70
.equ CHANSEY, 0x71
.equ TANGELA, 0x72
.equ KANGASKHAN, 0x73
.equ HORSEA, 0x74
.equ SEADRA, 0x75
.equ GOLDEEN, 0x76
.equ SEAKING, 0x77
.equ STARYU, 0x78
.equ STARMIE, 0x79
.equ MR_MIME, 0x7A
.equ SCYTHER, 0x7B
.equ JYNX, 0x7C
.equ ELECTABUZZ, 0x7D
.equ MAGMAR, 0x7E
.equ PINSIR, 0x7F
.equ TAUROS, 0x80
.equ MAGIKARP, 0x81
.equ GYARADOS, 0x82
.equ LAPRAS, 0x83
.equ DITTO, 0x84
.equ EEVEE, 0x85
.equ VAPOREON, 0x86
.equ JOLTEON, 0x87
.equ FLAREON, 0x88
.equ PORYGON, 0x89
.equ OMANYTE, 0x8A
.equ OMASTAR, 0x8B
.equ KABUTO, 0x8C
.equ KABUTOPS, 0x8D
.equ AERODACTYL, 0x8E
.equ SNORLAX, 0x8F
.equ ARTICUNO, 0x90
.equ ZAPDOS, 0x91
.equ MOLTRES, 0x92
.equ DRATINI, 0x93
.equ DRAGONAIR, 0x94
.equ DRAGONITE, 0x95
.equ MEWTWO, 0x96
.equ MEW, 0x97
.equ CHIKORITA, 0x98
.equ BAYLEEF, 0x99
.equ MEGANIUM, 0x9A
.equ CYNDAQUIL, 0x9B
.equ QUILAVA, 0x9C
.equ TYPHLOSION, 0x9D
.equ TOTODILE, 0x9E
.equ CROCONAW, 0x9F
.equ FERALIGATR, 0xA0
.equ SENTRET, 0xA1
.equ FURRET, 0xA2
.equ HOOTHOOT, 0xA3
.equ NOCTOWL, 0xA4
.equ LEDYBA, 0xA5
.equ LEDIAN, 0xA6
.equ SPINARAK, 0xA7
.equ ARIADOS, 0xA8
.equ CROBAT, 0xA9
.equ CHINCHOU, 0xAA
.equ LANTURN, 0xAB
.equ PICHU, 0xAC
.equ CLEFFA, 0xAD
.equ IGGLYBUFF, 0xAE
.equ TOGEPI, 0xAF
.equ TOGETIC, 0xB0
.equ NATU, 0xB1
.equ XATU, 0xB2
.equ MAREEP, 0xB3
.equ FLAAFFY, 0xB4
.equ AMPHAROS, 0xB5
.equ BELLOSSOM, 0xB6
.equ MARILL, 0xB7
.equ AZUMARILL, 0xB8
.equ SUDOWOODO, 0xB9
.equ POLITOED, 0xBA
.equ HOPPIP, 0xBB
.equ SKIPLOOM, 0xBC
.equ JUMPLUFF, 0xBD
.equ AIPOM, 0xBE
.equ SUNKERN, 0xBF
.equ SUNFLORA, 0xC0
.equ YANMA, 0xC1
.equ WOOPER, 0xC2
.equ QUAGSIRE, 0xC3
.equ ESPEON, 0xC4
.equ UMBREON, 0xC5
.equ MURKROW, 0xC6
.equ SLOWKING, 0xC7
.equ MISDREAVUS, 0xC8
.equ UNOWN, 0xC9
.equ WOBBUFFET, 0xCA
.equ GIRAFARIG, 0xCB
.equ PINECO, 0xCC
.equ FORRETRESS, 0xCD
.equ DUNSPARCE, 0xCE
.equ GLIGAR, 0xCF
.equ STEELIX, 0xD0
.equ SNUBBULL, 0xD1
.equ GRANBULL, 0xD2
.equ QWILFISH, 0xD3
.equ SCIZOR, 0xD4
.equ SHUCKLE, 0xD5
.equ HERACROSS, 0xD6
.equ SNEASEL, 0xD7
.equ TEDDIURSA, 0xD8
.equ URSARING, 0xD9
.equ SLUGMA, 0xDA
.equ MAGCARGO, 0xDB
.equ SWINUB, 0xDC
.equ PILOSWINE, 0xDD
.equ CORSOLA, 0xDE
.equ REMORAID, 0xDF
.equ OCTILLERY, 0xE0
.equ DELIBIRD, 0xE1
.equ MANTINE, 0xE2
.equ SKARMORY, 0xE3
.equ HOUNDOUR, 0xE4
.equ HOUNDOOM, 0xE5
.equ KINGDRA, 0xE6
.equ PHANPY, 0xE7
.equ DONPHAN, 0xE8
.equ PORYGON2, 0xE9
.equ STANTLER, 0xEA
.equ SMEARGLE, 0xEB
.equ TYROGUE, 0xEC
.equ HITMONTOP, 0xED
.equ SMOOCHUM, 0xEE
.equ ELEKID, 0xEF
.equ MAGBY, 0xF0
.equ MILTANK, 0xF1
.equ BLISSEY, 0xF2
.equ RAIKOU, 0xF3
.equ ENTEI, 0xF4
.equ SUICUNE, 0xF5
.equ LARVITAR, 0xF6
.equ PUPITAR, 0xF7
.equ TYRANITAR, 0xF8
.equ LUGIA, 0xF9
.equ HO_OH, 0xFA
.equ CELEBI, 0xFB
.equ NOPE, 0xFC
.equ NOPE, 0xFD
.equ NOPE, 0xFE
.equ NOPE, 0xFF
.equ NOPE, 0x100
.equ NOPE, 0x101
.equ NOPE, 0x102
.equ NOPE, 0x103
.equ NOPE, 0x104
.equ NOPE, 0x105
.equ NOPE, 0x106
.equ NOPE, 0x107
.equ NOPE, 0x108
.equ NOPE, 0x109
.equ NOPE, 0x10A
.equ NOPE, 0x10B
.equ NOPE, 0x10C
.equ NOPE, 0x10D
.equ NOPE, 0x10E
.equ NOPE, 0x10F
.equ NOPE, 0x110
.equ NOPE, 0x111
.equ NOPE, 0x112
.equ NOPE, 0x113
.equ NOPE, 0x114
.equ TREECKO, 0x115
.equ GROVYLE, 0x116
.equ SCEPTILE, 0x117
.equ TORCHIC, 0x118
.equ COMBUSKEN, 0x119
.equ BLAZIKEN, 0x11A
.equ MUDKIP, 0x11B
.equ MARSHTOMP, 0x11C
.equ SWAMPERT, 0x11D
.equ POOCHYENA, 0x11E
.equ MIGHTYENA, 0x11F
.equ ZIGZAGOON, 0x120
.equ LINOONE, 0x121
.equ WURMPLE, 0x122
.equ SILCOON, 0x123
.equ BEAUTIFLY, 0x124
.equ CASCOON, 0x125
.equ DUSTOX, 0x126
.equ LOTAD, 0x127
.equ LOMBRE, 0x128
.equ LUDICOLO, 0x129
.equ SEEDOT, 0x12A
.equ NUZLEAF, 0x12B
.equ SHIFTRY, 0x12C
.equ NINCADA, 0x12D
.equ NINJASK, 0x12E
.equ SHEDINJA, 0x12F
.equ TAILLOW, 0x130
.equ SWELLOW, 0x131
.equ SHROOMISH, 0x132
.equ BRELOOM, 0x133
.equ SPINDA, 0x134
.equ WINGULL, 0x135
.equ PELIPPER, 0x136
.equ SURSKIT, 0x137
.equ MASQUERAIN, 0x138
.equ WAILMER, 0x139
.equ WAILORD, 0x13A
.equ SKITTY, 0x13B
.equ DELCATTY, 0x13C
.equ KECLEON, 0x13D
.equ BALTOY, 0x13E
.equ CLAYDOL, 0x13F
.equ NOSEPASS, 0x140
.equ TORKOAL, 0x141
.equ SABLEYE, 0x142
.equ BARBOACH, 0x143
.equ WHISCASH, 0x144
.equ LUVDISC, 0x145
.equ CORPHISH, 0x146
.equ CRAWDAUNT, 0x147
.equ FEEBAS, 0x148
.equ MILOTIC, 0x149
.equ CARVANHA, 0x14A
.equ SHARPEDO, 0x14B
.equ TRAPINCH, 0x14C
.equ VIBRAVA, 0x14D
.equ FLYGON, 0x14E
.equ MAKUHITA, 0x14F
.equ HARIYAMA, 0x150
.equ ELECTRIKE, 0x151
.equ MANECTRIC, 0x152
.equ NUMEL, 0x153
.equ CAMERUPT, 0x154
.equ SPHEAL, 0x155
.equ SEALEO, 0x156
.equ WALREIN, 0x157
.equ CACNEA, 0x158
.equ CACTURNE, 0x159
.equ SNORUNT, 0x15A
.equ GLALIE, 0x15B
.equ LUNATONE, 0x15C
.equ SOLROCK, 0x15D
.equ AZURILL, 0x15E
.equ SPOINK, 0x15F
.equ GRUMPIG, 0x160
.equ PLUSLE, 0x161
.equ MINUN, 0x162
.equ MAWILE, 0x163
.equ MEDITITE, 0x164
.equ MEDICHAM, 0x165
.equ SWABLU, 0x166
.equ ALTARIA, 0x167
.equ WYNAUT, 0x168
.equ DUSKULL, 0x169
.equ DUSCLOPS, 0x16A
.equ ROSELIA, 0x16B
.equ SLAKOTH, 0x16C
.equ VIGOROTH, 0x16D
.equ SLAKING, 0x16E
.equ GULPIN, 0x16F
.equ SWALOT, 0x170
.equ TROPIUS, 0x171
.equ WHISMUR, 0x172
.equ LOUDRED, 0x173
.equ EXPLOUD, 0x174
.equ CLAMPERL, 0x175
.equ HUNTAIL, 0x176
.equ GOREBYSS, 0x177
.equ ABSOL, 0x178
.equ SHUPPET, 0x179
.equ BANETTE, 0x17A
.equ SEVIPER, 0x17B
.equ ZANGOOSE, 0x17C
.equ RELICANTH, 0x17D
.equ ARON, 0x17E
.equ LAIRON, 0x17F
.equ AGGRON, 0x180
.equ CASTFORM, 0x181
.equ VOLBEAT, 0x182
.equ ILLUMISE, 0x183
.equ LILEEP, 0x184
.equ CRADILY, 0x185
.equ ANORITH, 0x186
.equ ARMALDO, 0x187
.equ RALTS, 0x188
.equ KIRLIA, 0x189
.equ GARDEVOIR, 0x18A
.equ BAGON, 0x18B
.equ SHELGON, 0x18C
.equ SALAMENCE, 0x18D
.equ BELDUM, 0x18E
.equ METANG, 0x18F
.equ METAGROSS, 0x190
.equ REGIROCK, 0x191
.equ REGICE, 0x192
.equ REGISTEEL, 0x193
.equ KYOGRE, 0x194
.equ GROUDON, 0x195
.equ RAYQUAZA, 0x196
.equ LATIAS, 0x197
.equ LATIOS, 0x198
.equ JIRACHI, 0x199
.equ DEOXYS, 0x19A
.equ CHIMECHO, 0x19B
.equ EGG, 0x19C
.equ UNOWN_B, 0x19D
.equ UNOWN_C, 0x19E
.equ UNOWN_D, 0x19F
.equ UNOWN_E, 0x1A0
.equ UNOWN_F, 0x1A1
.equ UNOWN_G, 0x1A2
.equ UNOWN_H, 0x1A3
.equ UNOWN_I, 0x1A4
.equ UNOWN_J, 0x1A5
.equ UNOWN_K, 0x1A6
.equ UNOWN_L, 0x1A7
.equ UNOWN_M, 0x1A8
.equ UNOWN_N, 0x1A9
.equ UNOWN_O, 0x1AA
.equ UNOWN_P, 0x1AB
.equ UNOWN_Q, 0x1AC
.equ UNOWN_R, 0x1AD
.equ UNOWN_S, 0x1AE
.equ UNOWN_T, 0x1AF
.equ UNOWN_U, 0x1B0
.equ UNOWN_V, 0x1B1
.equ UNOWN_W, 0x1B2
.equ UNOWN_X, 0x1B3
.equ UNOWN_Y, 0x1B4
.equ UNOWN_Z, 0x1B5
.equ UNOWN_EXCLAMATION, 0x1B6
.equ UNOWN_QUESTION, 0x1B7
.equ TURTWIG, 0x1B8
.equ GROTLE, 0x1B9
.equ TORTERRA, 0x1BA
.equ CHIMCHAR, 0x1BB
.equ MONFERNO, 0x1BC
.equ INFERNAPE, 0x1BD
.equ PIPLUP, 0x1BE
.equ PRINPLUP, 0x1BF
.equ EMPOLEON, 0x1C0
.equ STARLY, 0x1C1
.equ STARAVIA, 0x1C2
.equ STARAPTOR, 0x1C3
.equ BIDOOF, 0x1C4
.equ BIBAREL, 0x1C5
.equ KRICKETOT, 0x1C6
.equ KRICKETUNE, 0x1C7
.equ SHINX, 0x1C8
.equ LUXIO, 0x1C9
.equ LUXRAY, 0x1CA
.equ BUDEW, 0x1CB
.equ ROSERADE, 0x1CC
.equ CRANIDOS, 0x1CD
.equ RAMPARDOS, 0x1CE
.equ SHIELDON, 0x1CF
.equ BASTIODON, 0x1D0
.equ BURMY, 0x1D1
.equ WORMADAM, 0x1D2
.equ MOTHIM, 0x1D3
.equ COMBEE, 0x1D4
.equ VESPIQUEN, 0x1D5
.equ PACHIRISU, 0x1D6
.equ BUIZEL, 0x1D7
.equ FLOATZEL, 0x1D8
.equ CHERUBI, 0x1D9
.equ CHERRIM, 0x1DA
.equ SHELLOS, 0x1DB
.equ GASTRODON, 0x1DC
.equ AMBIPOM, 0x1DD
.equ DRIFLOON, 0x1DE
.equ DRIFBLIM, 0x1DF
.equ BUNEARY, 0x1E0
.equ LOPUNNY, 0x1E1
.equ MISMAGIUS, 0x1E2
.equ HONCHKROW, 0x1E3
.equ GLAMEOW, 0x1E4
.equ PURUGLY, 0x1E5
.equ CHINGLING, 0x1E6
.equ STUNKY, 0x1E7
.equ SKUNTANK, 0x1E8
.equ BRONZOR, 0x1E9
.equ BRONZONG, 0x1EA
.equ BONSLY, 0x1EB
.equ MIME_JR, 0x1EC
.equ HAPPINY, 0x1ED
.equ CHATOT, 0x1EE
.equ SPIRITOMB, 0x1EF
.equ GIBLE, 0x1F0
.equ GABITE, 0x1F1
.equ GARCHOMP, 0x1F2
.equ MUNCHLAX, 0x1F3
.equ RIOLU, 0x1F4
.equ LUCARIO, 0x1F5
.equ HIPPOPOTAS, 0x1F6
.equ HIPPOWDON, 0x1F7
.equ SKORUPI, 0x1F8
.equ DRAPION, 0x1F9
.equ CROAGUNK, 0x1FA
.equ TOXICROAK, 0x1FB
.equ CARNIVINE, 0x1FC
.equ FINNEON, 0x1FD
.equ LUMINEON, 0x1FE
.equ MANTYKE, 0x1FF
.equ SNOVER, 0x200
.equ ABOMASNOW, 0x201
.equ WEAVILE, 0x202
.equ MAGNEZONE, 0x203
.equ LICKILICKY, 0x204
.equ RHYPERIOR, 0x205
.equ TANGROWTH, 0x206
.equ ELECTIVIRE, 0x207
.equ MAGMORTAR, 0x208
.equ TOGEKISS, 0x209
.equ YANMEGA, 0x20A
.equ LEAFEON, 0x20B
.equ GLACEON, 0x20C
.equ GLISCOR, 0x20D
.equ MAMOSWINE, 0x20E
.equ PORYGON_Z, 0x20F
.equ GALLADE, 0x210
.equ PROBOPASS, 0x211
.equ DUSKNOIR, 0x212
.equ FROSLASS, 0x213
.equ ROTOM, 0x214
.equ UXIE, 0x215
.equ MESPRIT, 0x216
.equ AZELF, 0x217
.equ DIALGA, 0x218
.equ PALKIA, 0x219
.equ HEATRAN, 0x21A
.equ REGIGIGAS, 0x21B
.equ GIRATINA, 0x21C
.equ CRESSELIA, 0x21D
.equ PHIONE, 0x21E
.equ MANAPHY, 0x21F
.equ DARKRAI, 0x220
.equ SHAYMIN, 0x221
.equ ARCEUS, 0x222
.equ BURMY_SAND, 0x223
.equ BURMY_TRASH, 0x224
.equ WORMADAM_SAND, 0x225
.equ WORMADAM_THRASH, 0x226
.equ SHELLOS_EAST, 0x227
.equ GASTRODON_EAST, 0x228
.equ ROTOM_HEAT, 0x229
.equ ROTOM_WASH, 0x22A
.equ ROTOM_FROST, 0x22B
.equ ROTOM_FAN, 0x22C
.equ ROTOM_MOW, 0x22D
.equ GIRATINA_ORIGIN, 0x22E
.equ SHAYMIN_SKY, 0x22F
.equ ARCEUS_FIGHT, 0x230
.equ ARCEUS_FLYING, 0x231
.equ ARCEUS_POISON, 0x232
.equ ARCEUS_GROUND, 0x233
.equ ARCEUS_ROCK, 0x234
.equ ARCEUS_BUG, 0x235
.equ ARCEUS_GHOST, 0x236
.equ ARCEUS_STEEL, 0x237
.equ ARCEUS_UNKNOWN, 0x238
.equ ARCEUS_FIRE, 0x239
.equ ARCEUS_WATER, 0x23A
.equ ARCEUS_GRASS, 0x23B
.equ ARCEUS_ELECTRIC, 0x23C
.equ ARCEUS_PSYCHIC, 0x23D
.equ ARCEUS_ICE, 0x23E
.equ ARCEUS_DRAGON, 0x23F
.equ ARCEUS_DARK, 0x240
.equ ARCEUS_FAIRY, 0x241
.equ VICTINI, 0x242
.equ SNIVY, 0x243
.equ SERVINE, 0x244
.equ SERPERIOR, 0x245
.equ TEPIG, 0x246
.equ PIGNITE, 0x247
.equ EMBOAR, 0x248
.equ OSHAWOTT, 0x249
.equ DEWOTT, 0x24A
.equ SAMUROTT, 0x24B
.equ PATRAT, 0x24C
.equ WATCHOG, 0x24D
.equ LILLIPUP, 0x24E
.equ HERDIER, 0x24F
.equ STOUTLAND, 0x250
.equ PURRLOIN, 0x251
.equ LIEPARD, 0x252
.equ PANSAGE, 0x253
.equ SIMISAGE, 0x254
.equ PANSEAR, 0x255
.equ SIMISEAR, 0x256
.equ PANPOUR, 0x257
.equ SIMIPOUR, 0x258
.equ MUNNA, 0x259
.equ MUSHARNA, 0x25A
.equ PIDOVE, 0x25B
.equ TRANQUILL, 0x25C
.equ UNFEZANT, 0x25D
.equ BLITZLE, 0x25E
.equ ZEBSTRIKA, 0x25F
.equ ROGGENROLA, 0x260
.equ BOLDORE, 0x261
.equ GIGALITH, 0x262
.equ WOOBAT, 0x263
.equ SWOOBAT, 0x264
.equ DRILBUR, 0x265
.equ EXCADRILL, 0x266
.equ AUDINO, 0x267
.equ TIMBURR, 0x268
.equ GURDURR, 0x269
.equ CONKELDURR, 0x26A
.equ TYMPOLE, 0x26B
.equ PALPITOAD, 0x26C
.equ SEISMITOAD, 0x26D
.equ THROH, 0x26E
.equ SAWK, 0x26F
.equ SEWADDLE, 0x270
.equ SWADLOON, 0x271
.equ LEAVANNY, 0x272
.equ VENIPEDE, 0x273
.equ WHIRLIPEDE, 0x274
.equ SCOLIPEDE, 0x275
.equ COTTONEE, 0x276
.equ WHIMSICOTT, 0x277
.equ PETILIL, 0x278
.equ LILLIGANT, 0x279
.equ BASCULIN, 0x27A
.equ SANDILE, 0x27B
.equ KROKOROK, 0x27C
.equ KROOKODILE, 0x27D
.equ DARUMAKA, 0x27E
.equ DARMANITAN, 0x27F
.equ MARACTUS, 0x280
.equ DWEBBLE, 0x281
.equ CRUSTLE, 0x282
.equ SCRAGGY, 0x283
.equ SCRAFTY, 0x284
.equ SIGILYPH, 0x285
.equ YAMASK, 0x286
.equ COHAGRIGUS, 0x287
.equ TIRTOUGA, 0x288
.equ CARRACOSTA, 0x289
.equ ARCHEN, 0x28A
.equ ARCHEOPS, 0x28B
.equ TRUBBISH, 0x28C
.equ GARBODOR, 0x28D
.equ ZORUA, 0x28E
.equ ZOROARK, 0x28F
.equ MINCCINO, 0x290
.equ CINCCINO, 0x291
.equ GOTHITA, 0x292
.equ GOTHORITA, 0x293
.equ GOTHITELLE, 0x294
.equ SOLOSIS, 0x295
.equ DUOSION, 0x296
.equ REUNICLUS, 0x297
.equ DUCKLETT, 0x298
.equ SWANNA, 0x299
.equ VANILLITE, 0x29A
.equ VANILLISH, 0x29B
.equ VANILLUXE, 0x29C
.equ DEERLING, 0x29D
.equ SAWSBUCK, 0x29E
.equ EMOLGA, 0x29F
.equ KARRABLAST, 0x2A0
.equ ESCAVALIER, 0x2A1
.equ FOONGUS, 0x2A2
.equ AMOONGUSS, 0x2A3
.equ FRILLISH, 0x2A4
.equ JELLICENT, 0x2A5
.equ ALOMOMOLA, 0x2A6
.equ JOLTIK, 0x2A7
.equ GALVANTULA, 0x2A8
.equ FERROSEED, 0x2A9
.equ FERROTHORN, 0x2AA
.equ KLINK, 0x2AB
.equ KLANG, 0x2AC
.equ KLINKLANG, 0x2AD
.equ TYNAMO, 0x2AE
.equ EELEKTRIK, 0x2AF
.equ EELEKTROSS, 0x2B0
.equ ELGYEM, 0x2B1
.equ BEHEEYEM, 0x2B2
.equ LITWICK, 0x2B3
.equ LAMPENT, 0x2B4
.equ CHANDELURE, 0x2B5
.equ AXEW, 0x2B6
.equ FRAXURE, 0x2B7
.equ HAXORUS, 0x2B8
.equ CUBCHOO, 0x2B9
.equ BEARTIC, 0x2BA
.equ CRYOGONAL, 0x2BB
.equ SHELMET, 0x2BC
.equ ACCELGOR, 0x2BD
.equ STUNFISK, 0x2BE
.equ MIENFOO, 0x2BF
.equ MIENSHAO, 0x2C0
.equ DRUDDIGON, 0x2C1
.equ GOLETT, 0x2C2
.equ GOLURK, 0x2C3
.equ PAWNIARD, 0x2C4
.equ BISHARP, 0x2C5
.equ BOUFFALANT, 0x2C6
.equ RUFFLET, 0x2C7
.equ BRAVIARY, 0x2C8
.equ VULLABY, 0x2C9
.equ MANDIBUZZ, 0x2CA
.equ HEATMOR, 0x2CB
.equ DURANT, 0x2CC
.equ DEINO, 0x2CD
.equ ZWEILOUS, 0x2CE
.equ HYDREIGON, 0x2CF
.equ LARVESTA, 0x2D0
.equ VOLCARONA, 0x2D1
.equ COBALION, 0x2D2
.equ TERRAKION, 0x2D3
.equ VIRIZION, 0x2D4
.equ TORNADUS, 0x2D5
.equ THUNDURUS, 0x2D6
.equ RESHIRAM, 0x2D7
.equ ZEKROM, 0x2D8
.equ LANDORUS, 0x2D9
.equ KYUREM, 0x2DA
.equ KELDEO, 0x2DB
.equ MELOETTA, 0x2DC
.equ GENESECT, 0x2DD
.equ BASCULIN_BLUE, 0x2DE
.equ DARMANITAN_ZEN, 0x2DF
.equ DEERLING_SUMMER, 0x2E0
.equ DEERLING_AUTUMN, 0x2E1
.equ DEERLING_WINTER, 0x2E2
.equ SAWSBUCK_SUMMER, 0x2E3
.equ SAWSBUCK_AUTUMN, 0x2E4
.equ SAWSBUCK_WINTER, 0x2E5
.equ KYUREM_WHITE, 0x2E6
.equ KYUREM_BLACK, 0x2E7
.equ MELOETTA_PIROUETTE, 0x2E8
.equ GENESECT_SHOCK, 0x2E9
.equ GENESECT_BURN, 0x2EA
.equ GENESECT_CHILL, 0x2EB
.equ GENESECT_DOUSE, 0x2EC
.equ TORNADUS_THERIAN, 0x2ED
.equ THUNDURUS_THERIAN, 0x2EE
.equ LANDORUS_THERIAN, 0x2EF
.equ KELDEO_RESOLUTE, 0x2F0
.equ CHESPIN, 0x2F1
.equ QUILLADIN, 0x2F2
.equ CHESNAUGHT, 0x2F3
.equ FENNEKIN, 0x2F4
.equ BRAIXEN, 0x2F5
.equ DELPHOX, 0x2F6
.equ FROAKIE, 0x2F7
.equ FROGADIER, 0x2F8
.equ GRENINJA, 0x2F9
.equ BUNNELBY, 0x2FA
.equ DIGGERSBY, 0x2FB
.equ FLETCHLING, 0x2FC
.equ FLETCHINDER, 0x2FD
.equ TALONFLAME, 0x2FE
.equ SCATTERBUG, 0x2FF
.equ SPEWPA, 0x300
.equ VIVILLON, 0x301
.equ LITLEO, 0x302
.equ PYROAR, 0x303
.equ FLABEBE, 0x304
.equ FLOETTE, 0x305
.equ FLORGES, 0x306
.equ SKIDDO, 0x307
.equ GOGOAT, 0x308
.equ PANCHAM, 0x309
.equ PANGORO, 0x30A
.equ FURFROU, 0x30B
.equ ESPURR, 0x30C
.equ MEOWSTIC, 0x30D
.equ HONEDGE, 0x30E
.equ DOUBLADE, 0x30F
.equ AEGISLASH, 0x310
.equ SPRITZEE, 0x311
.equ AROMATISSE, 0x312
.equ SWIRLIX, 0x313
.equ SLURPUFF, 0x314
.equ INKAY, 0x315
.equ MALAMAR, 0x316
.equ BINACLE, 0x317
.equ BARBARACLE, 0x318
.equ SKRELP, 0x319
.equ DRAGALGE, 0x31A
.equ CLAUNCHER, 0x31B
.equ CLAWITZER, 0x31C
.equ HELIOPTILE, 0x31D
.equ HELIOLISK, 0x31E
.equ TYRUNT, 0x31F
.equ TYRANTRUM, 0x320
.equ AMAURA, 0x321
.equ AURORUS, 0x322
.equ SYLVEON, 0x323
.equ HAWLUCHA, 0x324
.equ DEDENNE, 0x325
.equ CARBINK, 0x326
.equ GOOMY, 0x327
.equ SLIGGOO, 0x328
.equ GOODRA, 0x329
.equ KLEFKI, 0x32A
.equ PHANTUMP, 0x32B
.equ TREVENANT, 0x32C
.equ PUMPKABOO, 0x32D
.equ GOURGEIST, 0x32E
.equ BERGMITE, 0x32F
.equ AVALUGG, 0x330
.equ NOIBAT, 0x331
.equ NOIVERN, 0x332
.equ XERNEAS, 0x333
.equ YVELTAL, 0x334
.equ ZYGARDE, 0x335
.equ DIANCIE, 0x336
.equ HOOPA, 0x337
.equ VOLCANION, 0x338
.equ PYROAR_FEMALE, 0x339
.equ FLABEBE_WHITE, 0x33A
.equ FLABEBE_YELLOW, 0x33B
.equ FLABEBE_ORANGE, 0x33C
.equ FLABEBE_BLUE, 0x33D
.equ FLOETTE_WHITE, 0x33E
.equ FLOETTE_YELLOW, 0x33F
.equ FLOETTE_ORANGE, 0x340
.equ FLOETTE_BLUE, 0x341
.equ FLORGES_WHITE, 0x342
.equ FLORGES_YELLOW, 0x343
.equ FLORGES_ORANGE, 0x344
.equ FLORGES_BLUE, 0x345
.equ MEOWSTIC_FEMALE, 0x346
.equ AEGISLASH_BLADE, 0x347
.equ PUMPKABOO_2, 0x348
.equ PUMPKABOO_3, 0x349
.equ PUMPKABOO_4, 0x34A
.equ GOURGEIST_2, 0x34B
.equ GOURGEIST_3, 0x34C
.equ GOURGEIST_4, 0x34D
.equ HOOPA_UNBOUND, 0x34E
.equ VENUSAUR_MEGA, 0x34F
.equ CHARIZARD_MEGAX, 0x350
.equ CHARIZARD_MEGAY, 0x351
.equ BLASTOISE_MEGA, 0x352
.equ BEEDRILL_MEGA, 0x353
.equ PIDGEOT_MEGA, 0x354
.equ ALAKAZAM_MEGA, 0x355
.equ SLOWBRO_MEGA, 0x356
.equ GENGAR_MEGA, 0x357
.equ KANGASKHAN_MEGA, 0x358
.equ PINSIR_MEGA, 0x359
.equ GYARADOS_MEGA, 0x35A
.equ AERODACTYL_MEGA, 0x35B
.equ MEWTWO_MEGAX, 0x35C
.equ MEWTWO_MEGAY, 0x35D
.equ AMPHAROS_MEGA, 0x35E
.equ STEELIX_MEGA, 0x35F
.equ SCIZOR_MEGA, 0x360
.equ HERACROSS_MEGA, 0x361
.equ HOUNDOOM_MEGA, 0x362
.equ TYRANITAR_MEGA, 0x363
.equ SCEPTILE_MEGA, 0x364
.equ BLAZIKEN_MEGA, 0x365
.equ SWAMPERT_MEGA, 0x366
.equ GARDEVOIR_MEGA, 0x367
.equ SABLEYE_MEGA, 0x368
.equ MAWILE_MEGA, 0x369
.equ AGGRON_MEGA, 0x36A
.equ MEDICHAM_MEGA, 0x36B
.equ MANECTRIC_MEGA, 0x36C
.equ SHARPEDO_MEGA, 0x36D
.equ CAMERUPT_MEGA, 0x36E
.equ ALTARIA_MEGA, 0x36F
.equ BANETTE_MEGA, 0x370
.equ ABSOL_MEGA, 0x371
.equ GLALIE_MEGA, 0x372
.equ SALAMENCE_MEGA, 0x373
.equ METAGROSS_MEGA, 0x374
.equ NOPE, 0x375 @Dunno why but maybe a new Latias out from the Soul Dew routine
.equ NOPE, 0x376 @Dunno why but maybe a new Latios out from the Soul Dew routine
.equ LATIAS_MEGA, 0x377
.equ LATIOS_MEGA, 0x378
.equ RAYQUAZA_MEGA, 0x379
.equ LOPUNNY_MEGA, 0x37A
.equ GARCHOMP_MEGA, 0x37B
.equ LUCARIO_MEGA, 0x37C
.equ ABOMASNOW_MEGA, 0x37D
.equ GALLADE_MEGA, 0x37E
.equ AUDINO_MEGA, 0x37F
.equ DIANCIE_MEGA, 0x380
.equ DEOXYS_NORMAL, 0x381 @Renewal of Deoxys' index
.equ DEOXYS_ATTACK, 0x382 @Renewal of Deoxys' index
.equ DEOXYS_DEFENSE, 0x383 @Renewal of Deoxys' index
.equ DEXOYS_SPEED, 0x384 @Renewal of Deoxys' index
.equ NOPE, 0x385 @Generation VII Pokemon starts here

.org 0x43F90, 0xFF
ldr r1, Hook3
bx r1
.align 2
Hook3: .word RomAreaOffset+dex_seeable_mon_hook+1

.org 0x88EDC, 0xFF
ldr r1, Hook6
bx r1
.align 2
Hook6: .word RomAreaOffset+dex_regional_count_hook+1

.org 0xCE91A, 0xFF
ldr r1, Hook4
bx r1
.align 2
Hook4: .word RomAreaOffset+dex_evolution_fix_hook+1

.org 0x10352C, 0xFF
ldr r1, Hook7
bx r1
.align 2
Hook7: .word RomAreaOffset+dex_display_hook+1

.org 0x10356C, 0xFF
ldr r0, Hook8
bx r0
.align 2
Hook8: .word RomAreaOffset+regional_dex_hook+1

.org 0x1035B4, 0xFF
ldr r1, Hook9
bx r1
.align 2
Hook9: .word RomAreaOffset+store_last_dex_seen_hook+1

.org 0x1035F4, 0xFF
ldr r0, HookA
bx r0
.align 2
HookA: .word RomAreaOffset+lazy_regional_dex_end_hook+1

.org 0x104A66, 0xFF
ldr r1, HookB
bx r1
.align 2
HookB: .word RomAreaOffset+display_regional_num_hook+1

.org 0x104BBC, 0xFF
ldr r2, Hook5
bx r2
.align 2
Hook5: .word RomAreaOffset+dex_display_counts_hook+1

.org 0x106810, 0xFF
ldr r1, Hook2
bx r1
.align 2
Hook2: .word RomAreaOffset+habitat_dex_regional_limit_hook+1

.org 0x106B84, 0xFF
ldr r1, Hook1
bx r1
.align 2
Hook1: .word RomAreaOffset+data_on_capture_hook+1

.org MyLoc, 0xFF
data_on_capture_hook:        @0x08106B84 via r1
        bl species_to_regional_dex_number
        cmp r0, #0x0
        bne capture_display_return
        ldr r0, add_task_no_capture_display
        bx r0

capture_display_return:
        ldr r0, add_task_capture_display
        bx r0

.align 2
.pool

.align 2

habitat_dex_regional_limit_hook:        @0x08106810 via r1
        push {r4, lr}
        mov r4, r0
        bl haz_national_dex_bool
        cmp r0, #0x1
        beq habitat_dex_regional_limit_return        @valid
        mov r0, r4
        bl species_to_regional_dex_number
        cmp r0, #0x0
        beq habitat_dex_regional_limit_return        @not in regional dex, return 0
        mov r0, #0x1

habitat_dex_regional_limit_return:
        pop {r4}
        pop {r1}
        bx r1

.align 2
.pool

.align 2

dex_seeable_mon_hook:        @0x08043F90 via r1
        push {r4, lr}
        mov r4, r0
        bl haz_national_dex_bool
        cmp r0, #0x0
        beq only_regional_numbered
@national
        mov r0, r4
        bl species_to_national_dex_number_1
        b dex_seeable_mon_check_valid_species

only_regional_numbered:
        mov r0, r4
        bl species_to_regional_dex_number

dex_seeable_mon_check_valid_species:
        cmp r0, #0x0
        bne dex_seeable_mon_return
        ldr r0, full_halfword

dex_seeable_mon_return:
        pop {r4}
        pop {r1}
        bx r1
.align
full_halfword:        .word 0xFFFF

.align 2
.pool

.align 2

dex_evolution_fix_hook:        @0x080CE91A via r1
        bl species_to_regional_dex_number
        cmp r0, #0x0        @not in regional dex, invalid
        beq dex_evolution_failure
        ldr r0, dex_evolution_success_return
        bx r0

dex_evolution_failure:
        mov r0, #0x11
        strh r0, [r5, #0x8]
        mov r2, #0x1
        ldr r1, dex_evolution_failure_return
        bx r1

.align 2
.pool

.align 2

dex_display_counts_hook:        @0x08104BBC via r2
        @r0: mode
        push {lr}
        cmp r1, #0x0
        beq call_regional_count
        bl national_pokedex_count
        b dex_display_counts_return

call_regional_count:
        bl dex_regional_count_hook

dex_display_counts_return:
        pop {pc}

.align 2
.pool

.align 2

dex_regional_count_hook:        @0x08088EDC via r1
        push {r4-r6, lr}
        mov r6, r0        @mode
        mov r4, #0x1        @loop
        mov r5, #0x0        @counter

dex_regional_count_loop:
        lsl r0, r4, #0x1        @loop times 2
        adr r1, regional_dex_order
        ldrh r0, [r1, r0]        @req species
        mov r1, r6        @mode
        mov r2, #0x1        @input is SPECIES
        bl dex_flag_check
        add r5, r5, r0
        add r4, #0x1
        ldr r0, regional_dex_limit
        cmp r4, r0
        blo dex_regional_count_loop
        mov r0, r5
        pop {r4-r6, pc}

.align 2
.pool

.align 2

dex_display_hook:        @0x0810352C via r1
        ldr r1, regional_dex_limit
        cmp r0, #0x0
        beq store_dex_limit_and_return
        ldr r1, national_dex_limit

store_dex_limit_and_return:
        str r1, [sp, #0x0]
        ldr r0, regional_dex_limit_return
        bx r0

.align 2
.pool

.align 2

regional_dex_hook:        @0x0810356C via r0
        mov r4, r8
        add r4, #0x1
        lsl r0, r4, #0x1        @index times 2
        adr r1, regional_dex_order
        ldrh r0, [r1, r0]
        bl species_to_national_dex_number_1
        mov r5, r0
        mov r1, #0x0
        ldr r2, regional_dex_hook_return
        bx r2

.align 2
.pool

.align 2

store_last_dex_seen_hook:        @0x081035B4 via r1
        str r0, [r2]
        mov r10, r4
        mov r4, r3
        ldr r0, def_store_string_dex_number
        bx r0

.align 2
.pool

.align 2

lazy_regional_dex_end_hook:        @0x081035F4 via r0
        mov r0, r8
        ldr r1, regional_dex_limit
        cmp r0, r1
        blo regional_dex_hook
        ldr r0, end_dex_display_return
        bx r0

.align 2
.pool

.align 2

display_regional_num_hook:        @0x08104A66 via r1
        mov r5, r0        @save species
        bl haz_national_dex_bool
        cmp r0, #0x0
        beq use_regional_dex_ordering
        ldr r1, dex_malloc_ptr
        ldr r1, [r1]
        add r1, #0x42
        ldrb r1, [r1]
        cmp r1, #0x0        @check if looking at regional dex
        beq use_regional_dex_ordering
        mov r0, r5
        bl species_to_national_dex_number_1
        b display_dex_number_return

use_regional_dex_ordering:
        mov r0, r5
        bl species_to_regional_dex_number       

display_dex_number_return:
        mov r5, r0
        ldr r0, dex_number_display_return
        bx r0

species_to_regional_dex_number:
        adr r3, regional_dex_order
        mov r2, r0        @req species
        mov r0, #0x0        @loop counter
find_regional_number_loop:
        lsl r1, r0, #0x1
        ldrh r1, [r3, r1]
        cmp r1, r2
        beq species_to_regional_dex_return
        add r0, #0x1
        ldr r1, regional_dex_limit
        cmp r0, r1
        bls find_regional_number_loop
        mov r0, #0x0        @not in dex: set number to 0
species_to_regional_dex_return:
        bx lr

species_to_national_dex_number_1:
        ldr r1, f_species_to_nat_dex
        bx r1
.align
f_species_to_nat_dex:        .word 0x08043298 + 1

haz_national_dex_bool:
        ldr r0, f_haz_national_check
        bx r0
.align
f_haz_national_check:        .word 0x0806E25C + 1

dex_flag_check:
        ldr r3, f_dex_flag_check
        bx r3
.align
f_dex_flag_check:        .word 0x08104AB0 + 1

national_pokedex_count:
        ldr r1, f_national_pokedex_count
        bx r1
.align
f_national_pokedex_count:        .word 0x08088E8C + 1

.align
add_task_no_capture_display:        .word 0x08106B90 + 1
add_task_capture_display:        .word 0x08106BA4 + 1
dex_evolution_success_return:        .word 0x080CE948 + 1
dex_evolution_failure_return:        .word 0x080CE924 + 1
regional_dex_limit:        .word number_of_mons_in_regional_dex
national_dex_limit:        .word number_of_mons_in_national_dex
regional_dex_limit_return:        .word 0x0810353a + 1
regional_dex_hook_return:        .word 0x08103578 + 1
def_store_string_dex_number:        .word 0x081035D6 + 1
end_dex_display_return:        .word 0x08103906 + 1
dex_malloc_ptr:                        .word 0x0203ACF0
dex_number_display_return:        .word 0x08104A70 + 1

regional_dex_order:
.hword        0x0000
.hword        TREECKO
.hword        GROVYLE
.hword        SCEPTILE
.hword        TORCHIC
.hword        COMBUSKEN
.hword        BLAZIKEN
.hword        MUDKIP
.hword        MARSHTOMP
.hword        SWAMPERT
.hword        POOCHYENA
.hword        MIGHTYENA
.hword        ZIGZAGOON
.hword        LINOONE
.hword        WURMPLE
.hword        SILCOON
.hword        BEAUTIFLY
.hword        CASCOON
.hword        DUSTOX
.hword        LOTAD
.hword        LOMBRE
.hword        LUDICOLO
.hword        SEEDOT
.hword        NUZLEAF
.hword        SHIFTRY
.hword        TAILLOW
.hword        SWELLOW
.hword        WINGULL
.hword        PELIPPER
.hword        RALTS
.hword        KIRLIA
.hword        GARDEVOIR
.hword        SURSKIT
.hword        MASQUERAIN
.hword        SHROOMISH
.hword        BRELOOM
.hword        SLAKOTH
.hword        VIGOROTH
.hword        SLAKING
.hword        ABRA
.hword        KADABRA
.hword        ALAKAZAM
.hword        NINCADA
.hword        NINJASK
.hword        SHEDINJA
.hword        WHISMUR
.hword        LOUDRED
.hword        EXPLOUD
.hword        MAKUHITA
.hword        HARIYAMA
.hword        GOLDEEN
.hword        SEAKING
.hword        MAGIKARP
.hword        GYARADOS
.hword        AZURILL
.hword        MARILL
.hword        AZUMARILL
.hword        GEODUDE
.hword        GRAVELER
.hword        GOLEM
.hword        NOSEPASS
.hword        SKITTY
.hword        DELCATTY
.hword        ZUBAT
.hword        GOLBAT
.hword        CROBAT
.hword        TENTACOOL
.hword        TENTACRUEL
.hword        SABLEYE
.hword        MAWILE
.hword        ARON
.hword        LAIRON
.hword        AGGRON
.hword        MACHOP
.hword        MACHOKE
.hword        MACHAMP
.hword        MEDITITE
.hword        MEDICHAM
.hword        ELECTRIKE
.hword        MANECTRIC
.hword        PLUSLE
.hword        MINUN
.hword        MAGNEMITE
.hword        MAGNETON
.hword        VOLTORB
.hword        ELECTRODE
.hword        VOLBEAT
.hword        ILLUMISE
.hword        ODDISH
.hword        GLOOM
.hword        VILEPLUME
.hword        BELLOSSOM
.hword        DODUO
.hword        DODRIO
.hword        ROSELIA
.hword        GULPIN
.hword        SWALOT
.hword        CARVANHA
.hword        SHARPEDO
.hword        WAILMER
.hword        WAILORD
.hword        NUMEL
.hword        CAMERUPT
.hword        SLUGMA
.hword        MAGCARGO
.hword        TORKOAL
.hword        GRIMER
.hword        MUK
.hword        KOFFING
.hword        WEEZING
.hword        SPOINK
.hword        GRUMPIG
.hword        SANDSHREW
.hword        SANDSLASH
.hword        SPINDA
.hword        SKARMORY
.hword        TRAPINCH
.hword        VIBRAVA
.hword        FLYGON
.hword        CACNEA
.hword        CACTURNE
.hword        SWABLU
.hword        ALTARIA
.hword        ZANGOOSE
.hword        SEVIPER
.hword        LUNATONE
.hword        SOLROCK
.hword        BARBOACH
.hword        WHISCASH
.hword        CORPHISH
.hword        CRAWDAUNT
.hword        BALTOY
.hword        CLAYDOL
.hword        LILEEP
.hword        CRADILY
.hword        ANORITH
.hword        ARMALDO
.hword        IGGLYBUFF
.hword        JIGGLYPUFF
.hword        WIGGLYTUFF
.hword        FEEBAS
.hword        MILOTIC
.hword        CASTFORM
.hword        STARYU
.hword        STARMIE
.hword        KECLEON
.hword        SHUPPET
.hword        BANETTE
.hword        DUSKULL
.hword        DUSCLOPS
.hword        TROPIUS
.hword        CHIMECHO
.hword        ABSOL
.hword        VULPIX
.hword        NINETALES
.hword        PICHU
.hword        PIKACHU
.hword        RAICHU
.hword        PSYDUCK
.hword        GOLDUCK
.hword        WYNAUT
.hword        WOBBUFFET
.hword        NATU
.hword        XATU
.hword        GIRAFARIG
.hword        PHANPY
.hword        DONPHAN
.hword        PINSIR
.hword        HERACROSS
.hword        RHYHORN
.hword        RHYDON
.hword        SNORUNT
.hword        GLALIE
.hword        SPHEAL
.hword        SEALEO
.hword        WALREIN
.hword        CLAMPERL
.hword        HUNTAIL
.hword        GOREBYSS
.hword        RELICANTH
.hword        CORSOLA
.hword        CHINCHOU
.hword        LANTURN
.hword        LUVDISC
.hword        HORSEA
.hword        SEADRA
.hword        KINGDRA
.hword        BAGON
.hword        SHELGON
.hword        SALAMENCE
.hword        BELDUM
.hword        METANG
.hword        METAGROSS
.hword        REGIROCK
.hword        REGICE
.hword        REGISTEEL
.hword        LATIAS
.hword        LATIOS
.hword        KYOGRE
.hword        GROUDON
.hword        RAYQUAZA
.hword        JIRACHI
.hword        DEOXYS



So I have an addendum to this that allows for Pokmon in the custom regional dex to be seen in the Pokdex Search Modes.

It's a bit hacky, as it technically allows every Pokmon in the National Dex to be seen, so they'll be listed as No. 000 if using the the quoted custom regional dex routine. What it does is hijack the routine for loading each Pokdex Search Mode to increase the limit of the regional dex to 386 Pokmon like the National Dex mode routine does.

If anyone can improve it so that it allows for only custom regional dex Pokmon before getting the National Dex, please do so. My knowledge of ASM hacking is pretty limited, so this is the best I can do for now.

Code:

.thumb
.align

.equ number_of_mons_in_regional_dex, 170 @or however long you wanted your regional dex to be
.equ number_of_mons_in_national_dex, 386
.equ MyLoc, 0x7202E0 @insert your location here
.equ RomAreaOffset,        0x8000000

.org 0x103616, 0xFF
ldr r1, HookAlphabet
bx r1
.align 2
HookAlphabet: .word RomAreaOffset+insert_386_hook_alphabet+1

.org 0x1036B6, 0xFF
ldr r1, HookType
bx r1
.align 2
HookType: .word RomAreaOffset+insert_386_hook_type+1

.org 0x10374E, 0xFF
ldr r1, HookWeight
bx r1
.align 2
HookWeight: .word RomAreaOffset+insert_386_hook_weight+1

.org 0x1037EA, 0xFF
ldr r1, HookHeight
bx r1
.align 2
HookHeight: .word RomAreaOffset+insert_386_hook_height+1

.org MyLoc, 0xFF
insert_386_hook_alphabet: @0x103616 via r1
ldr          r0, national_dex_limit
cmp        r5, r0
bgt          branch_to_finish_loop_alphabet
movs        r0, r5
movs        r1, #0
ldr                r2, alphabet_hook_return
bx                r2

branch_to_finish_loop_alphabet:
ldr                r2, check_finish_loop_alphabet
bx                r2

.align 2
.pool

.align 2

insert_386_hook_type: @0x1036B6 via r1
ldr          r0, national_dex_limit
cmp        r5, r0
bgt          branch_to_finish_loop_type
movs      r0, r5
movs      r1, #0
ldr                r0, type_hook_return
bx                r0

branch_to_finish_loop_type:
ldr                r2, check_finish_loop_type
bx                r2

.align 2
.pool

.align 2

insert_386_hook_weight: @0x10374E via r1
ldr          r0, national_dex_limit
cmp        r5, r0
bgt          branch_to_finish_loop_weight
movs        r0, r5
movs        r1, #0
ldr                r0, weight_hook_return
bx                r0

branch_to_finish_loop_weight:
ldr                r2, check_finish_loop_weight
bx                r2

.align 2
.pool

.align 2

insert_386_hook_height: @0x1037EA via r1
ldr          r0, national_dex_limit
cmp        r5, r0
bgt          branch_to_finish_loop_height
movs        r0, r5
movs        r1, #0
ldr                r0, height_hook_return
bx                          r0

branch_to_finish_loop_height:
ldr                    r2, check_finish_loop_height
bx                          r2

.align 2
.pool

.align 2

national_dex_limit:        .word number_of_mons_in_national_dex
check_finish_loop_alphabet:        .word 0x8103682 + 1
alphabet_hook_return:        .word 0x8103620 + 1
check_finish_loop_type:        .word 0x8103722 + 1
type_hook_return:        .word 0x81036C0 + 1
check_finish_loop_weight:        .word 0x81037BA + 1
weight_hook_return:        .word 0x8103758 + 1
check_finish_loop_height:        .word 0x8103856 + 1
height_hook_return:        .word 0x81037F4 + 1



Lunos June 22nd, 2018 2:58 PM

Quote:

Originally Posted by FBI (Post 8521318)
Quote:

Originally Posted by Touched
HEX EDIT

0x12EB54: 45 66 05 08
0x054A68: 3C 4C
0x054A6A: 20 68
0x054A6C: 00 49
0x054A6E: 01 E0
0x054A7E: 34 4E
0x054B3A: 00 00
0x054B3C: 00 00
0x054A70: REVERSED POINTER TO TEXT CONTAINING YOUR DEFAULT NAME (max 8 chars, last char must be 0)

EDIT: Despite what he says about last char having to be zero, I think its a typo for FF. The name's size limit is 7 bytes (chars) the last byte must be 0xFF (string terminator). If the name is less than 7 characters, pad the remaining characters with 0xFF.

Is there a way to set a pre-defined name for the Rival too though?
Because without something like that, this is what happens In-Game.
https://s20.postimg.cc/uip29y73h/Oud_LQTH.png

Unrelated: Could someone port this routine to Emerald, please?
It's basically FBI's EV/IV Checker, but it uses the Vars 8000-8005 instead of 8005-800A.
He wrote it in a matter of minutes at some point inside the Discord server and I had it saved ever since, but I'd really like to have a version that works with Pokémon Emerald too.
Thanks :)

tkim June 23rd, 2018 10:24 PM

Quote:

Originally Posted by Spherical Ice (Post 9043890)

Nature-affected stats colouring routines [FR]:


CLICK FOR EMERALD

Spoiler:
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.

http://i.imgur.com/8IfVLeT.pnghttp://i.imgur.com/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!



Hi Spherical Ice, could you shorten your routines into one, similar to what MWisBest did for DizzyEgg's? https://www.pokecommunity.com/showpost.php?p=9611218&postcount=1150

Lunos June 27th, 2018 6:03 PM

Quote:

Originally Posted by Skeli- (Post 9743323)
Expanding the Bag Entirely [FR]

I think I'm screwing up somewhere, because I can't get this to work.
Basically, the process as you explain it Skelli is:
Quote:

1) At 0x1083F4, Ctrl+B this: 10 B5 09 4C F1 20 3C 30 C0 00 FA F6 CD FB 20 60 00 28 06 D0 05 48 FA F6 C7 FB 60 60 00 28 00 D0 01 20 10 BC 02 BC 08 47 18 AD 03 02 E3 11 00 00

2) At 0x99E44, Ctrl+B this: 10 49 0C 48 08 60 96 20 40 00 88 80 08 48 88 60 3C 20 08 73 08 48 08 61 1B 20 08 75 07 48 88 61 80 20 08 77 06 48 08 62 24 31 43 20 08 70 70 47 C0 59 02 02 D0 C6 03 02 3C 58 02 02 D0 C4 03 02 B0 58 02 02 8C 98 03 02

3) Save and test.
Correct?
Welp, I can't get more than 44 items.
This is the script that I'm trying, and all the items after Calcium are being omitted: https://pastebin.com/gK3UpwHA

EDIT: I also tried to put all the items after the Calcium in a separate script, but it's useless. I'm just not getting them.
The bag still ends at Calcium, the 44th item.

Skeli June 27th, 2018 6:26 PM

Quote:

Originally Posted by Lunos (Post 9894791)
I think I'm screwing up somewhere, because I can't get this to work.
Basically, the process as you explain it Skelli is:


Correct?
Welp, I can't get more than 44 items.
This is the script that I'm trying, and all the items after Calcium are being omitted: https://pastebin.com/gK3UpwHA

EDIT: I also tried to put all the items after the Calcium in a separate script, but it's useless. I'm just not getting them.
The bag still ends at Calcium, the 44th item.

You need to use it in conjunction with this routine posted by Azurile13:
Code:

.equ largest_pocket_size, 0xF0
.equ largest_pocket_size_plus_one, largest_pocket_size + 1
.equ strings_size,        largest_pocket_size_plus_one * 19

.org 0x1083F4
main:
        push {r4, lr}
        ldr r4, =(0x0203AD18)
        mov r0, #largest_pocket_size_plus_one
        add r0, #0xA0 @Change to 0x3C for 300 items
        lsl r0, #0x3
        bl 0x2B9C @malloc
        str r0, [r4]
        cmp r0, #0x0
        beq return
        ldr r0, =strings_size
        bl 0x2B9C @malloc
        str r0, [r4, #0x4]
        cmp r0, #0x0
        beq return
        mov r0, #0x1

return:
        pop {r4,pc}


It's been modified to allow support for up to 400 items.

Lunos June 27th, 2018 6:33 PM

Quote:

Originally Posted by Skeli- (Post 9894800)
You need to use it in conjunction with this routine posted by Azurile13:
Code:

.equ largest_pocket_size, 0xF0
.equ largest_pocket_size_plus_one, largest_pocket_size + 1
.equ strings_size,        largest_pocket_size_plus_one * 19

.org 0x1083F4
main:
        push {r4, lr}
        ldr r4, =(0x0203AD18)
        mov r0, #largest_pocket_size_plus_one
        add r0, #0xA0 @Change to 0x3C for 300 items
        lsl r0, #0x3
        bl 0x2B9C @malloc
        str r0, [r4]
        cmp r0, #0x0
        beq return
        ldr r0, =strings_size
        bl 0x2B9C @malloc
        str r0, [r4, #0x4]
        cmp r0, #0x0
        beq return
        mov r0, #0x1

return:
        pop {r4,pc}


It's been modified to allow support for up to 400 items.

Isn't that the very first step that I described though?
Quote:

1) At 0x1083F4, Ctrl+B this: 10 B5 09 4C F1 20 3C 30 C0 00 FA F6 CD FB 20 60 00 28 06 D0 05 48 FA F6 C7 FB 60 60 00 28 00 D0 01 20 10 BC 02 BC 08 47 18 AD 03 02 E3 11 00 00
EDIT: Wait, that routine you posted now looks different compared to the one you shared in the post that I quoted before.
I'm confused.

Skeli June 27th, 2018 6:37 PM

Quote:

Originally Posted by Lunos (Post 9894807)
Isn't that the very first step that I described though?

I made a mistake in that post. Assemble the new routine, goto the offset in the routine, and copy what’s there in the .bin file to that offset in your rom.

Lunos June 27th, 2018 6:46 PM

Quote:

Originally Posted by Skeli- (Post 9894809)
I made a mistake in that post. Assemble the new routine, goto the offset in the routine, and copy what’s there in the .bin file to that offset in your rom.

So, what I have to put in 0x1083F4 now is basically:
10 B5 08 4C F1 20 A0 30 C0 00 FA F6 CD FB 20 60 00 28 06 D0 04 48 FA F6 C7 FB 60 60 00 28 00 D0 01 20 10 BD 18 AD 03 02 E3 11 00 00
^ That is the routine that you just gave to me right here.

Then I go to 0x99E44 and Ctrl+B this:
10 49 0C 48 08 60 96 20 40 00 88 80 08 48 88 60 3C 20 08 73 08 48 08 61 1B 20 08 75 07 48 88 61 80 20 08 77 06 48 08 62 24 31 43 20 08 70 70 47 C0 59 02 02 D0 C6 03 02 3C 58 02 02 D0 C4 03 02 B0 58 02 02 8C 98 03 02
As you explained in this post.

And then it should be working?
Because it's not. The Items pocket of my bag is still capping at 44 items.


EDIT: Alright, we were able to solve the issue on Discord.

The procedure is simple and I'm gonna leave it right here in order to avoid any kind of confusion:
1) Compile the routine that Skeli posted right here and Ctrl+B it in 0x1083F4.
2) Compile this ASM Routine that he wrote and Ctrl+B it in 0x99E44.
3) Save and test, but make sure to start a new savefile. Old savefiles will not work.
And that's it.

Here's a quick video showing it in action.

UltimaSoul June 28th, 2018 4:29 PM

Hey everyone. I have another ASM hack to provide.

This ASM hack is one for infinite use of the Elemental Hyper Beam tutor and I've made it so that all of the final starter evolutions have access to their respective ultimate moves just like in newer games as well. It isn't like the other tutors where you can just clear or never set a particular flag just by looking at the flags in the script and it also uses two routines to check for compatibility.

Routine 1:
Code:

.thumb
.align

.equ PKMN_VENUSAUR, 0x3
.equ PKMN_CHARIZARD, 0x6
.equ PKMN_BLASTOISE, 0x9
.equ PKMN_MEGANIUM, 0x9A
.equ PKMN_TYPHLOSION, 0x9D
.equ PKMN_FERALIGATR, 0xA0
.equ PKMN_SCEPTILE, 0x117
.equ PKMN_BLAZIKEN, 0x11A
.equ PKMN_SWAMPERT, 0x11D
.equ MyLoc, 0x720360 @insert your location here
.equ RomAreaOffset,        0x8000000

.org 0x120BF2, 0xFF
ldr r1, Hook
bx r1
.align 2
Hook: .word RomAreaOffset+move_tutor_hook+1

.org MyLoc, 0xFF
move_tutor_hook:
cmp r2, #0x10
beq fire_starter_check_hook
cmp r2, #0x10
bgt watercheck
cmp r2, #0xF
beq grass_starter_check_hook
ldr r1, GeneralMoveTutorCheck
bx r1

.align 2
.pool

.align 2

watercheck:
cmp r2, #0x11
beq water_starter_check_hook
ldr r1, GeneralMoveTutorCheck
bx r1

.align 2
.pool

.align 2

grass_starter_check_hook:
cmp r0, #PKMN_VENUSAUR
beq successlink
cmp r0, #PKMN_MEGANIUM
beq successlink
ldr r1, =PKMN_SCEPTILE
cmp r0, r1
beq successlink
b faillink

.align 2
.pool

.align 2

fire_starter_check_hook:
cmp r0, #PKMN_CHARIZARD
beq successlink
cmp r0, #PKMN_TYPHLOSION
beq successlink
ldr r1, =PKMN_BLAZIKEN
cmp r0, r1
beq successlink
b faillink

.align 2
.pool

.align 2

water_starter_check_hook:
cmp r0, #PKMN_BLASTOISE
beq successlink
cmp r0, #PKMN_FERALIGATR
beq successlink
ldr r1, =PKMN_SWAMPERT
cmp r0, r1
beq successlink
b faillink

.align 2
.pool

.align 2

successlink:
ldr r0, success
bx r0

.align 2
.pool

.align 2

faillink:
ldr r0, fail
bx r0

.align 2
.pool

.align 2

success: .word 0x8120C34 + 1
fail: .word 0x8120C2A + 1
GeneralMoveTutorCheck: .word 0x8120C18 + 1


Routine 1 is for hooking the compatibility check when teaching the move in the party screen.

Routine 2:
Code:

.thumb
.align

.equ PKMN_VENUSAUR, 0
.equ PKMN_CHARIZARD, 2
.equ PKMN_BLASTOISE, 4
.equ PKMN_MEGANIUM, 6
.equ PKMN_TYPHLOSION, 8
.equ PKMN_FERALIGATR, 10
.equ PKMN_SCEPTILE, 12
.equ PKMN_BLAZIKEN, 14
.equ PKMN_SWAMPERT, 16
.equ MyLoc, 0x7203C8 @insert your location here
.equ RomAreaOffset,        0x8000000
.equ move_names, 0x8901800 @change if using a repointed move name table
                                                  @by default this is for MrDollSteak's rombase

.org 0x0CCBC8, 0xFF
add r0, r4, #2

.org 0x0CCBCE, 0xFF
cmp r4, #16

.org 0x0CCBE2, 0xFF
ldrh r1, [r1]

.org 0x0CCBEA, 0xFF
cmp r4, #18

.org 0x0CCC00, 0xFF
ldr r1, Hook
bx r1
.align 2
Hook: .word RomAreaOffset+get_right_move_hook+1

.org 0x0CCC1C, 0xFF
.long RomAreaOffset+Table

.org 0x0CCC28, 0xFF      @comment out if using vanilla move table
.long move_names+0x112A  @comment out if using vanilla move table

.org 0x0CCC50, 0xFF                  @comment out if using vanilla move table
.long move_names+0xF97          @comment out if using vanilla move table

.org 0x0CCC84, 0xFF                  @comment out if using vanilla move table
.long move_names+0xFA4          @comment out if using vanilla move table

.org MyLoc, 0xFF
get_right_move_hook:
cmp r0, #0xFF
bne exit_loop_linker
cmp r7, #PKMN_VENUSAUR
beq frenzy_plant
cmp r7, #PKMN_CHARIZARD
beq blast_burn
cmp r7, #PKMN_BLASTOISE
beq hydro_cannon
cmp r7, #PKMN_MEGANIUM
beq frenzy_plant
cmp r7, #PKMN_TYPHLOSION
beq blast_burn
cmp r7, #PKMN_FERALIGATR
beq hydro_cannon
cmp r7, #PKMN_SCEPTILE
beq frenzy_plant
cmp r7, #PKMN_BLAZIKEN
beq blast_burn
cmp r7, #PKMN_SWAMPERT
beq hydro_cannon
b exit_loop_linker

.align 2
.pool

.align 2

frenzy_plant:
ldr r0, frenzy_plant_buffer
bx r0

.align 2
.pool

.align 2

blast_burn:
ldr r0, blast_burn_buffer
bx r0

.align 2
.pool

.align 2

hydro_cannon:
ldr r0, hydro_cannon_buffer
bx r0

.align 2
.pool

.align 2

exit_loop_linker:
ldr r0, exit_loop
bx r0

.align 2
.pool

.align 2

frenzy_plant_buffer: .word 0x80CCC08 + 1
blast_burn_buffer: .word 0x80CCC38 + 1
hydro_cannon_buffer: .word 0x80CCC5C + 1
exit_loop: .word 0x80CCC7A + 1

.org MyLoc + 0x4C
Table:
VENUSAUR: .hword 0x3
CHARIZARD: .hword 0x6
BLASTOISE: .hword 0x9
MEGANIUM: .hword 0x9A
TYPHLOSION: .hword 0x9D
FERALIGATR: .hword 0xA0
SCEPTILE: .hword 0x117
BLAZIKEN: .hword 0x11A
SWAMPERT: .hword 0x11D


Routine 2 is for hooking the routine run when special2 0x800D/LASTRESULT 0x1A3 is called. This checks the Pokémon in the first party for being eligible by species and having max happiness. Then it sets the appropriate move to be taught into the [buffer2] which is then used in the dialogue when the tutor recognizes that your Pokémon can be taught.

And this is the edited script for the old lady tutor:
Code:

//---------------
#org 0x1C4DEC
special 0x187
compare LASTRESULT 0x2
if 0x1 goto 0x81A7AE0
special 0x188
lock
faceplayer
clearflag 0x2DE
clearflag 0x2DF
clearflag 0x2E0
bufferfirstpokemon 0x0
msgbox 0x81A46C6 MSG_KEEPOPEN //"I perfected the ultimate move of\n..."
special2 LASTRESULT 0x1A3
compare LASTRESULT 0x0
if 0x1 goto 0x81C4F26
copyvar 0x8009 0x8005
compare PLAYERFACING 0x2
if 0x1 call 0x81C4EF0
compare PLAYERFACING 0x1
if 0x1 call 0x81C4EFB
compare PLAYERFACING 0x4
if 0x1 call 0x81C4F06
compare PLAYERFACING 0x3
if 0x1 call 0x81C4F11
msgbox 0x81A4751 MSG_YESNO //"Oh! This is the one!\nThis is the ..."
compare LASTRESULT 0x0
if 0x1 goto 0x81C4F1C
call 0x81C4F37
compare LASTRESULT 0x0
if 0x1 goto 0x81C4F1C
msgbox 0x81A4814 MSG_KEEPOPEN //"You will allow it?\pThen, let me c..."
closeonkeypress
fadescreen 0x1
goto 0x81C4EDA

//---------------
#org 0x1A7AE0
release
end

//---------------
#org 0x1C4F26
msgbox 0x81A4737 MSG_KEEPOPEN //"[.]No[.]\nI was just mistaken."
release
end

//---------------
#org 0x1C4EF0
applymovement 0x1 0x81C4F4C
waitmovement 0x0
return

//---------------
#org 0x1C4EFB
applymovement 0x1 0x81C4F4E
waitmovement 0x0
return

//---------------
#org 0x1C4F06
applymovement 0x1 0x81C4F50
waitmovement 0x0
return

//---------------
#org 0x1C4F11
applymovement 0x1 0x81C4F52
waitmovement 0x0
return

//---------------
#org 0x1C4F1C
msgbox 0x81A47E5 MSG_KEEPOPEN //"Gaah! You reject it?\nNo, I won't ..."
release
end

//---------------
#org 0x1C4F37
textcolor 0x3
special 0x171
signmsg
msgbox 0x81A644F MSG_YESNO //"Do you want to teach this move to\..."
normalmsg
call 0x81A6675
return

//---------------
#org 0x1C4EDA
call 0x81C4F30
compare LASTRESULT 0x0
if 0x1 goto 0x81C4F1C
goto 0x81C4EAB

//---------------
#org 0x1A6675
copyvar 0x8012 0x8013
return

//---------------
#org 0x1C4F30
special 0x18D
waitstate
lock
faceplayer
return

//---------------
#org 0x1C4EAB
copyvar 0x8005 0x8009
special2 LASTRESULT 0x1A4
compare LASTRESULT 0x1
if 0x1 goto 0x81C4ECD
msgbox 0x81A4865 MSG_KEEPOPEN //"Gasp, gasp, gasp[.]\pI didn't thin..."
release
end

//---------------
#org 0x1C4ECD
msgbox 0x81A48F3 MSG_KEEPOPEN //"Gasp, gasp, gasp[.]\pI have no reg..."
setflag 0x2E1
release
end

//---------
// Strings
//---------
#org 0x1A46C6
= I perfected the ultimate move of\nits type[.]\pBut will no one take it for\nfuture use?\p[.]Hm? Hmmm!\pY-you[.]\nTh-that [buffer1][.]

#org 0x1A4751
= Oh! This is the one!\nThis is the Pokémon!\pThis [buffer1] is worthy of\nlearning my ultimate move!\pWill you allow it?\pWill you allow your [buffer1] to\nlearn my [buffer2]?

#org 0x1A4814
= You will allow it?\pThen, let me confer my ultimate\n[buffer2] on your [buffer1].\pGgggrah-awooo!

#org 0x1A4737
= [.]No[.]\nI was just mistaken.

#org 0x1A47E5
= Gaah! You reject it?\nNo, I won't be dissuaded!

#org 0x1A644F
= Do you want to teach this move to\nyour Pokémon?

#org 0x1A4865
= Gasp, gasp, gasp[.]\pI didn't think I could teach that\nmove while I still lived[.]

#org 0x1A48F3
= Gasp, gasp, gasp[.]\pI have no regrets now.\nI've passed on everything I know.\pNow I can live out my life knowing\nmy work is done.

//-----------
// Movements
//-----------
#org 0x1C4F4C
#raw 0x52 //Jump in Place (Facing Down)
#raw 0xFE //End of Movements

#org 0x1C4F4E
#raw 0x53 //Jump in Place (Facing Up)
#raw 0xFE //End of Movements

#org 0x1C4F50
#raw 0x54 //Jump in Place (Facing Left)
#raw 0xFE //End of Movements

#org 0x1C4F52
#raw 0x55 //Jump in Place (Facing Right)
#raw 0xFE //End of Movements


This can be copy-pasted directly into the same location as the old script and it won't overwrite extra data.

Do note the #org 0x1A644F = Do you want to teach this move to\nyour Pokémon? is actually used by other move tutors as well. It replaces the message that tells you it can only be taught once, which doesn't make sense if you've made the tutors infinite use.

You can also change the move table name offset if you are using a custom one, but if you're just using the normal one then comment out the identified routines before compiling.

Also this clears the flags at 0x2DE, 0x2DF, and 0x2E0 which are set by special2 0x800D/LASTRESULT 0x1A4 after teaching each of the moves once allowing for infinite tutoring! This also doesn't set flag 0x2 which prevented you from teaching another move unless you exited the house and came back in again.

If there are any problems, questions, or improvements don't hesitate to reply to this message or PM me.

BluRose July 5th, 2018 5:16 PM

Quote:

Originally Posted by Lunos (Post 9892623)
Unrelated: Could someone port this routine to Emerald, please?
It's basically FBI's EV/IV Checker, but it uses the Vars 8000-8005 instead of 8005-800A.
He wrote it in a matter of minutes at some point inside the Discord server and I had it saved ever since, but I'd really like to have a version that works with Pokémon Emerald too.
Thanks :)

sorry for getting this to you late, mate
i just needed to sit down and do it

Spoiler:
Code:

.thumb
.align 2

main:
    push {r4-r7, lr}
    ldr r5, =(0x20375D8)
    mov r7, r5
    mov r6, r5
    add r5, r5, #0x8
    ldrb r6, [r6]
    mov r0, #0xD
    mul r6, r6, r0 @type * 0xD
    add r6, r6, #0x1A
    ldrb r5, [r5]
    mov r0, #0x64
    mul r5, r5, r0
    ldr r0, =(0x20244EC)
    add r5, r5, r0 @slot address
    mov r4, #0x0

loop:
    cmp r4, #0x6
    bge end
    mov r0, r5
    mov r1, r6
    add r1, r1, r4
    mov r2, SP
    ldr r3, =(0x0806A519)
    bl link_r3
    strh r0, [r7]
    add r4, r4, #0x1
    add r7, r7, #0x2
    b loop

link_r3:
    bx r3 

end:
    pop {r4-r7, pc}

.align 2



Lunos July 5th, 2018 6:33 PM

Quote:

Originally Posted by BluRose (Post 9897699)
sorry for getting this to you late, mate
i just needed to sit down and do it

Spoiler:
Code:

.thumb
.align 2

main:
    push {r4-r7, lr}
    ldr r5, =(0x20375D8)
    mov r7, r5
    mov r6, r5
    add r5, r5, #0x8
    ldrb r6, [r6]
    mov r0, #0xD
    mul r6, r6, r0 @type * 0xD
    add r6, r6, #0x1A
    ldrb r5, [r5]
    mov r0, #0x64
    mul r5, r5, r0
    ldr r0, =(0x20244EC)
    add r5, r5, r0 @slot address
    mov r4, #0x0

loop:
    cmp r4, #0x6
    bge end
    mov r0, r5
    mov r1, r6
    add r1, r1, r4
    mov r2, SP
    ldr r3, =(0x0806A519)
    bl link_r3
    strh r0, [r7]
    add r4, r4, #0x1
    add r7, r7, #0x2
    b loop

link_r3:
    bx r3 

end:
    pop {r4-r7, pc}

.align 2



It seems to be working beautifully, thanks Blu! <3
https://s20.postimg.cc/kefrhb425/kxx_HVw_U.gif

tkim July 9th, 2018 6:56 AM

Quote:

Originally Posted by Spherical Ice (Post 9681830)

[FR] EV-reducing Berries


Spoiler:
Find 0x49C bytes of free space at a word-aligned address, and take note of it.
Set the EV-reducing berries' Type to Type 1 ("Out of battle").
Set the items' Field script pointers to the address you noted, plus 1.
Set the items' Battle script pointer to 0xA2239.
Assemble the following routine, changing 0xXXXXXX to the address you noted (not plus 1).
Open the generated .bin file, navigate to the location address, and select 0x49C bytes.
Copy the bytes and paste them in your ROM, at the same address.

Code:

.thumb

@ -- Change these
.equ start_address, 0x29B110
@ --

.equ rom, 0x08000000

.equ pokemon_length, 0x64

.equ req_species,          0x0B
.equ req_held_item,        0x0C
.equ req_hp_ev,            0x1A
.equ req_atk_ev,            0x1B
.equ req_def_ev,            0x1C
.equ req_spe_ev,            0x1D
.equ req_spatk_ev,          0x1E
.equ req_spdef_ev,          0x1F
.equ req_happiness,        0x20
.equ req_catch_location,    0x23
.equ req_pokeball,          0x26

.equ item_luxuryball,  0x0B
.equ item_pomegberry,  0x99
.equ item_kelpsyberry,  0x9A
.equ item_qualotberry,  0x9B
.equ item_hondewberry,  0x9C
.equ item_grepaberry,  0x9D
.equ item_tomatoberry,  0x9E
.equ item_soothebell,  0xB8

.org start_address, 0xFF
ev_berries:
    push {lr}
    lsl r0, r0, #0x18
    lsr r0, r0, #0x18
    ldr r2, item_function_ptr
    ldr r1, =(rom + dp05_ev_berries + 1)
    str r1, [r2]
    ldr r3, item_consume_maybe
    bl call_via_r3
    pop {r3}

call_via_r3:
    bx r3

.align 2
    item_consume_maybe:    .word 0x080A16D0|1
    .pool

dp05_ev_berries:
    push {r4-r7,lr}
    mov r7, r10
    mov r6, r9
    mov r5, r8
    push {r5-r7}
    sub sp, sp, #0xC
    str r1, [sp, #0]
    lsl r0, r0, #0x18
    lsr r0, r0, #0x18
    mov r10, r0

get_selected_pokemon:
    ldr r4, brm
    ldrb r1, [r4, #9]
    mov r0, #pokemon_length
    mul r1, r0
    ldr r0, party_player
    add r5, r1, r0

determine_berry:
    ldr r0, var_800E
    ldrh r0, [r0]
    lsl r0, r0, #0x10
    lsr r0, r0, #0x10
    sub r0, #(item_pomegberry - 1)
    mov r7, r0

get_ev_req:
    mov r0, r5
    mov r1, r7
    ldr r3, =(rom + get_ev_req_from_berry_id + 1)
    bl call_via_r3
    lsl r0, r0, #0x18
    lsr r0, r0, #0x18
    cmp r0, #0
    beq no_effect
    mov r6, r0

happiness_before:
    mov r0, r5
    mov r1, #req_happiness
    ldr r3, get_attr
    bl call_via_r3
    lsl r0, r0, #0x10
    lsr r0, r0, #0x10
    ldr r1, var_8000
    strh r0, [r1]

ev_value_before:
    mov r0, r5
    mov r1, r6
    mov r2, #0
    ldr r3, get_attr
    bl call_via_r3
    lsl r0, r0, #0x10
    lsr r0, r0, #0x10
    ldr r1, var_8001
    strh r0, [r1]

use_berry:
    mov r0, r5
    mov r1, r6
    ldr r3, =(rom + use_ev_berry + 1)
    bl call_via_r3
    lsl r0, r0, #0x18
    lsr r4, r0, #0x18

ev_after:
    mov r0, r5
    mov r1, r6
    mov r2, #0
    ldr r3, get_attr
    bl call_via_r3
    lsl r0, r0, #0x10
    lsr r0, r0, #0x10
    mov r8, r0

happiness_after:
    mov r0, r5
    mov r1, #req_happiness
    ldr r3, get_attr
    bl call_via_r3
    lsl r0, r0, #0x10
    lsr r0, r0, #0x10
    mov r9, r0

branch_for_effectiveness:
    cmp r4, #0
    bne no_effect
    ldr r0, var_8000
    ldrh r0, [r0]
    cmp r0, r9
    bne effect
    ldr r1, var_8001
    ldrh r1, [r1]
    cmp r1, r8
    bne effect

no_effect:
    ldr r1, item_effectiveness
    mov r0, #0
    strb r0, [r1]
    mov r0, #5
    ldr r3, audio_play
    bl call_via_r3
    ldr r0, no_effect_str
    mov r1, #1
    ldr r3, item_menu_string
    bl call_via_r3
    mov r0, #2
    ldr r3, bgid_mark_for_sync
    bl call_via_r3
    ldr r1, tasks
    mov r2, r10
    lsl r0, r2, #2
    add r0, r10
    lsl r0, r0, #3
    add r0, r0, r1
    ldr r1, [sp]
    str r1, [r0]
    b end

effect:
    mov r0, r10
    ldr r3, item_use_animation
    bl call_via_r3
    ldr r1, item_function_ptr
    ldr r0, =(rom + berry_use + 1)
    str r0, [r1]

end:
    add sp, sp, #0xC
    pop {r3-r5}
    mov r8, r3
    mov r9, r4
    mov r10, r5
    pop {r4-r7}
    pop {r0}
    bx r0

.align 2
    item_function_ptr:      .word 0x03005E98
    .pool

berry_use:
    push {r4-r7,lr}
    lsl r0, r0, #0x18
    lsr r5, r0, #0x18
    ldr r1, item_effectiveness
    mov r0, #1
    strb r0, [r1]

sound_fx:
    mov r0, #1
    ldr r3, audio_play
    bl call_via_r3

remove_item:
    ldr r0, var_800E
    ldrh r0, [r0]
    mov r1, #1
    ldr r3, bag_remove_item
    bl call_via_r3

get_selected_pokemon_again:
    ldr r4, brm
    ldrb r1, [r4, #9]
    mov r0, #pokemon_length
    mul r1, r0
    ldr r0, party_player
    add r4, r1, r0

determine_berry_again:
    ldr r0, var_800E
    ldrh r0, [r0]
    lsl r0, r0, #0x10
    lsr r0, r0, #0x10
    sub r0, #(item_pomegberry - 1)
    mov r7, r0

get_ev_req_again:
    mov r0, r4
    mov r1, r7
    ldr r3, =(rom + get_ev_req_from_berry_id + 1)
    bl call_via_r3
    lsl r0, r0, #0x18
    lsr r1, r0, #0x18

ev_after_again:
    mov r0, r4
    mov r2, #0
    ldr r3, get_attr
    bl call_via_r3
    lsl r0, r0, #0x10
    lsr r0, r0, #0x10
    mov r8, r0

happiness_after_again:
    mov r0, r4
    mov r1, #req_happiness
    ldr r3, get_attr
    bl call_via_r3
    lsl r0, r0, #0x10
    lsr r0, r0, #0x10
    mov r9, r0

buffer_pkmn_nick_to_buffer2:
    ldr r1, fcode_buffer2
    mov r0, r4
    ldr r3, buffer_pkmn_nick
    bl call_via_r3

buffer_stat_name_to_buffer3:
    ldr r1, fcode_buffer3
    mov r0, r7
    ldr r3, =(rom + buffer_stat_name + 1)
    bl call_via_r3

branch_for_string:
    ldr r0, var_8000
    ldrh r0, [r0]
    cmp r0, r9
    beq happiness_at_max
    ldr r0, var_8001
    ldrh r0, [r0]
    cmp r0, r8
    beq ev_at_0

happiness_not_at_max_ev_above_0:
    ldr r0, displayed_string
    ldr r1, =(rom + happiness_not_at_max_ev_above_0_str)
    ldr r3, fdecoder
    bl call_via_r3
    b load_displayed_string

ev_at_0:
    ldr r0, displayed_string
    ldr r1, =(rom + happiness_up_ev_cant_fall_str)
    ldr r3, fdecoder
    bl call_via_r3
    b load_displayed_string

happiness_at_max:
    ldr r0, displayed_string
    ldr r1, =(rom + adore_ev_down_str)
    ldr r3, fdecoder
    bl call_via_r3

load_displayed_string:
    ldr r0, displayed_string

print_item_message:
    mov r1, #1
    ldr r3, item_menu_string
    bl call_via_r3
    mov r0, #2
    ldr r3, bgid_mark_for_sync
    bl call_via_r3
    ldr r1, tasks
    mov r2, r5
    lsl r0, r2, #2
    add r0, r0, r5
    lsl r0, r0, #3
    add r0, r0, r1
    ldr r1, item_menu_callback
    str r1, [r0]
    pop {r4-r7}
    pop {r0}
    bx r0

.align 2
get_ev_req_from_berry_id:
    push {r4-r7,lr}
    mov r4, r0
    lsl r1, r1, #0x18
    lsr r1, r1, #0x18
    lsl r1, r1, #2
    ldr r0, =(rom + ev_switch_table)
    add r0, r0, r1
    ldr r0, [r0]
    mov pc, r0 @ switch jump

.align 2
ev_switch_table:
    .word (rom + ev_switch_default)
    .word (rom + case_ev_hp)
    .word (rom + case_ev_atk)
    .word (rom + case_ev_def)
    .word (rom + case_ev_spatk)
    .word (rom + case_ev_spdef)
    .word (rom + case_ev_spe)

.align 2
ev_switch_default:
case_ev_hp:
    mov r0, #req_hp_ev
    b return_ev_req

case_ev_atk:
    mov r0, #req_atk_ev
    b return_ev_req

case_ev_def:
    mov r0, #req_def_ev
    b return_ev_req

case_ev_spe:
    mov r0, #req_spe_ev
    b return_ev_req

case_ev_spatk:
    mov r0, #req_spatk_ev
    b return_ev_req

case_ev_spdef:
    mov r0, #req_spdef_ev
    b return_ev_req

ev_return_0:
    mov r0, #0

return_ev_req:
    pop {r4-r7}
    pop {r1}
    bx r1

.align 2
buffer_stat_name:
    push {lr}
    mov r2, r1
    lsl r0, r0, #0x18
    lsr r0, r0, #0x18
    cmp r0, #6
    bgt return_stat_name
    ldr r1, =(rom + stat_name_switch_table)
    lsl r0, r0, #2
    add r0, r0, r1
    ldr r0, [r0]
    mov pc, r0 @ switch jump

stat_name_switch_table:
    .word (rom + stat_name_default)
    .word (rom + case_hp_name)
    .word (rom + case_atk_name)
    .word (rom + case_def_name)
    .word (rom + case_spatk_name)
    .word (rom + case_spdef_name)
    .word (rom + case_spe_name)

stat_name_default:
case_hp_name:
    ldr r1, hp_name_str
    b break_stat_name_switch

case_atk_name:
    ldr r1, atk_name_str
    b break_stat_name_switch

case_def_name:
    ldr r1, def_name_str
    b break_stat_name_switch

case_spe_name:
    ldr r1, spe_name_str
    b break_stat_name_switch

case_spatk_name:
    ldr r1, spatk_name_str
    b break_stat_name_switch

case_spdef_name:
    ldr r1, spdef_name_str

break_stat_name_switch:
    mov r0, r2
    ldr r3, strcpy_xFF_terminated
    bl call_via_r3

return_stat_name:
    pop {r0}
    bx r0

.align 2
use_ev_berry:
    push {r4-r7,lr}
    mov r7, r10
    mov r6, r9
    mov r5, r8
    push {r5-r7}
    lsl r1, r1, #0x18
    lsr r1, r1, #0x18
    mov r8, r0
    mov r7, r1

get_relevant_ev_value:
    mov r0, r8
    mov r1, r7
    mov r2, #0
    ldr r3, get_attr
    bl call_via_r3
    lsl r0, r0, #0x10
    lsr r0, r0, #0x10

check_ev:
    cmp r0, #0
    ble set_ev_unchanged_flag

subtract_ev:
    mov r1, r0
    sub r0, #10
    cmp r0, r1
    blo set_ev
    mov r0, #0

set_ev:
    mov r2, sp
    strh r0, [r2]
    mov r0, r8
    mov r1, r7
    ldr r3, set_attr
    bl call_via_r3

recalc_stats:
    mov r0, r8
    ldr r3, recalculate_stats
    bl call_via_r3
    b get_happiness_value

set_ev_unchanged_flag:
    mov r6, #1

get_happiness_value:
    mov r0, r8
    mov r1, #req_happiness
    mov r2, #0
    ldr r3, get_attr
    bl call_via_r3

check_happiness:
    cmp r0, #255
    beq check_if_should_return_1
    cmp r0, #199
    bgt add_two_happiness
    cmp r0, #99
    bgt add_five_happiness

add_ten_happiness:
    mov r6, #10
    b remember_new_happiness

add_five_happiness:
    mov r6, #5
    b remember_new_happiness

add_two_happiness:
    mov r6, #2

remember_new_happiness:
    add r5, r6, r0

luxuryball_check:
    mov r0, r8
    mov r1, #req_pokeball
    mov r2, #0
    ldr r3, get_attr
    bl call_via_r3
    cmp r0, #item_luxuryball
    bne metlocation_check

luxuryball_bonus:
    add r5, #1
    add r6, #1

metlocation_check:
    mov r0, r8
    mov r1, #req_catch_location
    mov r2, #0
    ldr r3, get_attr
    bl call_via_r3
    mov r4, r0
    ldr r3, sav1_map_get_name
    bl call_via_r3
    lsl r0, r0, #0x18
    lsr r0, r0, #0x18
    cmp r4, r0
    bne soothebell_check

metlocation_bonus:
    add r5, #1
    add r6, #1

soothebell_check:
    mov r0, r8
    mov r1, #req_held_item
    mov r2, #0
    ldr r3, get_attr
    bl call_via_r3
    lsl r0, r0, #0x10
    lsr r0, r0, #0x10
    mov r1, #item_soothebell
    cmp r0, r1
    bne add_happiness

soothebell_bonus:
    lsr r0, r6, #1
    add r5, r0

add_happiness:
    mov r0, r5
    cmp r0, #255
    ble set_happiness
    mov r0, #255

set_happiness:
    mov r2, sp
    strh r0, [r2]
    mov r0, r8
    mov r1, #req_happiness
    ldr r3, set_attr
    bl call_via_r3

return_0:
    mov r0, #0
    b finish_using_ev_berry

check_if_should_return_1:
    cmp r5, #1
    bne return_0

return_1:
    mov r0, #1

finish_using_ev_berry:
    pop {r3-r5}
    mov r8, r3
    mov r9, r4
    mov r10, r5
    pop {r4-r7}
    pop {r1}
    bx r1

happiness_not_at_max_ev_above_0_str:
    .byte 0xFD, 0x02, 0x00, 0xE8, 0xE9, 0xE6, 0xE2, 0xD9, 0xD8, 0x00, 0xDA, 0xE6, 0xDD, 0xD9, 0xE2, 0xD8, 0xE0, 0xED, 0xAD, 0xFE, 0xCE, 0xDC, 0xD9, 0x00, 0xD6, 0xD5, 0xE7, 0xD9, 0x00, 0xFD, 0x03, 0x00, 0xDA, 0xD9, 0xE0, 0xE0, 0xAB, 0xFC, 0x09, 0xFF
    @ "[PKMN] turned friendly.[NEWLINE]The base [STAT] fell![WAITKEYPRESS]"

happiness_up_ev_cant_fall_str:
    .byte 0xFD, 0x02, 0x00, 0xE8, 0xE9, 0xE6, 0xE2, 0xD9, 0xD8, 0x00, 0xDA, 0xE6, 0xDD, 0xD9, 0xE2, 0xD8, 0xE0, 0xED, 0xAD, 0xFE, 0xCE, 0xDC, 0xD9, 0x00, 0xD6, 0xD5, 0xE7, 0xD9, 0x00, 0xFD, 0x03, 0x00, 0xD7, 0xD5, 0xE2, 0xB4, 0xE8, 0x00, 0xDA, 0xD5, 0xE0, 0xE0, 0xAB, 0xFC, 0x09, 0xFF
    @ "[PKMN] turned friendly.[NEWLINE]The base [STAT] can't fall![WAITKEYPRESS]"

adore_ev_down_str:
    .byte 0xFD, 0x02, 0x00, 0xD5, 0xD8, 0xE3, 0xE6, 0xD9, 0xE7, 0x00, 0xED, 0xE3, 0xE9, 0xAB, 0xFE, 0xCE, 0xDC, 0xD9, 0x00, 0xD6, 0xD5, 0xE7, 0xD9, 0x00, 0xFD, 0x03, 0x00, 0xDA, 0xD9, 0xE0, 0xE0, 0xAB, 0xFC, 0x09, 0xFF
    @ "[PKMN] adores you![NEWLINE]The base [STAT] fell![WAITKEYPRESS]"

.align 2
    fcode_buffer2:          .word 0x02021CD0
    fcode_buffer3:          .word 0x02021CF0
    displayed_string:      .word 0x02021D18
    party_player:          .word 0x02024284
    var_8000:              .word 0x020370B8
    var_8001:              .word 0x020370BA
    var_800E:              .word 0x0203AD30
    brm:                    .word 0x0203B0A0
    item_effectiveness:    .word 0x0203B0C0

    tasks:                  .word 0x03005090

    strcpy_xFF_terminated:  .word 0x08008D84|1
    fdecoder:              .word 0x08008FCC|1
    recalculate_stats:      .word 0x0803E47C|1
    get_attr:              .word 0x0803FBE8|1
    set_attr:              .word 0x0804037C|1
    sav1_map_get_name:      .word 0x08056260|1
    audio_play:            .word 0x080722CC|1
    bag_remove_item:        .word 0x0809A1D8|1
    bgid_mark_for_sync:    .word 0x080F67A4|1
    buffer_pkmn_nick:      .word 0x081202E0|1
    item_menu_string:      .word 0x081202F8|1
    item_use_animation:    .word 0x08124DC0|1
    item_menu_callback:    .word 0x081255BC|1
    hp_name_str:            .word 0x084169C2 @ "HP"
    spatk_name_str:        .word 0x084169C5 @ "SP. ATK"
    spdef_name_str:        .word 0x084169CD @ "SP. DEF"
    atk_name_str:          .word 0x08417674 @ "ATTACK"
    def_name_str:          .word 0x0841767B @ "DEFENSE"
    spe_name_str:          .word 0x0841768D @ "SPEED"
    no_effect_str:          .word 0x084169DC @ "It won't have any effect."


The Soothe Bell multiplier acts as it does in Generation IV and onwards (meaning it will also multiply bonuses from the met location and Luxury Ball).

This will introduce the Pomeg Glitch; see tkim's post here on how to fix it.



Spherical Ice' EV-Reducing Berries for FireRed should seriously be indexed in the main thread.

xizqu July 11th, 2018 8:49 AM

Actually, everything after like pg 43 stopped being indexed ??

dearman4 July 19th, 2018 3:17 PM

Quote:

Originally Posted by FBI (Post 8509928)

Toggling Capturability of Pokemon



So it's quite likely that maybe you want a Pokemon to be uncapturable, and at the same time you don't want to diminish it's catch rate to 0 in your Pokemon editor. Or perhaps you used the "capture trainer Pokemon" hack and you don't want it to work for all trainers. No problem, this is the hack for you :P

Basically it checks if variable 0x8000 is 0x1 or not. If it's 0x1, then any Pokemon you encounter (trainer or wild, via script or natural encounter) will become uncapturable even with the master ball. Simply set 0x8000 back to normal for the original game mechanics.
Note: If you use this hack, to say make it so the player can only capture a certain trainer's Pokemon, you will need to set 0x8000 right before the encounter, and unset it after (which is quite simple)
Note2: This hack won't let you capture trainer Pokemon, you need to have the capture trainer Pokemon hack from last time to create that effect.

How to insert:

First compile the following ASM code and insert into free space:
Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

main:
        ldr r0, =(0x2022B4C)
        ldr r1, [r0]
        ldr r2, .VAR
        ldrb r2, [r2]
        cmp r2, #0x1
        beq uncatchable
        ldr r0, = (0x802D490 +1)
        bx r0

uncatchable:
        ldr r0, = (0x802D460 +1)
        bx r0

.align 2
.VAR:
        .word 0x020270B8 + (0x8000 * 2) @change to var of your choice if you want




Here is a compiled version:
Code:

05 48 01 68 03 4A 12 78 01 2A 01 D0 03 48 00 47 03 48 00 47 B8 70 03 02 4C 2B 02 02 91 D4 02 08 61 D4 02 08


Now navigate to 0x2D452 and insert the following:
Code:

01 48 00 47 00 00 XX XX XX 08


Where XX XX XX is the reverse hex pointer to where you inserted the above routine. That's it :)
EDIT: Add one to the pointer.

Here's a pesky Rattata:
http://i.imgur.com/JpL4im1.png
(Yes, the Pokeball animation is still there, this was taken after it.)

I tried this in Emerald and it didn't work, I added in the pointer as +1 of the offset of the compiled code and tried setting the variable in a static encounter script and by walking through a script event and neither worked, does this just not work in Emerald? If so, is there another way of doing this that I can try?

Lance Koijer 2.0 July 19th, 2018 8:39 PM

Quote:

Originally Posted by dearman4 (Post 9902602)
I tried this in Emerald and it didn't work, I added in the pointer as +1 of the offset of the compiled code and tried setting the variable in a static encounter script and by walking through a script event and neither worked, does this just not work in Emerald? If so, is there another way of doing this that I can try?

The code will not work in Emerald because it is an ASM for FireRed only, as far as I know.

dearman4 July 19th, 2018 8:41 PM

Quote:

Originally Posted by Lance Koijer 2.0 (Post 9902691)
The code will not work in Emerald because it is an ASM for FireRed only, as far as I know.

Do you know of anything comparable to this that works for emerald?

Lancekoijerwillborough July 19th, 2018 10:07 PM

Quote:

Originally Posted by dearman4 (Post 9902692)
Do you know of anything comparable to this that works for emerald?

TOGGLING CAPTURABILITY OF POKEMON: EM

Basically, it is a port of FBI's Toggling Capturability Routine available only on Fire Red to Emerald. This port makes a certain Pokemon uncapturable by just setting var 8000 to 0x1. This only works on Emerald .

How to insert:

First compile the following ASM code and insert into free space:
Spoiler:

.text
.align 2
.thumb
.thumb_func

main:
ldr r0, =(0x2022fec)
ldr r1, [r0]
ldr r2, .VAR
ldrb r2, [r2]
cmp r2, #0x1
beq uncatchable
ldr r0, =(0x805635c+1)
bx r0

uncatchable:
ldr r0, =(0x805632a+1)
bx r0

.align 2
.VAR:
.word 0x20375D8


Here is a compiled version:
Code:

05 48 01 68 03 4A 12 78 01 2A 01 D0 03 48 00 47 03 48 00 47 D8 75 03 02 EC 2F 02 02 5D 63 05 08 2B 63 05 08


Now navigate to 0x5631E and insert the following:

Code:

01 48 00 47 00 00 XX XX XX 08


Where XX+1 XX XX is the reverse hex pointer to where you inserted the above routine. That's it :)

NOTE: This only prints the text "The TRAINER blocked the ball! Don't be a Thief!". I suggest changing this to "The ball is Blocked! This Pokemon cannot be caught!"


Optional:
Insert the following in free-space location in your ROM:

AAAAAA:
Code:

CE DC D9 00 BC BB C6 C6 00 DD E7 00 D6 E0 E3 D7 DF D9 D8 AB FF


BBBBBB:
Code:

CE DC DD E7 00 CA E3 DF D9 E1 E3 E2 00 D7 D5 E2 E2 E3 E8 00 D6 D9 00 D7 D5 E9 DB DC E8 AB FF


In 0x5CC64C, insert the reverse pointer of AAAAAA (do not add 1)
In 0x5CC650, insert the reverse pointer of BBBBBB (do not add 1)


NOTE: This will replace the "The TRAINER blocked the BALL" and "Don't be a thief!" strings.

https://scontent.fmnl3-1.fna.fbcdn.net/v/t1.15752-9/37132326_1767827489951966_8381321768370962432_n.png?_nc_cat=0&oh=0f4777dd9ce48a5e35d1bf29c8576d81&oe=5BD64FEBhttps://scontent.fmnl3-1.fna.fbcdn.net/v/t1.15752-9/37565425_1767827499951965_3780329454006435840_n.png?_nc_cat=0&oh=705f5c32dfde7c10f019eba9b7ee7a18&oe=5BCEF31C


All credits goes to FBI.

dearman4 July 19th, 2018 10:52 PM

Quote:

Originally Posted by Lancekoijerwillborough (Post 9902740)
TOGGLING CAPTURABILITY OF POKEMON: EM

Basically, it is a port of FBI's Toggling Capturability Routine available only on Fire Red to Emerald. This port makes a certain Pokemon uncapturable by just setting var 8000 to 0x1. This only works on Emerald .

How to insert:

First compile the following ASM code and insert into free space:
Spoiler:

.text
.align 2
.thumb
.thumb_func

main:
ldr r0, =(0x2022fec)
ldr r1, [r0]
ldr r2, .VAR
ldrb r2, [r2]
cmp r2, #0x1
beq uncatchable
ldr r0, =(0x805635c+1)
bx r0

uncatchable:
ldr r0, =(0x805632a+1)
bx r0

.align 2
.VAR:
.word 0x20375D8


Here is a compiled version:
Code:

05 48 01 68 03 4A 12 78 01 2A 01 D0 03 48 00 47 03 48 00 47 D8 75 03 02 EC 2F 02 02 5D 63 05 08 2B 63 05 08


Now navigate to 0x5631E and insert the following:

Code:

01 48 00 47 00 00 XX XX XX 08


Where XX+1 XX XX is the reverse hex pointer to where you inserted the above routine. That's it :)

NOTE: This only prints the text "The TRAINER blocked the ball! Don't be a Thief!". I suggest changing this to "The ball is Blocked! This Pokemon cannot be caught!"

All credits goes to FBI.

Thanks a million! Will try it out when I get home :)
And sorry if this is a dumb question, but how do I change the message when the pokeball is blocked?

Lancekoijerwillborough July 20th, 2018 12:01 AM

Quote:

Originally Posted by dearman4 (Post 9902754)
Thanks a million! Will try it out when I get home :)
And sorry if this is a dumb question, but how do I change the message when the pokeball is blocked?

Insert the following in free-space location in your ROM:

AAAAAA:
Code:

CE DC D9 00 BC BB C6 C6 00 DD E7 00 D6 E0 E3 D7 DF D9 D8 AB FF


BBBBBB:
Code:

CE DC DD E7 00 CA E3 DF D9 E1 E3 E2 00 D7 D5 E2 E2 E3 E8 00 D6 D9 00 D7 D5 E9 DB DC E8 AB FF


In 0x5CC64C, insert the reverse pointer of AAAAAA (do not add 1)
In 0x5CC650, insert the reverse pointer of BBBBBB (do not add 1)


NOTE: This will replace the "The TRAINER blocked the BALL" and "Don't be a thief!" strings.
Welp, that's fine for me. The previous strings are kind of not friendly lol

https://scontent.fmnl3-1.fna.fbcdn.net/v/t1.15752-9/37132326_1767827489951966_8381321768370962432_n.png?_nc_cat=0&oh=0f4777dd9ce48a5e35d1bf29c8576d81&oe=5BD64FEBhttps://scontent.fmnl3-1.fna.fbcdn.net/v/t1.15752-9/37565425_1767827499951965_3780329454006435840_n.png?_nc_cat=0&oh=705f5c32dfde7c10f019eba9b7ee7a18&oe=5BCEF31C

UltimaSoul July 20th, 2018 7:53 PM

Quote:

Originally Posted by tkim (Post 9722274)
[FR] Volt Tackle port from EM:

If you have free space from 0x270670-0x270741 (0xD2 bytes), use the IPS patch I provide here. ...It's a long story, so I will expand on this when I get the time. Fully working, I promise. You're gonna love it.

edit: A bit of explanation now: I took a look at an Emerald disassembly and found the routine that calls to check if the egg at the Day-Care is a pichu and if either of the parents are holding a Light Ball. I ported that exact routine into FR, but I had to make a copy of the routine at sub_80460D4 as to include the pichu check. Then I had to make special 0xB8 call the new routine instead of sub_80460D4. Since I had made a copy of the routine I also had to make sure the new routine used all the same offsets as before, and therefore I placed the routine at 0x270670, which I happened to have free space. I wanted to place the routine at something like 0x760000 or higher, but the old offsets wouldn't work any more. Down below are the uncompiled stuff:

This routine (located at 0x270670 in my patch) is a copy of the routine at 0x0460D4 but now includes the pichu egg check (in orange):
Code:

sub_80460D4:                @ CODE XREF: sp0B8_daycare+Cp

var_18        = -0x18
var_14        = -0x14

        PUSH    {R4-R6,LR}
        SUB    SP, SP,    #0x6C
        ADD    R5, R0,    #0
        ADD    R6, SP,    #0x7C+var_18
        ADD    R1, R6,    #0
        BL    sub_8046000
        ADD    R4, SP,    #0x7C+var_14
        STRH    R0, [R4]
        ADD    R0, R4,    #0
        ADD    R1, R5,    #0
        BL    incense_effects
        LDRH    R1, [R4]
        MOV    R0, SP
        ADD    R2, R5,    #0
        BL    sub_8046208
        MOV    R0, SP
        ADD    R1, R5,    #0
        BL    sub_8045AC0
        LDRB    R0, [R6,#1]
        MOV    R2, #0x8C @ '?'
        ADD    R1, R0,    #0
        MUL    R1, R2
        ADD    R1, R5,    R1
        LDRB    R0, [R6]
        MUL    R2, R0
        ADD    R2, R5,    R2
        MOV    R0, SP
        BL    daycare_build_child_moveset
        ldrh r0, [r4]
        cmp r0, #0xAC
        bne _08070918
        mov r0, sp
        add r1, r5, #0
        bl sub_82706FC
_08070918:

        MOV    R2, SP
        ADD    R2, #0x6A @ 'j'
        MOV    R0, #1
        STRB    R0, [R2]
        MOV    R0, SP
        MOV    R1, #0x2D @ '-'
        BL    pokemon_setattr
        LDR    R0, off_804614C
        MOV    R1, #0xFA @ '?'
        LSL    R1, R1,    #1
        ADD    R0, R0,    R1
        MOV    R1, SP
        MOV    R2, #0x64 @ 'd'
        BL    memcpy
        BL    party_compaction
        BL    party_count_pokemon
        ADD    R0, R5,    #0
        BL    sub_8045F70
        ADD    SP, SP,    #0x6C
        POP    {R4-R6}
        POP    {R0}
        BX    R0
@ End of function sub_80460D4

@ ---------------------------------------------------------------------------
.align 2
off_804614C:    .long 0x2024284        @ DATA XREF: sub_80460D4+52r


This routine (located at 0x2706FC in my patch) handles the volt tackle inheriting:
Code:

sub_80707A4:
    push {r4-r6,lr}
    add r5, r0, #0
    add r4, r1, #0
    add r0, r4, #0
    mov r1, #0xC
    bl pokemon_getattr_encrypted
    add r6, r0, #0
    add r4, #0x8C
    add r0, r4, #0
    mov r1, #0xC
    bl pokemon_getattr_encrypted
    cmp r6, #0xCA
    beq _080707C6
    cmp r0, #0xCA
    bne _080707E2

_080707C6:
    mov r4, #0xAC
    lsl r4, r4, #0x1
    add r0, r5, #0
    add r1, r4, #0
    bl pokemon_moveset_pad_
    lsl r0, r0, #0x10
    ldr r1, =(0xffff0000)
    cmp r0, r1
    bne _080707E2
    add r0, r5, #0
    add r1, r4, #0
    bl sub_803EB94

_080707E2:
    pop {r4-r6}
    pop {r0}
    bx r0


This last one makes sure the old offsets work correctly from the new offsets:
Code:

.text
.align 2
.thumb
.thumb_func

.org 0x0462B8
bl 0x270670

.org 0x27067A
bl 0x046000

.org 0x270686
bl 0x045FA0

.org 0x270690
bl 0x046208

.org 0x270698
bl 0x045AC0

.org 0x2706AE
bl 0x045CD0

.org 0x2706BC
bl 0x2706FC

.org 0x2706CC
bl 0x04037C

.org 0x2706DC
bl 0x1E5E78

.org 0x2706E0
bl 0x0937DC

.org 0x2706E4
bl 0x040C3C

.org 0x2706EA
bl 0x045F70

.org 0x270706
bl 0x03FD44

.org 0x270712
bl 0x03FD44

.org 0x270726
bl 0x03E89C

.org 0x270736
bl 0x03EB94


If anybody has a better way of porting this, please post it here.
edit2: I could probably just use bx r3?

I improved this ASM so you only need to assemble it once and also it works in any free space occupied.

Just replace the offset at MyLoc with your desired free space and then copy paste the assembled code to 0x0462B0 and MyLoc as appropriate.

Code:

.thumb
.align

.equ MyLoc, 0x720000 @insert your location here
.equ RomAreaOffset,        0x8000000       

.org 0x0462B0, 0xFF
ldr  r3, clean_hook
bx  r3
.align 2
clean_hook: .word RomAreaOffset+hook_handle+1

.org MyLoc, 0xFF
hook_handle:
ldr r0, [r0]
mov r1, #0xBE
lsl r1, r1, #6
add r0, r0, r1
bl  sub_80460D4
ldr r3, return
bx  r3

.align 2
.pool

.align 2

sub_80460D4:
                PUSH    {R4-R6,LR}
        SUB    SP, SP,    #0x6C
        ADD    R5, R0,    #0
        ADD    R6, SP,    #0x64
        ADD    R1, R6,    #0
        ldr    r3, sub_8046000
                bl    call_external_function
        ADD    R4, SP,    #0x68
        STRH    R0, [R4]
        ADD    R0, R4,    #0
        ADD    R1, R5,    #0
                ldr  r3, incense_effects
        bl    call_external_function
        LDRH    R1, [R4]
        MOV    R0, SP
        ADD    R2, R5,    #0
        ldr  r3, sub_8046208
                bl    call_external_function
        MOV    R0, SP
        ADD    R1, R5,    #0
                ldr  r3, sub_8045AC0
        bl  call_external_function
        LDRB    R0, [R6,#1]
        MOV    R2, #0x8C @ '?'
        ADD    R1, R0,    #0
        MUL    R1, R2
        ADD    R1, R5,    R1
        LDRB    R0, [R6]
        MUL    R2, R0
        ADD    R2, R5,    R2
        MOV    R0, SP
        ldr  r3, daycare_build_child_moveset
                bl    call_external_function
        ldrh r0, [r4]
        cmp r0, #0xAC
        bne _08070918
        mov r0, sp
        add r1, r5, #0
        bl sub_80707A4

_08070918:
        MOV    R2, SP
        ADD    R2, #0x6A @ 'j'
        MOV    R0, #1
        STRB    R0, [R2]
        MOV    R0, SP
        MOV    R1, #0x2D @ '-'
        ldr    r3, pokemon_setattr
                bl    call_external_function
        LDR    R0, off_804614C
        MOV    R1, #0xFA @ '?'
        LSL    R1, R1,    #1
        ADD    R0, R0,    R1
        MOV    R1, SP
        MOV    R2, #0x64 @ 'd'
        ldr  r3, memcpy
                bl  call_external_function
        ldr  r3, party_compaction
                bl  call_external_function
        ldr  r3, party_count_pokemon
                bl  call_external_function
        ADD    R0, R5,    #0
        ldr    r3, sub_8045F70
                bl    call_external_function
        ADD    SP, SP,    #0x6C
        POP    {R4-R6}
        POP    {R0}
        BX    R0

.align 2
.pool

.align 2

sub_80707A4:
    push {r4-r6,lr}
    add r5, r0, #0
    add r4, r1, #0
    add r0, r4, #0
    mov r1, #0xC
    ldr r3, pokemon_getattr_encrypted
        bl call_external_function
    add r6, r0, #0
    add r4, #0x8C
    add r0, r4, #0
    mov r1, #0xC
    ldr r3, pokemon_getattr_encrypted
        bl call_external_function
    cmp r6, #0xCA
    beq _080707C6
    cmp r0, #0xCA
    bne _080707E2

_080707C6:
    mov r4, #0xAC
    lsl r4, r4, #0x1
    add r0, r5, #0
    add r1, r4, #0
        ldr r3, pokemon_moveset_pad_
    bl call_external_function
    lsl r0, r0, #0x10
    ldr r1, =(0xffff0000)
    cmp r0, r1
    bne _080707E2
    add r0, r5, #0
    add r1, r4, #0
    ldr r0, sub_803EB94
        bl call_external_function_r0

_080707E2:
    pop {r4-r6}
    pop {r0}
    bx r0

.align 2
.pool

.align 2

call_external_function:
bx r3

.align 2

call_external_function_r0:
bx r0

.align 2
return: .word 0x80462BC + 1
sub_8046000: .word 0x8046000 + 1
incense_effects: .word 0x8045FA0 + 1
sub_8046208: .word 0x8046208 + 1
sub_8045AC0: .word 0x8045AC0 + 1
daycare_build_child_moveset: .word 0x8045CD0 + 1
pokemon_setattr: .word 0x804037C + 1
memcpy: .word 0x81E5E78 + 1
party_compaction: .word 0x80937DC + 1
party_count_pokemon: .word 0x8040C3C + 1
sub_8045F70: .word 0x8045F70 + 1
off_804614C: .word 0x2024284
pokemon_getattr_encrypted: .word 0x0803FD44 + 1
pokemon_moveset_pad_: .word 0x0803E89C + 1
sub_803EB94: .word 0x0803EB94 + 1


Feel free to reply with questions or suggestions for improvements.

dearman4 July 20th, 2018 9:34 PM

Quote:

Originally Posted by jiangzhengwenjzw (Post 9229108)
Misc:

A EV-IV Display Screen


RENEWAL:
Spoiler:
The new version is here (no difference, but codes will be automatically inserted into the ROM):
FIRERED:
https://github.com/jiangzhengwenjz/EV-IV-Screen
EMERALD:
https://github.com/jiangzhengwenjz/EV-IV-Screen-EM
Read Readme.md to know how to compile.

Quick Preview:
http://i869.photobucket.com/albums/ab256/jiangzhengwenjz/q_zpshnquzant.gifhttps://i.imgur.com/18HjHg0.png

OLD CONTENT:
Spoiler:
Quick Preview:
http://i869.photobucket.com/albums/ab256/jiangzhengwenjz/q_zpshnquzant.gif
Download:
https://github.com/jiangzhengwenjz/EV-IV-Screen/tree/c1b303e17788f21e1a663204f9db59ffdcfc2a2d
Usage:
1. Make sure that you have Devkitarm and GNU make/cygwin installed.
2. Download this repo and create a new folder called "build".
3. Assign the free space you want to use in linker.lsc.
4. Open your cmd prompt and type in make. Then press enter.
5. Now main.bin should be generated. Paste it to the offset specified in step3.
6. Write a script to test (You should callasm to the offset of insertion + 0x79).
Code:

Example:
lock
faceplayer
callasm 0x8800079 //I inserted the code at 0x8800000
msgbox 0x8FD0013 0x2 //"It's nice, huh?"
releaseall
end



SO I have tried to install Devkit and any time I try the make command, I get errors and the program crashes, I would love to use this but without the ability to get the code for it inserted into the ROM I can't use it, does anyone have the compiled hex code for this?

Super Versekr Dark August 19th, 2018 8:27 AM

Excuse me, can you put Ruby's routines here?

BrittneySpearsMom August 19th, 2018 4:09 PM

Forgive me for not contributing, but I had to ask.

At the risk of being totally unhelpful to the thread: does anyone know of working routines for attack boosting Gems (Normal Gem, Flying Gem, etc., etc.) for either FireRed or Emerald? I've seen a certain Japanese hack of FireRed has gotten them to work and it looks like Pokemon Clover either has implemented them already or is planning to offer them eventually.

Skeli August 23rd, 2018 2:13 PM

The bag expansion for Fire Red has been completely revamped and should work now:
https://www.pokecommunity.com/showthread.php?p=9743323#9743323

tkim August 25th, 2018 5:30 PM

Quote:

Originally Posted by Pokemon_XY (Post 9010564)

Time Box triggered along with the Start Menu


Preview: (Click to see the GIF animation)
Attachment 77173
The routines are only for FR. I haven't found any bugs in it. However, the CPU will run much more instructions so that it will be a bit (really?) slower when you open the 'pokemon', 'bag'..... menus.
1) Insert the RTC routine via the tool 'DNS'.
2) Insert these routines and do the byte changes:
Routine I:
Spoiler:
byte changes:
Code:

0x6F09C - 00 48 00 47 XX+1 XX XX 08
change all the 0x8750000 in the routine to the insert offset of the routine.
change all the 0x8750001 in the routine to the insert offset + 1 of the routine.


routine:
Code:

.thumb
bl box_func
ldr r1, =0x20370FF
ldrb r0, [r1]
add r0, #1
strb r0, [r1]
mov r0, #0
add sp, sp, #0xC
pop {r4, pc}
.ltorg

box_func:
push {r4, lr}
ldr r4, =0x2037101
ldr r0, =(0x8750000 + rbox_config)
ldr r3, =0x8003ce5
bl call_r3
strb r0, [r4]
ldr r3, =0x8003fa1
bl call_r3
ldrb r0, [r4]
mov r1, #0
ldr r3, =0x80F6F1D
bl call_r3
bl print_string
ldr r0, =(0x8750001 + print_string)
mov r1, #2
ldr r3, =0x807741D
bl call_r3
ldr r1, =0x20370C0
strh r0, [r1]
pop {r4, pc}
.ltorg

print_string:
push {r4-r7, lr}
sub sp, sp, #0xC
ldr r0, =0x2021cd0
add r7, r0, #0
ldr r1, =0x300553c
ldrb r5, [r1, #7] @minute
ldrb r6, [r1, #8] @second
ldrb r1, [r1, #6] @hour
mov r2, #1
mov r3, #2
ldr r4, =0x8008E79
bl call_r4
bl go_padding
ldr r0, =0x2021CF0
add r7, r0, #0
add r1, r5, #0
mov r2, #1
mov r3, #2
ldr r4, =0x8008e79
bl call_r4
bl go_padding
ldr r0, =0x2021d04
add r7, r0, #0
add r1, r6, #0
mov r2, #1
mov r3, #2
ldr r4, =0x8008e79
bl call_r4
bl go_padding
ldr r5, =0x2021D18
ldr r1, =(0x8750000 + string)
add r0, r5, #0
ldr r3, =0x8008FCD
bl call_r3
ldr r0, =0x2037101
ldrb r0, [r0]
mov r1, #3
str r1, [sp]
mov r1, #0xff
str r1, [sp, #4]
mov r1, #0
str r1, [sp, #8]
mov r1, #2
add r2, r5, #0
mov r3, #4
ldr r4, =0x8002C49
bl call_r4
ldr r0, =0x2037101
ldrb r0, [r0]
mov r1, #2
ldr r3, =0x8003F21
bl call_r3
add sp, sp, #0xC
pop {r4-r7, pc}
.ltorg

go_padding:
push {lr}
ldrb r0, [r7]
cmp r0, #0
bne back
mov r0, #0xa1
strb r0, [r7]
back:
pop {pc}

call_r3:
bx r3

call_r4:
bx r4

.align 2
rbox_config:
.byte 0x0 @bg_id
.byte 0x1 @x
.byte 0x1 @y
.byte 0xa @width
.byte 0x2 @height
.byte 0xf
.hword 0x8 @tileset_ofs
.word 0x8419f76 @pixels

.align 2
string:
.byte 0xce, 0xdd, 0xe1, 0xd9, 0xf0, 0xfd, 0x2, 0xf0, 0xfd, 0x3, 0xf0, 0xfd, 0x4, 0xff



Routine II:
Spoiler:
byte changes:
Code:

0x6EF1E - 00 00 00 49 08 47 YY+1 YY YY 08


routine:
Code:

.thumb
cmp r0, #1
beq safari
ldr r0, =0x20370C0
ldrh r0, [r0]
ldr r3, =0x8077509
bl call_r3

safari:
ldr r4, =0x02037101
ldrb r0, [r4]
mov r1, #0
ldr r3, =0x806ef29

call_r3:
bx r3



Routine III:
Spoiler:
byte changes:
Code:

0x6f4e8 - 00 48 00 47 ZZ+1 ZZ ZZ 08


routine:
Code:

.thumb
push {lr}
ldr r0, =0x20370c0
ldrh r0, [r0]
ldr r3, =0x8077509
bl call_r3
ldr r1, =0x20370F0
ldr r0, =0x806f5a5
str r0, [r1]
mov r0, #0
pop {pc}
call_r3:
bx r3



I've modified 'Routine I' of Pokemon_XY's Time Box to exclude displaying seconds, which in turn decreases the lag when viewing the Start Menu. I've also fixed a bug in his routine where the Time Box would display when the step-counter is displayed while in the Safari Zone. Provided down below is a 24-hour format and a 12-hour format. Choose one of them instead of Pokemon_XY's 'Routine I' if you wish.

24-hour format (use instead of 'Routine I'):
Spoiler:
Code:

@ 0x6F09C - 00 48 00 47 XX+1 XX XX 08
@ change all the 0x8950000 in the routine to the insert offset of the routine.
@ change all the 0x8950001 in the routine to the insert offset + 1 of the routine.


Code:

.thumb
mov r0, #0x80
lsl r0, r0, #4
bl flag_check
lsl r0, r0, #0x18
lsr r0, r0, #0x18
cmp r0, #0x1
beq safari
bl box_func

safari:
ldr r1, =0x20370FF
ldrb r0, [r1]
add r0, #1
strb r0, [r1]
mov r0, #0
add sp, sp, #0xC
pop {r4, pc}
.ltorg

box_func:
push {r4, lr}
ldr r4, =0x2037101
ldr r0, =(0x8950000 + rbox_config)
ldr r3, =0x8003ce5
bl call_r3
strb r0, [r4]
ldr r3, =0x8003fa1
bl call_r3
ldrb r0, [r4]
mov r1, #0
ldr r3, =0x80F6F1D
bl call_r3
bl print_string
ldr r0, =(0x8950001 + print_string)
mov r1, #2
ldr r3, =0x807741D
bl call_r3
ldr r1, =0x20370C0
strh r0, [r1]
pop {r4, pc}
.ltorg

print_string:
push {r4-r7, lr}
sub sp, sp, #0xC
ldr r0, =0x2021cd0
add r7, r0, #0
ldr r1, =0x300553c
ldrb r5, [r1, #7] @minute
ldrb r1, [r1, #6] @hour
mov r2, #1
mov r3, #2
ldr r4, =0x8008E79
bl call_r4
bl go_padding
ldr r0, =0x2021CF0
add r7, r0, #0
add r1, r5, #0
mov r2, #1
mov r3, #2
ldr r4, =0x8008e79
bl call_r4
bl go_padding
ldr r5, =0x2021D18
ldr r1, =(0x8950000 + string)
add r0, r5, #0
ldr r3, =0x8008FCD
bl call_r3
ldr r0, =0x2037101
ldrb r0, [r0]
mov r1, #3
str r1, [sp]
mov r1, #0xff
str r1, [sp, #4]
mov r1, #0
str r1, [sp, #8]
mov r1, #2
add r2, r5, #0
mov r3, #4
ldr r4, =0x8002C49
bl call_r4
ldr r0, =0x2037101
ldrb r0, [r0]
mov r1, #2
ldr r3, =0x8003F21
bl call_r3
add sp, sp, #0xC
pop {r4-r7, pc}
.ltorg

go_padding:
push {lr}
ldrb r0, [r7]
cmp r0, #0
bne back
mov r0, #0xa1
strb r0, [r7]
back:
pop {pc}

call_r3:
bx r3

call_r4:
bx r4

flag_check:
ldr r1, =0x0806E6D1
bx r1

.align 2
rbox_config:
.byte 0x0 @bg_id
.byte 0x1 @x
.byte 0x1 @y
.byte 0x5 @width
.byte 0x2 @height
.byte 0xf
.hword 0x8 @tileset_ofs
.word 0x8419f76 @pixels

.align 2
string:
.byte 0xfd, 0x2, 0xf0, 0xfd, 0x3, 0xff




12-hour format (use instead of 'Routine I'):
Spoiler:
Code:

@ 0x6F09C - 00 48 00 47 XX+1 XX XX 08
@ change all the 0x8950000 in the routine to the insert offset of the routine.
@ change all the 0x8950001 in the routine to the insert offset + 1 of the routine.


Code:

.thumb
mov r0, #0x80
lsl r0, r0, #4
bl flag_check
lsl r0, r0, #0x18
lsr r0, r0, #0x18
cmp r0, #0x1
beq safari
bl box_func

safari:
ldr r1, =0x20370FF
ldrb r0, [r1]
add r0, #1
strb r0, [r1]
mov r0, #0
add sp, sp, #0xC
pop {r4, pc}
.ltorg

box_func:
push {r4, lr}
ldr r4, =0x2037101
ldr r0, =(0x8950000 + rbox_config)
ldr r3, =0x8003ce5
bl call_r3
strb r0, [r4]
ldr r3, =0x8003fa1
bl call_r3
ldrb r0, [r4]
mov r1, #0
ldr r3, =0x80F6F1D
bl call_r3
bl print_string
ldr r0, =(0x8950001 + print_string)
mov r1, #2
ldr r3, =0x807741D
bl call_r3
ldr r1, =0x20370C0
strh r0, [r1]
pop {r4, pc}
.ltorg

print_string:
push {r4-r7, lr}
sub sp, sp, #0xC
ldr r0, =0x2021cd0
add r7, r0, #0
ldr r1, =0x300553c
ldrb r5, [r1, #7] @minute
ldrb r6, [r1, #6] @hour
add r1, r6, #0
cmp r1, #0xC
bhi usat
cmp r1, #0x0
beq zero

continue:
mov r2, #1
mov r3, #2
ldr r4, =0x8008E79
bl call_r4
bl go_padding
ldr r0, =0x2021CF0
add r7, r0, #0
add r1, r5, #0
mov r2, #1
mov r3, #2
ldr r4, =0x8008e79
bl call_r4
bl go_padding
ldr r5, =0x2021D18
cmp r6, #0xB
bhi night
ldr r1, =(0x8950000 + day)

goon:
add r0, r5, #0
ldr r3, =0x8008FCD
bl call_r3
ldr r0, =0x2037101
ldrb r0, [r0]
mov r1, #3
str r1, [sp]
mov r1, #0xff
str r1, [sp, #4]
mov r1, #0
str r1, [sp, #8]
mov r1, #2
add r2, r5, #0
mov r3, #4
ldr r4, =0x8002C49
bl call_r4
ldr r0, =0x2037101
ldrb r0, [r0]
mov r1, #2
ldr r3, =0x8003F21
bl call_r3
add sp, sp, #0xC
pop {r4-r7, pc}
.ltorg

go_padding:
push {lr}
ldrb r0, [r7]
cmp r0, #0
bne back
mov r0, #0xa1
strb r0, [r7]
back:
pop {pc}

call_r3:
bx r3

call_r4:
bx r4

flag_check:
ldr r1, =0x0806E6D1
bx r1

usat:
sub r1, r1, #0xC
b continue

zero:
add r1, r1, #0xc
b continue

night:
ldr r1, =(0x8950000 + nite)
b goon

.align 2
rbox_config:
.byte 0x0 @bg_id
.byte 0x1 @x
.byte 0x1 @y
.byte 0x7 @width
.byte 0x2 @height
.byte 0xf
.hword 0x8 @tileset_ofs
.word 0x8419f76 @pixels

.align 2
day:
.byte 0xfd, 0x2, 0xf0, 0xfd, 0x3, 0x0, 0xBB, 0xc7, 0xff
nite:
.byte 0xfd, 0x2, 0xf0, 0xfd, 0x3, 0x0, 0xCA, 0xc7, 0xff



AkameTheBulbasaur September 2nd, 2018 7:49 PM


This involves four routines and a bunch of scripting.

Notes Before We Begin

• You will need 25 vars that you will not use for anything else. I used vars 0x408F through 0x40A8, and the routines posted below reflect that. If you wish to change them, you'll need to figure out the RAM addresses for those vars on your own.
• 24 of those vars are for the moves of your party. 1 is set when the Metronome Battle starts for reasons I will get into later.
• These vars need to be permanent vars (so not 0x8000 whatever) because they need to be accessed even if the game is turned off and on.

Routine 1: Clear RAM

What this does is clear out (sets to zero) all the vars which will contain the moves. This just make sure that you have a blank slate for the next routine.
Spoiler:
.text
.align 2
.thumb
.thumb_func

Main:
push {r4-r5, lr}

ClearItems:
ldr r4, .RAMStart
mov r0, #0x0
Loop:
strh r0, [r4]
add r4, r4, #0x2
ldr r5, .RAMEnd
cmp r4, r5
bgt Return
b Loop

Return:
pop {r4-r5, pc}

.align 2
.RAMStart: .word 0x0202664A
.RAMEnd: .word 0x02026678


Routine 2: Store Party's Moves


This routine takes all the moves of your Party Pokemon and stores them one at a time in the vars I mentioned before. If the Pokemon doesn't have a move in that slot, it will just set the var to zero by default.
Spoiler:
.text
.align 2
.thumb
.thumb_func

Main:
push {r4-r7, lr}
mov r4, #0x0 /*Party Slot*/
mov r5, #0x0 /*Slot Counter*/
mov r6, #0x0 /*Move Counter*/
mov r7, #0x0 /*Var Counter*/

GetMoveLoop:
ldr r0, .FirstPoke
mov r1, #0x64
mul r1, r4
add r0, r0, r1
push {r0}
mov r1, #0xB
mov r2, #0x0
bl Decrypt
mov r1, r0
pop {r0}
cmp r1, #0x0
beq End
mov r1, #0xD
add r1, r1, r6
mov r2, #0x0
bl Decrypt
ldr r1, .VarStart
add r1, r1, r7
strh r0, [r1]

LoopCheck:
add r5, r5, #0x1
cmp r5, #0x4
beq CheckSlot
add r7, r7, #0x2
add r6, r6, #0x1
b GetMoveLoop

CheckSlot:
cmp r4, #0x5
beq End
add r4, r4, #0x1
mov r6, #0x0
mov r5, #0x0
add r7, r7, #0x2
b GetMoveLoop

End:
pop {r4-r7, pc}

Decrypt:
ldr r3, .Decrypt
bx r3

.align 2
.VarStart: .word 0x0202664A
.FirstPoke: .word 0x02024284
.Decrypt: .word 0x0803FBE9


Routine 3: Replace Moves With Metronome

This routine is fairly self-explanatory. It replaces all of your Pokemon's move with four of Metronome. Note that this does not change the PP, so the PP of Metronome will still be the same as whatever move it replaced. This is easily fixed during the scripting (which will come soon).
Spoiler:
.text
.align 2
.thumb
.thumb_func

Main:
push {r4-r7, lr}
mov r4, #0x0 /*Party Slot*/
mov r5, #0x0 /*Slot Counter*/
mov r6, #0x0 /*Move Counter*/
mov r7, #0x0 /*Var Counter*/

GetMoveLoop:
ldr r0, .FirstPoke
mov r1, #0x64
mul r1, r4
add r0, r0, r1
push {r0}
mov r1, #0xB
mov r2, #0x0
bl Decrypt
mov r1, r0
pop {r0}
cmp r1, #0x0
beq End
mov r1, #0xD
add r1, r1, r6
mov r2, #0x76
push {r2}
mov r2, sp
bl Encrypt
pop {r2}

LoopCheck:
add r5, r5, #0x1
cmp r5, #0x4
beq CheckSlot
add r7, r7, #0x2
add r6, r6, #0x1
b GetMoveLoop

CheckSlot:
cmp r4, #0x5
beq End
add r4, r4, #0x1
mov r6, #0x0
mov r5, #0x0
add r7, r7, #0x2
b GetMoveLoop

End:
pop {r4-r7, pc}

Encrypt:
ldr r3, .Encrypt
bx r3

Decrypt:
ldr r3, .Decrypt
bx r3

.align 2
.Encrypt: .word 0x0804037D
.VarStart: .word 0x0202664A
.FirstPoke: .word 0x02024284
.Decrypt: .word 0x0803FBE9


Routine 4: Restore Party's Moves

This last routine takes the moves in the vars and gives them back to the Pokemon they originally belonged to.
Spoiler:
.text
.align 2
.thumb
.thumb_func

Main:
push {r4-r7, lr}
mov r4, #0x0 /*Party Slot*/
mov r5, #0x0 /*Slot Counter*/
mov r6, #0x0 /*Move Counter*/
mov r7, #0x0 /*Var Counter*/

GetMoveLoop:
ldr r0, .FirstPoke
mov r1, #0x64
mul r1, r4
add r0, r0, r1
push {r0}
mov r1, #0xB
mov r2, #0x0
bl Decrypt
mov r1, r0
pop {r0}
cmp r1, #0x0
beq End
mov r1, #0xD
add r1, r1, r6
ldr r2, .VarStart
add r2, r2, r7
ldrh r2, [r2]
push {r2}
mov r2, sp
bl Encrypt
pop {r2}

LoopCheck:
add r5, r5, #0x1
cmp r5, #0x4
beq CheckSlot
add r7, r7, #0x2
add r6, r6, #0x1
b GetMoveLoop

CheckSlot:
cmp r4, #0x5
beq End
add r4, r4, #0x1
mov r6, #0x0
mov r5, #0x0
add r7, r7, #0x2
b GetMoveLoop

End:
pop {r4-r7, pc}

Encrypt:
ldr r3, .Encrypt
bx r3

Decrypt:
ldr r3, .Decrypt
bx r3

.align 2
.Encrypt: .word 0x0804037D
.VarStart: .word 0x0202664A
.FirstPoke: .word 0x02024284
.Decrypt: .word 0x0803FBE9


Putting it all Together


I will assume that the initiator of the Metronome battle will be a person event or something like that.

In your script, you will want to call the first three routines in order. Then script the battle, and then afterwards call the fourth routine and then the first again.

Syntax:
callasm OFFSET OF R1
callasm OFFSET OF R2
callasm OFFSET OF R3
special HEAL_POKEMON 'This fixes the PP issue from before
setvar SOME VAR 0xFF'
trainerbattle 0x3 0xNUM 0x0 @DefeatMsg
callasm OFFSET OF R4
callasm OFFSET OF R1
special HEAL_POKEMON
setvar SOME VAR 0x0


Let's explain a few things. You'll want to use specifically "trainerbattle" type 3. This makes the script continue after you defeat the trainer, which we want so that you can get your original moves back after you win.

But what about if you lose? This is what the SOME VAR is about. Before you start the battle, you'll want to set whichever var you chose to something not zero. I picked 0xFF just because.
If you win, this var gets set back to zero. But if you lose then the var is still the non-zero value.

So you will need to include this map script at every possible healing location the player could get sent back to.

Spoiler:
#dyn 0x740000
#org @Start
compare SOME VAR 0xFF
if true jump @RestoreMoves
release
end

#org @RestoreMoves
callasm OFFSET OF R4
callasm OFFSET OF R1
release
end


This checks if you initiated but did not complete the Metronome Battle (via the var) and if you that is true then it replaces your moves. If you lost the battle then it will do this during the normal White Out script.

What I recommend is using JPAN's SetHealingPlace hack to set the healing place to be the map where you find the NPC who starts the battle. That way you only need to have this map script on that specific map instead of having to put it everywhere.

Another important thing you will probably need is the routine to disable experience gain with a flag! I forgot where it was, but I believe it’s in this thread. You need this to prevent your Pokémon leveling up and learning a new move.

This would not only ruin the Metronome battle, but they wouldn’t even keep the move after the battle was over and everything got replaced back.

Example Script

Here I will just include the script I used in my game, just to get an idea of how the scripting part is supposed to go down.

Spoiler:
#dyn 0x740000
#org @Start
lock
faceplayer
message @Hello
callstd MSG_YESNO
compare LASTRESULT YES
if true jump @StoreMoves
message @Bye
release
end

#org @StoreMoves
callasm 0x8DB1E3D
callasm 0x8DB2C01
jump @SetHealingPlace

#org @SetHealingPlace
sethealingplace 0x1
setvar 0x405A 0x0C01
setvar 0x405B 0x6
setvar 0x405C 0x8
setvar 0x8004 0x1
setvar 0x4053 0x100
setvar 0x40F7 0x8
jump @ReplaceMoves

#org @ReplaceMoves
callasm 0x8DB47D9
special HEAL_POKEMON
setvar 0x40A8 0xFF
jump @StartBattle

#org @StartBattle
message @LetsGo
callstd MSG_SIGN
countpokemon
compare LASTRESULT 0x1
if true jump @OneMon
compare LASTRESULT 0x2
if true jump @TwoMon
compare LASTRESULT 0x3
if true jump @ThreeMon
compare LASTRESULT 0x4
if true jump @FourMon
compare LASTRESULT 0x5
if true jump @FiveMon
trainerbattle 0x3 0x1C1 0x0 @Defeat
jump @AfterBattle

#org @FiveMon
trainerbattle 0x3 0x1C2 0x0 @Defeat
jump @AfterBattle

#org @FourMon
trainerbattle 0x3 0x1C3 0x0 @Defeat
jump @AfterBattle

#org @ThreeMon
trainerbattle 0x3 0x1C4 0x0 @Defeat
jump @AfterBattle

#org @TwoMon
trainerbattle 0x3 0x1C5 0x0 @Defeat
jump @AfterBattle

#org @OneMon
trainerbattle 0x3 0x1C6 0x0 @Defeat
jump @AfterBattle

#org @AfterBattle
setflag 0x25C
settrainerflag 0x1C1
settrainerflag 0x1C2
settrainerflag 0x1C3
settrainerflag 0x1C4
settrainerflag 0x1C5
settrainerflag 0x1C6
message @Fun
callstd MSG_SIGN
jump @PutMovesBack

#org @PutMovesBack
callasm 0x8DB629D
callasm 0x8DB1E3D
special HEAL_POKEMON
setvar 0x40A8 0x0
release
end

#org @Hello
= Anna Marukawa: Wanna see a trick?\pI can temporarily change any\nPokemon's attacks to be anything\lat all!\pWell, not exactly. I can only\nchange them to Metronome.\pBut Metronome can be any attack,\nso there!\pAnyway, my idea is we can have a\nbattle where the only move either\lof us can use is Metronome!\pWouldn't that be fun? Want to try\nit out?

#org @Bye
= Oh, okay.\nMaybe another time then!

#org @Defeat
= Wow! That was great!

#org @LetsGo
= Okay!\pI changed all the moves and healed\nyour team.\pTo the Battle Dimension we go!

#org @Fun
= Wow! Wow!\pThat was so much fun!\pHere, let's give your Pokemon\ntheir real moves back.\pCome over soon so we can do that\nagain!

Koople September 11th, 2018 12:47 PM

Side Quest Menu [FR]

This hack converts the PC item storage menu into a side quest menu, or task list, etc.

Here is the repository, the compilation instructions are included in the readme. You will need to define your own parameters/ram in src/headers/defs.asm and create your own tables of string pointers for all of the quest names, descriptions, item images, and quest details. I kept the item image part to allow hackers to include items that might be symbolic of their quest, eg. a scroll or key or pokeball.

To use in a script (XSE)
Code:

writebytetooffset 0x1 <your questflag ram in src/headers/defs.asm>
fadescreen 0x1
callasm 0x80EBCD9
waitstate


Enjoy! And please let me know of any bugs.

Delta231 September 13th, 2018 6:47 AM

Quote:

Originally Posted by Koople (Post 9924710)
Side Quest Menu [FR]

This hack converts the PC item storage menu into a side quest menu, or task list, etc.

Here is the repository, the compilation instructions are included in the readme. You will need to define your own parameters/ram in src/headers/defs.asm and create your own tables of string pointers for all of the quest names, descriptions, item images, and quest details. I kept the item image part to allow hackers to include items that might be symbolic of their quest, eg. a scroll or key or pokeball.

To use in a script (XSE)
Code:

writebytetooffset 0x1 <your questflag ram in src/headers/defs.asm>
fadescreen 0x1
callasm 0x80EBCD9
waitstate


Here is a slightly outdated example GIF (it is just missing the item images in the box), but it gets the point across.

Enjoy! And please let me know of any bugs.

Nice work but you may wanna remove .exe and dll files as not everyone uses Windows.

Delta231 September 13th, 2018 6:49 AM

Quote:

Originally Posted by Super Versekr Dark (Post 9915420)
Excuse me, can you put Ruby's routines here?

Yes, you are allowed to put routines for Ruby as well.

Squeetz September 16th, 2018 6:19 AM

[FR] Multi-directional jump tiles
This is an expanded-upon version of Invert's routine on the Wahack forums (https://wahackforo.com/t-40642/fr-asm-salto-en-cualquier-direccion) So credit goes to them for the original.
Made this for the purpose of creating a multiple-height jumping puzzle which was something Invert's routine was lacking, so thought I might as well share it.

Code:

.thumb

.global AnyDirectionJumptile
.equ rom, 0x08000001
.equ offset, 0xXXXXXX

/*
Behavior bytes:
0x7F = able to jump in any direction over tile (only on height 0x0 & 0x10)
0x7E = able to jump up and down over tile
0x7D = able to jump left and right over tile
*/

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
hooks:
.org 0x59AF6
        cmp r0, #0x7D
        beq 0x59B02

.org 0x59B0A
        cmp r0, #0x7D
        beq 0x59B16

.org 0x59B1E
        cmp r0, #0x7E
        beq 0x59B2A

.org 0x59B32
        cmp r0, #0x7E
        beq 0x59B3E

.org 0x6812C
        bx r2

.org 0x68144
        .word main + rom

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

.org offset
main:
        cmp r0, #0x7F        @behavior byte
        beq CheckJump
        ldr r2, =(0x083A705C)
        lsl r1, r4, #0x2
        ldr r3, =(0x0806812E|1)
        bx r3

CheckJump:
        bl CanPlayerJump
        cmp r0, #0x0
        beq CantJump
CanJump:
        ldr r0, =(0x08068148|1)
        bx r0

CantJump:
        ldr r0, =(0x0806813E|1)
        bx r0

CanPlayerJump:
        ldr r1, npc_states
        ldrb r0, [r1, #0xB]                @player height
        mov r1, #0xF
        and r0, r1                        @lower 4 bits are height
        cmp r0, #0x4                        @movement permission 0x10
        beq TheyCan
        cmp r0, #0x0                        @movement permission 0x0
        beq TheyCan
TheyCant:
        mov r0, #0x0
        bx lr

TheyCan:
        mov r0, #0x1
        bx lr

.align 2
        npc_states:                .word 0x02036E38



Koople September 17th, 2018 10:58 AM

Evolution Moves [FR]

Adds the feature of learning moves when you evolve, regardless of the level. Currently, only compatable if you have expanded your moves above 511 (jambo learnsets). May make it compatable with old learnsets if there is a desire.

Here is the repository. Update config.ini with your learnset table location and a free ram address byte (does not need to be in the save block hack. Example free space starts at 0203e000 if you've removed the help system, I believe)

I've only done prelimenary testing, so there may be bugs.

hjk321 October 6th, 2018 5:28 AM

Quote:

Originally Posted by Koople (Post 9924710)
Side Quest Menu [FR]

This hack converts the PC item storage menu into a side quest menu, or task list, etc.

Here is the repository, the compilation instructions are included in the readme. You will need to define your own parameters/ram in src/headers/defs.asm and create your own tables of string pointers for all of the quest names, descriptions, item images, and quest details. I kept the item image part to allow hackers to include items that might be symbolic of their quest, eg. a scroll or key or pokeball.

To use in a script (XSE)
Code:

writebytetooffset 0x1 <your questflag ram in src/headers/defs.asm>
fadescreen 0x1
callasm 0x80EBCD9
waitstate


Here is a slightly outdated example GIF (it is just missing the item images in the box), but it gets the point across.

Enjoy! And please let me know of any bugs.

Hello,

I'm having a hard time understanding an aspect of your system, mainly the flags. So if you have 256 quests (the max, still kinda a small number), does that mean you need 512 flags? Consecutive flags, at that? So quest #1 would be flag 0x200, and that would go all the 0x2FF, leaving me with literally no other safe flags for the entire game, or to complete the other 256 flags eaten by the routine? Looks like I might have to dabble in expanding safe flags, unless I'm missing something obvious here.

Edit: Couldn't I just set the "flag" offsets to some unused RAM? Probably not, since it wouldn't be covered by the save block. And how do I convert the flag number to a RAM location?

Thanks, hjk321

Nice routine though!

Koople October 7th, 2018 10:32 AM

Quote:

Originally Posted by hjk321 (Post 9933627)
Hello,

I'm having a hard time understanding an aspect of your system, mainly the flags. So if you have 256 quests (the max, still kinda a small number), does that mean you need 512 flags? Consecutive flags, at that? So quest #1 would be flag 0x200, and that would go all the 0x2FF, leaving me with literally no other safe flags for the entire game, or to complete the other 256 flags eaten by the routine? Looks like I might have to dabble in expanding safe flags, unless I'm missing something obvious here.

Edit: Couldn't I just set the "flag" offsets to some unused RAM? Probably not, since it wouldn't be covered by the save block. And how do I convert the flag number to a RAM location?

Thanks, hjk321

Nice routine though!

I kept the instructions somewhat vague to allow different users to utilize the system the way they like, though you're right that I could have been a bit more verbose.

The system is set up so that you will need two flags for each quest: one to 'activate' the quest, which just means you have unlocked it and the quest name will show up in the menu and you can activate it and whatnot. The second will indicate that the quest is completed, in which case the 'Done' text will appear next to the quest name.

It is currently written so that the activation flags (to show the quest names) are in order, and the completion flags are also in order, but can start from a different initial flag. This was done to prevent the use of two separate tables, but can easily be changed.

256 quests seems like a pretty high number of quests for a rom hack though. And that is not necessarily the limit, the active quest ram can easily be expanded to a halfword value.

I would recommend expanding the safe number of flags with JPANs save block hack; this way you can unlock thousands more safe flags and this system won't be as limiting.

I'm not entirely sure why you would want to use RAM instead of flags; that would end up just taking up much more space unless you edit the routine to check for specific bits in the ram, which is then the same functionality as a flag.

I hope this helps.

hjk321 October 8th, 2018 11:38 AM

Quote:

Originally Posted by Koople (Post 9934044)
It is currently written so that the activation flags (to show the quest names) are in order, and the completion flags are also in order, but can start from a different initial flag. This was done to prevent the use of two separate tables, but can easily be changed.
I hope this helps.

Literally everything about your routine is great... except every quest is ???????? whether the flags are set or not! in the defs file I've tried RAM pointers (0x0203C001) I've tried repointed flag numbers (0x909) and I've tried raw flag numbers (0x2109) and no matter what the quests do not show up!

As an experiment I have 15 quests and I set some flags At the index. Index starts at 0203C001, have also tried 0x909 and 0x2109 in defs.asm. Here is proof I have flags set in that area...
https://cdn.pbrd.co/images/HHxEbja.png
and yet all 15 quests are unshowable. What am I doing wrong?

I only made minor edits to some text variables, as well as linking to external tables rather than making a table in the actual asm. I didn't edit anything significant.

Koople October 9th, 2018 8:40 AM

Quote:

Originally Posted by hjk321 (Post 9934365)
Literally everything about your routine is great... except every quest is ???????? whether the flags are set or not! in the defs file I've tried RAM pointers (0x0203C001) I've tried repointed flag numbers (0x909) and I've tried raw flag numbers (0x2109) and no matter what the quests do not show up!

As an experiment I have 15 quests and I set some flags At the index. Index starts at 0203C001, have also tried 0x909 and 0x2109 in defs.asm. Here is proof I have flags set in that area...
https://cdn.pbrd.co/images/HHxEbja.png
and yet all 15 quests are unshowable. What am I doing wrong?

I only made minor edits to some text variables, as well as linking to external tables rather than making a table in the actual asm. I didn't edit anything significant.

Can you share your code so I can better understand what you are trying to do? Let's do this via discord or personal message to keep this thread clean. :)

Banjo-Fella October 10th, 2018 4:59 AM

Hi ASMaties! I'm new to hacking and I'm not sure how to go about this would it be okay if I requested some help modifying the way EV-increasing items (HP Up, Protein, Iron, etc.) work in Emerald?

The default behaviour adds +10 EVs, but it has no effect when the EV is >=100. I want to remove that restriction so you can keep using EV items and max out an EV at 252, allowing players to EV train quickly and painlessly.

Any help would be much appreciated!

ghoulslash October 13th, 2018 8:38 AM

Quote:

Originally Posted by Koople (Post 9926980)
Evolution Moves [FR]

I found a bug in this code where a pokemon learning a move from any other way would be asked to learn moves it already knows and will be asked to learn a move even when their movesets are not full.

I rewrote the moveset loop by just calling a custom function rather than editing the main learn_move function at 0803ea88, and it appears to work fine.

Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func
.global LearnMove_Evolution
/*
insert 00 48 00 47 (xx+1) xx xx 08 at cedd4
*/

Main:
        ldrb r1, [r5, #0x10]
        mov r0, r9
        bl MoveChecks
        ldr r6, =(0x080ceddc +1)
        bx r6

MoveChecks:
        push {r4-r7, lr}
        mov r7, r10
        mov r6, r9
        mov r5, r8
        push {r5-r7}
        sub sp, #0x4
        mov r8, r0                @ r8 = start of poke data (02024284 + 64*ind)
        lsl r4, r1, #0x18
        lsr r4, r4, #0x18
        mov r0, #0x0
        str r0, [sp]
        mov r0, r8
        mov r1, #0xb
        mov r2, #0x0
        bl GetAttr
        lsl r0, r0, #0x10
        lsr r0, r0, #0x10
        mov r9, r0                @ r9 = species
        mov r0, r8
        mov r1, #0x38
        mov r2, #0x0
        bl GetAttr
        lsl r0, r0, #0x10
        lsr r0, r0, #0x10
        mov r10, r0                @ r10 = poke level
        ldr r0, =(0x0000ffff)
        mov r12, r0
        cmp r4, #0x0
        beq GetLearnset
        mov r1, sp
        ldrb r1, [r1]
        ldr r4, =(0x02024028)
        strb r1, [r4]

GetLearnset:
        ldr r3, .MovesetTable
        mov r1, r9
        lsl r4, r1, #0x2
        add r5, r4, r3
        ldr r5, [r5]        @ species learnset offset start
        ldr r6, =(0x02024028)
        mov r4, r10

LearnsetLoop:
        ldrb r0, [r6]
        lsl r1, r0, #0x1
        add r0, r0, r1
        add r3, r0, r5
        ldrb r1, [r3, #0x2]
        cmp r1, #0xFF
        beq EndofLearnset
        cmp r1, #0x0
        bne CompareLevels

CheckEvolved:
        ldr r0, .EvolveFlag
        ldrb r0, [r0]
        cmp r0, #0x0
        bne LearnMove        @ pokemon has evolved & found evo move

CompareLevels:
        ldrb r0, [r6]
        add r0, #0x1
        strb r0, [r6]        @ pos += 1
        cmp r1, r4
        bne LearnsetLoop

LearnMove:
        ldrb r0, [r6]
        add r0, #0x1
        strb r0, [r6]        @ pos += 1
        ldrb r0, [r3, #0x1]
        lsl r0, r0, #0x8
        ldrb r1, [r3]
        orr r0, r1
        ldr r2, =(0x02024022)
        strh r0, [r2]
        mov r0, r8        @ poke data struct in ram
        ldrh r1, [r2]        @ move to learn
        bl MovesetPad
        lsl r0, r0, #0x10
        lsr r0, r0, #0x10
        str r0, [sp]

EndofLearnset:
        ldr r0, [sp]
        add sp, #0x4
        pop {r3-r5}
        mov r8, r3
        mov r9, r4
        mov r10, r5
        pop {r4-r7}
        pop {r1}
        bx r1

GetAttr:
        ldr r3, =(0x0803fbe8 +1)
        bx r3

MovesetPad:
        ldr r2, =(0x0803e89c +1)
        bx r2

.align 2
.EvolveFlag:        .word 0x02xxxxxx  @ from the config.ini
.MovesetTable:        .word 0x0825d7b4




If you implemented the original routines, be sure to replace the bytes at 3eaa4.

Skeli October 13th, 2018 10:12 PM

Only Buy 1 TM From Shops [FR]

If you've decided to make your TMs reusable in Fire Red, this routine will remove the option to buy more than one of each from shops. Credits to azurile13 for the first part (Main) of the code.The only thing that needs changing is the line ".equ offset".
Code:

.thumb
.global AlreadyOwnTM

.equ rom, 0x8000000
.equ offset, 0x893960 @CHANGE THIS LINE

.org 0x9BC3C, 0xFF
        ldr r1, .Pointer1
        bx r1
.Pointer1: .word Main + rom + 1

.org 0x9BC7C, 0xFF
        ldr r0, .Pointer2
        bx r0
.Pointer2: .word OnlyBuyOne + rom + 1

.org 0x9BEBC, 0xFF
        ldr r1, .Pointer3
        bx r1
.Pointer3: .word AddItem + rom + 1

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

.org offset, 0xFF
Main:
        lsr r4, r0, #0x10
        mov r0, r4
        ldr r2, .GetItemPocket
        bl Jump
        cmp r0, #0x4
        bne Return
        mov r0, r4
        mov r1, #0x1
        ldr r2, .CheckItem
        bl Jump
        cmp r0, #0x0
        bne AlreadyOwn

Return:
        mov r0, r4
        ldr r1, =0x809BC45
        bx r1

AlreadyOwn:
        ldr r1, .AlreadyHaveTMString
        ldr r2, =0x809BC67
        bx r2

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

OnlyBuyOne:
        ldr r1, .FCodeBuffer2
        mov r0, r4
        ldr r2, .ItemID_Copy_Name
        bl Jump
        mov r0, r4
        ldr r2, .GetItemPocket
        bl Jump
        cmp r0, #0x4
        bne Return2

GetPrice:
        mov r0, r4
        ldr r2, .GetMarketPrice
        bl Jump
        mov r1, r0
        ldr r0, .FCodeBuffer2
        add r0, #0x20
        mov r2, #0x3
        mov r3, #0x8
        bl Hex2Dec
        ldr r1, .NewYouWantString
        ldr r2, =0x809BE91
        ldr r3, =0x809BC89
        bx r3

Return2:
        ldr r1, =0x809BC85
        bx r1

Hex2Dec:
        ldr r4, =0x8008E79
        bx r4

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

AddItem:
        ldr r2, .GetItemPocket
        bl Jump
        cmp r0, #0x4
        bne Return3
        mov r0, #0x1
        strh r1, [r4, #0x2]

Return3:
        ldrh r0, [r4, #0xA]
        ldrh r1, [r4, #0x2]
        ldr r2, .Bag_Add_Item
        bl Jump
        lsl r0, #0x18
        ldr r2, =0x809BEC5
Jump:
        bx r2

.align 2
.FCodeBuffer2: .word 0x2021CD0
.GetItemPocket: .word 0x809A9D9
.CheckItem: .word 0x8099F41
.ItemID_Copy_Name: .word 0x8099E91
.GetMarketPrice: .word 0x809A901
.Bag_Add_Item: .word 0x809A085
.AlreadyHaveTMString: .word STRING1 + rom
.NewYouWantString: .word STRING2 + rom

STRING1: .byte 0xD3, 0xE3, 0xE9, 0x00, 0xD5, 0xE0, 0xE6, 0xD9, 0xD5, 0xD8, 0xED, 0x00, 0xE3, 0xEB, 0xE2, 0x00, 0xE8, 0xDC, 0xD5, 0xE8, 0x00, 0xCE, 0xC7, 0xAD, 0xFC, 0x09, 0xFF
STRING2: .byte 0xFD, 0x02, 0xB8, 0xFE, 0xCE, 0xDC, 0xD5, 0xE8, 0x00, 0xEB, 0xDD, 0xE0, 0xE0, 0x00, 0xD6, 0xD9, 0x00, 0xB7, 0xFD, 0x03, 0xAD, 0x00, 0xC9, 0xDF, 0xD5, 0xED, 0xAC, 0xFF




All times are GMT -8. The time now is 8:46 AM.


Like our Facebook Page Follow us on Twitter © 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.