Pokémon Trading Card Game/ROM map

From Data Crystal
Jump to navigation Jump to search

Chip tiny.png The following article is a ROM map for Pokémon Trading Card Game.

Bank 0

ROM start

ROM0:0100 00               nop  
ROM0:0101 C3 50 01         jp   0150
...
ROM0:0150 F3               di   
ROM0:0151 31 FE FF         ld   sp,FFFE
ROM0:0154 F5               push af
ROM0:0155 AF               xor  a
ROM0:0156 E0 0F            ld   (ff00+0F),a
ROM0:0158 E0 FF            ld   (ff00+FF),a
ROM0:015A CD EC 03         call 03EC
ROM0:015D 3E 01            ld   a,01
ROM0:015F CD A3 07         call 07A3
ROM0:0162 AF               xor  a
ROM0:0163 CD A9 07         call 07A9		;RAM Bank switch
ROM0:0166 CD C5 07         call 07C5		;Set VRAM Bank to 0
ROM0:0169 CD 8A 02         call 028A
ROM0:016C F1               pop  af
ROM0:016D EA B3 CA         ld   (CAB3),a
ROM0:0170 CD 49 03         call 0349
ROM0:0173 3E 20            ld   a,20
ROM0:0175 EA B6 CA         ld   (CAB6),a
ROM0:0178 CD A1 03         call 03A1
ROM0:017B CD 0B 03         call 030B
ROM0:017E CD 6A 03         call 036A
ROM0:0181 CD 7F 37         call 377F
ROM0:0184 CD 41 02         call 0241
ROM0:0187 CD A6 0E         call 0EA6
ROM0:018A CD 93 05         call 0593
ROM0:018D CD 0B 08         call 080B
ROM0:0190 3E 01            ld   a,01
ROM0:0192 CD A3 07         call 07A3
ROM0:0195 31 00 E0         ld   sp,E000
ROM0:0198 C3 00 40         jp   4000

0:019B

ROM0:019B F5               push af
ROM0:019C C5               push bc
ROM0:019D D5               push de
ROM0:019E E5               push hl
ROM0:019F F0 80            ld   a,(ff00+80)		;a = ROM Bank
ROM0:01A1 F5               push af
ROM0:01A2 21 BA CA         ld   hl,CABA
ROM0:01A5 CB 46            bit  0,(hl)
ROM0:01A7 20 34            jr   nz,01DD
ROM0:01A9 CB C6            set  0,(hl)
ROM0:01AB FA C0 CA         ld   a,(CAC0)
ROM0:01AE B7               or   a
ROM0:01AF 28 07            jr   z,01B8
ROM0:01B1 CD 83 FF         call FF83		;Wait for OAM copy
ROM0:01B4 AF               xor  a
ROM0:01B5 EA C0 CA         ld   (CAC0),a
ROM0:01B8 F0 92            ld   a,(ff00+92)
ROM0:01BA E0 43            ld   (ff00+43),a
ROM0:01BC F0 93            ld   a,(ff00+93)
ROM0:01BE E0 42            ld   (ff00+42),a
ROM0:01C0 F0 94            ld   a,(ff00+94)
ROM0:01C2 E0 4B            ld   (ff00+4B),a
ROM0:01C4 F0 95            ld   a,(ff00+95)
ROM0:01C6 E0 4A            ld   (ff00+4A),a
ROM0:01C8 FA BB CA         ld   a,(CABB)
ROM0:01CB E0 40            ld   (ff00+40),a
ROM0:01CD FB               ei   
ROM0:01CE CD D0 CA         call CAD0		;Wait for VBlank
ROM0:01D1 CD 2D 04         call 042D
ROM0:01D4 21 B8 CA         ld   hl,CAB8
ROM0:01D7 34               inc  (hl)
ROM0:01D8 21 BA CA         ld   hl,CABA
ROM0:01DB CB 86            res  0,(hl)
ROM0:01DD F1               pop  af
ROM0:01DE CD A3 07         call 07A3
ROM0:01E1 E1               pop  hl
ROM0:01E2 D1               pop  de
ROM0:01E3 C1               pop  bc
ROM0:01E4 F1               pop  af
ROM0:01E5 D9               reti 

Game Boy Color Speed Switch

ROM0:0241 06 BC            ld   b,BC
ROM0:0243 CD 5C 02         call 025C		;Game Boy Color check
ROM0:0246 38 08            jr   c,0250
ROM0:0248 F0 4D            ld   a,(ff00+4D)
ROM0:024A E6 80            and  a,80
ROM0:024C 28 02            jr   z,0250
ROM0:024E 06 78            ld   b,78
ROM0:0250 78               ld   a,b
ROM0:0251 E0 06            ld   (ff00+06),a
ROM0:0253 3E 03            ld   a,03
ROM0:0255 E0 07            ld   (ff00+07),a
ROM0:0257 3E 07            ld   a,07
ROM0:0259 E0 07            ld   (ff00+07),a
ROM0:025B C9               ret  

Game Boy Color check

ROM0:025C FA B4 CA         ld   a,(CAB4)
ROM0:025F FE 02            cp   a,02
ROM0:0261 C8               ret  z
ROM0:0262 37               scf  
ROM0:0263 C9               ret  

Wait for VBlank

ROM0:0264 E5               push hl
ROM0:0265 FA BB CA         ld   a,(CABB)
ROM0:0268 CB 7F            bit  7,a
ROM0:026A 28 09            jr   z,0275
ROM0:026C 21 B8 CA         ld   hl,CAB8
ROM0:026F 7E               ld   a,(hl)
ROM0:0270 76               halt 
ROM0:0271 00               nop  
ROM0:0272 BE               cp   (hl)
ROM0:0273 28 FB            jr   z,0270
ROM0:0275 E1               pop  hl
ROM0:0276 C9               ret  

LCD on

ROM0:0277 FA BB CA         ld   a,(CABB)
ROM0:027A CB 7F            bit  7,a
ROM0:027C C0               ret  nz
ROM0:027D F6 80            or   a,80
ROM0:027F EA BB CA         ld   (CABB),a
ROM0:0282 E0 40            ld   (ff00+40),a
ROM0:0284 3E C0            ld   a,C0
ROM0:0286 EA BF CA         ld   (CABF),a
ROM0:0289 C9               ret  

Wait for VBlank, LCD off

ROM0:028A F0 40            ld   a,(ff00+40)
ROM0:028C CB 7F            bit  7,a
ROM0:028E C8               ret  z
ROM0:028F F0 FF            ld   a,(ff00+FF)
ROM0:0291 EA B7 CA         ld   (CAB7),a
ROM0:0294 CB 87            res  0,a
ROM0:0296 E0 FF            ld   (ff00+FF),a
ROM0:0298 F0 44            ld   a,(ff00+44)
ROM0:029A FE 91            cp   a,91
ROM0:029C 20 FA            jr   nz,0298
ROM0:029E F0 40            ld   a,(ff00+40)
ROM0:02A0 E6 7F            and  a,7F
ROM0:02A2 E0 40            ld   (ff00+40),a
ROM0:02A4 FA BB CA         ld   a,(CABB)
ROM0:02A7 E6 7F            and  a,7F
ROM0:02A9 EA BB CA         ld   (CABB),a
ROM0:02AC AF               xor  a
ROM0:02AD E0 47            ld   (ff00+47),a
ROM0:02AF E0 48            ld   (ff00+48),a
ROM0:02B1 E0 49            ld   (ff00+49),a
ROM0:02B3 FA B7 CA         ld   a,(CAB7)
ROM0:02B6 E0 FF            ld   (ff00+FF),a
ROM0:02B8 C9               ret  

Blanks WRAM and HRAM

ROM0:03EC 21 00 C0         ld   hl,C000
ROM0:03EF 01 00 20         ld   bc,2000
ROM0:03F2 AF               xor  a
ROM0:03F3 22               ldi  (hl),a
ROM0:03F4 0B               dec  bc
ROM0:03F5 79               ld   a,c
ROM0:03F6 B0               or   b
ROM0:03F7 20 F9            jr   nz,03F2
ROM0:03F9 0E 80            ld   c,80
ROM0:03FB 06 70            ld   b,70
ROM0:03FD AF               xor  a
ROM0:03FE E2               ld   (ff00+c),a
ROM0:03FF 0C               inc  c
ROM0:0400 05               dec  b
ROM0:0401 20 FB            jr   nz,03FE
ROM0:0403 C9               ret

0:0404

ROM0:0404 3E C0            ld   a,C0
ROM0:0406 18 09            jr   0411
ROM0:0408 F6 80            or   a,80
ROM0:040A 18 05            jr   0411
ROM0:040C EA BC CA         ld   (CABC),a
ROM0:040F 3E 80            ld   a,80
ROM0:0411 EA BF CA         ld   (CABF),a
ROM0:0414 FA BB CA         ld   a,(CABB)
ROM0:0417 17               rla  
ROM0:0418 D8               ret  c
ROM0:0419 E5               push hl
ROM0:041A D5               push de
ROM0:041B C5               push bc
ROM0:041C CD 2D 04         call 042D
ROM0:041F C1               pop  bc
ROM0:0420 D1               pop  de
ROM0:0421 E1               pop  hl
ROM0:0422 C9               ret  
ROM0:0423 EA BD CA         ld   (CABD),a
ROM0:0426 18 E7            jr   040F
ROM0:0428 EA BE CA         ld   (CABE),a
ROM0:042B 18 E2            jr   040F

0:042D

ROM0:042D FA BF CA         ld   a,(CABF)
ROM0:0430 B7               or   a
ROM0:0431 C8               ret  z
ROM0:0432 21 BC CA         ld   hl,CABC
ROM0:0435 2A               ldi  a,(hl)
ROM0:0436 E0 47            ld   (ff00+47),a
ROM0:0438 2A               ldi  a,(hl)
ROM0:0439 E0 48            ld   (ff00+48),a
ROM0:043B 7E               ld   a,(hl)
ROM0:043C E0 49            ld   (ff00+49),a
ROM0:043E FA B4 CA         ld   a,(CAB4)
ROM0:0441 FE 02            cp   a,02
ROM0:0443 28 05            jr   z,044A
ROM0:0445 AF               xor  a
ROM0:0446 EA BF CA         ld   (CABF),a
ROM0:0449 C9               ret  

Update display

ROM0:053F F5               push af
ROM0:0540 E5               push hl
ROM0:0541 D5               push de
ROM0:0542 C5               push bc
ROM0:0543 21 D3 CA         ld   hl,CAD3
ROM0:0546 CD B6 05         call 05B6
ROM0:0549 CD 64 02         call 0264		;Wait for VBlank
ROM0:054C CD DE 04         call 04DE
ROM0:054F CD 72 05         call 0572
ROM0:0552 FA D5 CA         ld   a,(CAD5)
ROM0:0555 B7               or   a
ROM0:0556 28 15            jr   z,056D
ROM0:0558 F0 91            ld   a,(ff00+91)
ROM0:055A E6 04            and  a,04
ROM0:055C 28 0F            jr   z,056D
ROM0:055E CD 64 02         call 0264		;Wait for VBlank
ROM0:0561 CD DE 04         call 04DE
ROM0:0564 CD 72 05         call 0572
ROM0:0567 F0 91            ld   a,(ff00+91)
ROM0:0569 E6 04            and  a,04
ROM0:056B 28 F1            jr   z,055E
ROM0:056D C1               pop  bc
ROM0:056E D1               pop  de
ROM0:056F E1               pop  hl
ROM0:0570 F1               pop  af
ROM0:0571 C9               ret  

0:05B6

ROM0:05B6 F5               push af
ROM0:05B7 2A               ldi  a,(hl)
ROM0:05B8 B6               or   (hl)
ROM0:05B9 20 02            jr   nz,05BD
ROM0:05BB F1               pop  af
ROM0:05BC C9               ret  

Copy array from (hl) to (de)

ROM0:073C 2A               ldi  a,(hl)
ROM0:073D 12               ld   (de),a
ROM0:073E 13               inc  de
ROM0:073F 0B               dec  bc
ROM0:0740 79               ld   a,c
ROM0:0741 B0               or   b
ROM0:0742 20 F8            jr   nz,073C
ROM0:0744 C9               ret

0:0745

ROM0:0745 E5               push hl
ROM0:0746 C5               push bc
ROM0:0747 F5               push af
ROM0:0748 D5               push de
ROM0:0749 5D               ld   e,l
ROM0:074A 54               ld   d,h
ROM0:074B F8 09            ld   hl,sp+09
ROM0:074D 46               ld   b,(hl)
ROM0:074E 2B               dec  hl
ROM0:074F 4E               ld   c,(hl)
ROM0:0750 2B               dec  hl
ROM0:0751 70               ld   (hl),b
ROM0:0752 2B               dec  hl
ROM0:0753 71               ld   (hl),c
ROM0:0754 F8 09            ld   hl,sp+09
ROM0:0756 F0 80            ld   a,(ff00+80)
ROM0:0758 32               ldd  (hl),a
ROM0:0759 36 00            ld   (hl),00
ROM0:075B 7A               ld   a,d
ROM0:075C 07               rlca 
ROM0:075D 07               rlca 
ROM0:075E E6 03            and  a,03
ROM0:0760 47               ld   b,a
ROM0:0761 CB BA            res  7,d
ROM0:0763 CB F2            set  6,d
ROM0:0765 6B               ld   l,e
ROM0:0766 62               ld   h,d
ROM0:0767 D1               pop  de
ROM0:0768 F1               pop  af
ROM0:0769 80               add  b
ROM0:076A CD A3 07         call 07A3		;ROM Bank switch
ROM0:076D C1               pop  bc
ROM0:076E C9               ret  

