diff options
-rw-r--r-- | Custom-order-for-the-Old-Pokédex-mode.md | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/Custom-order-for-the-Old-Pokédex-mode.md b/Custom-order-for-the-Old-Pokédex-mode.md index f92a463..c532ed0 100644 --- a/Custom-order-for-the-Old-Pokédex-mode.md +++ b/Custom-order-for-the-Old-Pokédex-mode.md @@ -123,28 +123,28 @@ Pokedex_PrintNumberIfOldMode: ``` And add this code to any safe place in the file. I put it right before OldPokedexOrder: - -`Pokedex_GetDexNumber:` -`; Get the intended number of the selected Pokémon.` - `push bc` - `push hl ;Store bc and hl to the stack` +``` +Pokedex_GetDexNumber: +; Get the intended number of the selected Pokémon. + push bc + push hl ;Store bc and hl to the stack - `ld a, [wTempSpecies] ;a = current mon (internal number)` - `ld b, a ;b = Needed mon (a and b must be matched)` - `ld c, 0 ;c = index` - `ld hl,OldPokedexOrder ;hl = OldDexOrder` + ld a, [wTempSpecies] ;a = current mon (internal number) + ld b, a ;b = Needed mon (a and b must be matched) + ld c, 0 ;c = index + ld hl,OldPokedexOrder ;hl = OldDexOrder -`.loop` - `inc c` - `ld a, [hli] ;save index of hl to a` - `cp b ;does a match b?` - `jr nz, .loop ;if not, loop` - `ld a, c` - `ld [wc296], a` - `pop hl ;Restore bc and hl in reverse order to keep the stack correct.` - `pop bc` - `ret` - +.loop + inc c + ld a, [hli] ;save index of hl to a + cp b ;does a match b? + jr nz, .loop ;if not, loop + ld a, c + ld [wc296], a + pop hl ;Restore bc and hl in reverse order to keep the stack correct. + pop bc + ret +``` Before we move on, please note "wc296". This is a point in wRAM where the correct Pokedex number is stored. This variable is read from in some unused code, but never written too or read from otherwise, so it is safe to use in Crystal vanilla. Edit [pokedex_2.asm](../blob/master/engine/pokedex/pokedex_2.asm): |