Guides:Goldenrod Glitch Pokédex Mode ACE setup (DE): Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
Line 755: Line 755:
C8 ret z
C8 ret z
18 F2 jr .goBack
18 F2 jr .goBack
</pre>

===Effect of the side effect-fixing code===

When using the Mail Writer, the assembly from this code is directly written and executed as follows:

<pre>
21 7A D6 ld hl, $D67A ; Address where the original pokégear flags have been displaced to
2A ldi a, (hl)
23 inc hl
F6 84 or $84 ; Ensures that minimal pokégears are restored if $D67A is empty
22 ldi (hl), a
AF xor a ; a = $00
21 E1 D5 ld wNumKeyItems ; Current amount of key items in key item pocket
47 ld b, a ; b = $00
4E ld c, (hl) ; Set c to amount of key items
09 add hl, bc
23 inc hl
36 FF ld (hl), $FF ; Restore cancel button to key item pocket
2E FC ld l, $FC ; hl targets wNumBalls
36 01 ld (hl), $01 ; Set current amount of balls in ball pocket to 1
21 03 DC ld hl, $DC03 ; Address containing $00's caught flag
CB BE res 7, (hl) ; Remove $00's caught flag
2E 23 ld l, $23 ; hl targets address containing $00's seen flag
CB BE res 7, (hl) ; Remove $00's seen flag
21 22 DA ld hl, wPartyCount
4E ld a, (hl)
35 dec (hl) ; Remove last party pokémon
09 add hl, bc
36 FF ld (hl), $FF ; Re-add proper terminator to party list
C9 ret
</pre>

===Effect of the pokédex mode-altering code===

When using the Mail Writer, the assembly from this code is directly written and executed as follows:

<pre>
3E XX ld a, $XX
EA 7E D6 ld (wLastDexMode), a
C9 ret
</pre>
</pre>