0:076F

ROM0:076F E5               push hl
ROM0:0770 C5               push bc
ROM0:0771 F5               push af
ROM0:0772 D5               push de
ROM0:0773 5D               ld   e,l
ROM0:0774 54               ld   d,h
ROM0:0775 F8 09            ld   hl,sp+09
ROM0:0777 46               ld   b,(hl)
ROM0:0778 2B               dec  hl
ROM0:0779 4E               ld   c,(hl)
ROM0:077A 2B               dec  hl
ROM0:077B 70               ld   (hl),b
ROM0:077C 2B               dec  hl
ROM0:077D 71               ld   (hl),c
ROM0:077E F8 09            ld   hl,sp+09
ROM0:0780 F0 80            ld   a,(ff00+80)
ROM0:0782 32               ldd  (hl),a
ROM0:0783 36 00            ld   (hl),00
ROM0:0785 6B               ld   l,e
ROM0:0786 62               ld   h,d
ROM0:0787 D1               pop  de
ROM0:0788 F1               pop  af
ROM0:0789 CD A3 07         call 07A3
ROM0:078C C1               pop  bc
ROM0:078D C9               ret  

0:078E

ROM0:078E E5               push hl
ROM0:078F D5               push de
ROM0:0790 F8 07            ld   hl,sp+07
ROM0:0792 3A               ldd  a,(hl)
ROM0:0793 CD A3 07         call 07A3		;ROM Bank switch
ROM0:0796 2B               dec  hl
ROM0:0797 56               ld   d,(hl)
ROM0:0798 2B               dec  hl
ROM0:0799 5E               ld   e,(hl)
ROM0:079A 23               inc  hl
ROM0:079B 23               inc  hl
ROM0:079C 73               ld   (hl),e
ROM0:079D 23               inc  hl
ROM0:079E 72               ld   (hl),d
ROM0:079F D1               pop  de
ROM0:07A0 E1               pop  hl
ROM0:07A1 F1               pop  af
ROM0:07A2 C9               ret  

ROM Bank switch

ROM0:07A3 E0 80            ld   (ff00+80),a
ROM0:07A5 EA 00 20         ld   (2000),a		;ROM Bank switch
ROM0:07A8 C9               ret  

RAM Bank switch

ROM0:07A9 F5               push af
ROM0:07AA E0 81            ld   (ff00+81),a
ROM0:07AC EA 00 40         ld   (4000),a		;RAM Bank switch
ROM0:07AF 3E 0A            ld   a,0A
ROM0:07B1 EA 00 00         ld   (0000),a		;Enable MBC5 RAM
ROM0:07B4 F1               pop  af
ROM0:07B5 C9               ret

Enable MBC5 RAM

ROM0:07B6 F5               push af
ROM0:07B7 3E 0A            ld   a,0A
ROM0:07B9 EA 00 00         ld   (0000),a		;Enable MBC5 RAM
ROM0:07BC F1               pop  af
ROM0:07BD C9               ret

Disable MBC5 RAM

ROM0:07BE F5               push af
ROM0:07BF AF               xor  a
ROM0:07C0 EA 00 00         ld   (0000),a		;Disable MBC5 RAM
ROM0:07C3 F1               pop  af
ROM0:07C4 C9               ret  

Set VRAM Bank to 0

ROM0:07C5 F5               push af
ROM0:07C6 AF               xor  a
ROM0:07C7 E0 82            ld   (ff00+82),a
ROM0:07C9 E0 4F            ld   (ff00+4F),a
ROM0:07CB F1               pop  af
ROM0:07CC C9               ret  

Set VRAM Bank to 1

ROM0:07CD F5               push af
ROM0:07CE 3E 01            ld   a,01
ROM0:07D0 E0 82            ld   (ff00+82),a
ROM0:07D2 E0 4F            ld   (ff00+4F),a
ROM0:07D4 F1               pop  af
ROM0:07D5 C9               ret  

VRAM Bank switch

ROM0:07D6 E0 82            ld   (ff00+82),a
ROM0:07D8 E0 4F            ld   (ff00+4F),a
ROM0:07DA C9               ret

0:07E7

ROM0:07E7 CD 5C 02         call 025C		;Game Boy Color check
ROM0:07EA D8               ret  c
ROM0:07EB 21 4D FF         ld   hl,FF4D
ROM0:07EE CB 7E            bit  7,(hl)
ROM0:07F0 C0               ret  nz
ROM0:07F1 F0 FF            ld   a,(ff00+FF)
ROM0:07F3 F5               push af
ROM0:07F4 AF               xor  a
ROM0:07F5 E0 FF            ld   (ff00+FF),a
ROM0:07F7 CB C6            set  0,(hl)
ROM0:07F9 AF               xor  a
ROM0:07FA E0 0F            ld   (ff00+0F),a
ROM0:07FC E0 FF            ld   (ff00+FF),a
ROM0:07FE 3E 30            ld   a,30
ROM0:0800 E0 00            ld   (ff00+00),a
ROM0:0802 10 00            stop
ROM0:0804 CD 41 02         call 0241
ROM0:0807 F1               pop  af
ROM0:0808 E0 FF            ld   (ff00+FF),a
ROM0:080A C9               ret  

0:084D

ROM0:084D 3E 03            ld   a,03
ROM0:084F CD 63 08         call 0863		;Blanks SRAM
ROM0:0852 3D               dec  a
ROM0:0853 FE FF            cp   a,FF
ROM0:0855 20 F8            jr   nz,084F
ROM0:0857 21 00 A0         ld   hl,A000
ROM0:085A 36 04            ld   (hl),04
ROM0:085C 23               inc  hl
ROM0:085D 36 21            ld   (hl),21
ROM0:085F 23               inc  hl
ROM0:0860 36 05            ld   (hl),05
ROM0:0862 C9               ret  

Blanks SRAM

ROM0:0863 F5               push af
ROM0:0864 CD A9 07         call 07A9		;RAM Bank switch
ROM0:0867 CD B6 07         call 07B6		;Enable MBC5 RAM
ROM0:086A 21 00 A0         ld   hl,A000		;Start of SRAM
ROM0:086D 01 00 20         ld   bc,2000		;Length of SRAM Bank
ROM0:0870 AF               xor  a
ROM0:0871 22               ldi  (hl),a		;Blank SRAM
ROM0:0872 0B               dec  bc
ROM0:0873 79               ld   a,c
ROM0:0874 B0               or   b
ROM0:0875 20 F9            jr   nz,0870		;Loop until SRAM is blanked
ROM0:0877 F1               pop  af
ROM0:0878 C9               ret  

PRNG

/* function starts at 0x88F */
n = accumulator;
frame = (CACC);
seed = rl((CACA) ⊕ (CACB)) ⊕ rl((CACA) ⊕ frame);
prn_1 = (seed × n) >> 8;				;1-byte PRN used in most occasions: Booster packs, Coin flips, Random damage...
prn_2 = rr((CACA) ⊕ rlc(rlc(CACB)));			;idk yet
  • 0x879-0x88E - Pseudo-random number between 0 and n-1, multiply prn generated at 0x866 by n, keep the most-significant bits (register h)
ROM0:0879 D5               push de
ROM0:087A 7C               ld   a,h		;a = n
ROM0:087B 5D               ld   e,l		;e = rl((CAC8) ⊕ (CAC9)) ⊕ rl((CAC8) ⊕ (CACA))
ROM0:087C 16 00            ld   d,00		;d = 0
ROM0:087E 6A               ld   l,d
ROM0:087F 62               ld   h,d		;hl = 0
ROM0:0880 18 05            jr   0887
ROM0:0882 19               add  hl,de		;hl += de
ROM0:0883 CB 23            sla  e		;e << 1
ROM0:0885 CB 12            rl   d		;rotate left, put the carry in the lsb of register d
ROM0:0887 CB 3F            srl  a		;a >> 1
ROM0:0889 38 F7            jr   c,0882		;If carry, jump to 0:0882
ROM0:088B 20 F6            jr   nz,0883		;else if(a != 0), jump to 0:0883
ROM0:088D D1               pop  de
ROM0:088E C9               ret  
  • 0x85A-0x865 - Loads (rl((CACB) ⊕ (CACA)) ⊕ rl((CACC) ⊕ (CACA)) × n) >> 8 in accumulator
ROM0:088F E5               push hl
ROM0:0890 67               ld   h,a		;h = n
ROM0:0891 CD 9B 08         call 089B
ROM0:0894 6F               ld   l,a		;l = rl((CACA) ⊕ (CAC9)) ⊕ rl((CAC8) ⊕ (CACA))
ROM0:0895 CD 79 08         call 0879
ROM0:0898 7C               ld   a,h		;a = h × l >> 8
ROM0:0899 E1               pop  hl
ROM0:089A C9               ret
  • 0x089B-0x8BE - Stores a one-byte pseudo-random value in accumulator, and loads a new two-byte seed in (CACA)
ROM0:089B E5               push hl
ROM0:089C D5               push de
ROM0:089D 21 CA CA         ld   hl,CACA
ROM0:08A0 2A               ldi  a,(hl)		;Loads (CACA)
ROM0:08A1 56               ld   d,(hl)		;Loads (CACB)
ROM0:08A2 23               inc  hl
ROM0:08A3 5F               ld   e,a		;e = (CACA)
ROM0:08A4 7A               ld   a,d		;a = (CACB)
ROM0:08A5 07               rlca 
ROM0:08A6 07               rlca 
ROM0:08A7 AB               xor  e
ROM0:08A8 1F               rra   		;a = rr(rlc(rlc(CACB)) ⊕ (CACA))
ROM0:08A9 F5               push af		;Pushes result
ROM0:08AA 7A               ld   a,d		;a = (CACB)
ROM0:08AB AB               xor  e
ROM0:08AC 57               ld   d,a 		;d = (CACB) ⊕ (CACA)
ROM0:08AD 7E               ld   a,(hl)		;Loads PRNG count (CACC)
ROM0:08AE AB               xor  e
ROM0:08AF 5F               ld   e,a		;e = (CACC) ⊕ (CACA)
ROM0:08B0 F1               pop  af
ROM0:08B1 CB 13            rl   e
ROM0:08B3 CB 12            rl   d
ROM0:08B5 7A               ld   a,d
ROM0:08B6 AB               xor  e		;a = rl((CACB) ⊕ (CACA)) ⊕ rl((CACC) ⊕ (CACA))
ROM0:08B7 34               inc  (hl)		;PRNG_frame(CACC)++
ROM0:08B8 2B               dec  hl
ROM0:08B9 72               ld   (hl),d		;Loads rl((CACB) ⊕ (CACA)) in (CACB)
ROM0:08BA 2B               dec  hl
ROM0:08BB 73               ld   (hl),e		;Loads rl((CACC) ⊕ (CACA)) in (CACA)
ROM0:08BC D1               pop  de
ROM0:08BD E1               pop  hl
ROM0:08BE C9               ret

0:08BF

ROM0:08BF 21 D6 CA         ld   hl,CAD6
ROM0:08C2 73               ld   (hl),e
ROM0:08C3 23               inc  hl
ROM0:08C4 72               ld   (hl),d
ROM0:08C5 21 D8 CA         ld   hl,CAD8
ROM0:08C8 36 01            ld   (hl),01
ROM0:08CA 23               inc  hl
ROM0:08CB AF               xor  a
ROM0:08CC 22               ldi  (hl),a
ROM0:08CD 22               ldi  (hl),a
ROM0:08CE 22               ldi  (hl),a
ROM0:08CF 22               ldi  (hl),a
ROM0:08D0 70               ld   (hl),b
ROM0:08D1 23               inc  hl
ROM0:08D2 22               ldi  (hl),a
ROM0:08D3 36 EF            ld   (hl),EF
ROM0:08D5 60               ld   h,b
ROM0:08D6 2E 00            ld   l,00
ROM0:08D8 AF               xor  a
ROM0:08D9 77               ld   (hl),a
ROM0:08DA 2C               inc  l
ROM0:08DB 20 FC            jr   nz,08D9
ROM0:08DD C9               ret

0:099C

ROM0:099C AF               xor  a
ROM0:099D EA B5 CA         ld   (CAB5),a	;(CAB5) = 0
ROM0:09A0 21 00 CA         ld   hl,CA00
ROM0:09A3 0E 28            ld   c,28
ROM0:09A5 AF               xor  a
ROM0:09A6 22               ldi  (hl),a
ROM0:09A7 22               ldi  (hl),a
ROM0:09A8 23               inc  hl
ROM0:09A9 23               inc  hl
ROM0:09AA 0D               dec  c
ROM0:09AB 20 F9            jr   nz,09A6
ROM0:09AD C9               ret  

Return to return adress after rst (idk which one)

