Pokémon 3rd Generation/Pokémon FireRed and LeafGreen/ROM map

From Data Crystal
Jump to navigation Jump to search

Chip tiny.png The following article is a ROM map for Pokémon 3rd Generation/Pokémon FireRed and LeafGreen.

General pointers

Offset Pointer Comment
08000128 082350AC Pointer to graphic table, which contains pointers to front pokemon images.
0800012C 0823654C Pointer to graphic table, which contains pointers to back pokemon images.
08000130 0823730C Pointer to palette table, which contains pointers to normal palettes for pokemon images.
08000134 082380CC Pointer to palette table, which contains pointers to shiny palettes for pokemon images.

Hex address to wild Pokemon

NOTE: This hacking I test in EUROPE (Spanish) version games.

Go to 3C438C address corresponding to Route 101 at the beginning of the game.

Then, in these address change the wild pokemon code, with the hex pokemon code that you like appear.

Hex address to Poke Market in first town

NOTE: This hacking I test in EUROPE (Spanish) version games.

Go to 16A30C address showing the codes first town.

Then you can change the code of first item that they sell you, to other code, for example a MasterBall (code 0100).

Copy array from a RAM address to another

  • arguments:
    • r0 = copy_destination
    • r1 = copy_source
    • r2 = number_of_bytes_to_copy
08008DD0 B570     push    r4-r6,r14                               ;
08008DD2 1C04     mov     r4,r0                                   ;r4 = copy_destination
08008DD4 1C0E     mov     r6,r1                                   ;r6 = copy_source
08008DD6 0612     lsl     r2,r2,18h                               ;
08008DD8 0E15     lsr     r5,r2,18h                               ;r5 = number_of_bytes_to_copy; max length is 255
08008DDA 2300     mov     r3,0h                                   ;current_byte = 0
08008DDC 1C28     mov     r0,r5                                   ;r0 = number_of_bytes_to_copy
08008DDE 4283     cmp     r3,r0                                   ;
08008DE0 D209     bcs     Lxx_8008DF6h                            ;if(number_of_bytes_to_copy == 0), exit this function
08008DE2 1C02     mov     r2,r0                                   ;r2 = number_of_bytes_to_copy
08008DE4 18E1     add     r1,r4,r3                                ;r1 = copy_destination + current_byte
08008DE6 18F0     add     r0,r6,r3                                ;r0 = copy_source + current_byte
08008DE8 7800     ldrb    r0,[r0]                                 ;load byte to copy
08008DEA 7008     strb    r0,[r1]                                 ;store copied byte in destination
08008DEC 1C58     add     r0,r3,1                                 ;
08008DEE 0400     lsl     r0,r0,10h                               ;
08008DF0 0C03     lsr     r3,r0,10h                               ;current_byte++
08008DF2 4293     cmp     r3,r2                                   ;
08008DF4 D3F6     bcc     Lxx_8008DE4h                            ;loop until the number_of_bytes_to_copy have been copied
08008DF6 1960     add     r0,r4,r5                                ;r0 = copy_destination + number_of_bytes_to_copy
08008DF8 BC70     pop     r4-r6                                   ;
08008DFA BC02     pop     r1                                      ;
08008DFC 4708     bx      r1                                      ;

Pokémon in Old Man Tutorial

In US 1.1, 0x7F8A0 contains the Pokémon ID, 0x7F8A2 the level, the instructions at 0x7F8B4 sets the battle type to OLD_MAN_TUTORIAL. If you try to set the Pokémon ID to a genderless Pokémon, you will softlock unless you change the check done on r0 ≠ 0 and the bne at 0x3DF54 after the call of func_3F7A0.

Check if Pokémon is male, female, or genderless

  • 0x3F7A0 - Retrieves Pokémon gender ratio, checks if always male, always female or genderless, then checks pid to determine if male or female
  • arguments:
    • r0 = pokemon_id
    • r1 = pid
  • returns:
    • r0 = 0x0 if male; 0xFE if female; 0xFF if genderless
0803F7A0 B500     push    r14                                     ;
0803F7A2 1C0B     mov     r3,r1                                   ;r3 = pokemon_pid
0803F7A4 0400     lsl     r0,r0,10h                               ;
0803F7A6 0C02     lsr     r2,r0,10h                               ;r2 = pokemon_id
0803F7A8 490C     ldr     r1,=Lxx_82547F4h                        ;r1 = pointer_to_pokemon_data
0803F7AA 00D0     lsl     r0,r2,3h                                ;
0803F7AC 1A80     sub     r0,r0,r2                                ;
0803F7AE 0080     lsl     r0,r0,2h                                ;r0 = pokemon_id × 28
0803F7B0 1840     add     r0,r0,r1                                ;r0 = pointer_to_pokemon_datum
0803F7B2 7C00     ldrb    r0,[r0,10h]                             ;r0 = pokemon_gender_ratio
0803F7B4 2800     cmp     r0,0h                                   ;
0803F7B6 D014     beq     Lxx_803F7E2h                            ;if (pokemon_always_male), exit this function
0803F7B8 2800     cmp     r0,0h                                   ;
0803F7BA DB03     blt     Lxx_803F7C4h                            ;
0803F7BC 28FF     cmp     r0,0FFh                                 ;
0803F7BE DC01     bgt     Lxx_803F7C4h                            ;
0803F7C0 28FE     cmp     r0,0FEh                                 ;
0803F7C2 DA0E     bge     Lxx_803F7E2h                            ;if (pokemon_always_female || pokemon_is_genderless), exit this function
0803F7C4 00D0     lsl     r0,r2,3h                                ;
0803F7C6 1A80     sub     r0,r0,r2                                ;
0803F7C8 0080     lsl     r0,r0,2h                                ;r0 = pokemon_id × 28
0803F7CA 1840     add     r0,r0,r1                                ;r0 = pointer_to_pokemon_datum
0803F7CC 7C01     ldrb    r1,[r0,10h]                             ;r1 = pokemon_gender_ratio
0803F7CE 20FF     mov     r0,0FFh                                 ;
0803F7D0 4018     and     r0,r3                                   ;r0 = 0xFF & pokemon_pid
0803F7D2 4281     cmp     r1,r0                                   ;
0803F7D4 D804     bhi     Lxx_803F7E0h                            ;if (pokemon_is_female), r0 = 0xFE, and exit this function
0803F7D6 2000     mov     r0,0h                                   ;else r0 = 0
0803F7D8 E003     b       Lxx_803F7E2h                            ;exit this function
0803F7DA 0000     lsl     r0,r0,0h                                ;
0803F7DC 082547F4                                                 ;(pointer_to_pokemon_data)
0803F7E0 20FE     mov     r0,0FEh                                 ;r0 = 0xFE
0803F7E2 BC02     pop     r1                                      ;
0803F7E4 4708     bx      r1                                      ;

Automatic Rival name subroutine

Call to 0x3E50 at address 0x1303D2 in US 1.1