Guides:Glitch Pokédex Mode ACE setup (DE): Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
mNo edit summary |
No edit summary |
||
Line 483: | Line 483: | ||
* Use TM25 to execute the code. If the game crashes, doublecheck the box name code and ensure you've performed every step of the process correctly |
* Use TM25 to execute the code. If the game crashes, doublecheck the box name code and ensure you've performed every step of the process correctly |
||
* If the code executes succesfully, the "MAILWRITER" nicknamed pokémon has now been repaired. |
* If the code executes succesfully, the "MAILWRITER" nicknamed pokémon has now been repaired. |
||
=Appendix= |
|||
==Plain text transcripts of codes== |
|||
* Glitch Pokédex mail |
|||
{| class="wikitable" style="margin-left: auto; margin-right: auto; border: none;" |
|||
! Language !! Mail |
|||
|- |
|||
! scope="row" | French |
|||
|| |
|||
p 0 ç é 5 4 j' 7 é 4 4 j' é é 6 4 |
|||
é Mn 2 j' W ♀ j' + 's ç 2 Pk p 0 - 1 |
|||
|} |
|||
* Setup box name code |
|||
{| class="wikitable" style="margin-left: auto; margin-right: auto; border: none;" |
|||
! Language !! Box names |
|||
|- |
|||
! scope="row"| French |
|||
|| |
|||
Box 1: é 8 2 ? O é 2 2 |
|||
Box 2: n' n' n' n' n' p ♀ Pk |
|||
Box 3: 0 g ♂ u' s é 6 2 |
|||
Box 4: ? b é ♀ 2 u' ♂ 5 |
|||
Box 5: é 3 2 u' t é 0 2 |
|||
Box 6: é ; 4 p u' 6 ♀ ] |
|||
Box 7: ♀ ♀ ♀ ♀ ♀ 's 5 5 |
|||
Box 8: ? ♀ é [ 4 u' x 5 |
|||
Box 9: é ( 4 H u' z 5 5 |
|||
Box 10: é : 4 * é ) 4 n' |
|||
Box 11: : 4 n' |
|||
|} |
|||
* Reset box name code (Glitch Pokédex Mode) |
|||
{| class="wikitable" style="margin-left: auto; margin-right: auto; border: none;" |
|||
! Language !! Box names |
|||
|- |
|||
! scope="row" | French |
|||
|| |
|||
Box 1: p u' 6 é ) 4 u' F |
|||
Box 2: é ; 4 n' n' p ♀ Pk |
|||
Box 3: 0 g ♂ T é [ 4 5 |
|||
Box 4: u' X é ( 4 H u' z |
|||
Box 5: é : 4 n' |
|||
|} |
|||
* Reset box name code (Wrong Pocket TM) |
|||
{| class="wikitable" style="margin-left: auto; margin-right: auto; border: none;" |
|||
! Language !! Box names |
|||
|- |
|||
! scope="row" | French |
|||
|| |
|||
Box 1: p u' 6 é ) 4 u' F |
|||
Box 2: é ; 4 u' I é [ 4 |
|||
Box 3: u' w é ( 4 H u' z |
|||
Box 4: é : 4 n' |
|||
|} |
|||
==In-depth explanation of the setup== |
|||
===Effect of the glitch pokédex mode=== |
|||
In the 2nd generation of Pokémon games, the Pokédex offers three different modes of sorting pokémon species (New, Old, A-Z). When the Pokédex is opened, the game checks which mode was last active, then launches a function to sort all species. Since the game needs to know which mode was last active, the last used Pokédex mode is stored in RAM at address $D67E. |
|||
By swapping an item stack using the extended Ball Pocket, we can directly overwrite the value for the last used mode. When the Pokédex is next opened, the game will read this value and attempt to launch an invalid sorting function depending on the value used, some of which will trigger ACE. |
|||
For the French versions of Gold & Silver, mode 25 ($19) will trigger ACE from $F8CD onward. This address is echo ram for $D8CD, which correspond to the 6th character of the 2nd box name. |
|||
When species $00 is registered to the Pokédex, opening the Pokédex after safely returning from ACE can result in regions of data (including map data) being overwritten with $D1 values. To prevent this issue from occuring, the codes included will ensure that we will be immediately forced to exit the pokédex once the code is executed. |
|||
===Effect of the mail=== |
|||
The last read mail is buffered from $CEED onward. Converting the characters from the mail to assembly results in the following, ordered by language: |
|||
====German==== |
|||
<pre> |
|||
Mail |
|||
EA FB FA ld ($FAFB), a ; a = $EA |
|||
AF xor a ; a = $00 |
|||
84 add h ; a = $CE |
|||
EA FC FA ld ($FAFC), a |
|||
C6 F5 add $F5 ; a = $C3 |
|||
EA FA FA ld ($FAFA), a |
|||
83 add e ; a = $0A |
|||
84 add h ; a = $D8 |
|||
FB ei |
|||
4E ld c, (hl) |
|||
EA E2 F5 ld (wKeyItems), a ; Change first item in key item pocket to TM25 |
|||
93 sub e ; a = $91 |
|||
87 add a ; a = $22, set carry flag |
|||
EA BE F8 ld ($F8BE), a |
|||
9A add a ; a = $21 |
|||
E1 pop hl ; Set hl to $D8F1, return address of previous rst28h |
|||
EA F9 F8 ld ($F8F9), a |
|||
C3 C0 F8 jp wBoxNames + 1 h |
|||
Bootstrap ($FAFA, 5th party pokémon's stat experience) |
|||
C3 EA CE jr nz, wTempMail - 3h |
|||
</pre> |
|||
===Effect of the setup box name code=== |
|||
Converting the characters from box names to assembly results in the following code. Please note that the box name code overwrites part of itself, the translated assembly assumes the code was already used once. |
|||
The code overwrites part of itself to call the byteFill function. This will fill the area between $D57E and $D5AF with $FF values, setting all 50 TM quantities to 255. Separately, this code overwrites the latter half of party pokémon #5's stat experience data, allowing it to function as a TM25 bootstrap that redirects execution to the Mail Writer. |
|||
====German==== |
|||
<pre> |
|||
Lead-up to wBoxNames: $D8BE |
|||
22 ldi (hl), a ; Due to mail, set hl to $D8F1 |
|||
Box 1: $D8BF |
|||
C0 |
|||
C4 BE F8 call nz, $F8BE ; Due to mail, a = $21 |
|||
96 sub (hl) ; a = $7E |
|||
C4 BE F8 call nz, $F8BE |
|||
50 ld d, b |
|||
Box 2: $D8C8 |
|||
96 sub (hl) ; a = $F5 |
|||
C4 BE F8 call nz, $F8BE |
|||
96 sub (hl) |
|||
96 sub (hl) |
|||
93 sub e ; a = $0E |
|||
FB ei |
|||
50 ld d; b |
|||
Box 3: $D8D1 |
|||
C4 BE F8 call nz, $F8BE |
|||
B6 or (hl) ; a = $9F |
|||
86 add (hl) ; a = $32 |
|||
C4 BE F8 call nz, $F8BE |
|||
50 ld d, b |
|||
Box 4: $D8DA |
|||
86 add (hl) ; a = $C3 |
|||
C4 BE F8 call nz, $F8BE |
|||
86 add (hl) ; a = $79 |
|||
C4 BE F8 call nz, $F8BE |
|||
50 ld d, b |
|||
Box 5: $D8E3 |
|||
86 add (hl) ; a = $31 |
|||
C4 BE F8 call nz, $F8BE |
|||
C2 FF F8 jp nz, $F8FF |
|||
AF xor a ; a = $00, entry point for mode 71 |
|||
50 ld d, b |
|||
Box 6: $D8EC |
|||
F5 push af |
|||
E1 pop hl ; hl = $0080 |
|||
F6 A6 or A6 ; a = $A6 |
|||
EF rst28h JumpTable ; Due to ROM header structure, call $CEEA, three bytes before the last read mail |
|||
EF filler |
|||
A3 filler |
|||
89 filler ; Overwritten to 21 7E F5 (ld hl, wTMsHMs) |
|||
50 filler |
|||
Box 7: $D8F5 |
|||
93 filler ; Overwritten to 0E 32 (ld e, $32) |
|||
92 filler |
|||
B5 filler |
|||
B8 filler ; Overwritten to C4 79 31 (call ByteFill) |
|||
(A1) 9A FA filler ; Overwritten to form 21 9A FA (ld hl, $FA9A) |
|||
A7 and a ; Reset zero flag |
|||
50 ld d, b |
|||
Box 8: $D8FE |
|||
C0 ret nz |
|||
F6 FF or $FF ; a = $FF |
|||
C4 F1 F8 call nz, $F8F1 |
|||
E6 BE and $BE ; a = $BE |
|||
50 ld d, b |
|||
Box 9: $D907 |
|||
E6 7F and $7F ; a = $3E |
|||
C4 BE F8 call nz, $F8BE |
|||
E6 84 and $84 ; a = $04 |
|||
FB ei |
|||
50 ld d, b |
|||
Box 10: $D910 |
|||
C4 BE F8 call nz, $F8BE |
|||
AF xor a ; a = $00 |
|||
F6 C2 or $C2 ; a = $C2 |
|||
FB ei |
|||
FB ei |
|||
50 ld d, b |
|||
Box 11: $D919 |
|||
C4 BE F8 call nz, $F8BE |
|||
87 add a |
|||
84 add h ; a = $7E |
|||
C4 BE F8 call nz, $F8BE |
|||
50 ld d, b |
|||
Box 12: $D922 |
|||
AF xor a ; a = $00 |
|||
F6 F5 or $F5 ; a = $F5 |
|||
C4 BE F8 call nz, $F8BE |
|||
AF xor a ; a = $00 |
|||
83 add e |
|||
50 ld d, b |
|||
Box 13: $D92B |
|||
E6 E2 and $E2 ; a = $42 |
|||
F5 push af |
|||
E1 pop hl ; h = $42 |
|||
F6 E3 or $E3 ; a = $E3 |
|||
F7 rst30h ; Jump to $10:42E3, final bytes of Pokedex_ReinitDexEntryScreen. This will set $CE63 to $FF, causing immediate exit of Pokédex after return |
|||
Party pokémon #3's stat experience, starting from $DA9A |
|||
3E 04 ld a, $04 |
|||
C2 7E F5 jp nz, wTMsHMs ; Carry and zero flag are both reset when using TM25 |
|||
</pre> |
|||
===Effect of the TM code=== |
|||
Converting the TM quantities to assembly results in the following code. Please note that this code requires a value of $04 in register a in order to properly work. |
|||
====German==== |
|||
<pre> |
|||
11 55 DD ld de, $DD55 |
|||
D5 push de |
|||
D5 push de ; .nextMail |
|||
D5 push de |
|||
21 22 62 ld hl, _ComposeMailMessage |
|||
CF rst08h, FarCall a:hl |
|||
E1 pop hl |
|||
D1 pop de |
|||
2A ldi a, (hl) ; .continue |
|||
FE 50 cp $50 |
|||
38 FB jr c, .continue |
|||
28 0A jr z, .terminator |
|||
87 add a, a |
|||
86 add a, (hl) |
|||
12 ld (de), a |
|||
13 inc de |
|||
23 inc hl |
|||
81 add a, c |
|||
4F ld c, a |
|||
12 ld (de), a |
|||
18 EF jr .continue |
|||
21 01 C4 ld hl, $C401 ; .screenLoop |
|||
4D ld c, l |
|||
CD E6 3A call PrintBCDNumber.loop - 1 |
|||
1B dec de ; .goBack |
|||
CD 87 37 call JoyTextDelay_ForcehJoyDown |
|||
BD cp a, l ; l = $04 |
|||
28 D9 jr z, .nextMail |
|||
38 F0 jr c, .displayLoop |
|||
FE 08 cp $08 |
|||
C8 ret z |
|||
18 F2 jr .goBack |
|||
</pre> |
|||
===Effect of the reset box name code (Glitch Pokédex Mode)=== |
|||
Converting the characters from box names to assembly results in the following code. This code overwrites the latter half of party pokémon #3's stat experience data, allowing it to function as a TM25 bootstrap that redirects execution to the Mail Writer. |
|||
====German==== |
|||
<pre> |
|||
Lead-up to wBoxNames: $D8BE |
|||
22 ldi (hl), a |
|||
Box 1: $D8BF |
|||
C0 ret nz |
|||
C4 F9 F8 call nz, $F8F9 ; Sets hl to $FA9A |
|||
AF xor a ; a = $00 |
|||
F6 9F or $9F ; a = BF |
|||
87 and a ; a = $3E |
|||
50 ld d, b |
|||
Box 2: $D8C8 |
|||
C4 BE F8 call nz, $F8BE |
|||
E6 84 and $84 ; a = $04 |
|||
C4 BE F8 call nz, $F8BE |
|||
Box 3: $D8D1 |
|||
AF xor a ; a = $00 |
|||
F6 C2 or $C2 ; a = $C2 |
|||
C4 BE F8 call nz, $F8BE |
|||
87 add a ; a = $84 |
|||
84 add a, h ; a = $7E |
|||
50 ld d, b |
|||
Box 4: $D8DA |
|||
C4 BE F8 call nz, $F8BE |
|||
AF xor a ; a = $00 |
|||
F6 F5 or $F5 ; a = $F5 |
|||
FB ei |
|||
FB ei |
|||
50 ld d, b |
|||
Box 5: $D8E3 |
|||
C3 BE F8 jp nz, $F8BE |
|||
AF xor a ; a = $00 |
|||
AF xor a ; a = $00 |
|||
AF xor a ; a = $00 |
|||
AF xor a ; a = $00 |
|||
AF xor a ; a = $00 |
|||
50 ld d, b |
|||
Box 6: $D8EC |
|||
F5 push af |
|||
E1 pop hl ; hl = $0080 |
|||
F6 A6 or A6 ; a = $A6 |
|||
EF rst28h JumpTable ; Due to ROM header structure, call $CEEA, three bytes before the last read mail |
|||
50 ld d, b |
|||
Party pokémon #3's stat experience, starting from $DA9A |
|||
3E 04 ld a, $04 |
|||
C2 7E F5 jp wTMsHMs ; carry and zero flag are both reset when using TM25 |
|||
</pre> |
|||
===Effect of the mail=== |
|||
The last read mail is buffered from $CEED onward. Converting the characters from the mail to assembly results in the following, ordered by language: |
|||
====German==== |
|||
<pre> |
|||
80 add a, b |
|||
80 add a, b |
|||
80 add a, b |
|||
80 add a, b |
|||
80 add a, b |
|||
80 add a, b |
|||
80 add a, b |
|||
80 add a, b |
|||
80 add a, b |
|||
80 add a, b |
|||
80 add a, b |
|||
80 add a, b |
|||
80 add a, b |
|||
80 add a, b |
|||
80 add a, b |
|||
80 add a, b |
|||
4E ld c, (hl) ; Newline control character. |
|||
80 add a, b |
|||
80 add a, b |
|||
C6 B8 add $B8 ; Located at $CF00, all values before this address are filler and will not be executed. a = $22 |
|||
EA BE F8 ld (F8BE), a ; One byte before the start of wBoxNames |
|||
C6 FF add $FF ; a = $21 |
|||
EA C0 F8 ld (F8C0), a ; One byte after the start of wBoxNames |
|||
C3 C0 F8 jp F8C0 ; Jump to second character of box name #1 |
|||
</pre> |
|||
===Effect of the reset box name code (Wrong Pocket TM)=== |
|||
Converting the characters from box names to assembly results in the following code. This code overwrites the latter half of party pokémon #3's stat experience data, allowing it to function as a TM25 bootstrap that redirects execution to the Mail Writer. |
|||
This code requires a bootstrap pokémon in the 2nd party slot that redirects execution to box names. |
|||
====German==== |
|||
<pre> |
|||
Lead-up to wBoxNames: $D8BE |
|||
22 ldi (hl), a |
|||
Box 1: $D8BF |
|||
C0 ret nz |
|||
21 9A FA hl hl, FA9A |
|||
AF xor a ; a = $00 |
|||
F6 9F or $9F ; a = $9F |
|||
87 add a ; a = $3E |
|||
50 ld d, b |
|||
Box 2: $D8C8 |
|||
C4 BE F8 call nz, $F8BE |
|||
E6 84 or $84 ; a = $04 |
|||
C4 BE F8 call nz, $F8BE |
|||
50 ld d, b |
|||
Box 3: $D8D1 |
|||
AF xor a ; a = $00 |
|||
F6 C2 or $C2 ; a = $C2 |
|||
C4 BE F8 call nz, $F8BE |
|||
87 add a ; a = $84 |
|||
84 add a, h ; a = $7E |
|||
50 ld d, b |
|||
Box 4: $D8DA |
|||
C4 BE F8 call nz, $F8BE |
|||
AF xor a ; a = $00 |
|||
F6 F5 or $F5 ; a = $F5 |
|||
FB ei |
|||
FB ei |
|||
50 ld d, b |
|||
Box 5: $D8E3 |
|||
C3 BE F8 call nz, $F8BE |
|||
Party pokémon #3's stat experience, starting from $DA9A |
|||
3E 04 ld a, $04 |
|||
C2 7E F5 jp wTMsHMs ; carry and zero flag are both reset when using TM25 |
|||
</pre> |
|||
[[Category:Guides]] |
[[Category:Guides]] |