ROM0:09AE E5               push hl
ROM0:09AF E5               push hl
ROM0:09B0 E5               push hl
ROM0:09B1 E5               push hl		;SP shenanigans
ROM0:09B2 D5               push de
ROM0:09B3 F5               push af
ROM0:09B4 F8 0D            ld   hl,sp+0D
ROM0:09B6 56               ld   d,(hl)
ROM0:09B7 2B               dec  hl
ROM0:09B8 5E               ld   e,(hl)
ROM0:09B9 2B               dec  hl
ROM0:09BA 36 00            ld   (hl),00
ROM0:09BC 2B               dec  hl
ROM0:09BD F0 80            ld   a,(ff00+80)	;a = ROM Bank
ROM0:09BF 32               ldd  (hl),a
ROM0:09C0 36 09            ld   (hl),09
ROM0:09C2 2B               dec  hl
ROM0:09C3 36 DC            ld   (hl),DC
ROM0:09C5 2B               dec  hl
ROM0:09C6 13               inc  de
ROM0:09C7 1A               ld   a,(de)
ROM0:09C8 32               ldd  (hl),a
ROM0:09C9 1B               dec  de
ROM0:09CA 1A               ld   a,(de)
ROM0:09CB 77               ld   (hl),a
ROM0:09CC 3E 01            ld   a,01
ROM0:09CE CD A3 07         call 07A3
ROM0:09D1 F8 0D            ld   hl,sp+0D
ROM0:09D3 13               inc  de
ROM0:09D4 13               inc  de
ROM0:09D5 72               ld   (hl),d
ROM0:09D6 2B               dec  hl
ROM0:09D7 73               ld   (hl),e
ROM0:09D8 F1               pop  af
ROM0:09D9 D1               pop  de
ROM0:09DA E1               pop  hl
ROM0:09DB C9               ret  

0:09CE

ROM0:09CE CD A3 07         call 07A3		;ROM Bank switch
ROM0:09D1 F8 0D            ld   hl,sp+0D
ROM0:09D3 13               inc  de
ROM0:09D4 13               inc  de
ROM0:09D5 72               ld   (hl),d
ROM0:09D6 2B               dec  hl
ROM0:09D7 73               ld   (hl),e
ROM0:09D8 F1               pop  af
ROM0:09D9 D1               pop  de
ROM0:09DA E1               pop  hl
ROM0:09DB C9               ret

ROM Bank switching after rst

ROM0:09DC F5               push af
ROM0:09DD E5               push hl
ROM0:09DE F8 04            ld   hl,sp+04
ROM0:09E0 7E               ld   a,(hl)
ROM0:09E1 CD A3 07         call 07A3		;ROM Bank switch
ROM0:09E4 E1               pop  hl
ROM0:09E5 F1               pop  af
ROM0:09E6 33               inc  sp
ROM0:09E7 33               inc  sp
ROM0:09E8 C9               ret

Return to return adress after rst

ROM0:09E9 E5               push hl
ROM0:09EA E5               push hl
ROM0:09EB E5               push hl
ROM0:09EC E5               push hl		;SP shenanigans
ROM0:09ED D5               push de
ROM0:09EE F5               push af
ROM0:09EF F8 0D            ld   hl,sp+0D
ROM0:09F1 56               ld   d,(hl)
ROM0:09F2 2B               dec  hl
ROM0:09F3 5E               ld   e,(hl)
ROM0:09F4 2B               dec  hl
ROM0:09F5 36 00            ld   (hl),00
ROM0:09F7 2B               dec  hl
ROM0:09F8 F0 80            ld   a,(ff00+80)	;a = ROM Bank
ROM0:09FA 32               ldd  (hl),a
ROM0:09FB 36 09            ld   (hl),09
ROM0:09FD 2B               dec  hl
ROM0:09FE 36 DC            ld   (hl),DC
ROM0:0A00 2B               dec  hl
ROM0:0A01 13               inc  de
ROM0:0A02 13               inc  de
ROM0:0A03 1A               ld   a,(de)
ROM0:0A04 32               ldd  (hl),a
ROM0:0A05 1B               dec  de
ROM0:0A06 1A               ld   a,(de)
ROM0:0A07 77               ld   (hl),a
ROM0:0A08 1B               dec  de
ROM0:0A09 1A               ld   a,(de)
ROM0:0A0A 13               inc  de
ROM0:0A0B 18 C1            jr   09CE

Set up SNES memory and palette

ROM0:0A0D 21 D0 0A         ld   hl,0AD0
ROM0:0A10 CD 20 0B         call 0B20		;SGB Handling
ROM0:0A13 21 50 0A         ld   hl,0A50
ROM0:0A16 CD 20 0B         call 0B20
ROM0:0A19 21 60 0A         ld   hl,0A60
ROM0:0A1C CD 20 0B         call 0B20
ROM0:0A1F 21 70 0A         ld   hl,0A70
ROM0:0A22 CD 20 0B         call 0B20
ROM0:0A25 21 80 0A         ld   hl,0A80
ROM0:0A28 CD 20 0B         call 0B20
ROM0:0A2B 21 90 0A         ld   hl,0A90
ROM0:0A2E CD 20 0B         call 0B20
ROM0:0A31 21 A0 0A         ld   hl,0AA0
ROM0:0A34 CD 20 0B         call 0B20
ROM0:0A37 21 B0 0A         ld   hl,0AB0
ROM0:0A3A CD 20 0B         call 0B20
ROM0:0A3D 21 C0 0A         ld   hl,0AC0
ROM0:0A40 CD 20 0B         call 0B20
ROM0:0A43 21 F0 0A         ld   hl,0AF0
ROM0:0A46 CD 20 0B         call 0B20
ROM0:0A49 21 E0 0A         ld   hl,0AE0
ROM0:0A4C CD 20 0B         call 0B20
ROM0:0A4F C9               ret

SGB Handling

  • 0xB20-0xB58 - Handles SGB commands sent to this function
ROM0:0B20 7E               ld   a,(hl)
ROM0:0B21 E6 07            and  a,07
ROM0:0B23 C8               ret  z
ROM0:0B24 47               ld   b,a
ROM0:0B25 0E 00            ld   c,00
ROM0:0B27 C5               push bc
ROM0:0B28 3E 00            ld   a,00
ROM0:0B2A E2               ld   (ff00+c),a
ROM0:0B2B 3E 30            ld   a,30
ROM0:0B2D E2               ld   (ff00+c),a
ROM0:0B2E 06 10            ld   b,10
ROM0:0B30 1E 08            ld   e,08
ROM0:0B32 2A               ldi  a,(hl)
ROM0:0B33 57               ld   d,a
ROM0:0B34 CB 42            bit  0,d
ROM0:0B36 3E 10            ld   a,10
ROM0:0B38 20 02            jr   nz,0B3C
ROM0:0B3A 3E 20            ld   a,20
ROM0:0B3C E2               ld   (ff00+c),a
ROM0:0B3D 3E 30            ld   a,30
ROM0:0B3F E2               ld   (ff00+c),a
ROM0:0B40 CB 1A            rr   d
ROM0:0B42 1D               dec  e
ROM0:0B43 20 EF            jr   nz,0B34
ROM0:0B45 05               dec  b
ROM0:0B46 20 E8            jr   nz,0B30
ROM0:0B48 3E 20            ld   a,20
ROM0:0B4A E2               ld   (ff00+c),a
ROM0:0B4B 3E 30            ld   a,30
ROM0:0B4D E2               ld   (ff00+c),a
ROM0:0B4E C1               pop  bc
ROM0:0B4F 05               dec  b
ROM0:0B50 20 D5            jr   nz,0B27
ROM0:0B52 01 04 00         ld   bc,0004
ROM0:0B55 CD 08 0C         call 0C08
ROM0:0B58 C9               ret

Display text

Display textbox

ROM0:2AAB CD 59 2A         call 2A59		;Display wide textbox
ROM0:2AAE AF               xor  a		;a = 0
ROM0:2AAF 21 C8 2A         ld   hl,2AC8
ROM0:2AB2 CD 36 26         call 2636		;Initialize Cursor
ROM0:2AB5 CD 77 02         call 0277		;LCD Enable
ROM0:2AB8 CD 3F 05         call 053F		;Update display
ROM0:2ABB CD DA 26         call 26DA		;Check if Player has pressed a button
ROM0:2ABE F0 91            ld   a,(ff00+91)	;a = buttons_pressed
ROM0:2AC0 E6 03            and  a,03
ROM0:2AC2 28 F4            jr   z,2AB8		;Loop to 1:2AB8 until Player presses A or B
ROM0:2AC4 CD E9 26         call 26E9		;Remove cursor
ROM0:2AC7 C9               ret  

0:235E

ROM0:235E FA 0A CD         ld   a,(CD0A)
ROM0:2361 B7               or   a
ROM0:2362 28 12            jr   z,2376		// If((CD0A) == 0), jump to 0:2376
ROM0:2364 CD B1 23         call 23B1		// Changes lowercase character to UPPERCASE
ROM0:2367 FA 0B CD         ld   a,(CD0B)
ROM0:236A 57               ld   d,a
ROM0:236B B7               or   a
ROM0:236C 20 08            jr   nz,2376		// If((CD0B) ≠ 0), jump to 0:2376
ROM0:236E 7B               ld   a,e
ROM0:236F EA 0B CD         ld   (CD0B),a	// Stores the character in (CD0B)
ROM0:2372 3E 01            ld   a,01
ROM0:2374 B7               or   a
ROM0:2375 C9               ret

0:2376

ROM0:2376 AF               xor  a
ROM0:2377 EA 0B CD         ld   (CD0B),a
ROM0:237A F0 A9            ld   a,(ff00+A9)
ROM0:237C 6F               ld   l,a
ROM0:237D 26 C6            ld   h,C6
ROM0:237F 7E               ld   a,(hl)
ROM0:2380 B7               or   a
ROM0:2381 C8               ret  z
ROM0:2382 BB               cp   e
ROM0:2383 20 05            jr   nz,238A
ROM0:2385 24               inc  h
ROM0:2386 7E               ld   a,(hl)
ROM0:2387 BA               cp   d
ROM0:2388 28 05            jr   z,238F
ROM0:238A 26 C8            ld   h,C8
ROM0:238C 6E               ld   l,(hl)
ROM0:238D 18 EE            jr   237D
ROM0:238F F0 A9            ld   a,(ff00+A9)
ROM0:2391 BD               cp   l
ROM0:2392 28 1B            jr   z,23AF
ROM0:2394 4F               ld   c,a
ROM0:2395 06 C9            ld   b,C9
ROM0:2397 7D               ld   a,l
ROM0:2398 02               ld   (bc),a
ROM0:2399 E0 A9            ld   (ff00+A9),a
ROM0:239B 26 C9            ld   h,C9
ROM0:239D 46               ld   b,(hl)
ROM0:239E 36 00            ld   (hl),00
ROM0:23A0 26 C8            ld   h,C8
ROM0:23A2 79               ld   a,c
ROM0:23A3 4E               ld   c,(hl)
ROM0:23A4 77               ld   (hl),a
ROM0:23A5 68               ld   l,b
ROM0:23A6 71               ld   (hl),c
ROM0:23A7 26 C9            ld   h,C9
ROM0:23A9 0C               inc  c
ROM0:23AA 0D               dec  c
ROM0:23AB 28 02            jr   z,23AF
ROM0:23AD 69               ld   l,c
ROM0:23AE 70               ld   (hl),b
ROM0:23AF 37               scf  
ROM0:23B0 C9               ret  

Changes lowercase character to UPPERCASE

ROM0:23B1 FA 0D CD         ld   a,(CD0D)	// Uppercase switch
ROM0:23B4 B7               or   a
ROM0:23B5 C8               ret  z		// If the uppercase switch is disabled, get out of this function
ROM0:23B6 7B               ld   a,e
ROM0:23B7 FE 60            cp   a,60
ROM0:23B9 D8               ret  c
ROM0:23BA FE 7B            cp   a,7B
ROM0:23BC D0               ret  nc		// If the character is not a lowercase letter, get out of this function
ROM0:23BD D6 20            sub  a,20		// Uppercases the character
ROM0:23BF 5F               ld   e,a
ROM0:23C0 C9               ret

0:2546

ROM0:2546 FA 0A CD         ld   a,(CD0A)
ROM0:2549 B7               or   a
ROM0:254A 20 13            jr   nz,255F
ROM0:254C 7B               ld   a,e
ROM0:254D FE 10            cp   a,10
ROM0:254F 38 10            jr   c,2561
ROM0:2551 FE 60            cp   a,60
ROM0:2553 30 10            jr   nc,2565
ROM0:2555 F0 AF            ld   a,(ff00+AF)
ROM0:2557 FE 0F            cp   a,0F
ROM0:2559 20 0A            jr   nz,2565
ROM0:255B 16 0F            ld   d,0F
ROM0:255D B7               or   a
ROM0:255E C9               ret

Update display if LCD is enabled

ROM0:3C48 F5               push af
ROM0:3C49 F0 40            ld   a,(ff00+40)	;LCD Control
ROM0:3C4B CB 7F            bit  7,a
ROM0:3C4D 28 09            jr   z,3C58
ROM0:3C4F C5               push bc
ROM0:3C50 D5               push de
ROM0:3C51 E5               push hl
ROM0:3C52 CD 3F 05         call 053F		;Update display
ROM0:3C55 E1               pop  hl
ROM0:3C56 D1               pop  de
ROM0:3C57 C1               pop  bc
ROM0:3C58 F1               pop  af
ROM0:3C59 C9               ret

0:3C5A

