summaryrefslogtreecommitdiff
path: root/data/pokedex/entry_pointers.asm
diff options
context:
space:
mode:
Diffstat (limited to 'data/pokedex/entry_pointers.asm')
-rw-r--r--data/pokedex/entry_pointers.asm72
1 files changed, 72 insertions, 0 deletions
diff --git a/data/pokedex/entry_pointers.asm b/data/pokedex/entry_pointers.asm
index 4f0f8aff2..5a432e661 100644
--- a/data/pokedex/entry_pointers.asm
+++ b/data/pokedex/entry_pointers.asm
@@ -1,3 +1,75 @@
+GetDexEntryPointer: ; 44333
+; return dex entry pointer b:de
+ push hl
+ ld hl, PokedexDataPointerTable
+ ld a, b
+ dec a
+ ld d, 0
+ ld e, a
+ add hl, de
+ add hl, de
+ ld e, [hl]
+ inc hl
+ ld d, [hl]
+ push de
+ rlca
+ rlca
+ and $3
+ ld hl, .PokedexEntryBanks
+ ld d, 0
+ ld e, a
+ add hl, de
+ ld b, [hl]
+ pop de
+ pop hl
+ ret
+
+.PokedexEntryBanks: ; 44351
+
+GLOBAL PokedexEntries1
+GLOBAL PokedexEntries2
+GLOBAL PokedexEntries3
+GLOBAL PokedexEntries4
+
+ db BANK(PokedexEntries1)
+ db BANK(PokedexEntries2)
+ db BANK(PokedexEntries3)
+ db BANK(PokedexEntries4)
+
+GetDexEntryPagePointer: ; 44355
+ call GetDexEntryPointer ; b:de
+ push hl
+ ld h, d
+ ld l, e
+; skip species name
+.loop1
+ ld a, b
+ call GetFarByte
+ inc hl
+ cp "@"
+ jr nz, .loop1
+; skip height and weight
+rept 4
+ inc hl
+endr
+; if c != 1: skip entry
+ dec c
+ jr z, .done
+; skip entry
+.loop2
+ ld a, b
+ call GetFarByte
+ inc hl
+ cp "@"
+ jr nz, .loop2
+
+.done
+ ld d, h
+ ld e, l
+ pop hl
+ ret
+
+PokedexDataPointerTable: ; 0x44378
; Pointers to all the Pokedex entries.
dw BulbasaurPokedexEntry