If you are still using the old URL (datacrystal.romhacking.net), please update your bookmarks! The old URL may stop working soon.
The current URL is datacrystal.tcrf.net.
The current URL is datacrystal.tcrf.net.
Pokémon Card GB2/ROM map
Jump to navigation
Jump to search
The following article is a ROM map for Pokémon Card GB2.
Bank 0
Copy Battle State in SRAM
ROM0:070C 2A ldi a,(hl) ROM0:070D 12 ld (de),a ROM0:070E 13 inc de ROM0:070F 0B dec bc ROM0:0710 79 ld a,c ROM0:0711 B0 or b ROM0:0712 20 F8 jr nz,070C ROM0:0714 C9 ret
? (to document)
- 0x715-0x73E - Pointer for Booster card ?
ROM0:0715 E5 push hl ROM0:0716 C5 push bc ROM0:0717 F5 push af ROM0:0718 D5 push de ROM0:0719 5D ld e,l ROM0:071A 54 ld d,h ROM0:071B F8 09 ld hl,sp+09 ROM0:071D 46 ld b,(hl) ROM0:071E 2B dec hl ROM0:071F 4E ld c,(hl) ROM0:0720 2B dec hl ROM0:0721 70 ld (hl),b ROM0:0722 2B dec hl ROM0:0723 71 ld (hl),c ROM0:0724 F8 09 ld hl,sp+09 ROM0:0726 F0 80 ld a,(ff00+80) ROM0:0728 32 ldd (hl),a ROM0:0729 36 00 ld (hl),00 ROM0:072B 7A ld a,d // a = card ID >> 8 ROM0:072C 07 rlca ROM0:072D 07 rlca ROM0:072E E6 03 and a,03 // If(carry) a = 3; Else a = 0 ROM0:0730 47 ld b,a ROM0:0731 CB BA res 7,d ROM0:0733 CB F2 set 6,d ROM0:0735 6B ld l,e ROM0:0736 62 ld h,d // hl = 0x4000 + card ID × 2 ROM0:0737 D1 pop de // de = card ID ROM0:0738 F1 pop af ROM0:0739 80 add b ROM0:073A CD 73 07 call 0773 ROM0:073D C1 pop bc ROM0:073E C9 ret
- 0x73F-0x75D - ?
ROM0:073F E5 push hl ROM0:0740 C5 push bc ROM0:0741 F5 push af ROM0:0742 D5 push de ROM0:0743 5D ld e,l ROM0:0744 54 ld d,h ROM0:0745 F8 09 ld hl,sp+09 ROM0:0747 46 ld b,(hl) ROM0:0748 2B dec hl ROM0:0749 4E ld c,(hl) ROM0:074A 2B dec hl ROM0:074B 70 ld (hl),b ROM0:074C 2B dec hl ROM0:074D 71 ld (hl),c ROM0:074E F8 09 ld hl,sp+09 ROM0:0750 F0 80 ld a,(ff00+80) ROM0:0752 32 ldd (hl),a ROM0:0753 36 00 ld (hl),00 ROM0:0755 6B ld l,e ROM0:0756 62 ld h,d ROM0:0757 D1 pop de ROM0:0758 F1 pop af ROM0:0759 CD 73 07 call 0773 ROM0:075C C1 pop bc ROM0:075D C9 ret
- 0x75E-0x772 - ?
ROM0:075E E5 push hl ROM0:075F D5 push de ROM0:0760 F8 07 ld hl,sp+07 ROM0:0762 3A ldd a,(hl) ROM0:0763 CD 73 07 call 0773 ROM0:0766 2B dec hl ROM0:0767 56 ld d,(hl) ROM0:0768 2B dec hl ROM0:0769 5E ld e,(hl) ROM0:076A 23 inc hl ROM0:076B 23 inc hl ROM0:076C 73 ld (hl),e ROM0:076D 23 inc hl ROM0:076E 72 ld (hl),d ROM0:076F D1 pop de ROM0:0770 E1 pop hl ROM0:0771 F1 pop af ROM0:0772 C9 ret
- 0x773-0x778 - ?
ROM0:0773 E0 80 ld (ff00+80),a ROM0:0775 EA 00 20 ld (2000),a ROM0:0778 C9 ret
PRNG
/* function starts at 0x85A */ n = accumulator; frame = (CACA); seed = rl((CAC8) ⊕ (CAC9)) ⊕ rl((CAC8) ⊕ frame); prn_1 = (seed × n) >> 8; // 1-byte PRN used in most occasions: Booster packs, Coin flips, Random damage... prn_2 = rr((CAC8) ⊕ rlc(rlc(CAC9))); // 1-byte PRN used in fewer occasions
- 0x844-0x859 - Pseudo-random number between 0 and n-1, multiply prn generated at 0x866 by n, keep the most-significant bits (register h)
ROM0:0844 D5 push de ROM0:0845 7C ld a,h // a = n ROM0:0846 5D ld e,l // e = rl((CAC8) ⊕ (CAC9)) ⊕ rl((CAC8) ⊕ (CACA)) ROM0:0847 16 00 ld d,00 // d = 0 ROM0:0849 6A ld l,d ROM0:084A 62 ld h,d // hl = 0 ROM0:084B 18 05 jr 0852 ROM0:084D 19 add hl,de // hl += de ROM0:084E CB 23 sla e // e << 1 ROM0:0850 CB 12 rl d // rotate left, put the carry in the lsb of register d ROM0:0852 CB 3F srl a // a >> 1 ROM0:0854 38 F7 jr c,084D // If carry, jump to 0x84D ROM0:0856 20 F6 jr nz,084E // ElseIf a != 0, jump to 0x84E ROM0:0858 D1 pop de ROM0:0859 C9 ret
- 0x85A-0x865 - Loads (rl((CAC9) ⊕ (CAC8)) ⊕ rl((CACA) ⊕ (CAC8)) × n) >> 8 in accumulator
ROM0:085A E5 push hl ROM0:085B 67 ld h,a // h = n ROM0:085C CD 66 08 call 0866 ROM0:085F 6F ld l,a // l = rl((CACA) ⊕ (CAC9)) ⊕ rl((CAC8) ⊕ (CACA)) ROM0:0860 CD 44 08 call 0844 ROM0:0863 7C ld a,h // a = h × l >> 8 ROM0:0864 E1 pop hl ROM0:0865 C9 ret
- 0x866-0x889 - Stores a one-byte pseudo-random value in accumulator, and loads a new two-byte seed in (CAC8)
ROM0:0866 E5 push hl ROM0:0867 D5 push de ROM0:0868 21 C8 CA ld hl,CAC8 ROM0:086B 2A ldi a,(hl) // Loads (CAC8) ROM0:086C 56 ld d,(hl) // Loads (CAC9) ROM0:086D 23 inc hl ROM0:086E 5F ld e,a // e = (CAC8) ROM0:086F 7A ld a,d // a = (CAC9) ROM0:0870 07 rlca ROM0:0871 07 rlca ROM0:0872 AB xor e ROM0:0873 1F rra // a = rr(rlc(rlc(CAC9)) ⊕ (CAC8)) ROM0:0874 F5 push af // Stores result ROM0:0875 7A ld a,d // a = (CAC9) ROM0:0876 AB xor e ROM0:0877 57 ld d,a // d = (CAC9) ⊕ (CAC8) ROM0:0878 7E ld a,(hl) // Loads PRNG frame (CACA) ROM0:0879 AB xor e ROM0:087A 5F ld e,a // e = (CACA) ⊕ (CAC8) ROM0:087B F1 pop af ROM0:087C CB 13 rl e ROM0:087E CB 12 rl d ROM0:0880 7A ld a,d ROM0:0881 AB xor e // a = rl((CAC9) ⊕ (CAC8)) ⊕ rl((CACA) ⊕ (CAC8)) ROM0:0882 34 inc (hl) // Increment PRNG frame in (CACA) ROM0:0883 2B dec hl ROM0:0884 72 ld (hl),d // Loads rl((CAC9) ⊕ (CAC8)) in (CAC9) ROM0:0885 2B dec hl ROM0:0886 73 ld (hl),e // Loads rl((CACA) ⊕ (CAC8)) in (CAC8) ROM0:0887 D1 pop de ROM0:0888 E1 pop hl ROM0:0889 C9 ret
? (to document)
- 0x9A7-0x9B3 - ?
ROM0:09A7 F5 push af ROM0:09A8 E5 push hl ROM0:09A9 F8 04 ld hl,sp+04 ROM0:09AB 7E ld a,(hl) ROM0:09AC CD 73 07 call 0773 ROM0:09AF E1 pop hl ROM0:09B0 F1 pop af ROM0:09B1 33 inc sp ROM0:09B2 33 inc sp ROM0:09B3 C9 ret
Multiply by 10
- 0xB20-0xB27 - Multiply accumulator by 10
ROM0:0B20 D5 push de ROM0:0B21 5F ld e,a ROM0:0B22 87 add a ROM0:0B23 87 add a ROM0:0B24 83 add e ROM0:0B25 87 add a ROM0:0B26 D1 pop de ROM0:0B27 C9 ret
? (Reads deck ?)
ROM0:111F F5 push af ROM0:1120 E5 push hl ROM0:1121 CD 6B 11 call 116B ROM0:1124 5E ld e,(hl) ROM0:1125 23 inc hl ROM0:1126 56 ld d,(hl) ROM0:1127 E1 pop hl ROM0:1128 F1 pop af ROM0:1129 C9 ret
Damage calculation
- 0x1500-0x1534 - Initialize damage modifiers
ROM0:1500 AF xor a ROM0:1501 EA 01 CD ld (CD01),a // Sets every damage modifier to 0 ROM0:1504 EA E2 CC ld (CCE2),a ROM0:1507 EA 02 CD ld (CD02),a ROM0:150A EA FB CC ld (CCFB),a ROM0:150D EA 04 CD ld (CD04),a ROM0:1510 EA 05 CD ld (CD05),a ROM0:1513 EA 06 CD ld (CD06),a ROM0:1516 EA 0A CD ld (CD0A),a ROM0:1519 EA 0C CD ld (CD0C),a ROM0:151C EA 0D CD ld (CD0D),a ROM0:151F EA 16 CD ld (CD16),a ROM0:1522 21 10 CD ld hl,CD10 ROM0:1525 22 ldi (hl),a ROM0:1526 22 ldi (hl),a ROM0:1527 22 ldi (hl),a ROM0:1528 77 ld (hl),a ROM0:1529 DF rst 18 ROM0:152A 13 inc de ROM0:152B 6B ld l,e ROM0:152C 3E ED ld a,ED ROM0:152E CD 8C 14 call 148C ROM0:1531 EA 0B CD ld (CD0B),a ROM0:1534 C9 ret
- 0x1796-0x17A4 - Loads Base Damage of current attack
ROM0:1796 AF xor a ROM0:1797 EA D1 CC ld (CCD1),a ROM0:179A 21 C9 CC ld hl,CCC9 ROM0:179D 2A ldi a,(hl) // Loads Base Damage of current attack ROM0:179E B6 or (hl) ROM0:179F 20 04 jr nz,17A5 // If the attack deals damage, jump to next function at 0x17A5 ROM0:17A1 11 00 00 ld de,0000 ROM0:17A4 C9 ret
- 0x17A5-0x17BF -
ROM0:17A5 AF xor a ROM0:17A6 E0 9F ld (ff00+9F),a ROM0:17A8 56 ld d,(hl) ROM0:17A9 2B dec hl ROM0:17AA 5E ld e,(hl) // Loads Base Damage of current attack ROM0:17AB CB 7A bit 7,d ROM0:17AD 28 0B jr z,17BA ROM0:17AF CB BA res 7,d ROM0:17B1 AF xor a ROM0:17B2 EA D1 CC ld (CCD1),a ROM0:17B5 DF rst 18 ROM0:17B6 22 ldi (hl),a ROM0:17B7 6C ld l,h ROM0:17B8 18 4F jr 1809 ROM0:17BA DF rst 18 ROM0:17BB 22 ldi (hl),a ROM0:17BC 6C ld l,h ROM0:17BD 7B ld a,e ROM0:17BE B2 or d ROM0:17BF C8 ret z
- 0x18B3-0x18C8 - Subtract final damage from the Defending Pokémon HP
ROM0:18B3 E5 push hl ROM0:18B4 D5 push de ROM0:18B5 7E ld a,(hl) // Loads (C2C8) or (C3C8), Defending Pokémon's remaining HP ROM0:18B6 93 sub e // Subtract damage from remaining HP ROM0:18B7 77 ld (hl),a // Loads result in (C2C8) or (C3C8) ROM0:18B8 3E 00 ld a,00 ROM0:18BA 9A sbc d ROM0:18BB E6 80 and a,80 ROM0:18BD 28 02 jr z,18C1 // If damage was greater than remaining HP, set remaining HP to 0 ROM0:18BF 36 00 ld (hl),00 ROM0:18C1 7E ld a,(hl) ROM0:18C2 B7 or a ROM0:18C3 28 01 jr z,18C6 // If remaining HP is greater than 0, set carry flag ROM0:18C5 37 scf ROM0:18C6 D1 pop de ROM0:18C7 E1 pop hl ROM0:18C8 C9 ret
? (to document)
- 0x1B50-0x1B73 - ?
ROM0:1B50 E5 push hl ROM0:1B51 C5 push bc ROM0:1B52 D5 push de ROM0:1B53 DF rst 18 ROM0:1B54 0C inc c ROM0:1B55 6A ld l,d ROM0:1B56 D1 pop de ROM0:1B57 CD 86 07 call 0786 ROM0:1B5A 21 00 C0 ld hl,C000 ROM0:1B5D 19 add hl,de ROM0:1B5E 7E ld a,(hl) ROM0:1B5F E6 7F and a,7F ROM0:1B61 FE 63 cp a,63 ROM0:1B63 30 09 jr nc,1B6E ROM0:1B65 21 00 A1 ld hl,A100 ROM0:1B68 19 add hl,de ROM0:1B69 7E ld a,(hl) ROM0:1B6A E6 7F and a,7F ROM0:1B6C 3C inc a ROM0:1B6D 77 ld (hl),a ROM0:1B6E CD 8E 07 call 078E ROM0:1B71 C1 pop bc ROM0:1B72 E1 pop hl ROM0:1B73 C9 ret
Loads card data
- 0x2D70-0x2D8C - Loads card data from array at 0x5C430
ROM0:2D70 E5 push hl ROM0:2D71 D5 push de ROM0:2D72 CD 8D 2D call 2D8D // Ensures card ID in register de is valid ROM0:2D75 38 13 jr c,2D8A ROM0:2D77 3E 17 ld a,17 ROM0:2D79 CD 15 07 call 0715 // Pointer for Booster card ? ROM0:2D7C 5E ld e,(hl) // e = Card Type ROM0:2D7D 01 05 00 ld bc,0005 ROM0:2D80 09 add hl,bc ROM0:2D81 46 ld b,(hl) // b = Rarity ROM0:2D82 23 inc hl ROM0:2D83 23 inc hl ROM0:2D84 4E ld c,(hl) // c = Booster ROM0:2D85 CD 5E 07 call 075E ROM0:2D88 7B ld a,e // a = Card Type ROM0:2D89 B7 or a // (to clear carry flag) ROM0:2D8A D1 pop de // de = Card ID ROM0:2D8B E1 pop hl // hl = Pointer to possible cards in Booster pack ROM0:2D8C C9 ret
- 0x2D8D-0x2D9F - Ensures the Card ID is valid
ROM0:2D8D D5 push de ROM0:2D8E C5 push bc ROM0:2D8F 7A ld a,d ROM0:2D90 B3 or e ROM0:2D91 28 0A jr z,2D9D ROM0:2D93 7A ld a,d ROM0:2D94 FE 01 cp a,01 ROM0:2D96 20 03 jr nz,2D9B ROM0:2D98 7B ld a,e ROM0:2D99 FE BE cp a,BE ROM0:2D9B 38 03 jr c,2DA0 // If((CardID > 0) && (CardID < 0x1BE)), jump to 0:2DA0 ROM0:2D9D 37 scf ROM0:2D9E 18 13 jr 2DB3 // Else jump to 0:2DB3
- 0x2DA0-0x2DB5 - ?
ROM0:2DA0 6B ld l,e ROM0:2DA1 62 ld h,d ROM0:2DA2 29 add hl,hl // hl = CardID × 2 ROM0:2DA3 01 00 00 ld bc,0000 ROM0:2DA6 09 add hl,bc ROM0:2DA7 3E 17 ld a,17 ROM0:2DA9 CD 15 07 call 0715 // hl = pointer for Booster card ? ROM0:2DAC 2A ldi a,(hl) ROM0:2DAD 66 ld h,(hl) ROM0:2DAE 6F ld l,a // hl = (4000 + Card ID ×2) ROM0:2DAF CD 5E 07 call 075E ROM0:2DB2 B7 or a ROM0:2DB3 C1 pop bc ROM0:2DB4 D1 pop de ROM0:2DB5 C9 ret
0:3509
ROM0:3509 F1 pop af ROM0:350A 04 inc b ROM0:350B 22 ldi (hl),a ROM0:350C 0D dec c ROM0:350D 20 FC jr nz,350B ROM0:350F 05 dec b ROM0:3510 20 F9 jr nz,350B ROM0:3512 C9 ret ROM0:3513 79 ld a,c ROM0:3514 B0 or b ROM0:3515 20 01 jr nz,3518 ;if (≠ 0), jump to Copy data to SRAM ROM0:3517 C9 ret
Copy data to SRAM
ROM0:3518 04 inc b ROM0:3519 2A ldi a,(hl) ROM0:351A 12 ld (de),a ROM0:351B 13 inc de ROM0:351C 0D dec c ROM0:351D 20 FA jr nz,3519 ROM0:351F 05 dec b ROM0:3520 20 F7 jr nz,3519 ROM0:3522 C9 ret
Bank 3
Booster pack
Booster pack arrays
- 0xCC9B-0xCE40 - Booster pack arrays, to analyze. Bold text means it's described below.
00 08 FF 00 08 FF 00 00 FF 00 01 FF 00 09 FF 00 02 00 FF 00 00 FF 00 01 FF 00 00 FF 00 04 04 FF 00 00 FF 00 02 02 FF 00 01 00 FF 00 03 FF 00 02 02 FF 00 00 00 FF 00 03 00 FF 00 01 FF 00 02 FF 00 02 02 FF 00 04 02 FF 00 00 00 FF 00 01 01 FF 00 02 FF 00 03 03 FF 00 00 00 FF 00 04 04 FF 00 01 01 FF 00 03 02 FF 00 03 02 FF 00 04 03 FF 00 03 03 FF 00 00 FF 00 01 01 FF 00 00 00 FF 00 03 03 FF 00 02 FF 00 00 FF 00 04 04 FF 00 02 01 FF 00 00 00 FF 00 06 05 FF 00 03 FF 00 04 FF 00 00 FF 00 04 00 FF 00 05 00 FF 00 05 01 FF 00 05 02 FF 00 06 02 FF 00 05 FF 00 05 FF 00 05 FF 00 05 05 FF 00 05 FF 00 05 FF 00 05 05 FF 00 01 00 FF 00 02 FF 00 05 FF 00 06 05 FF 00 06 05 FF 00 02 FF 00 03 FF 00 06 FF 00 05 05 FF 00 06 03 FF 00 06 04 FF 00 06 05 FF 00 06 00 FF 00 06 01 FF 00 05 01 FF 00 05 02 FF 00 06 06 FF 00 01 01 FF 00 02 02 FF 00 03 03 FF 00 05 03 FF 00 06 04 FF 00 06 06 FF 00 09 FF 00 03 02 00 FF 00 03 02 FF 00 03 02 01 FF 00 06 05 FF 01 02 00 01 02 03 04 05 06 FF 02 02 00 01 02 FF 02 04 00 01 02 FF 02 04 00 01 02 03 FF 02 04 00 01 02 03 04 FF 02 02 02 05 06 FF 02 04 01 02 05 06 FF 02 04 02 03 04 05 06 FF 02 04 00 01 02 03 04 05 06 FF 00 0A 0A 0A FF 00 0B 0A 0A FF 00 0C 0B 0A FF 00 0A FF 00 0B FF 00 0C FF 00 00 FF 00 01 FF 00 02 FF 00 05 FF 00 06 FF 00 09 FF
- 0xCDA2-0xCDA5 - 2 Ambition Booster packs
00 - Fixed 06 06 - Ambition ×2
- 0xCDA6-0xCDA9 - 2 Legends Booster packs
00 - Fixed 01 01 - Legends ×2
- 0xCDAA-0xCDAD - 2 Lost Isle Booster packs
00 - Fixed 02 02 - Lost Isle ×2
- 0xCDAE-0xCDB1 - 2 Assault Booster packs
00 - Fixed 03 03 - Assault ×2
- 0xCDD3-0xCDDB - 2 Random Booster packs from 0x00 to 0x06
01 - Random 02 - 2 Booster packs 00 01 02 03 04 05 06 - Booster packs IDs
List of rewards from Extra Challenge/King's Cup
- 0xD1A9-0xD1C8 - List of promo cards that can be won from the Extra Challenge?
Card ID Card Name ------- ---------------- 69 00 Promo Arcanine Lv34 BF 00 Promo Pikachu Lv16 C0 00 Promo Pikachu Lv16 C3 00 Promo Surfing Pikachu Lv13 C4 00 Promo Surfing Pikachu Lv13 D8 00 Promo Electabuzz Lv20 1E 01 Promo Slowpoke Lv9 3D 01 Promo Mewtwo Lv60 3C 01 Promo Mewtwo Lv60 40 01 Promo Mew Lv8 58 01 Promo Jigglypuff Lv12 C1 00 Promo Flying Pikachu Lv12 8A 01 Imakuni? 98 01 Super Energy Retrieval 39 01 Promo Mewtwo Lv30 BD 00 Promo Pikachu Lv13 C2 00 Promo Flying Pikachu Lv12
- 0xD1C9-0xD1EC - List of promo cards that can be won from the King's Cup?
Card ID Card Name ------- ---------------- 64 01 Promo Dark Persian Lv28 5F 01 Promo Meowth Lv14 A2 01 Computer Error 7B 01 Promo Cool Porygon Lv15 7E 01 Promo Snorlax Lv50 14 00 Promo Venusaur Lv67 5F 00 Promo Charizard Lv76 84 00 Promo Blastoise Lv52 66 01 Promo Farfetch'd Lv20 70 01 Promo Kangaskhan Lv38 E8 00 Promo Diglett Lv16 EA 00 Promo Dugtrio Lv40 84 01 Promo Dragonite Lv43 AA 00 Promo Magikarp Lv10 87 01 Promo Togepi Lv8 BA 00 Promo Marill Lv17 ED 00 Promo Mankey Lv7
Booster packs array to be used
- 0xDBDB-0xDBF1 - If(valueFromFunc0xDD5Aor0xDD27 + (D61A) + 1 == 0x20), set (D61A) to 0, hl to (D61B-D61C), a to (D619)
ROM3:5BDB AF xor a ROM3:5BDC EA 1A D6 ld (D61A),a // (D61A) = 0 ROM3:5BDF 21 1B D6 ld hl,D61B ROM3:5BE2 2A ldi a,(hl) ROM3:5BE3 66 ld h,(hl) ROM3:5BE4 6F ld l,a ROM3:5BE5 11 1E D6 ld de,D61E ROM3:5BE8 01 20 00 ld bc,0020 ROM3:5BEB FA 19 D6 ld a,(D619) ROM3:5BEE CD 38 34 call 3438 ROM3:5BF1 C9 ret
- 0xDD0E-0xDD25 - Fail-safe from Func0xE531; fixes (D61A) and (D61B)
ROM3:5D0E 4F ld c,a // c = valueFromFunc0xDD27 ROM3:5D0F 21 1B D6 ld hl,D61B ROM3:5D12 86 add (hl) ROM3:5D13 22 ldi (hl),a // (D61B) += valueFromFunc0xDD27 ROM3:5D14 30 01 jr nc,5D17 ROM3:5D16 34 inc (hl) ROM3:5D17 79 ld a,c ROM3:5D18 21 1A D6 ld hl,D61A ROM3:5D1B 86 add (hl) ROM3:5D1C FE 20 cp a,20 ROM3:5D1E 30 02 jr nc,5D22 // If(a == 0x20), jump to 3:5D22 ROM3:5D20 77 ld (hl),a // (D61A) += valueFromFunc0xDD27 + (D61A) + 1 ROM3:5D21 C9 ret ROM3:5D22 CD DB 5B call 5BDB // If(a == 0x20), call 3:5BDB ROM3:5D25 C9 ret
- 0xDD27-0xDD39 - Fail-safe from Func0xE531; sets accumulator to 1, 2, 3, 4 or 5, then jumps to 0xDD0E
ROM3:5D27 3E 01 ld a,01 ROM3:5D29 18 E3 jr 5D0E ROM3:5D2B 3E 02 ld a,02 ROM3:5D2D 18 DF jr 5D0E ROM3:5D2F 3E 03 ld a,03 ROM3:5D31 18 DB jr 5D0E ROM3:5D33 3E 04 ld a,04 ROM3:5D35 18 D7 jr 5D0E ROM3:5D37 3E 05 ld a,05 ROM3:5D39 18 D3 jr 5D0E
- 0xDD3B-0xDD53 - Stores pointer to the Booster pack array in register bc
ROM3:5D3B F5 push af ROM3:5D3C 21 1A D6 ld hl,D61A ROM3:5D3F 86 add (hl) ROM3:5D40 3C inc a // a = valueFromFunc0xDD5A + (D61A) + 1 ROM3:5D41 FE 20 cp a,20 ROM3:5D43 30 0F jr nc,5D54 // If(a == 0x20), jump to 3:5D54 ROM3:5D45 C1 pop bc ROM3:5D46 3D dec a ROM3:5D47 21 1E D6 ld hl,D61E ROM3:5D4A 85 add l ROM3:5D4B 6F ld l,a ROM3:5D4C 30 01 jr nc,5D4F ROM3:5D4E 24 inc h ROM3:5D4F 2A ldi a,(hl) ROM3:5D50 46 ld b,(hl) ROM3:5D51 4F ld c,a // Store pointer to the array in BC ROM3:5D52 B0 or b ROM3:5D53 C9 ret
- 0xDD54-0xDD59 - (from Func0xDD3B) If(valueFromFunc0xDD5A + (D61A) + 1 == 20)
ROM3:5D54 CD DB 5B call 5BDB // If(a == 0x20), call 3:5BDB ROM3:5D57 F1 pop af ROM3:5D58 18 E1 jr 5D3B
- 0xDD5A-0xDD64 - Sets accumulator to 1, 2 or 3, then jumps to 0xDD3B
ROM3:5D5A 3E 01 ld a,01 ROM3:5D5C 18 DD jr 5D3B ROM3:5D5E 3E 02 ld a,02 ROM3:5D60 18 D9 jr 5D3B ROM3:5D62 3E 03 ld a,03 ROM3:5D64 18 D5 jr 5D3B
Awards Booster packs
- 0xE531-0xE5B2 - Gives Booster packs to the player
ROM3:6531 CD 5A 5D call 5D5A // Stores Booster packs array in register bc ROM3:6534 69 ld l,c ROM3:6535 60 ld h,b ROM3:6536 2A ldi a,(hl) ROM3:6537 FE 00 cp a,00 ROM3:6539 28 0B jr z,6546 // If fixed Booster pack, jump to 3:6546 ROM3:653B FE 01 cp a,01 ROM3:653D 28 23 jr z,6562 // If random Booster pack, jump to 3:6562 ROM3:653F FE 02 cp a,02 ROM3:6541 28 15 jr z,6558 // If random number of random Booster packs, jump to 3:6558 ROM3:6543 C3 2F 5D jp 5D2F // Fail-safe, jump to 3:5D2F, (D61A) += 3, (D61B) += 3 ROM3:6546 E5 push hl ROM3:6547 AF xor a ROM3:6548 4F ld c,a ROM3:6549 2A ldi a,(hl) // Load next Booster pack ID ROM3:654A FE FF cp a,FF ROM3:654C 28 03 jr z,6551 // If the Booster array has been fully read, jump to 3:6551 ROM3:654E 0C inc c ROM3:654F 18 F8 jr 6549 ROM3:6551 E1 pop hl ROM3:6552 79 ld a,c ROM3:6553 EA 67 D6 ld (D667),a ROM3:6556 18 62 jr 65BA ROM3:6558 2A ldi a,(hl) // Load max number of Booster packs ROM3:6559 CD 5A 08 call 085A // Pseudo-Random Number between 0 and max number of Booster packs array - 1 ROM3:655C 3C inc a // a++ ROM3:655D EA 67 D6 ld (D667),a // Store number of Booster packs to be awarded in (D667) ROM3:6560 18 04 jr 6566 // Jump to 3:6566 (random Booster pack) ROM3:6562 2A ldi a,(hl) // Load number of Booster packs to be awarded from the array at 0xCDD3 ROM3:6563 EA 67 D6 ld (D667),a // Store number of Booster packs to be awarded in (D667) ROM3:6566 11 4E D6 ld de,D64E ROM3:6569 AF xor a ROM3:656A 4F ld c,a ROM3:656B 2A ldi a,(hl) // Load next Booster pack ID ROM3:656C FE FF cp a,FF ROM3:656E 28 05 jr z,6575 // If the Booster array has been fully read, jump to 3:6575 ROM3:6570 12 ld (de),a // Store Booster pack ID in (D64E) + current iteration ROM3:6571 13 inc de ROM3:6572 0C inc c ROM3:6573 18 F6 jr 656B ROM3:6575 79 ld a,c ROM3:6576 EA 5E D6 ld (D65E),a ROM3:6579 11 5F D6 ld de,D65F ROM3:657C FA 67 D6 ld a,(D667) ROM3:657F 4F ld c,a ROM3:6580 FA 5E D6 ld a,(D65E) ROM3:6583 CD 5A 08 call 085A // Pseudo-Random Number between 0 and (D65E)-1 ROM3:6586 21 4E D6 ld hl,D64E ROM3:6589 85 add l ROM3:658A 6F ld l,a ROM3:658B 30 01 jr nc,658E ROM3:658D 24 inc h ROM3:658E 7E ld a,(hl) ROM3:658F 12 ld (de),a // Store Booster pack to be awarded in (D65F) + current iteration ROM3:6590 13 inc de ROM3:6591 0D dec c ROM3:6592 20 EC jr nz,6580 ROM3:6594 FA 67 D6 ld a,(D667) ROM3:6597 4F ld c,a ROM3:6598 FA 67 D6 ld a,(D667) ROM3:659B 47 ld b,a ROM3:659C 21 5F D6 ld hl,D65F ROM3:659F 11 5F D6 ld de,D65F ROM3:65A2 13 inc de ROM3:65A3 05 dec b ROM3:65A4 28 0E jr z,65B4 ROM3:65A6 1A ld a,(de) ROM3:65A7 BE cp (hl) ROM3:65A8 38 06 jr c,65B0 ROM3:65AA 1A ld a,(de) ROM3:65AB F5 push af ROM3:65AC 7E ld a,(hl) ROM3:65AD 12 ld (de),a ROM3:65AE F1 pop af ROM3:65AF 77 ld (hl),a ROM3:65B0 23 inc hl ROM3:65B1 13 inc de ROM3:65B2 18 EF jr 65A3
- 0xE5B4-0xE5BA - Loops the random Booster pack generation
ROM3:65B4 0D dec c ROM3:65B5 20 E1 jr nz,6598 ROM3:65B7 21 5F D6 ld hl,D65F ROM3:65BA EF rst 28
Bank 6
Card Pop Routines
The earliest entry point found for CardPop vs a CPU opponent is 0x637B.
- 0x19F49-0x19FBB - ?
// CARDPOP_5F49 - leads in to card check routine - produce resulting card id in DE ROM6:5F49 3E C2 ld a,C2 ROM6:5F4B E0 99 ld (ff00+99),a ROM6:5F4D CD 86 07 call 0786 // CARDPOP_0786 ROM6:5F50 21 10 A0 ld hl,A010 ROM6:5F53 CD BC 5F call 5FBC // CARDPOP_5FBC ROM6:5F56 CD 8E 07 call 078E // CARDPOP_078E ROM6:5F59 D5 push de ROM6:5F5A 21 00 C5 ld hl,C500 ROM6:5F5D CD BC 5F call 5FBC // CARDPOP_5FBC ROM6:5F60 C1 pop bc ROM6:5F61 21 C8 CA ld hl,CAC8 // set address to CAC8 (PRNG seed location in WRA0) <- card pop enters here? ROM6:5F64 78 ld a,b // by the time we reach here: bc and de describe the generation of the seed, as they are all used just below to set a new seed (this is fixed every time, so is likely based on player name/secret id) ROM6:5F65 92 sub d ROM6:5F66 57 ld d,a ROM6:5F67 22 ldi (hl),a // write to CAC8 PRNG seed location ROM6:5F68 79 ld a,c ROM6:5F69 93 sub e ROM6:5F6A 5F ld e,a ROM6:5F6B 22 ldi (hl),a // write to CAC9 PRNG seed location ROM6:5F6C 82 add d ROM6:5F6D 77 ld (hl),a // write to CACA PRNG seed location ROM6:5F6E FA 25 CE ld a,(CE25) ,-- ??Opponents secret ID (either way this is a small value before Ronald's name ROM6:5F71 FE 04 cp a,04 ROM6:5F73 20 07 jr nz,5F7C ROM6:5F75 7B ld a,e ROM6:5F76 FE 05 cp a,05 ROM6:5F78 28 21 jr z,5F9B ROM6:5F7A 18 19 jr 5F95 ROM6:5F7C 7B ld a,e ROM6:5F7D FE 05 cp a,05 ROM6:5F7F 28 1A jr z,5F9B ROM6:5F81 FE 40 cp a,40 ROM6:5F83 38 10 jr c,5F95 ROM6:5F85 FE 9A cp a,9A ROM6:5F87 38 06 jr c,5F8F ROM6:5F89 3E 2F ld a,2F ROM6:5F8B 06 00 ld b,00 ROM6:5F8D 18 10 jr 5F9F ROM6:5F8F 3E 2F ld a,2F ROM6:5F91 06 01 ld b,01 ROM6:5F93 18 0A jr 5F9F ROM6:5F95 3E 2B ld a,2B ROM6:5F97 06 02 ld b,02 ROM6:5F99 18 04 jr 5F9F ROM6:5F9B 3E 30 ld a,30 ROM6:5F9D 06 FE ld b,FE ROM6:5F9F EA 22 CE ld (CE22),a // something to do with opponent ROM6:5FA2 78 ld a,b ROM6:5FA3 01 06 00 ld bc,0006 ROM6:5FA6 EF rst 28 ROM6:5FA7 09 add hl,bc ROM6:5FA8 A2 and d ROM6:5FA9 58 ld e,b ROM6:5FAA CD 5A 08 call 085A // call PRNG routine ROM6:5FAD 6F ld l,a // load the index of the card to select from a (this is most-significant bit from prn_2 (I think! - makes sense as frame doesn't seem to matter for results)) ROM6:5FAE 26 00 ld h,00 // set higher bit to 0 (as no more than 0x80 cards to choose from) ROM6:5FB0 29 add hl,hl // double the index (2 byte index for card) ROM6:5FB1 11 00 C0 ld de,C000 // set starting point for looking up a card id from the random selection for card pop (and secret id? or opponent's card?) ROM6:5FB4 19 add hl,de // set address to retrieve card index num from ROM6:5FB5 5E ld e,(hl) // load lower byte of card id (and secret ID or opponent's card?) ROM6:5FB6 23 inc hl ROM6:5FB7 56 ld d,(hl) // load higher byte of card id (and secret ID or opponent's card?) ROM6:5FB8 CD 0A 2D call 2D0A // CARDPOP_2D04 (cardpop enters via 2D0A) ROM6:5FBB C9 ret
- 0x19FBC-0x19FCB - ?
// CARDPOP_5FBC ROM6:5FBC 0E 10 ld c,10 ROM6:5FBE 11 00 00 ld de,0000 ROM6:5FC1 7B ld a,e ROM6:5FC2 86 add (hl) ROM6:5FC3 5F ld e,a ROM6:5FC4 7A ld a,d ROM6:5FC5 AE xor (hl) ROM6:5FC6 57 ld d,a ROM6:5FC7 23 inc hl ROM6:5FC8 0D dec c ROM6:5FC9 20 F6 jr nz,5FC1 ROM6:5FCB C9 ret
- 0x1A364-0x1A49A - ?
// CARDPOP_6364 (cardpop jumps in at 637B (at least with CPU opponent)) ROM6:6364 CD F4 1F call 1FF4 ROM6:6367 C3 05 1F jp 1F05 ROM6:636A 21 6F 02 ld hl,026F ROM6:636D 3E 03 ld a,03 ROM6:636F 18 0F jr 6380 ROM6:6371 21 6F 02 ld hl,026F ROM6:6374 3E 04 ld a,04 ROM6:6376 F5 push af ROM6:6377 3E 04 ld a,04 ROM6:6379 18 08 jr 6383 ROM6:637B 21 70 02 ld hl,0270 // < - cardpop jumps in here (at least with CPU opponent) [EARLIEST ENTRY POINT SO FAR] ROM6:637E 3E 02 ld a,02 ROM6:6380 F5 push af ROM6:6381 3E 01 ld a,01 ROM6:6383 EA 25 CE ld (CE25),a ROM6:6386 CD C3 59 call 59C3 // CARDPOP_59B4 (cardpop enters via 59C3) ROM6:6389 0E 10 ld c,10 ROM6:638B 21 90 C5 ld hl,C590 ROM6:638E 11 00 C5 ld de,C500 ROM6:6391 2A ldi a,(hl) ROM6:6392 12 ld (de),a ROM6:6393 13 inc de ROM6:6394 0D dec c ROM6:6395 B7 or a ROM6:6396 20 F9 jr nz,6391 ROM6:6398 0C inc c ROM6:6399 18 03 jr 639E ROM6:639B AF xor a ROM6:639C 12 ld (de),a ROM6:639D 13 inc de ROM6:639E 0D dec c ROM6:639F 20 FA jr nz,639B ROM6:63A1 F1 pop af ROM6:63A2 EA 0D C5 ld (C50D),a ROM6:63A5 01 10 00 ld bc,0010 ROM6:63A8 21 00 C5 ld hl,C500 ROM6:63AB 11 2C CE ld de,CE2C ROM6:63AE CD 0C 07 call 070C // bank 0 - Copy Battle State in SRAM [called by card pop - sets opponent name?] ROM6:63B1 FA 0D C5 ld a,(C50D) ROM6:63B4 FE 03 cp a,03 ROM6:63B6 28 29 jr z,63E1 ROM6:63B8 3E C2 ld a,C2 ROM6:63BA E0 99 ld (ff00+99),a ROM6:63BC 21 00 C5 ld hl,C500 ROM6:63BF CD BC 5F call 5FBC // CARDPOP_5FBC [called by card pop after setting name??] ROM6:63C2 D5 push de ROM6:63C3 CD 86 07 call 0786 //CARDPOP_0786 ROM6:63C6 21 10 A0 ld hl,A010 ROM6:63C9 CD BC 5F call 5FBC // CARDPOP_5FBC ROM6:63CC CD 8E 07 call 078E // CARDPOP_078E ROM6:63CF C1 pop bc ROM6:63D0 CD 61 5F call 5F61 // CARDPOP_5F49 (cardpop enters via 5F61) [called by card pop - loads opponet secret id?/card they get] ROM6:63D3 21 3E CE ld hl,CE3E ROM6:63D6 73 ld (hl),e ROM6:63D7 23 inc hl ROM6:63D8 72 ld (hl),d ROM6:63D9 CD 49 5F call 5F49 // CARDPOP_5F49 [is called by card pop - leads in to card check routine - produce resulting card id in DE] ROM6:63DC 01 A7 64 ld bc,64A7 ROM6:63DF 18 24 jr 6405 ROM6:63E1 3E 06 ld a,06 ROM6:63E3 CD 5A 08 call 085A // call PRNG routine ROM6:63E6 87 add a ROM6:63E7 5F ld e,a ROM6:63E8 16 00 ld d,00 ROM6:63EA 21 9B 64 ld hl,649B ROM6:63ED 19 add hl,de ROM6:63EE 5E ld e,(hl) ROM6:63EF 23 inc hl ROM6:63F0 56 ld d,(hl) ROM6:63F1 21 3E CE ld hl,CE3E ROM6:63F4 73 ld (hl),e ROM6:63F5 23 inc hl ROM6:63F6 72 ld (hl),d ROM6:63F7 11 8A 01 ld de,018A ROM6:63FA CD 0A 2D call 2D0A // CARDPOP_2D04 (cardpop enters via 2D0A) ROM6:63FD 3E 2B ld a,2B ROM6:63FF EA 22 CE ld (CE22),a ROM6:6402 01 AC 64 ld bc,64AC ROM6:6405 C5 push bc ROM6:6406 21 3C CE ld hl,CE3C ROM6:6409 73 ld (hl),e ROM6:640A 23 inc hl ROM6:640B 72 ld (hl),d ROM6:640C E1 pop hl ROM6:640D 11 40 CE ld de,CE40 ROM6:6410 01 05 00 ld bc,0005 ROM6:6413 CD 0C 07 call 070C // Copy Battle State in SRAM ROM6:6416 3E 01 ld a,01 ROM6:6418 12 ld (de),a ROM6:6419 FA 0D C5 ld a,(C50D) ROM6:641C FE 04 cp a,04 ROM6:641E 20 2D jr nz,644D ROM6:6420 21 40 CE ld hl,CE40 ROM6:6423 CD 86 07 call 0786 // CARDPOP_0786 ROM6:6426 FA 20 A0 ld a,(A020) ROM6:6429 CB 3F srl a ROM6:642B 22 ldi (hl),a ROM6:642C FA 21 A0 ld a,(A021) ROM6:642F CB 1F rr a ROM6:6431 22 ldi (hl),a ROM6:6432 CD 8E 07 call 078E // CARDPOP_078E ROM6:6435 E5 push hl ROM6:6436 CD AA 1A call 1AAA // CARDPOP_1A8E (jumped to by cardpop at 1AAA) ROM6:6439 CB 3C srl h ROM6:643B CB 1D rr l ROM6:643D CB 3C srl h ROM6:643F CB 1D rr l ROM6:6441 5D ld e,l ROM6:6442 54 ld d,h ROM6:6443 E1 pop hl ROM6:6444 73 ld (hl),e ROM6:6445 23 inc hl ROM6:6446 72 ld (hl),d ROM6:6447 23 inc hl ROM6:6448 36 04 ld (hl),04 ROM6:644A 23 inc hl ROM6:644B 36 04 ld (hl),04 ROM6:644D CD CA 58 call 58CA // CARDPOP_58CA ROM6:6450 3E 10 ld a,10 ROM6:6452 01 00 00 ld bc,0000 ROM6:6455 CD 5D 3E call 3E5D ROM6:6458 21 5A 02 ld hl,025A ROM6:645B CD 30 2A call 2A30 // card pop goes to (2A30 Bank 0) and is waiting for player to press A button ROM6:645E CD 78 30 call 3078 ROM6:6461 3E 12 ld a,12 ROM6:6463 01 00 00 ld bc,0000 ROM6:6466 CD 5D 3E call 3E5D ROM6:6469 21 5D 02 ld hl,025D ROM6:646C CD A5 27 call 27A5 ROM6:646F CD 12 05 call 0512 ROM6:6472 F0 91 ld a,(ff00+91) ROM6:6474 E6 01 and a,01 ROM6:6476 28 F7 jr z,646F ROM6:6478 CD E2 58 call 58E2 ROM6:647B 3E 32 ld a,32 ROM6:647D EA F2 C5 ld (C5F2),a ROM6:6480 CD 84 5E call 5E84 ROM6:6483 CD AA 5D call 5DAA ROM6:6486 21 5E 02 ld hl,025E ROM6:6489 CD 24 5D call 5D24 ROM6:648C 21 3E CE ld hl,CE3E ROM6:648F 5E ld e,(hl) ROM6:6490 23 inc hl ROM6:6491 56 ld d,(hl) ROM6:6492 CD 58 2D call 2D58 ROM6:6495 6B ld l,e ROM6:6496 62 ld h,d ROM6:6497 CD A9 2C call 2CA9 ROM6:649A C9 ret
Cards in Booster pack (to document)
- 0x1AD41-0x1AD80 - ?
ROM6:6D41 E5 push hl ROM6:6D42 D5 push de ROM6:6D43 11 9F 38 ld de,389F ROM6:6D46 CD BB 1F call 1FBB ROM6:6D49 D1 pop de ROM6:6D4A CD 0A 2D call 2D0A ROM6:6D4D CD 78 30 call 3078 ROM6:6D50 3E 30 ld a,30 ROM6:6D52 CD 62 30 call 3062 ROM6:6D55 3E C2 ld a,C2 ROM6:6D57 E0 99 ld (ff00+99),a // (FF99) = 0xC2 ROM6:6D59 E1 pop hl ROM6:6D5A EF rst 28 ROM6:6D5B 09 add hl,bc ROM6:6D5C 58 ld e,b ROM6:6D5D 41 ld b,c ROM6:6D5E CD 67 30 call 3067 ROM6:6D61 B7 or a ROM6:6D62 20 FA jr nz,6D5E ROM6:6D64 CD 7D 30 call 307D ROM6:6D67 DF rst 18 ROM6:6D68 FA 53 C9 ld a,(C953) ROM6:6D6B EF rst 28 ROM6:6D6C 09 add hl,bc ROM6:6D6D DA 57 db DA,57 ROM6:6D6F CD 81 6D call 6D81 ROM6:6D72 21 00 C4 ld hl,C400 ROM6:6D75 5E ld e,(hl) ROM6:6D76 23 inc hl ROM6:6D77 56 ld d,(hl) ROM6:6D78 23 inc hl ROM6:6D79 7B ld a,e ROM6:6D7A B2 or d ROM6:6D7B C8 ret z ROM6:6D7C CD 50 1B call 1B50 ROM6:6D7F 18 F4 jr 6D75
- 0x1AD81-0x1ADA1 - Stores number of cards in current Booster pack in (C510)
ROM6:6D81 3E C2 ld a,C2 ROM6:6D83 E0 99 ld (ff00+99),a // (FF99) = 0xC2 ROM6:6D85 67 ld h,a ROM6:6D86 2E 00 ld l,00 // hl = 0xC200 ROM6:6D88 AF xor a // Start of the loop, 00s (C200) to (C23C) ROM6:6D89 22 ldi (hl),a ROM6:6D8A 7D ld a,l ROM6:6D8B FE 3C cp a,3C ROM6:6D8D 38 F9 jr c,6D88 // End of the loop ROM6:6D8F 21 00 C4 ld hl,C400 ROM6:6D92 11 10 C5 ld de,C510 ROM6:6D95 0E 00 ld c,00 ROM6:6D97 2A ldi a,(hl) // Start of the loop, load next card in Booster pack ROM6:6D98 B6 or (hl) ROM6:6D99 23 inc hl // hl++ ROM6:6D9A 28 06 jr z,6DA2 // If end of the array, jump to 6:6DA2 ROM6:6D9C 79 ld a,c ROM6:6D9D 12 ld (de),a // Store current iteration in (C510 + current iteration) ROM6:6D9E 13 inc de ROM6:6D9F 0C inc c ROM6:6DA0 18 F5 jr 6D97 // End of the loop
- 0x1ADA2-0x1ADB1 - ?
ROM6:6DA2 3E FF ld a,FF ROM6:6DA4 12 ld (de),a // Store FF in (C510 + c) ROM6:6DA5 DF rst 18 ROM6:6DA6 78 ld a,b ROM6:6DA7 42 ld b,d ROM6:6DA8 DF rst 18 ROM6:6DA9 2A ldi a,(hl) ROM6:6DAA 52 ld d,d ROM6:6DAB 21 58 00 ld hl,0058 ROM6:6DAE 11 3C 02 ld de,023C ROM6:6DB1 DF rst 18
Bank 9
Save Battle State in SRAM - subroutine
ROM9:4017 E5 push hl ROM9:4018 C5 push bc ROM9:4019 4E ld c,(hl) ROM9:401A 23 inc hl ROM9:401B 46 ld b,(hl) ROM9:401C 23 inc hl ROM9:401D E1 pop hl ROM9:401E CD 0C 07 call 070C // Copy Battle State in SRAM ROM9:4021 E1 pop hl ROM9:4022 23 inc hl ROM9:4023 23 inc hl ROM9:4024 18 E9 jr 400F ROM9:4026 E1 pop hl ROM9:4027 11 45 23 ld de,2345 ROM9:402A 01 52 03 ld bc,0352 ROM9:402D 7B ld a,e ROM9:402E 96 sub (hl) ROM9:402F 5F ld e,a ROM9:4030 2A ldi a,(hl) ROM9:4031 AA xor d ROM9:4032 57 ld d,a ROM9:4033 0B dec bc ROM9:4034 79 ld a,c ROM9:4035 B0 or b ROM9:4036 20 F5 jr nz,402D ROM9:4038 E1 pop hl ROM9:4039 3E 01 ld a,01 ROM9:403B 22 ldi (hl),a ROM9:403C 73 ld (hl),e ROM9:403D 23 inc hl ROM9:403E 72 ld (hl),d ROM9:403F 23 inc hl ROM9:4040 FA 02 CC ld a,(CC02) ROM9:4043 77 ld (hl),a ROM9:4044 CD 8E 07 call 078E ROM9:4047 C9 ret
WRAM pointer and amount of bytes to be copied to SRAM
ROM9:4084 00 C2 - (C200) 10 03 - 784 bytes
Cards in Booster pack
Add cards in Booster pack ?
- 0x257D4-0x25811 - ?
ROM9:57D4 13 inc de ROM9:57D5 13 inc de ROM9:57D6 13 inc de ROM9:57D7 13 inc de ROM9:57D8 15 dec d ROM9:57D9 15 dec d ROM9:57DA 5F ld e,a ROM9:57DB 87 add a ROM9:57DC 83 add e ROM9:57DD 87 add a ROM9:57DE 5F ld e,a ROM9:57DF 16 00 ld d,00 ROM9:57E1 21 4E 58 ld hl,584E ROM9:57E4 19 add hl,de ROM9:57E5 46 ld b,(hl) ROM9:57E6 23 inc hl ROM9:57E7 4E ld c,(hl) ROM9:57E8 23 inc hl ROM9:57E9 11 00 C4 ld de,C400 ROM9:57EC 3E 02 ld a,02 // Fossil ROM9:57EE CD 12 58 call 5812 ROM9:57F1 3E 01 ld a,01 // Jungle ROM9:57F3 CD 12 58 call 5812 ROM9:57F6 3E 00 ld a,00 // Base Set ROM9:57F8 CD 12 58 call 5812 ROM9:57FB 3E FF ld a,FF // Promo ROM9:57FD CD 12 58 call 5812 ROM9:5800 AF xor a ROM9:5801 12 ld (de),a // Stores cards in Booster pack in (C400) ROM9:5802 13 inc de ROM9:5803 12 ld (de),a ROM9:5804 21 10 C5 ld hl,C510 ROM9:5807 0E 0A ld c,0A ROM9:5809 AF xor a ROM9:580A 22 ldi (hl),a ROM9:580B 3C inc a ROM9:580C 0D dec c ROM9:580D 20 FB jr nz,580A ROM9:580F 36 FF ld (hl),FF ROM9:5811 C9 ret
Store Expansion in HRAM
- 0x25812-0x25816 - Stores card Expansion ID in (FF98)
ROM9:5812 E0 98 ld (ff00+98),a ROM9:5814 2A ldi a,(hl) // Loads value from the array at 0x25850 ROM9:5815 B7 or a ROM9:5816 C8 ret z // Return If(a == 0)
Adds cards in Booster pack
- 0x25817-0x2584D - Generates cards in Booster pack
ROM9:5817 2B dec hl ROM9:5818 C5 push bc ROM9:5819 D5 push de ROM9:581A E5 push hl ROM9:581B F0 98 ld a,(ff00+98) // a = card Expansion ROM9:581D CD A2 58 call 58A2 ROM9:5820 E1 pop hl ROM9:5821 D1 pop de ROM9:5822 C1 pop bc ROM9:5823 2A ldi a,(hl) ROM9:5824 E5 push hl ROM9:5825 C5 push bc ROM9:5826 4F ld c,a ROM9:5827 C5 push bc ROM9:5828 21 10 C5 ld hl,C510 ROM9:582B FA 54 CD ld a,(CD54) ROM9:582E CD 5A 08 call 085A // Pseudo-Random Number between 0 and (CD54) - 1 ROM9:5831 6F ld l,a ROM9:5832 26 00 ld h,00 ROM9:5834 29 add hl,hl ROM9:5835 01 00 C0 ld bc,C000 ROM9:5838 09 add hl,bc ROM9:5839 2A ldi a,(hl) ROM9:583A B6 or (hl) ROM9:583B 2B dec hl ROM9:583C 28 ED jr z,582B ROM9:583E 2A ldi a,(hl) ROM9:583F 12 ld (de),a // Stores cards in Booster pack in (C400) ROM9:5840 13 inc de ROM9:5841 7E ld a,(hl) ROM9:5842 12 ld (de),a ROM9:5843 13 inc de ROM9:5844 AF xor a ROM9:5845 32 ldd (hl),a ROM9:5846 77 ld (hl),a ROM9:5847 C1 pop bc ROM9:5848 0D dec c ROM9:5849 20 DC jr nz,5827 ROM9:584B C1 pop bc ROM9:584C E1 pop hl ROM9:584D C9 ret
Array ?
- 0x25850-0x258A0 - Array ?
01 03 05 01 01 01 01 03 05 01 02 02 01 03 05 01 03 03 01 03 06 00 04 04 01 03 06 00 05 05 01 03 06 00 06 06 01 03 06 00 00 07 0A 00 00 00 00 00 00 00 00 0A 00 06 01 03 06 00 00 04 01 03 06 00 03 06 01 03 06 00 05 06 01 03 06 00 00 06 02 03 05 00
Special handlers for Promo and GB cards ?
- 0x258A2-0x258BB - Special handlers for Promo and GB cards ?
ROM9:58A2 FE FF cp a,FF ROM9:58A4 28 49 jr z,58EF // If((FF98) == 0xFF), jump to 9:58EF ROM9:58A6 FE FE cp a,FE ROM9:58A8 28 40 jr z,58EA // If((FF98) == 0xFE), jump to 9:58EA ROM9:58AA 21 51 CD ld hl,CD51 ROM9:58AD 22 ldi (hl),a // a = (CD51) ROM9:58AE 70 ld (hl),b // b = (CD52) ROM9:58AF 23 inc hl ROM9:58B0 71 ld (hl),c // c = (CD53) ROM9:58B1 AF xor a // a = 0 ROM9:58B2 EA 54 CD ld (CD54),a // a = (CD54) ROM9:58B5 11 00 00 ld de,0000 // de = 0 ROM9:58B8 21 00 C0 ld hl,C000 // hl = 0xC000 ROM9:58BB 18 1E jr 58DB
Cards of specified Rarity and Expansion
- 0x258BD-0x258E9 - Loads cards pool of specified Rarity used to generate Booster pack
ROM9:58BD E5 push hl ROM9:58BE 21 51 CD ld hl,CD51 ROM9:58C1 78 ld a,b ROM9:58C2 BE cp (hl) ROM9:58C3 20 17 jr nz,58DC // If(Rarity ≠ (CD51)), jump to 9:58DC (next Card ID) ROM9:58C5 23 inc hl ROM9:58C6 79 ld a,c ROM9:58C7 BE cp (hl) ROM9:58C8 28 08 jr z,58D2 // If(Booster ID = (CD52)), jump to 9:58D2 ROM9:58CA 38 10 jr c,58DC // ElseIf(Booster ID < (CD52)), jump to 9:58DC (next Card ID) ROM9:58CC 23 inc hl ROM9:58CD BE cp (hl) ROM9:58CE 28 02 jr z,58D2 // If(Booster ID = (CD53)), jump to 9:58D2 ROM9:58D0 30 0A jr nc,58DC // ElseIf(Booster ID ≥ (CD53)), jump to 9:58DC (next Card ID) ROM9:58D2 21 54 CD ld hl,CD54 ROM9:58D5 34 inc (hl) // (CD54)++ ROM9:58D6 E1 pop hl ROM9:58D7 73 ld (hl),e // Stores card ID to (C000 + current iteration ×2) ROM9:58D8 23 inc hl ROM9:58D9 72 ld (hl),d ROM9:58DA 23 inc hl ROM9:58DB E5 push hl ROM9:58DC 13 inc de // Card ID++ ROM9:58DD CD 70 2D call 2D70 // Loads card data ROM9:58E0 E1 pop hl ROM9:58E1 30 DA jr nc,58BD // If no carry, loop to 58BD ROM9:58E3 AF xor a // a = 0 ROM9:58E4 22 ldi (hl),a ROM9:58E5 77 ld (hl),a ROM9:58E6 FA 54 CD ld a,(CD54) ROM9:58E9 C9 ret
GB and Promo cards
- 0x258EA-0x258EE - GB cards ?
ROM9:58EA 21 22 59 ld hl,5922 ROM9:58ED 18 03 jr 58F2
- 0x258EF-0x25907 - Promo cards ?
ROM9:58EF 21 08 59 ld hl,5908 ROM9:58F2 0E 00 ld c,00 ROM9:58F4 11 00 C0 ld de,C000 ROM9:58F7 2A ldi a,(hl) ROM9:58F8 47 ld b,a ROM9:58F9 12 ld (de),a // Stores cards pool to (C000) ROM9:58FA 13 inc de ROM9:58FB 2A ldi a,(hl) ROM9:58FC 12 ld (de),a ROM9:58FD 13 inc de ROM9:58FE 0C inc c ROM9:58FF B0 or b ROM9:5900 20 F5 jr nz,58F7 ROM9:5902 79 ld a,c ROM9:5903 3D dec a ROM9:5904 EA 54 CD ld (CD54),a ROM9:5907 C9 ret
Lists of cards?
- 0x25908-0x25921 - 2 repetitions of basic energy cards? (terminated by 0x0000)
Card ID Card Name ------- ---------------- 0001 Grass Energy 0002 Fire Energy 0003 Water Energy 0004 Lightning Energy 0005 Fighting Energy 0006 Psychic Energy 0001 Grass Energy 0002 Fire Energy 0003 Water Energy 0004 Lightning Energy 0005 Fighting Energy 0006 Psychic Energy
- 0x25922-0x25933 - 2 repetitions of Phantom cards? (terminated by 0x0000)
Card ID Card Name ------- ----------------------- 0012 Gameboy Venusaur Lv64 0141 Promo Mew Lv15 01BC Here Comes Team Rocket! 0188 Promo Lugia Lv55 0012 Gameboy Venusaur Lv64 0141 Promo Mew Lv15 01BC Here Comes Team Rocket! 0188 Promo Lugia Lv55
These lists indicate that the GB/Promo distinction suggested above may actually be Energy/Phantom.
Bank 11
Unknown list of cards
- 0x44606-0x44617 - List of 1 Pokemon of each type and a trainer card
Might be to do with Black Box (5->1 Trade).
Card ID Card Name ------- ------------------------ 0C 00 B-Pack Bulbasaur Lv12 59 00 Rocket Charmander Lv9 7F 00 Rocket Squirtle Lv16 BD 00 Promo Pikachu Lv13 F7 00 Rocket Dark Machoke Lv28 42 01 Fossil Mew Lv23 5E 01 Gameboy Meowth Lv13 BC 01 Here Comes Team Rocket!
Black Box Recipes
- 0x44618-0x446AF - Table of cards that can be obtained via Black Box recipes, and the offset at where the recipes are stored
- 0x446B0-0x44785 - A list of recipes for the table above (each one is terminated by 0x0000 and uses between 2 and 4 cards Rare cards)
Recipe Card ID Card Name Offset Recipe (stored at offset listed) ------- ------------------------------- ------ ----------------------------- 00EA P20: Dugtrio Lv40 46B0 E9 00 0A 01 0B 01 00 00 00ED P21: Mankey Lv7 46B8 0A 01 0B 01 00 00 00E8 P19: Diglett Lv16 46BE E9 00 EB 00 00 00 007B P04: Moltres Lv40 46C4 63 00 65 00 79 00 00 00 0069 P03: Arcanine Lv34 46CC 63 00 6B 00 00 00 005E A13: (R) Base Charizard Lv76* 46D2 60 00 65 00 00 00 00BD P10: Pikachu Lv13 46D8 C7 00 C8 00 C5 00 C9 00 00 00 00BF P11: Pikachu Lv16 (Toyota) 46E2 C7 00 C8 00 C5 00 00 00 00E1 P18: Zapdos Lv68 46EA C7 00 C9 00 E0 00 00 00 00C0 P12: Pikachu Lv16 (CoroCoro) 46F2 D5 00 D6 00 CE 00 D0 00 00 00 00D8 P17: Electabuzz Lv20 46FC DA 00 CF 00 CE 00 D0 00 00 00 00B9 P08: Articuno Lv37 4706 8F 00 9D 00 B8 00 00 00 00AA P06: Magikarp Lv10 470E AB 00 AC 00 00 00 0084 P05: Blastoise Lv52 4714 85 00 AC 00 00 00 0014 P01: Venusaur Lv67 471A 39 00 15 00 00 00 013F P30: GR's Mewtwo Lv35 4720 42 01 3A 01 3E 01 00 00 013D P29: Mewtwo Lv60 (CoroCoro) 4728 42 01 3E 01 00 00 013C P28: Mewtwo Lv60 (FanBook) 472E 42 01 3A 01 00 00 0139 P27: Mewtwo Lv30 4734 3A 01 3E 01 00 00 011E P25: Slowpoke Lv9 473A 1B 01 2C 01 35 01 00 00 0198 P43: Super Energy Retrieval 4742 8F 00 81 01 00 00 0164 P34: Dark Persian Lv28 4748 6E 01 56 01 5B 01 00 00 0158 P32: Jigglypuff Lv12 4750 6E 01 54 01 00 00 0170 P36: Kangaskhan Lv38 4756 71 01 81 01 00 00 0166 P35: Farfetch'd Lv20 475C 47 01 54 01 74 01 00 00 0183 P39: Dragonite Lv41 4764 85 01 86 01 81 01 00 00 0185 B52: (R) Fossil Dragonite Lv45* 476C 85 01 86 01 83 01 00 00 015F P33: Meowth Lv14 4774 74 01 7C 01 00 00 017E P38: Hungry Snorlax Lv50 477A 7C 01 7D 01 00 00 017B P37: Cool Porygon Lv15 4780 74 01 56 01 00 00
* These are both regular rare cards, rather than promo cards. Also the recipe for Fossil Dragonite Lv45 includes a promo card (and doesn't work as a result, as it clashes with other trading mechanic for promo cards).
List of promo cards
- 0x44786-0x447AF - A list of promo cards (covers all of promos not listed above, with a few inconsistencies) (terminated by 0x0000)
Card ID Card Name Method to obtain ------- -------------------------- ------------------- 12 00 Gameboy Venusaur Lv64 CardPop! BA 00 Promo Marill Lv17 Ishihara B6 00 Promo Omastar Lv36 Bill's Computer 01 01 Promo Golem Lv37 Bill's Computer F8 00 Promo Machamp Lv54 Bill's Computer 1C 01 Promo Alakazam Lv45 Bill's Computer 2D 01 Promo Gengar Lv40 Bill's Computer 39 01 Promo Mewtwo Lv30* CHALLENGE CUP 1st 41 01 Promo Mew Lv15 CardPop! 40 01 Promo Mew Lv8 COIN TOSS GAME C3 00 Promo Surfing Pikachu Lv13 Ishihara C4 00 Promo Surfing Pikachu Lv13 Ishihara C1 00 Promo Flying Pikachu Lv12 Ishihara C2 00 Promo Flying Pikachu Lv12 Ishihara 84 01 Promo Dragonite Lv43* Benefactor 87 01 Promo Togepi Lv8 Ishihara 88 01 Promo Lugia Lv55 CardPop! BC 01 Here Comes Team Rocket! CardPop! 8A 01 Imakuni? Imakuni? A2 01 Computer Error Rival
* Promo Mewtwo Lv30 does have a recipe, and Promo Dragonite Lv43 maybe was supposed to (see the situation with Dragonite Lv45 recipe above). Promo Charizard Lv76 is missing from both lists (but the rare version does have a recipe).
List of rewards from Grand Master's Cup?
- 0x448DE-0x44928 - Seems to be the list of cards that can be won from the Grand Master's Cup
Card ID Card Name ------- --------------------------- 69 00 Promo Arcanine Lv34 BF 00 Promo Pikachu Lv16 C0 00 Promo Pikachu Lv16 C3 00 Promo Surfing Pikachu Lv13 C4 00 Promo Surfing Pikachu Lv13 D8 00 Promo Electabuzz Lv20 1E 01 Promo Slowpoke Lv9 3D 01 Promo Mewtwo Lv60 3C 01 Promo Mewtwo Lv60 40 01 Promo Mew Lv8 58 01 Promo Jigglypuff Lv12 C1 00 Promo Flying Pikachu Lv12 C2 00 Promo Flying Pikachu Lv12 64 01 Promo Dark Persian Lv28 5F 01 Promo Meowth Lv14 7B 01 Promo Cool Porygon Lv15 7E 01 Promo Snorlax Lv50 14 00 Promo Venusaur Lv67 5F 00 Promo Charizard Lv76 84 00 Promo Blastoise Lv52 39 01 Promo Mewtwo Lv30 BD 00 Promo Pikachu Lv13 66 01 Promo Farfetch'd Lv20 70 01 Promo Kangaskhan Lv38 E8 00 Promo Diglett Lv16 EA 00 Promo Dugtrio Lv40 84 01 Promo Dragonite Lv43 AA 00 Promo Magikarp Lv10 87 01 Promo Togepi Lv8 BA 00 Promo Marill Lv17 ED 00 Promo Mankey Lv7 A2 01 Computer Error! 98 01 Super Energy Retrieval 7B 00 Promo Moltres Lv40 B9 00 Promo Articuno Lv37 E1 00 Promo Zapdos Lv68 83 01 Promo Dragonite Lv41
Bank 17
Cards Data
- 0x5C430-0x62A69 - Cards Data array
Size Description ---- ----------- 1 Card Type 1 ? 1 ? 2 Species pointer 1 Rarity 1 Expansion 1 Booster 2 Card ID 1 Hit Points 1 Card Category 2 Evolves from (Species pointer) 4 Attack #1 cost 1 Attack #1 damage 4 Attack #2 cost 1 Attack #2 damage 1 Retreat Cost 1 Weakness 1 Resistance 1 Pokédex ID 1 Level
Graphics
- 0x142EF0-0x1BE3FF - 2BPP Graphics data (8x8 tiles)
- 0x1BE340-0x1D8A1F - Compressed 2BPP Graphics data (8x8 tiles)???
Internal Data for Pokémon Card GB2
| |
---|---|