ROM0:3C5A 21 00 00         ld   hl,0000
ROM0:3C5D CB 11            rl   c
ROM0:3C5F CB 10            rl   b
ROM0:3C61 3E 10            ld   a,10
ROM0:3C63 E0 B6            ld   (ff00+B6),a
ROM0:3C65 CB 15            rl   l
ROM0:3C67 CB 14            rl   h
ROM0:3C69 E5               push hl
ROM0:3C6A 7D               ld   a,l
ROM0:3C6B 93               sub  e
ROM0:3C6C 6F               ld   l,a
ROM0:3C6D 7C               ld   a,h
ROM0:3C6E 9A               sbc  d
ROM0:3C6F 3F               ccf  
ROM0:3C70 30 06            jr   nc,3C78
ROM0:3C72 67               ld   h,a
ROM0:3C73 E8 02            add  sp,02
ROM0:3C75 37               scf  
ROM0:3C76 18 01            jr   3C79
ROM0:3C78 E1               pop  hl
ROM0:3C79 CB 11            rl   c
ROM0:3C7B CB 10            rl   b
ROM0:3C7D F0 B6            ld   a,(ff00+B6)
ROM0:3C7F 3D               dec  a
ROM0:3C80 20 E1            jr   nz,3C63
ROM0:3C82 C9               ret  

0:3C83

ROM0:3C83 CD 85 37         call 3785
ROM0:3C86 C9               ret

0:3C1F

ROM0:3C1F E5               push hl
ROM0:3C20 C5               push bc
ROM0:3C21 73               ld   (hl),e
ROM0:3C22 23               inc  hl
ROM0:3C23 72               ld   (hl),d
ROM0:3C24 23               inc  hl
ROM0:3C25 0B               dec  bc
ROM0:3C26 78               ld   a,b
ROM0:3C27 B1               or   c
ROM0:3C28 20 F7            jr   nz,3C21
ROM0:3C2A C1               pop  bc
ROM0:3C2B E1               pop  hl
ROM0:3C2C C9               ret

Bank 1

Check uppercase switch

ROM1:4000 F3               di   
ROM1:4001 31 00 E0         ld   sp,E000
ROM1:4004 CD A6 0E         call 0EA6
ROM1:4007 CD E4 02         call 02E4
ROM1:400A CD DD 02         call 02DD
ROM1:400D CD B6 07         call 07B6		;Enable MBC5 RAM
ROM1:4010 FA 06 A0         ld   a,(A006)
ROM1:4013 EA 47 CE         ld   (CE47),a
ROM1:4016 FA 09 A0         ld   a,(A009)
ROM1:4019 EA F2 CC         ld   (CCF2),a
ROM1:401C CD BE 07         call 07BE		;Disable MBC5 RAM
ROM1:401F 3E 01            ld   a,01
ROM1:4021 EA 0D CD         ld   (CD0D),a		// UPPERCASE switch
ROM1:4024 FB               ei   
ROM1:4025 EF               rst  28

Open Pokémon Power menu

ROM1:438E CD 31 64         call 6431
ROM1:4391 DA 6D 42         jp   c,426D
ROM1:4394 CD 30 17         call 1730
ROM1:4397 C3 6D 42         jp   426D

Player End of Turn

ROM1:439A 3E 08            ld   a,08
ROM1:439C CD E7 51         call 51E7
ROM1:439F DA 68 42         jp   c,4268
ROM1:43A2 3E 05            ld   a,05
ROM1:43A4 CD 7F 0F         call 0F7F
ROM1:43A7 CD 7A 71         call 717A
ROM1:43AA C9               ret  

Player Retreat

ROM1:43AB 3E F0            ld   a,F0
ROM1:43AD CD 0B 16         call 160B
ROM1:43B0 E6 0F            and  a,0F
ROM1:43B2 FE 01            cp   a,01
ROM1:43B4 E0 A0            ld   (ff00+A0),a
ROM1:43B6 20 39            jr   nz,43F1
ROM1:43B8 FA 0C CC         ld   a,(CC0C)
ROM1:43BB B7               or   a
ROM1:43BC 20 2A            jr   nz,43E8
ROM1:43BE CD BB 45         call 45BB
ROM1:43C1 38 5C            jr   c,441F
ROM1:43C3 CD 11 46         call 4611
ROM1:43C6 38 54            jr   c,441C
ROM1:43C8 21 0E 01         ld   hl,010E
ROM1:43CB CD AB 2A         call 2AAB			;Display textbox
ROM1:43CE CD 0C 60         call 600C
ROM1:43D1 38 49            jr   c,441C
ROM1:43D3 EA CB CB         ld   (CBCB),a
ROM1:43D6 FA CB CB         ld   a,(CBCB)
ROM1:43D9 E0 A1            ld   (ff00+A1),a
ROM1:43DB 3E 04            ld   a,04
ROM1:43DD CD 7F 0F         call 0F7F
ROM1:43E0 CD 7A 65         call 657A
ROM1:43E3 30 37            jr   nc,441C
ROM1:43E5 CD 9D 4F         call 4F9D
ROM1:43E8 21 3D 00         ld   hl,003D
ROM1:43EB CD AB 2A         call 2AAB			;Display textbox
ROM1:43EE C3 95 42         jp   4295

1:43F1

ROM1:43F1 CD BB 45         call 45BB
ROM1:43F4 38 29            jr   c,441F
ROM1:43F6 CD 11 46         call 4611
ROM1:43F9 38 21            jr   c,441C
ROM1:43FB CD 58 65         call 6558
ROM1:43FE 21 0E 01         ld   hl,010E
ROM1:4401 CD AB 2A         call 2AAB			;Display textbox
ROM1:4404 CD 0C 60         call 600C
ROM1:4407 EA CB CB         ld   (CBCB),a		;(CBCB) = Benched Pokémon
ROM1:440A E0 A1            ld   (ff00+A1),a
ROM1:440C F5               push af
ROM1:440D CD 64 65         call 6564
ROM1:4410 F1               pop  af
ROM1:4411 DA 6D 42         jp   c,426D
ROM1:4414 3E 04            ld   a,04
ROM1:4416 CD 7F 0F         call 0F7F
ROM1:4419 CD 7A 65         call 657A
ROM1:441C C3 6D 42         jp   426D
ROM1:441F CD AB 2A         call 2AAB			;Display textbox
ROM1:4422 C3 95 42         jp   4295

Open Hand menu

ROM1:4425 3E EE            ld   a,EE
ROM1:4427 CD 0B 16         call 160B
ROM1:442A B7               or   a
ROM1:442B 20 09            jr   nz,4436
ROM1:442D 21 A4 00         ld   hl,00A4
ROM1:4430 CD AB 2A         call 2AAB			;Display textbox
ROM1:4433 C3 95 42         jp   4295

1:4436

ROM1:4436 CD 3B 12         call 123B
ROM1:4439 CD 9A 55         call 559A
ROM1:443C 21 AA 00         ld   hl,00AA
ROM1:443F CD 88 55         call 5588
ROM1:4442 3E 01            ld   a,01
ROM1:4444 EA DE CB         ld   (CBDE),a		;wCBDE = 1
ROM1:4447 CD F0 55         call 55F0
ROM1:444A F5               push af
ROM1:444B FA DF CB         ld   a,(CBDF)		;a = wCBDF
ROM1:444E B7               or   a
ROM1:444F C4 58 12         call nz,1258
ROM1:4452 F1               pop  af
ROM1:4453 DA 6D 42         jp   c,426D
ROM1:4456 F0 98            ld   a,(ff00+98)
ROM1:4458 CD 76 13         call 1376
ROM1:445B FA 24 CC         ld   a,(CC24)
ROM1:445E 4F               ld   c,a
ROM1:445F CB 61            bit  4,c
ROM1:4461 20 0C            jr   nz,446F
ROM1:4463 CB 59            bit  3,c
ROM1:4465 20 10            jr   nz,4477
ROM1:4467 CD DB 44         call 44DB
ROM1:446A 38 66            jr   c,44D2
ROM1:446C C3 6D 42         jp   426D

1:446F

ROM1:446F CD F9 18         call 18F9
ROM1:4472 38 5E            jr   c,44D2
ROM1:4474 C3 6D 42         jp   426D

Check if an Energy card has been played this turn

ROM1:4477 79               ld   a,c
ROM1:4478 FE 0B            cp   a,0B
ROM1:447A 20 05            jr   nz,4481
ROM1:447C CD 15 36         call 3615
ROM1:447F 38 2E            jr   c,44AF
ROM1:4481 FA 0B CC         ld   a,(CC0B)		;Has an Energy card been played this turn ? (stays at 0 if Water Energy with Rain Dance)
ROM1:4484 B7               or   a
ROM1:4485 20 45            jr   nz,44CC			;if(energies_played > 0), jump to 1:44CC
ROM1:4487 CD DD 5F         call 5FDD
ROM1:448A CD 0C 60         call 600C
ROM1:448D DA 6D 42         jp   c,426D
ROM1:4490 3E 01            ld   a,01
ROM1:4492 EA 0B CC         ld   (CC0B),a
ROM1:4495 F0 9D            ld   a,(ff00+9D)
ROM1:4497 E0 A1            ld   (ff00+A1),a
ROM1:4499 5F               ld   e,a
ROM1:449A F0 98            ld   a,(ff00+98)
ROM1:449C E0 A0            ld   (ff00+A0),a
ROM1:449E CD D2 14         call 14D2
ROM1:44A1 CD B8 61         call 61B8
ROM1:44A4 3E 03            ld   a,03
ROM1:44A6 CD 7F 0F         call 0F7F
ROM1:44A9 CD E4 68         call 68E4
ROM1:44AC C3 6D 42         jp   426D

1:44AF

ROM1:44AF CD DD 5F         call 5FDD
ROM1:44B2 CD 0C 60         call 600C
ROM1:44B5 DA 6D 42         jp   c,426D
ROM1:44B8 CD 22 36         call 3622
ROM1:44BB 38 D8            jr   c,4495
ROM1:44BD FA 0B CC         ld   a,(CC0B)
ROM1:44C0 B7               or   a
ROM1:44C1 28 CD            jr   z,4490
ROM1:44C3 21 3E 00         ld   hl,003E
ROM1:44C6 CD AB 2A         call 2AAB			;Display textbox
ROM1:44C9 C3 36 44         jp   4436
ROM1:44CC 21 3E 00         ld   hl,003E
ROM1:44CF CD AB 2A         call 2AAB			;Display textbox
ROM1:44D2 CD 3B 12         call 123B
ROM1:44D5 CD BE 55         call 55BE
ROM1:44D8 C3 47 44         jp   4447

1:44DB

ROM1:44DB FA 2D CC         ld   a,(CC2D)
ROM1:44DE B7               or   a
ROM1:44DF 20 43            jr   nz,4524
ROM1:44E1 3E EF            ld   a,EF
ROM1:44E3 CD 0B 16         call 160B
ROM1:44E6 FE 06            cp   a,06
ROM1:44E8 30 32            jr   nc,451C
ROM1:44EA F0 98            ld   a,(ff00+98)
ROM1:44EC E0 A0            ld   (ff00+A0),a
ROM1:44EE CD 85 14         call 1485
ROM1:44F1 E0 9D            ld   (ff00+9D),a
ROM1:44F3 C6 CE            add  a,CE
ROM1:44F5 CD 0B 16         call 160B
ROM1:44F8 36 00            ld   (hl),00
ROM1:44FA 3E 01            ld   a,01
ROM1:44FC CD 7F 0F         call 0F7F
ROM1:44FF F0 98            ld   a,(ff00+98)
ROM1:4501 CD 76 13         call 1376
ROM1:4504 3E 14            ld   a,14
ROM1:4506 CD F5 29         call 29F5
ROM1:4509 36 00            ld   (hl),00
ROM1:450B 21 00 00         ld   hl,0000
ROM1:450E CD BB 2E         call 2EBB
ROM1:4511 21 61 00         ld   hl,0061
ROM1:4514 CD AB 2A         call 2AAB			;Display textbox
ROM1:4517 CD 1E 16         call 161E
ROM1:451A B7               or   a
ROM1:451B C9               ret

1:451C

ROM1:451C 21 B2 00         ld   hl,00B2
ROM1:451F CD AB 2A         call 2AAB			;Display textbox
ROM1:4522 37               scf  
ROM1:4523 C9               ret  

1:4524

ROM1:4524 3E EF            ld   a,EF
ROM1:4526 CD 0B 16         call 160B
ROM1:4529 4F               ld   c,a
ROM1:452A F0 98            ld   a,(ff00+98)
ROM1:452C 57               ld   d,a
ROM1:452D 1E 00            ld   e,00
ROM1:452F D5               push de
ROM1:4530 C5               push bc
ROM1:4531 D5               push de
ROM1:4532 CD F7 13         call 13F7
ROM1:4535 D1               pop  de
ROM1:4536 30 1C            jr   nc,4554
ROM1:4538 1C               inc  e
ROM1:4539 0D               dec  c
ROM1:453A 20 F5            jr   nz,4531
ROM1:453C C1               pop  bc
ROM1:453D D1               pop  de
ROM1:453E D5               push de
ROM1:453F CD F7 13         call 13F7
ROM1:4542 D1               pop  de
ROM1:4543 21 B4 00         ld   hl,00B4
ROM1:4546 20 07            jr   nz,454F
ROM1:4548 1C               inc  e
ROM1:4549 0D               dec  c
ROM1:454A 20 F2            jr   nz,453E
ROM1:454C 21 B3 00         ld   hl,00B3
ROM1:454F CD AB 2A         call 2AAB			;Display textbox
ROM1:4552 37               scf  
ROM1:4553 C9               ret  

1:4554

ROM1:4554 C1               pop  bc
ROM1:4555 D1               pop  de
ROM1:4556 CD B7 35         call 35B7
ROM1:4559 38 25            jr   c,4580
ROM1:455B CD DD 5F         call 5FDD
ROM1:455E CD 0C 60         call 600C
ROM1:4561 38 1B            jr   c,457E
ROM1:4563 F0 98            ld   a,(ff00+98)
ROM1:4565 E0 A0            ld   (ff00+A0),a
ROM1:4567 F0 9D            ld   a,(ff00+9D)
ROM1:4569 E0 A1            ld   (ff00+A1),a
ROM1:456B CD A2 13         call 13A2
ROM1:456E 38 EE            jr   c,455E
ROM1:4570 3E 02            ld   a,02
ROM1:4572 CD 7F 0F         call 0F7F
ROM1:4575 CD B8 61         call 61B8
ROM1:4578 CD FA 68         call 68FA
ROM1:457B CD 1E 16         call 161E
ROM1:457E B7               or   a
ROM1:457F C9               ret  

1:4580

ROM1:4580 CD AB 2A         call 2AAB			;Display textbox
ROM1:4583 37               scf  
ROM1:4584 C9               ret  

Open Check menu

ROM1:4585 CD 31 3B         call 3B31
ROM1:4588 CD 96 30         call 3096
ROM1:458B C3 6D 42         jp   426D

Bank 2

Bank 3

Challenge Cup

  • 0xF580-0xF5B2: Selects Challenge Cup opponent
ROM3:7580 CD 69 4A         call 4A69
ROM3:7583 44               ld   b,h
ROM3:7584 FE 03            cp   a,03
ROM3:7586 28 0E            jr   z,7596
ROM3:7588 CD 69 4A         call 4A69
ROM3:758B 45               ld   b,l
ROM3:758C FE 03            cp   a,03
ROM3:758E 16 18            ld   d,18		// Random number range excluding Ronald
ROM3:7590 20 06            jr   nz,7598
ROM3:7592 3E 02            ld   a,02		// Select Ronald as opponent
ROM3:7594 18 16            jr   75AC
ROM3:7596 16 19            ld   d,19		// Random number range including Ronald
ROM3:7598 7A               ld   a,d
ROM3:7599 CD 8F 08         call 088F		;PRNG
ROM3:759C 4F               ld   c,a
ROM3:759D CD CC 75         call 75CC
ROM3:75A0 38 F6            jr   c,7598
ROM3:75A2 CD D4 75         call 75D4
ROM3:75A5 06 00            ld   b,00
ROM3:75A7 21 B3 75         ld   hl,75B3		// Offset of challenger ids
ROM3:75AA 09               add  hl,bc
ROM3:75AB 7E               ld   a,(hl)
ROM3:75AC EA AB D3         ld   (D3AB),a
ROM3:75AF EA 96 D6         ld   (D696),a	// Store opponent's ID
ROM3:75B2 C9               ret  
  • 0xF5B3-0xF5CB: Challenge Cup opponents' event IDs

Bank 4

4:4000

ROM4:4000 3E 00            ld   a,00
ROM4:4002 EA B6 CA         ld   (CAB6),a
ROM4:4005 CD A2 04         call 04A2
ROM4:4008 CD 19 21         call 2119
ROM4:400B 11 7F 30         ld   de,307F
ROM4:400E CD 75 22         call 2275
ROM4:4011 CD B9 02         call 02B9
ROM4:4014 AF               xor  a
ROM4:4015 E0 92            ld   (ff00+92),a
ROM4:4017 E0 93            ld   (ff00+93),a
ROM4:4019 FA BB CA         ld   a,(CABB)
ROM4:401C CB 7F            bit  7,a
ROM4:401E 20 05            jr   nz,4025
ROM4:4020 AF               xor  a
ROM4:4021 E0 43            ld   (ff00+43),a
ROM4:4023 E0 42            ld   (ff00+42),a
ROM4:4025 CD 8C 68         call 688C
ROM4:4028 CD 9C 09         call 099C
ROM4:402B 3E 01            ld   a,01
ROM4:402D EA C0 CA         ld   (CAC0),a
ROM4:4030 C9               ret  

4:4031

ROM4:4031 F0 81            ld   a,(ff00+81)	;a = RAM Bank
ROM4:4033 F5               push af
ROM4:4034 3E 01            ld   a,01		;(switch to RAM Bank 1)
ROM4:4036 CD A9 07         call 07A9		;RAM Bank switch
ROM4:4039 CD BB 4C         call 4CBB
ROM4:403C CD BE 07         call 07BE		;Disable MBC5 RAM
ROM4:403F CD 28 4B         call 4B28
ROM4:4042 CD 04 04         call 0404		;GBC / SGB Palettes to load ?
ROM4:4045 CD 77 02         call 0277		;LCD Enable
ROM4:4048 CD 48 3C         call 3C48
ROM4:404B CD EA 4C         call 4CEA
ROM4:404E CD 04 04         call 0404		;GBC / SGB Palettes to load ?
ROM4:4051 F1               pop  af		;a = Previous RAM Bank
ROM4:4052 CD A9 07         call 07A9		;RAM Bank switch
ROM4:4055 CD BE 07         call 07BE		;Disable MBC5 RAM
ROM4:4058 C9               ret

4:430B

ROM4:430B 36 03            ld   (hl),03
ROM4:430D 38 03            jr   c,4312
ROM4:430F 39               add  hl,sp
ROM4:4310 03               inc  bc
ROM4:4311 34               inc  (hl)
ROM4:4312 03               inc  bc
ROM4:4313 35               dec  (hl)
ROM4:4314 03               inc  bc
ROM4:4315 37               scf  
ROM4:4316 03               inc  bc
ROM4:4317 33               inc  sp		;SP++
ROM4:4318 03               inc  bc
ROM4:4319 32               ldd  (hl),a
ROM4:431A 03               inc  bc

Open Booster pack

ROM4:431B 4F               ld   c,a		;c = Booster data offset
ROM4:431C FA 91 D2         ld   a,(D291)
ROM4:431F F5               push af
ROM4:4320 C5               push bc
ROM4:4321 CD 8A 02         call 028A		;Wait for VBlank, LCD off
ROM4:4324 CD 00 40         call 4000
ROM4:4327 AF               xor  a
ROM4:4328 EA F3 CC         ld   (CCF3),a	;(CCF3) = 0
ROM4:432B C1               pop  bc
ROM4:432C C5               push bc
ROM4:432D 06 00            ld   b,00
ROM4:432F 21 A5 43         ld   hl,43A5
ROM4:4332 09               add  hl,bc
ROM4:4333 7E               ld   a,(hl)
ROM4:4334 4F               ld   c,a
ROM4:4335 87               add  a
ROM4:4336 87               add  a
ROM4:4337 4F               ld   c,a
ROM4:4338 21 C2 43         ld   hl,43C2
ROM4:433B 09               add  hl,bc
ROM4:433C 2A               ldi  a,(hl)
ROM4:433D E5               push hl
ROM4:433E 01 00 06         ld   bc,0600
ROM4:4341 CD CA 70         call 70CA
ROM4:4344 E1               pop  hl
ROM4:4345 2A               ldi  a,(hl)
ROM4:4346 EA 43 CE         ld   (CE43),a
ROM4:4349 AF               xor  a
ROM4:434A EA 44 CE         ld   (CE44),a
ROM4:434D 2A               ldi  a,(hl)
ROM4:434E EA 3F CE         ld   (CE3F),a
ROM4:4351 7E               ld   a,(hl)
ROM4:4352 EA 40 CE         ld   (CE40),a
ROM4:4355 CD 31 40         call 4031
ROM4:4358 CD 9B 37         call 379B
ROM4:435B 3E 1C            ld   a,1C
ROM4:435D CD 85 37         call 3785		;Play SE 0x1C
ROM4:4360 C1               pop  bc
ROM4:4361 79               ld   a,c		;a = Booster data offset
ROM4:4362 EF               rst  28
ROM4:4363 07 C4 61    => 7:61C4			;Booster pack generation
ROM4:4366 21 87 03         ld   hl,0387
ROM4:4369 FA 17 D1         ld   a,(D117)
ROM4:436C FE 01            cp   a,01
ROM4:436E 20 03            jr   nz,4373
ROM4:4370 21 88 03         ld   hl,0388
ROM4:4373 CD 73 2C         call 2C73
ROM4:4376 CD 96 3C         call 3C96
ROM4:4379 CD A0 37         call 37A0
ROM4:437C 21 89 03         ld   hl,0389
ROM4:437F CD 73 2C         call 2C73
ROM4:4382 CD 8A 02         call 028A
ROM4:4385 CD 8C 68         call 688C
ROM4:4388 CD 9C 09         call 099C
ROM4:438B 3E 01            ld   a,01
ROM4:438D EA C0 CA         ld   (CAC0),a
ROM4:4390 3E 04            ld   a,04
ROM4:4392 EA F3 CC         ld   (CCF3),a
ROM4:4395 EF               rst  28
ROM4:4396 01 99 75    => 1:7599
ROM4:4399 EF               rst  28
ROM4:439A 03 A4 41    => 3:41A4
ROM4:439D CD 48 3C         call 3C48
ROM4:43A0 F1               pop  af
ROM4:43A1 EA 91 D2         ld   (D291),a
ROM4:43A4 C9               ret

Booster pack from Mail

ROM4:4920 AF               xor  a
ROM4:4921 EA 17 D1         ld   (D117),a	;(D117) = 0
ROM4:4924 FA 2E D1         ld   a,(D12E)	;a = Mail_ID_status
ROM4:4927 CB 7F            bit  7,a		;a = Mail_ID_status | 0x80
ROM4:4929 28 20            jr   z,494B
ROM4:492B E6 7F            and  a,7F
ROM4:492D 87               add  a		;a = Mail_ID × 2
ROM4:492E 4F               ld   c,a
ROM4:492F 06 00            ld   b,00
ROM4:4931 21 5C 49         ld   hl,495C
ROM4:4934 09               add  hl,bc		;hl = 495C + (Mail_ID × 2)
ROM4:4935 2A               ldi  a,(hl)		;a = Mail Booster pack data offset
ROM4:4936 E5               push hl
ROM4:4937 CD 1B 43         call 431B		;Open Booster pack
ROM4:493A 3E 01            ld   a,01
ROM4:493C EA 17 D1         ld   (D117),a	;(D117) = 1
ROM4:493F E1               pop  hl
ROM4:4940 7E               ld   a,(hl)		;a = Mail 2nd Booster pack data offset
ROM4:4941 B7               or   a
ROM4:4942 28 03            jr   z,4947		;If Mail has only 1 Booster pack, jump to 4:4947
ROM4:4944 CD 1B 43         call 431B		;Open Booster pack
ROM4:4947 CD 8A 02         call 028A		;Wait for VBlank, LCD off
ROM4:494A C9               ret

Mail Booster pack offsets array

ROM4:495C
00 00
00 00 - Mail 1
17 00 - Mail 2
08 00 - Mail 3
11 00 - Mail 4
0B 00 - Mail 5
02 00 - Mail 6
17 00 - Mail 7
17 00 - Mail 8
10 00 - Mail 9
00 07 - Mail 10
0E 14 - Mail 11
06 00 - Mail 12
0D 00 - Mail 13
13 00 - Mail 14
18 00 - Mail 15

4:4B28

ROM4:4B28 FA 93 D2         ld   a,(D293)
ROM4:4B2B EA BC CA         ld   (CABC),a		;BGP
ROM4:4B2E EA BD CA         ld   (CABD),a		;OBP0
ROM4:4B31 EA BE CA         ld   (CABE),a		;OBP1
ROM4:4B34 11 FF 7F         ld   de,7FFF
ROM4:4B37 21 F0 CA         ld   hl,CAF0
ROM4:4B3A 01 40 00         ld   bc,0040
ROM4:4B3D CD 1F 3C         call 3C1F
ROM4:4B40 C9               ret  

4:4CBB

ROM4:4CBB F0 81            ld   a,(ff00+81)
ROM4:4CBD F5               push af
ROM4:4CBE FE 01            cp   a,01
ROM4:4CC0 28 01            jr   z,4CC3
ROM4:4CC2 FF               rst  38
ROM4:4CC3 3E 01            ld   a,01
ROM4:4CC5 CD A9 07         call 07A9		;RAM Bank switch
ROM4:4CC8 21 00 A8         ld   hl,A800
ROM4:4CCB FA BC CA         ld   a,(CABC)
ROM4:4CCE 22               ldi  (hl),a
ROM4:4CCF FA BD CA         ld   a,(CABD)
ROM4:4CD2 22               ldi  (hl),a
ROM4:4CD3 FA BE CA         ld   a,(CABE)
ROM4:4CD6 22               ldi  (hl),a
ROM4:4CD7 5D               ld   e,l
ROM4:4CD8 54               ld   d,h
ROM4:4CD9 21 F0 CA         ld   hl,CAF0
ROM4:4CDC 01 80 00         ld   bc,0080
ROM4:4CDF CD 32 07         call 0732
ROM4:4CE2 F1               pop  af
ROM4:4CE3 CD A9 07         call 07A9		;RAM Bank switch
ROM4:4CE6 CD BE 07         call 07BE		;Disable MBC5 RAM
ROM4:4CE9 C9               ret

Bank 5

Bank 6

Bank 7

Loads next Room ID

ROM7:4056 E5               push hl
ROM7:4057 C5               push bc
ROM7:4058 D5               push de
ROM7:4059 FA 2F D3         ld   a,(D32F)	// Loads previous Room ID
ROM7:405C 87               add  a
ROM7:405D 4F               ld   c,a
ROM7:405E 06 00            ld   b,00
ROM7:4060 21 99 40         ld   hl,4099
ROM7:4063 09               add  hl,bc		// Pointer to Room warps data
ROM7:4064 2A               ldi  a,(hl)
ROM7:4065 66               ld   h,(hl)
ROM7:4066 6F               ld   l,a
ROM7:4067 01 05 00         ld   bc,0005
ROM7:406A FA 30 D3         ld   a,(D330)
ROM7:406D 57               ld   d,a
ROM7:406E FA 31 D3         ld   a,(D331)
ROM7:4071 5F               ld   e,a
ROM7:4072 2A               ldi  a,(hl)
ROM7:4073 B6               or   (hl)
ROM7:4074 28 1F            jr   z,4095
ROM7:4076 3A               ldd  a,(hl)
ROM7:4077 BB               cp   e
ROM7:4078 20 04            jr   nz,407E
ROM7:407A 7E               ld   a,(hl)
ROM7:407B BA               cp   d
ROM7:407C 28 03            jr   z,4081
ROM7:407E 09               add  hl,bc
ROM7:407F 18 F1            jr   4072
ROM7:4081 23               inc  hl
ROM7:4082 23               inc  hl
ROM7:4083 2A               ldi  a,(hl)
ROM7:4084 EA BB D0         ld   (D0BB),a	// Updates Room ID
ROM7:4087 2A               ldi  a,(hl)
ROM7:4088 EA BC D0         ld   (D0BC),a	// Updates x coordinate
ROM7:408B 2A               ldi  a,(hl)
ROM7:408C EA BD D0         ld   (D0BD),a	// Updates y coordinate
ROM7:408F FA 34 D3         ld   a,(D334)
ROM7:4092 EA BE D0         ld   (D0BE),a
ROM7:4095 D1               pop  de
ROM7:4096 C1               pop  bc
ROM7:4097 E1               pop  hl
ROM7:4098 C9               ret
  • 0x1C0E0-0x1C338 - Room IDs warps

Credits

ROM7:56AD 3E 00            ld   a,00
ROM7:56AF CD 85 37         call 3785
ROM7:56B2 CD 05 57         call 5705
ROM7:56B5 CD 58 48         call 4858
ROM7:56B8 AF               xor  a
ROM7:56B9 EA 24 D3         ld   (D324),a
ROM7:56BC 3E 12            ld   a,12
ROM7:56BE CD 85 37         call 3785
ROM7:56C1 EF               rst  28
          04 31 40
ROM7:56C5 CD 85 37         call 3785
ROM7:56C8 CD 48 3C         call 3C48
ROM7:56CB CD 65 57         call 5765
ROM7:56CE CD 0B 58         call 580B
ROM7:56D1 FA 33 D6         ld   a,(D633)
ROM7:56D4 FE FF            cp   a,FF
ROM7:56D6 20 F0            jr   nz,56C8
ROM7:56D8 CD 96 3C         call 3C96
ROM7:56DB 3E 08            ld   a,08
ROM7:56DD EF               rst  28
          04 63 68
ROM7:56E1 3E 00            ld   a,00
ROM7:56E3 CD 85 37         call 3785
ROM7:56E6 EF               rst  28
          04 B4 4A
ROM7:56EA CD A4 3C         call 3CA4
ROM7:56ED CD D4 02         call 02D4
ROM7:56F0 CD 58 57         call 5758
ROM7:56F3 CD 77 02         call 0277
ROM7:56F6 CD 48 3C         call 3C48
ROM7:56F9 CD 8A 02         call 028A
ROM7:56FC 21 BB CA         ld   hl,CABB
ROM7:56FF CB CE            set  1,(hl)
ROM7:5701 CD DB 3B         call 3BDB
ROM7:5704 C9               ret

Boosters data arrays

  • 0x1DAEF-0x1E1BB - To document
ROM7:5AEF
DB 59 D5 59 00 00 00 9E 5A 3E 5A 00 00 90 00 2C
5A 02 01 2E 03 17 5A 00 00 B1 07 E1 59 53 58 3C
A5 5A 00 20 90 00 53 58 E1 A5 5A 00 00 90 00 EE
59 D5 59 00 00 01 54 5A 0E 06 02 01 54 5A 04 0E
01 07 54 5A 06 04 02 0C 3E 5A 00 00 90 00 04 5A
00 03 17 5A 00 00 B2 07 E1 59 53 58 3C A5 5A 00
18 90 00 A5 5A 00 18 68 28 53 58 E1 A5 5A 00 18
90 00 A5 5A 00 00 90 00 EE 59 D5 59 00 00 02 54
5A 06 08 02 0D 54 5A 06 16 03 65 54 5A 0A 12 03
66 54 5A 0C 0C 03 63 3E 5A 00 00 90 00 04 5A 00
07 17 5A 00 00 B3 07 E1 59 53 58 3C A5 5A 00 18
90 00 A5 5A 00 18 78 18 53 58 E1 A5 5A 00 18 90
00 A5 5A 00 00 90 00 EE 59 97 58 00 3E 5A 00 00
90 00 04 5A 00 05 17 5A 00 00 B4 07 E1 59 53 58
3C A5 5A 00 18 90 00 A5 5A 00 18 68 28 53 58 E1
A5 5A 00 18 90 00 A5 5A 00 00 90 00 EE 59 97 58
01 3E 5A 00 00 90 00 04 5A 00 07 17 5A 00 00 B5
07 E1 59 53 58 3C A5 5A 00 18 90 00 A5 5A 00 18
68 28 53 58 E1 A5 5A 00 18 90 00 04 5A 04 03 17
5A 00 04 B6 07 A5 5A 00 18 68 28 53 58 E1 A5 5A
00 18 90 00 04 5A 04 03 17 5A 00 04 B7 07 A5 5A
00 18 68 28 53 58 E1 A5 5A 00 18 90 00 A5 5A 00
00 90 00 EE 59 97 58 02 3E 5A 00 00 90 00 04 5A
00 07 17 5A 00 00 B8 07 E1 59 53 58 3C A5 5A 00
18 90 00 A5 5A 00 18 78 18 53 58 E1 A5 5A 00 18
90 00 A5 5A 00 00 90 00 04 5A 00 05 17 5A 00 00
B9 07 A5 5A 00 18 90 00 A5 5A 00 18 78 18 53 58
E1 A5 5A 00 18 90 00 A5 5A 00 00 90 00 EE 59 97
58 03 3E 5A 00 00 90 00 04 5A 00 07 17 5A 00 00
BA 07 E1 59 53 58 3C A5 5A 00 18 90 00 A5 5A 00
18 78 18 53 58 E1 A5 5A 00 18 90 00 A5 5A 00 00
90 00 04 5A 00 05 17 5A 00 00 BB 07 A5 5A 00 18
90 00 A5 5A 00 18 70 20 53 58 E1 A5 5A 00 18 90
00 A5 5A 00 00 90 00 EE 59 78 58 06 03 05 3E 5A
00 00 90 00 04 5A 00 06 17 5A 00 00 BC 07 E1 59
53 58 3C A5 5A 00 18 90 00 A5 5A 00 18 78 18 53
58 E1 A5 5A 00 18 90 00 A5 5A 00 00 90 00 EE 59
78 58 06 03 06 3E 5A 00 00 90 00 04 5A 00 05 17
5A 00 00 BD 07 E1 59 53 58 3C A5 5A 00 18 90 00
A5 5A 00 18 78 18 53 58 E1 A5 5A 00 18 90 00 A5
5A 00 00 90 00 EE 59 78 58 06 03 07 3E 5A 00 00
90 00 04 5A 00 05 17 5A 00 00 BE 07 E1 59 53 58
3C A5 5A 00 18 90 00 A5 5A 00 18 78 18 53 58 E1
A5 5A 00 18 90 00 A5 5A 00 00 90 00 EE 59 D5 59
00 00 03 54 5A 08 08 02 03 3E 5A 00 00 90 00 04
5A 00 08 17 5A 00 00 BF 07 E1 59 53 58 3C A5 5A
00 18 90 00 A5 5A 00 18 60 30 53 58 E1 A5 5A 00
18 90 00 04 5A 04 04 17 5A 00 04 C0 07 A5 5A 00
18 60 30 53 58 E1 A5 5A 00 18 90 00 A5 5A 00 00
90 00 EE 59 D5 59 10 08 0E 54 5A 06 04 02 3B 54
5A 0A 04 02 3C 54 5A 12 10 03 42 54 5A 12 02 00
04 54 5A 08 0C 02 51 54 5A 14 08 02 52 3E 5A 00
00 90 00 04 5A 00 08 17 5A 00 00 C1 07 E1 59 53
58 3C A5 5A 00 18 90 00 A5 5A 00 18 70 20 53 58
E1 A5 5A 00 18 90 00 04 5A 04 04 17 5A 00 04 C2
07 A5 5A 00 18 70 20 53 58 E1 A5 5A 00 18 90 00
A5 5A 00 00 90 00 EE 59 D5 59 30 00 1E 54 5A 0E
04 02 4A 54 5A 12 08 03 02 54 5A 0C 08 01 73 3E
5A 00 00 90 00 04 5A 00 07 17 5A 00 00 C3 07 E1
59 53 58 3C A5 5A 00 20 90 00 A5 5A 00 20 70 20
53 58 E1 A5 5A 00 20 90 00 04 5A 04 04 17 5A 00
05 C4 07 A5 5A 00 20 70 20 53 58 E1 A5 5A 00 20
90 00 A5 5A 00 00 90 00 04 5A 00 07 17 5A 00 00
C5 07 A5 5A 00 28 90 00 A5 5A 00 28 70 20 53 58
E1 A5 5A 00 28 90 00 04 5A 06 04 17 5A 00 06 C6
07 A5 5A 00 28 68 28 53 58 E1 A5 5A 00 28 90 00
A5 5A 00 00 90 00 EE 59 78 58 06 03 01 3E 5A 00
00 90 00 04 5A 00 08 17 5A 00 00 C7 07 E1 59 53
58 3C A5 5A 00 18 90 00 A5 5A 00 18 78 18 53 58
E1 A5 5A 00 18 90 00 A5 5A 00 00 90 00 EE 59 78
58 06 03 02 3E 5A 00 00 90 00 04 5A 00 06 17 5A
00 00 C8 07 E1 59 53 58 3C A5 5A 00 18 90 00 A5
5A 00 18 78 18 53 58 E1 A5 5A 00 18 90 00 A5 5A
00 00 90 00 EE 59 78 58 06 03 03 3E 5A 00 00 90
00 04 5A 00 06 17 5A 00 00 C9 07 E1 59 53 58 3C
A5 5A 00 18 90 00 A5 5A 00 18 78 18 53 58 E1 A5
5A 00 18 90 00 A5 5A 00 00 90 00 EE 59 78 58 06
03 04 3E 5A 00 00 90 00 04 5A 00 06 17 5A 00 00
CA 07 E1 59 53 58 3C A5 5A 00 18 90 00 A5 5A 00
18 78 18 53 58 E1 A5 5A 00 18 90 00 A5 5A 00 00
90 00 EE 59 97 58 04 3E 5A 00 00 90 00 04 5A 00
07 17 5A 00 00 CB 07 E1 59 53 58 3C A5 5A 00 18
90 00 A5 5A 00 18 78 18 53 58 E1 A5 5A 00 18 90
00 A5 5A 00 00 90 00 04 5A 00 07 17 5A 00 00 CC
07 53 58 3C A5 5A 00 18 90 00 A5 5A 00 18 68 28
53 58 E1 A5 5A 00 18 90 00 A5 5A 00 00 90 00 EE
59 97 58 05 3E 5A 00 00 90 00 04 5A 00 07 17 5A
00 00 CD 07 E1 59 53 58 3C A5 5A 00 18 90 00 A5
5A 00 18 68 28 53 58 E1 A5 5A 00 18 90 00 04 5A
04 05 17 5A 00 04 CE 07 A5 5A 00 18 60 30 53 58
E1 A5 5A 00 18 90 00 04 5A 04 04 17 5A 00 04 CF
07 A5 5A 00 18 60 30 53 58 E1 A5 5A 00 18 90 00
A5 5A 00 00 90 00 EE 59 97 58 06 3E 5A 00 00 90
00 04 5A 00 08 17 5A 00 00 D0 07 E1 59 53 58 3C
A5 5A 00 18 90 00 A5 5A 00 18 78 18 53 58 E1 A5
5A 00 18 90 00 A5 5A 00 00 90 00 EE 59 97 58 07
3E 5A 00 00 90 00 04 5A 00 07 17 5A 00 00 D1 07
E1 59 53 58 3C A5 5A 00 18 90 00 A5 5A 00 18 68
28 53 58 E1 A5 5A 00 18 90 00 A5 5A 00 00 90 00
EE 59 97 58 08 3E 5A 00 00 90 00 04 5A 00 07 17
5A 00 00 D2 07 E1 59 53 58 3C A5 5A 00 18 90 00
A5 5A 00 18 68 28 53 58 E1 A5 5A 00 18 90 00 A5
5A 00 00 90 00 EE 59 D5 59 10 10 21 54 5A 0A 08
00 68 54 5A 0C 08 00 69 54 5A 08 0A 00 6A 54 5A
0A 0A 00 6B 54 5A 0C 0A 00 6C 54 5A 0E 0A 00 6D
3E 5A 00 00 90 00 04 5A 00 07 17 5A 00 00 D3 07
E1 59 53 58 3C A5 5A 00 18 90 00 A5 5A 00 18 68
28 53 58 E1 A5 5A 00 18 90 00 A5 5A 00 00 90 00
EE 59 5A 58 00 00 17 3E 5A 00 00 90 00

Booster packs

Booster pack main routine

ROM7:61C4 E5               push hl
ROM7:61C5 C5               push bc
ROM7:61C6 D5               push de
ROM7:61C7 EA 69 D6         ld   (D669),a	;Booster data offset
ROM7:61CA CD 30 64         call 6430
ROM7:61CD CD 6D 63         call 636D
ROM7:61D0 CD DF 61         call 61DF		;Booster pack generation
ROM7:61D3 38 F5            jr   c,61CA
ROM7:61D5 CD F3 63         call 63F3
ROM7:61D8 CD 0A 64         call 640A
ROM7:61DB D1               pop  de
ROM7:61DC C1               pop  bc
ROM7:61DD E1               pop  hl
ROM7:61DE C9               ret

Booster pack generation

ROM7:61DF 3E 02            ld   a,02
ROM7:61E1 EA 6C D6         ld   (D66C),a
ROM7:61E4 CD 19 62         call 6219
ROM7:61E7 7E               ld   a,(hl)
ROM7:61E8 B7               or   a
ROM7:61E9 28 1E            jr   z,6209
ROM7:61EB CD 26 62         call 6226		;Initialize Booster data
ROM7:61EE CD C2 62         call 62C2
ROM7:61F1 B7               or   a
ROM7:61F2 28 22            jr   z,6216
ROM7:61F4 CD 8F 08         call 088F		;PRNG
ROM7:61F7 CD FA 62         call 62FA
ROM7:61FA CD 1D 63         call 631D		;Determines card to be added to Booster
ROM7:61FD CD 50 63         call 6350
ROM7:6200 CD DB 63         call 63DB
ROM7:6203 CD 19 62         call 6219
ROM7:6206 35               dec  (hl)
ROM7:6207 18 DB            jr   61E4
ROM7:6209 FA 6C D6         ld   a,(D66C)
ROM7:620C 3D               dec  a
ROM7:620D EA 6C D6         ld   (D66C),a
ROM7:6210 CB 7F            bit  7,a
ROM7:6212 28 D0            jr   z,61E4
ROM7:6214 B7               or   a
ROM7:6215 C9               ret

7:6216

ROM7:6216 FF               rst  38
ROM7:6217 37               scf  
ROM7:6218 C9               ret  

7:6219

ROM7:6219 C5               push bc
ROM7:621A 21 6E D6         ld   hl,D66E
ROM7:621D FA 6C D6         ld   a,(D66C)
ROM7:6220 4F               ld   c,a
ROM7:6221 06 00            ld   b,00
ROM7:6223 09               add  hl,bc
ROM7:6224 C1               pop  bc
ROM7:6225 C9               ret  

Initialize Booster data

ROM7:6226 0E 09            ld   c,09
ROM7:6228 21 71 D6         ld   hl,D671
ROM7:622B AF               xor  a
ROM7:622C 22               ldi  (hl),a		;00s (D671) to (D67A)
ROM7:622D 0D               dec  c
ROM7:622E 20 FC            jr   nz,622C		;Loop to 7:622C until wD671 is initialized
ROM7:6230 AF               xor  a
ROM7:6231 21 33 D1         ld   hl,D133
ROM7:6234 77               ld   (hl),a		;(D133) = 0
ROM7:6235 11 01 00         ld   de,0001
ROM7:6238 D5               push de
ROM7:6239 7B               ld   a,e
ROM7:623A EA 6A D6         ld   (D66A),a	;(D66A) = 1
ROM7:623D CD 23 64         call 6423		;Checks if Player owns card
ROM7:6240 38 1E            jr   c,6260
ROM7:6242 CD 68 62         call 6268
ROM7:6245 38 19            jr   c,6260
ROM7:6247 FA 83 D6         ld   a,(D683)
ROM7:624A CD A0 62         call 62A0
ROM7:624D F5               push af
ROM7:624E E5               push hl
ROM7:624F 4F               ld   c,a
ROM7:6250 06 00            ld   b,00
ROM7:6252 21 71 D6         ld   hl,D671
ROM7:6255 09               add  hl,bc
ROM7:6256 34               inc  (hl)		;(D671+offset)++
ROM7:6257 E1               pop  hl
ROM7:6258 FA 6A D6         ld   a,(D66A)
ROM7:625B 22               ldi  (hl),a		;(hl) = (D66A)
ROM7:625C F1               pop  af
ROM7:625D 22               ldi  (hl),a
ROM7:625E AF               xor  a
ROM7:625F 77               ld   (hl),a		;(hl) = 0
ROM7:6260 D1               pop  de
ROM7:6261 1C               inc  e
ROM7:6262 7B               ld   a,e
ROM7:6263 FE E5            cp   a,E5
ROM7:6265 38 D1            jr   c,6238		;if(card ID < 0xE5), loop to 7:6238
ROM7:6267 C9               ret

7:6268

ROM7:6268 C5               push bc
ROM7:6269 7B               ld   a,e
ROM7:626A CD 5D 2F         call 2F5D
ROM7:626D EA 83 D6         ld   (D683),a
ROM7:6270 78               ld   a,b
ROM7:6271 EA 84 D6         ld   (D684),a
ROM7:6274 79               ld   a,c
ROM7:6275 EA 85 D6         ld   (D685),a
ROM7:6278 FA 84 D6         ld   a,(D684)
ROM7:627B 4F               ld   c,a
ROM7:627C FA 6C D6         ld   a,(D66C)
ROM7:627F B9               cp   c
ROM7:6280 20 1B            jr   nz,629D
ROM7:6282 FA 83 D6         ld   a,(D683)
ROM7:6285 CD A0 62         call 62A0
ROM7:6288 FE 08            cp   a,08
ROM7:628A 28 0E            jr   z,629A
ROM7:628C FA 85 D6         ld   a,(D685)
ROM7:628F CB 37            swap a
ROM7:6291 E6 0F            and  a,0F
ROM7:6293 4F               ld   c,a
ROM7:6294 FA 86 D6         ld   a,(D686)
ROM7:6297 B9               cp   c
ROM7:6298 20 03            jr   nz,629D
ROM7:629A B7               or   a
ROM7:629B 18 01            jr   629E
ROM7:629D 37               scf  
ROM7:629E C1               pop  bc
ROM7:629F C9               ret  

7:62A0

ROM7:62A0 E5               push hl
ROM7:62A1 C5               push bc
ROM7:62A2 21 B1 62         ld   hl,62B1
ROM7:62A5 FE 11            cp   a,11
ROM7:62A7 30 04            jr   nc,62AD
ROM7:62A9 4F               ld   c,a
ROM7:62AA 06 00            ld   b,00
ROM7:62AC 09               add  hl,bc
ROM7:62AD 7E               ld   a,(hl)
ROM7:62AE C1               pop  bc
ROM7:62AF E1               pop  hl
ROM7:62B0 C9               ret  

7:62B1 (array)

ROM7:62B1
01 00 03 02 04 05 06 07 08 08 08 08 08 08 08 07 07

7:62C2

ROM7:62C2 0E 09            ld   c,09
ROM7:62C4 AF               xor  a
ROM7:62C5 21 7A D6         ld   hl,D67A
ROM7:62C8 22               ldi  (hl),a
ROM7:62C9 0D               dec  c
ROM7:62CA 20 FC            jr   nz,62C8
ROM7:62CC EA CA D4         ld   (D4CA),a
ROM7:62CF 01 00 00         ld   bc,0000
ROM7:62D2 C5               push bc
ROM7:62D3 21 71 D6         ld   hl,D671
ROM7:62D6 09               add  hl,bc
ROM7:62D7 7E               ld   a,(hl)
ROM7:62D8 B7               or   a
ROM7:62D9 28 14            jr   z,62EF
ROM7:62DB 21 89 D6         ld   hl,D689
ROM7:62DE 09               add  hl,bc
ROM7:62DF 7E               ld   a,(hl)
ROM7:62E0 B7               or   a
ROM7:62E1 28 0C            jr   z,62EF
ROM7:62E3 21 7A D6         ld   hl,D67A
ROM7:62E6 09               add  hl,bc
ROM7:62E7 77               ld   (hl),a
ROM7:62E8 FA CA D4         ld   a,(D4CA)
ROM7:62EB 86               add  (hl)
ROM7:62EC EA CA D4         ld   (D4CA),a
ROM7:62EF C1               pop  bc
ROM7:62F0 0C               inc  c
ROM7:62F1 79               ld   a,c
ROM7:62F2 FE 09            cp   a,09
ROM7:62F4 38 DC            jr   c,62D2
ROM7:62F6 FA CA D4         ld   a,(D4CA)
ROM7:62F9 C9               ret

7:62FA

ROM7:62FA EA CA D4         ld   (D4CA),a
ROM7:62FD 0E 00            ld   c,00
ROM7:62FF 21 7A D6         ld   hl,D67A		;hl = 0xD67A
ROM7:6302 7E               ld   a,(hl)
ROM7:6303 B7               or   a
ROM7:6304 28 09            jr   z,630F		;if((hl) == 0), jump to 7:630F
ROM7:6306 FA CA D4         ld   a,(D4CA)
ROM7:6309 96               sub  (hl)
ROM7:630A EA CA D4         ld   (D4CA),a	;a = (D4CA)
ROM7:630D 38 09            jr   c,6318		;if((D4CA) < (hl)), jump to 7:6318
ROM7:630F 23               inc  hl		;hl++
ROM7:6310 0C               inc  c		;c++
ROM7:6311 79               ld   a,c		;a = c
ROM7:6312 FE 09            cp   a,09
ROM7:6314 38 EC            jr   c,6302		;If a < 9, jump to 7:6302
ROM7:6316 3E 08            ld   a,08		;Fail-safe fail ! Should have been ld c, 08
ROM7:6318 79               ld   a,c		;a = c
ROM7:6319 EA 6B D6         ld   (D66B),a	;(D66B) = a
ROM7:631C C9               ret

Determines card to be added to Booster

ROM7:631D FA 6B D6         ld   a,(D66B)
ROM7:6320 4F               ld   c,a
ROM7:6321 06 00            ld   b,00		;bc = (D66B)
ROM7:6323 21 71 D6         ld   hl,D671
ROM7:6326 09               add  hl,bc		;hl = D671 + (D66B)
ROM7:6327 7E               ld   a,(hl)		;a = (D671+offset)
ROM7:6328 CD 8F 08         call 088F		;PRNG
ROM7:632B EA CA D4         ld   (D4CA),a	;(D4CA) = PRN
ROM7:632E 21 33 D1         ld   hl,D133
ROM7:6331 2A               ldi  a,(hl)		;card_id = (D133+iteration)
ROM7:6332 B7               or   a
ROM7:6333 28 18            jr   z,634D
ROM7:6335 EA 6A D6         ld   (D66A),a	;Store card_id in (D66A)
ROM7:6338 FA 6B D6         ld   a,(D66B)	;a = (D66B)
ROM7:633B BE               cp   (hl)
ROM7:633C 20 0A            jr   nz,6348		;if((D66B) != (D134+iteration)), jump to 7:6348 - Loop to 7:634B
ROM7:633E FA CA D4         ld   a,(D4CA)	;Load (D4CA) to accumulator
ROM7:6341 B7               or   a
ROM7:6342 28 07            jr   z,634B		;If(a == 0), jump to 7:634B
ROM7:6344 3D               dec  a
ROM7:6345 EA CA D4         ld   (D4CA),a	;PRN --
ROM7:6348 23               inc  hl		;hl++
ROM7:6349 18 E6            jr   6331		;Loop to 7:6331
ROM7:634B B7               or   a
ROM7:634C C9               ret

7:634D

ROM7:634D FF               rst  38
ROM7:634E 37               scf  
ROM7:634F C9               ret  

7:6350

ROM7:6350 E5               push hl
ROM7:6351 C5               push bc
ROM7:6352 FA 6B D6         ld   a,(D66B)
ROM7:6355 4F               ld   c,a
ROM7:6356 06 00            ld   b,00
ROM7:6358 21 89 D6         ld   hl,D689
ROM7:635B 09               add  hl,bc
ROM7:635C FA 6D D6         ld   a,(D66D)
ROM7:635F 4F               ld   c,a
ROM7:6360 7E               ld   a,(hl)
ROM7:6361 91               sub  c
ROM7:6362 77               ld   (hl),a
ROM7:6363 28 02            jr   z,6367
ROM7:6365 30 03            jr   nc,636A
ROM7:6367 3E 01            ld   a,01
ROM7:6369 77               ld   (hl),a
ROM7:636A C1               pop  bc
ROM7:636B E1               pop  hl
ROM7:636C C9               ret

7:636D

ROM7:636D 21 88 D6         ld   hl,D688
ROM7:6370 3A               ldd  a,(hl)
ROM7:6371 B7               or   a
ROM7:6372 28 03            jr   z,6377		;if((D688)==0), jump to 7:6377
ROM7:6374 6E               ld   l,(hl)
ROM7:6375 67               ld   h,a		;hl = (D687)
ROM7:6376 E9               jp   hl
ROM7:6377 7E               ld   a,(hl)
ROM7:6378 B7               or   a
ROM7:6379 C8               ret  z		;if((D687)==0), exit this function
ROM7:637A F5               push af
ROM7:637B CD 80 63         call 6380		;Store prn in (D66A) and (C40B) area, increment (C0xx), xx = prn
ROM7:637E F1               pop  af
ROM7:637F C9               ret

Store prn in (D66A) and (C40B) area, increment (C0xx), xx = prn

ROM7:6380 EA 6A D6         ld   (D66A),a	;Store prn in (D66A)
ROM7:6383 CD CF 63         call 63CF		;Store pseudo-random number in (C40B) area and increment (C0xx), xx = prn
ROM7:6386 C9               ret

7:6387

ROM7:6387 3E 06            ld   a,06
ROM7:6389 CD 8F 08         call 088F		;PRNG
ROM7:638C C6 01            add  a,01
ROM7:638E 18 F0            jr   6380
ROM7:6390 3E 0A            ld   a,0A
ROM7:6392 F5               push af
ROM7:6393 CD 87 63         call 6387
ROM7:6396 F1               pop  af
ROM7:6397 3D               dec  a
ROM7:6398 20 F8            jr   nz,6392
ROM7:639A 18 22            jr   63BE
ROM7:639C 21 C9 63         ld   hl,63C9
ROM7:639F 18 0A            jr   63AB
ROM7:63A1 21 CB 63         ld   hl,63CB
ROM7:63A4 18 05            jr   63AB
ROM7:63A6 21 CD 63         ld   hl,63CD
ROM7:63A9 18 00            jr   63AB
ROM7:63AB 06 02            ld   b,02
ROM7:63AD 0E 05            ld   c,05
ROM7:63AF E5               push hl
ROM7:63B0 C5               push bc
ROM7:63B1 7E               ld   a,(hl)
ROM7:63B2 CD 80 63         call 6380
ROM7:63B5 C1               pop  bc
ROM7:63B6 E1               pop  hl
ROM7:63B7 0D               dec  c
ROM7:63B8 20 F5            jr   nz,63AF
ROM7:63BA 23               inc  hl
ROM7:63BB 05               dec  b
ROM7:63BC 20 EF            jr   nz,63AD
ROM7:63BE AF               xor  a
ROM7:63BF EA 6E D6         ld   (D66E),a
ROM7:63C2 EA 6F D6         ld   (D66F),a
ROM7:63C5 EA 70 D6         ld   (D670),a
ROM7:63C8 C9               ret

7:63C9 (array))

ROM7:63C9
04 02 03 05 01 06

Store pseudo-random number in (C40B) area and increment (C0xx), xx = prn

ROM7:63CF E5               push hl
ROM7:63D0 21 0B C4         ld   hl,C40B		;(C400) to (C40A) is reserved for Booster pack cards
ROM7:63D3 CD E7 63         call 63E7		;Stores pseudo-random number in free area after (C40B)
ROM7:63D6 CD 19 64         call 6419		;Increments (C0xx), xx = prn
ROM7:63D9 E1               pop  hl
ROM7:63DA C9               ret

Store pseudo-random number in (C400) area and increment (C0xx), xx = prn

ROM7:63DB E5               push hl
ROM7:63DC 21 00 C4         ld   hl,C400
ROM7:63DF CD E7 63         call 63E7		;Stores pseudo-random number in free area after (C400)
ROM7:63E2 CD 19 64         call 6419		;Increments (C0xx), xx = prn
ROM7:63E5 E1               pop  hl
ROM7:63E6 C9               ret

Stores pseudo-random number in free area after (hl)

ROM7:63E7 2A               ldi  a,(hl)
ROM7:63E8 B7               or   a
ROM7:63E9 20 FC            jr   nz,63E7		;Loop until free RAM area is found
ROM7:63EB 2B               dec  hl
ROM7:63EC FA 6A D6         ld   a,(D66A)	;a = prn
ROM7:63EF 22               ldi  (hl),a		;Store prn in (hl)
ROM7:63F0 AF               xor  a		;a = 0
ROM7:63F1 77               ld   (hl),a		;Store 0 in (hl+1)
ROM7:63F2 C9               ret

7:63F3

ROM7:63F3 E5               push hl
ROM7:63F4 21 0B C4         ld   hl,C40B
ROM7:63F7 2A               ldi  a,(hl)
ROM7:63F8 B7               or   a
ROM7:63F9 28 0D            jr   z,6408
ROM7:63FB EA 6A D6         ld   (D66A),a
ROM7:63FE E5               push hl
ROM7:63FF 21 00 C4         ld   hl,C400
ROM7:6402 CD E7 63         call 63E7
ROM7:6405 E1               pop  hl
ROM7:6406 18 EF            jr   63F7
ROM7:6408 E1               pop  hl
ROM7:6409 C9               ret  

7:640A

ROM7:640A E5               push hl
ROM7:640B 21 00 C4         ld   hl,C400
ROM7:640E 2A               ldi  a,(hl)
ROM7:640F B7               or   a
ROM7:6410 28 05            jr   z,6417
ROM7:6412 CD 6E 1D         call 1D6E
ROM7:6415 18 F7            jr   640E
ROM7:6417 E1               pop  hl
ROM7:6418 C9               ret  

Increments (C0xx), xx = prn

ROM7:6419 E5               push hl
ROM7:641A 26 C0            ld   h,C0
ROM7:641C FA 6A D6         ld   a,(D66A)
ROM7:641F 6F               ld   l,a		;l = prn
ROM7:6420 34               inc  (hl)		;(hl)++
ROM7:6421 E1               pop  hl
ROM7:6422 C9               ret

Checks if Player owns card

ROM7:6423 E5               push hl
ROM7:6424 26 C0            ld   h,C0
ROM7:6426 FA 6A D6         ld   a,(D66A)
ROM7:6429 6F               ld   l,a
ROM7:642A 7E               ld   a,(hl)		;a = (C001+offset) - Cards owned by player
ROM7:642B E1               pop  hl
ROM7:642C FE 01            cp   a,01
ROM7:642E 3F               ccf  
ROM7:642F C9               ret

Blanks (C000) to (C100), (C400) to (C416), load Booster data pointer, and ?

ROM7:6430 0E 16            ld   c,16
ROM7:6432 21 00 C4         ld   hl,C400
ROM7:6435 AF               xor  a
ROM7:6436 22               ldi  (hl),a		;Blanks (C400) to (C416)
ROM7:6437 0D               dec  c
ROM7:6438 20 FC            jr   nz,6436		;Loops 22 times to 7:6436
ROM7:643A 0E 00            ld   c,00
ROM7:643C 21 00 C0         ld   hl,C000
ROM7:643F AF               xor  a
ROM7:6440 22               ldi  (hl),a		;Blanks (C000) to (C100)
ROM7:6441 0D               dec  c
ROM7:6442 20 FC            jr   nz,6440		;Loops 255 times to 7:6440
ROM7:6444 CD 6F 64         call 646F		;Load Booster data pointer to hl
ROM7:6447 11 86 D6         ld   de,D686		;Array destination
ROM7:644A 01 0C 00         ld   bc,000C		;Array length
ROM7:644D CD 3C 07         call 073C		;Copy array from (hl) to (de)
ROM7:6450 CD BA 64         call 64BA
ROM7:6453 01 00 00         ld   bc,0000
ROM7:6456 16 09            ld   d,09
ROM7:6458 1E 00            ld   e,00
ROM7:645A 21 89 D6         ld   hl,D689
ROM7:645D 2A               ldi  a,(hl)
ROM7:645E B7               or   a
ROM7:645F 28 03            jr   z,6464
ROM7:6461 81               add  c
ROM7:6462 4F               ld   c,a
ROM7:6463 1C               inc  e
ROM7:6464 15               dec  d
ROM7:6465 20 F6            jr   nz,645D
ROM7:6467 CD 5A 3C         call 3C5A
ROM7:646A 79               ld   a,c
ROM7:646B EA 6D D6         ld   (D66D),a
ROM7:646E C9               ret

Load Booster data pointer to hl

ROM7:646F C5               push bc
ROM7:6470 FA 69 D6         ld   a,(D669)
ROM7:6473 87               add  a
ROM7:6474 4F               ld   c,a
ROM7:6475 06 00            ld   b,00
ROM7:6477 21 80 64         ld   hl,6480
ROM7:647A 09               add  hl,bc		;hl = 6480 + (D669) × 2
ROM7:647B 2A               ldi  a,(hl)
ROM7:647C 66               ld   h,(hl)
ROM7:647D 6F               ld   l,a		;hl = Booster data pointer
ROM7:647E C1               pop  bc
ROM7:647F C9               ret

Boosters data pointers

ROM7:6480
E4 64
F0 64
FC 64
08 65
14 65
20 65
2C 65
38 65
44 65
50 65
5C 65
68 65
74 65
80 65
8C 65
98 65
A4 65
B0 65
BC 65
C8 65
D4 65
E0 65
EC 65
F8 65
04 66
10 66
1C 66
28 66
34 66

7:64BA

ROM7:64BA FA 86 D6         ld   a,(D686)	;Booster data array
ROM7:64BD 87               add  a
ROM7:64BE 87               add  a
ROM7:64BF 4F               ld   c,a
ROM7:64C0 06 00            ld   b,00
ROM7:64C2 21 D4 64         ld   hl,64D4
ROM7:64C5 09               add  hl,bc
ROM7:64C6 23               inc  hl
ROM7:64C7 2A               ldi  a,(hl)		;From array at ROM7:64D4
ROM7:64C8 EA 6E D6         ld   (D66E),a
ROM7:64CB 2A               ldi  a,(hl)
ROM7:64CC EA 6F D6         ld   (D66F),a
ROM7:64CF 2A               ldi  a,(hl)
ROM7:64D0 EA 70 D6         ld   (D670),a
ROM7:64D3 C9               ret

Boosters data arrays

  • 0x1E4D4-0x1E63F - Boosters data arrays, to document
ROM7:64D4
01 05 03 01 01 05 03 01 00 06 03 01 00 06 03 01
ROM7:64E4
00 87 63 14 14 14 14 14 14 14 14 00 - Coliseum
00 01 00 30 10 10 10 10 10 10 10 00 - Coliseum
00 02 00 10 30 10 10 10 10 10 10 00 - Coliseum
00 03 00 10 10 30 10 10 10 10 10 00 - Coliseum
00 04 00 10 10 10 30 10 10 10 10 00 - Coliseum
00 05 00 10 10 10 10 30 10 10 10 00 - Coliseum
00 87 63 10 10 10 10 10 10 10 30 00 - Coliseum
01 87 63 14 14 14 14 14 14 14 14 00 - Evolution
01 01 00 30 10 10 10 10 10 10 10 00 - Evolution
01 02 00 14 14 14 14 14 14 14 14 00 - Evolution
01 03 00 10 10 30 10 10 10 10 10 00 - Evolution
01 05 00 10 10 10 10 30 10 10 10 00 - Evolution
01 06 00 10 10 10 10 10 30 10 10 00 - Evolution
01 87 63 10 10 10 10 10 10 10 30 00 - Evolution
02 00 00 11 11 11 11 11 11 11 11 11 - Mystery
02 00 00 30 0C 0C 0C 0C 0C 16 0C 0C - Mystery
02 00 00 0C 0C 30 0C 0C 0C 16 0C 0C - Mystery
02 00 00 0C 0C 0C 30 0C 0C 16 0C 0C - Mystery
02 00 00 0C 0C 0C 0C 30 0C 16 0C 0C - Mystery
02 00 00 0C 0C 0C 0C 0C 0C 16 30 0C - Mystery
03 00 00 14 14 14 14 10 14 14 18 00 - Laboratory
03 00 00 30 10 10 10 10 10 10 10 00 - Laboratory
03 00 00 10 10 30 10 10 10 10 10 00 - Laboratory
03 00 00 10 10 10 10 10 30 10 10 00 - Laboratory
03 00 00 10 10 10 10 10 10 10 30 00 - Laboratory
00 9C 63 00 00 00 00 00 00 00 00 00
00 A1 63 00 00 00 00 00 00 00 00 00
00 A6 63 00 00 00 00 00 00 00 00 00
00 90 63 00 00 00 00 00 00 00 00 00

Bank 8

Bank 9

Bank A

Bank B

Bank C

Decks pointers

0x30004-0x3006D Pointers to starter deck and opponent deck data

70 40
E7 41
B5 43
44 43
B5 43
28 44
65 44
8C 44
CF 44
FA 44
3B 45
64 45
A1 45
D6 45
09 46
30 46
51 46
70 46
99 46
B8 46
DD 46
04 47
25 47
48 47
69 47
92 47
BD 47
EA 47
1D 48
48 48
73 48
A2 48
C5 48
E6 48
0D 49
38 49
59 49
90 49
B7 49
DC 49
01 4A
20 4A
4B 4A
7E 4A
A9 4A
D6 4A
FF 4A
1E 4B
49 4B
6C 4B
99 4B
BE 4B
E5 4B
0E 4C
3D 4C

Bank D

Bank E

Bank F

Game text

0x3C000-0x3FFA7 - Game text

Bank 10

Bank 11

Bank 12

Bank 13

Bank 14

Bank 15

Bank 16

Bank 17

Bank 18

Bank 19

Bank 1A

Bank 1B

Bank 1C

Bank 1D

Bank 1E

Bank 1F

Bank 20

Bank 21

Bank 22

Bank 23

Bank 24

Bank 25

Bank 26

Bank 27

Bank 28

Bank 29

Bank 2A

Bank 2B

Bank 2C

Bank 2D

Bank 2E

Bank 2F

Bank 30

Bank 31

Bank 32

Bank 33

Bank 34

Bank 35

Bank 36

Bank 37

Bank 38

Bank 39

Bank 3A

Bank 3B

Bank 3C

Bank 3D

Bank 3E

Bank 3F