Yu-Gi-Oh! Monster Capsule GB/ROM map

From Data Crystal
Jump to navigation Jump to search

Chip tiny.png The following article is a ROM map for Yu-Gi-Oh! Monster Capsule GB.

Bank 0

0:02BA (related to sound?)

ROM0:02BA F0 40            ld   a,(ff00+40)
ROM0:02BC CB 7F            bit  7,a
ROM0:02BE C8               ret  z
ROM0:02BF C5               push bc
ROM0:02C0 D5               push de
ROM0:02C1 E5               push hl
ROM0:02C2 F0 9F            ld   a,(ff00+9F)
ROM0:02C4 CB 67            bit  4,a
ROM0:02C6 C4 9F 0D         call nz,0D9F
ROM0:02C9 CD B7 18         call 18B7
ROM0:02CC CD 62 1B         call 1B62
ROM0:02CF F0 9F            ld   a,(ff00+9F)
ROM0:02D1 F6 80            or   a,80
ROM0:02D3 E0 9F            ld   (ff00+9F),a
ROM0:02D5 76               halt 
ROM0:02D6 00               nop  
ROM0:02D7 F0 9F            ld   a,(ff00+9F)
ROM0:02D9 CB 7F            bit  7,a
ROM0:02DB 20 F8            jr   nz,02D5
ROM0:02DD E1               pop  hl
ROM0:02DE D1               pop  de
ROM0:02DF C1               pop  bc
ROM0:02E0 C9               ret  

Load intro

ROM0:2B4D 3E FF            ld   a,FF
ROM0:2B4F EA 01 C2         ld   (C201),a
ROM0:2B52 EA BD C2         ld   (C2BD),a
ROM0:2B55 3E 09            ld   a,00
ROM0:2B57 EA 00 C2         ld   (C200),a         ;Intro
ROM0:2B5A F0 96            ld   a,(ff00+96)
ROM0:2B5C F6 02            or   a,02
ROM0:2B5E E0 96            ld   (ff00+96),a
ROM0:2B60 CD 62 32         call 3262
ROM0:2B63 CD 46 0A         call 0A46

Load requested screen

ROM0:2C26 FA 00 C2         ld   a,(C200)         ;Screen ID
ROM0:2C29 4F               ld   c,a
ROM0:2C2A 87               add  a
ROM0:2C2B 81               add  c
ROM0:2C2C 21 92 2C         ld   hl,2C92
ROM0:2C2F 06 00            ld   b,00
ROM0:2C31 4F               ld   c,a
ROM0:2C32 09               add  hl,bc            ;hl = 0x2C92 + (Screen ID × 3)
ROM0:2C33 2A               ldi  a,(hl)
ROM0:2C34 4F               ld   c,a
ROM0:2C35 2A               ldi  a,(hl)
ROM0:2C36 47               ld   b,a
ROM0:2C37 2A               ldi  a,(hl)           ;Load pointer + bank
ROM0:2C38 CD ED 0A         call 0AED             ;Bank switch
ROM0:2C3B 69               ld   l,c
ROM0:2C3C 60               ld   h,b
ROM0:2C3D 01 42 2C         ld   bc,2C42
ROM0:2C40 C5               push bc
ROM0:2C41 E9               jp   hl               ;Jump to pointer
ROM0:2C42 CD BA 02         call 02BA
ROM0:2C45 CD 69 22         call 2269
ROM0:2C48 CD 2E 32         call 322E
ROM0:2C4B FA 01 C2         ld   a,(C201)
ROM0:2C4E FE FF            cp   a,FF
ROM0:2C50 28 D4            jr   z,2C26
ROM0:2C52 FA 01 C2         ld   a,(C201)
ROM0:2C55 EA 00 C2         ld   (C200),a
ROM0:2C58 3E FF            ld   a,FF
ROM0:2C5A EA 01 C2         ld   (C201),a
ROM0:2C5D F0 96            ld   a,(ff00+96)
ROM0:2C5F CB 7F            bit  7,a
ROM0:2C61 28 13            jr   z,2C76
ROM0:2C63 FA 00 C2         ld   a,(C200)
ROM0:2C66 FE 07            cp   a,07
ROM0:2C68 28 0C            jr   z,2C76
ROM0:2C6A FE 08            cp   a,08
ROM0:2C6C 28 08            jr   z,2C76
ROM0:2C6E FE 05            cp   a,05
ROM0:2C70 CC 89 2C         call z,2C89
ROM0:2C73 CD 58 0D         call 0D58
ROM0:2C76 CD 46 0A         call 0A46
ROM0:2C79 7F               ld   a,a
ROM0:2C7A 45               ld   b,l
ROM0:2C7B 03               inc  bc
ROM0:2C7C FA 00 C2         ld   a,(C200)
ROM0:2C7F B7               or   a
ROM0:2C80 C2 99 2B         jp   nz,2B99
ROM0:2C83 CD 58 0D         call 0D58
ROM0:2C86 C3 5A 2B         jp   2B5A
ROM0:2C89 3E 49            ld   a,49
ROM0:2C8B CD 8C 16         call 168C
ROM0:2C8E CD 42 16         call 1642
ROM0:2C91 C9               ret  

Screen pointers and banks

ROM0:2C92
B0 2C 00 - Intro
7B 40 18
F9 4B 18
AE 49 18
16 44 02
00 40 01
00 40 01
05 40 08
14 40 08
8C 51 03 - Sound test
05 03 08

0:3B77 (Load soundtrack ?)

ROM0:3B77 F5               push af
ROM0:3B78 C5               push bc
ROM0:3B79 47               ld   b,a              ;b = soundtrack_id
ROM0:3B7A F0 95            ld   a,(ff00+95)
ROM0:3B7C F5               push af
ROM0:3B7D CD FA 0A         call 0AFA
ROM0:3B80 78               ld   a,b
ROM0:3B81 CD 8B 3B         call 3B8B
ROM0:3B84 F1               pop  af
ROM0:3B85 CD 12 0B         call 0B12
ROM0:3B88 C1               pop  bc
ROM0:3B89 F1               pop  af
ROM0:3B8A C9               ret

0:3B8B

ROM0:3B8B F5               push af
ROM0:3B8C F0 94            ld   a,(ff00+94)
ROM0:3B8E EA 25 A7         ld   (A725),a
ROM0:3B91 F1               pop  af
ROM0:3B92 E5               push hl
ROM0:3B93 21 DC FF         ld   hl,FFDC
ROM0:3B96 CB CE            set  1,(hl)
ROM0:3B98 D5               push de
ROM0:3B99 C5               push bc
ROM0:3B9A F5               push af
ROM0:3B9B CD 1B 3C         call 3C1B
ROM0:3B9E FA 25 A7         ld   a,(A725)
ROM0:3BA1 E0 94            ld   (ff00+94),a
ROM0:3BA3 EA 00 20         ld   (2000),a
ROM0:3BA6 F1               pop  af
ROM0:3BA7 C1               pop  bc
ROM0:3BA8 D1               pop  de
ROM0:3BA9 21 DC FF         ld   hl,FFDC
ROM0:3BAC CB 8E            res  1,(hl)
ROM0:3BAE E1               pop  hl
ROM0:3BAF C9               ret

0:3C1B - write soundtrack_id in SRAM sA709, and ?

ROM0:3C1B EA 09 A7         ld   (A709),a           ;write soundtrack_id in SRAM sA709
ROM0:3C1E B7               or   a
ROM0:3C1F 20 11            jr   nz,3C32
ROM0:3C21 EA 26 A7         ld   (A726),a
ROM0:3C24 3E 1D            ld   a,1D
ROM0:3C26 E0 94            ld   (ff00+94),a
ROM0:3C28 EA 00 20         ld   (2000),a
ROM0:3C2B C3 73 48         jp   4873
ROM0:3C2E EA 1C A7         ld   (A71C),a
ROM0:3C31 C9               ret

0:3C32

ROM0:3C32 21 1B A7         ld   hl,A71B
ROM0:3C35 CB 46            bit  0,(hl)
ROM0:3C37 20 F5            jr   nz,3C2E
ROM0:3C39 CB 7F            bit  7,a
ROM0:3C3B 28 0C            jr   z,3C49
ROM0:3C3D 47               ld   b,a
ROM0:3C3E FA 26 A7         ld   a,(A726)
ROM0:3C41 B8               cp   b
ROM0:3C42 20 01            jr   nz,3C45
ROM0:3C44 C9               ret

0:3C32 - setting debug values in SRAM for playing soundtrack in Sound Test ?

ROM0:3C45 78               ld   a,b                ;a = soundtrack_id
ROM0:3C46 EA 26 A7         ld   (A726),a           ;sA726 = soundtrack_id
ROM0:3C49 AF               xor  a
ROM0:3C4A EA 17 A7         ld   (A717),a
ROM0:3C4D FA 1A A7         ld   a,(A71A)
ROM0:3C50 CB 47            bit  0,a
ROM0:3C52 20 1D            jr   nz,3C71
ROM0:3C54 FA 0A A7         ld   a,(A70A)
ROM0:3C57 B7               or   a
ROM0:3C58 28 0D            jr   z,3C67
ROM0:3C5A CB 47            bit  0,a
ROM0:3C5C 28 13            jr   z,3C71
ROM0:3C5E CB 87            res  0,a
ROM0:3C60 CB C7            set  0,a
ROM0:3C62 EA 0A A7         ld   (A70A),a
ROM0:3C65 18 0A            jr   3C71
ROM0:3C67 0E 24            ld   c,24
ROM0:3C69 F2               ld   a,(ff00+c)
ROM0:3C6A FE 77            cp   a,77
ROM0:3C6C 28 03            jr   z,3C71
ROM0:3C6E 3E 77            ld   a,77
ROM0:3C70 E2               ld   (ff00+c),a
ROM0:3C71 FA 09 A7         ld   a,(A709)          ;a = soundtrack_id
ROM0:3C74 47               ld   b,a
ROM0:3C75 FE 80            cp   a,80
ROM0:3C77 30 0D            jr   nc,3C86           ;if (soundtrack_id > 0x80, jump to 0x3C86)
ROM0:3C79 3E 1D            ld   a,1D
ROM0:3C7B E0 94            ld   (ff00+94),a
ROM0:3C7D EA 00 20         ld   (2000),a          ;ROM Bank switch to 0x1D
ROM0:3C80 78               ld   a,b
ROM0:3C81 21 FE 3F         ld   hl,3FFE           ;hl = 0x3FFE
ROM0:3C84 18 20            jr   3CA6
ROM0:3C86 FE C0            cp   a,C0
ROM0:3C88 30 0F            jr   nc,3C99           ;if (soundtrack_id > 0xC0, jump to 0x3C99); Battle OSTs, Dungeon world OSTs, testing sounds
ROM0:3C8A 3E 1E            ld   a,1E
ROM0:3C8C E0 94            ld   (ff00+94),a
ROM0:3C8E EA 00 20         ld   (2000),a          ;ROM Bank switch to 0x1E
ROM0:3C91 78               ld   a,b
ROM0:3C92 21 FE 3F         ld   hl,3FFE           ;hl = 0x3FFE
ROM0:3C95 D6 80            sub  a,80              ;soundtrack_id -= 0x80
ROM0:3C97 18 0D            jr   3CA6
ROM0:3C99 3E 1F            ld   a,1F
ROM0:3C9B E0 94            ld   (ff00+94),a
ROM0:3C9D EA 00 20         ld   (2000),a          ;ROM Bank switch to 0x1F
ROM0:3CA0 78               ld   a,b
ROM0:3CA1 21 FE 3F         ld   hl,3FFE           ;hl = 0x3FFE
ROM0:3CA4 D6 C0            sub  a,C0              ;soundtrack_id -= 0xC0
ROM0:3CA6 CD 11 3F         call 3F11
ROM0:3CA9 2A               ldi  a,(hl)
ROM0:3CAA EA 08 A7         ld   (A708),a
ROM0:3CAD 46               ld   b,(hl)
ROM0:3CAE 23               inc  hl
ROM0:3CAF 5D               ld   e,l
ROM0:3CB0 54               ld   d,h
ROM0:3CB1 21 00 A0         ld   hl,A000
ROM0:3CB4 CB 08            rrc  b
ROM0:3CB6 DC 63 3D         call c,3D63
ROM0:3CB9 24               inc  h
ROM0:3CBA CB 08            rrc  b
ROM0:3CBC DC 63 3D         call c,3D63
ROM0:3CBF 24               inc  h
ROM0:3CC0 CB 08            rrc  b
ROM0:3CC2 DC 63 3D         call c,3D63
ROM0:3CC5 78               ld   a,b
ROM0:3CC6 07               rlca 
ROM0:3CC7 07               rlca 
ROM0:3CC8 07               rlca 
ROM0:3CC9 47               ld   b,a
ROM0:3CCA 21 00 A0         ld   hl,A000
ROM0:3CCD CB 38            srl  b
ROM0:3CCF DC 68 3D         call c,3D68
ROM0:3CD2 21 00 A1         ld   hl,A100
ROM0:3CD5 CB 38            srl  b
ROM0:3CD7 DC 68 3D         call c,3D68
ROM0:3CDA 21 00 A2         ld   hl,A200
ROM0:3CDD CB 38            srl  b
ROM0:3CDF DC 68 3D         call c,3D68
ROM0:3CE2 AF               xor  a
ROM0:3CE3 EA 10 A7         ld   (A710),a
ROM0:3CE6 CB 38            srl  b
ROM0:3CE8 D0               ret  nc
ROM0:3CE9 21 00 A3         ld   hl,A300
ROM0:3CEC FA 08 A7         ld   a,(A708)
ROM0:3CEF BE               cp   (hl)
ROM0:3CF0 D8               ret  c
ROM0:3CF1 FA 0A A7         ld   a,(A70A)
ROM0:3CF4 B7               or   a
ROM0:3CF5 20 06            jr   nz,3CFD
ROM0:3CF7 EA 0B A7         ld   (A70B),a
ROM0:3CFA EA 0C A7         ld   (A70C),a
ROM0:3CFD AF               xor  a
ROM0:3CFE EA 0D A7         ld   (A70D),a
ROM0:3D01 EA 06 A7         ld   (A706),a
ROM0:3D04 CD 1D 3D         call 3D1D
ROM0:3D07 CB 38            srl  b
ROM0:3D09 21 00 A4         ld   hl,A400
ROM0:3D0C DC 1D 3D         call c,3D1D
ROM0:3D0F CB 38            srl  b
ROM0:3D11 21 00 A5         ld   hl,A500
ROM0:3D14 DC 1D 3D         call c,3D1D
ROM0:3D17 CB 38            srl  b
ROM0:3D19 21 00 A6         ld   hl,A600
ROM0:3D1C D0               ret  nc
ROM0:3D1D FA 08 A7         ld   a,(A708)
ROM0:3D20 22               ldi  (hl),a
ROM0:3D21 FA 09 A7         ld   a,(A709)
ROM0:3D24 22               ldi  (hl),a
ROM0:3D25 1A               ld   a,(de)
ROM0:3D26 22               ldi  (hl),a
ROM0:3D27 13               inc  de
ROM0:3D28 1A               ld   a,(de)
ROM0:3D29 13               inc  de
ROM0:3D2A 22               ldi  (hl),a
ROM0:3D2B 3E 01            ld   a,01
ROM0:3D2D 22               ldi  (hl),a
ROM0:3D2E AF               xor  a
ROM0:3D2F 22               ldi  (hl),a
ROM0:3D30 22               ldi  (hl),a
ROM0:3D31 22               ldi  (hl),a
ROM0:3D32 77               ld   (hl),a
ROM0:3D33 2E 14            ld   l,14
ROM0:3D35 77               ld   (hl),a
ROM0:3D36 2E 24            ld   l,24
ROM0:3D38 22               ldi  (hl),a
ROM0:3D39 22               ldi  (hl),a
ROM0:3D3A 22               ldi  (hl),a
ROM0:3D3B 22               ldi  (hl),a
ROM0:3D3C 22               ldi  (hl),a
ROM0:3D3D 22               ldi  (hl),a
ROM0:3D3E 77               ld   (hl),a
ROM0:3D3F 2E 48            ld   l,48
ROM0:3D41 22               ldi  (hl),a
ROM0:3D42 22               ldi  (hl),a
ROM0:3D43 22               ldi  (hl),a
ROM0:3D44 22               ldi  (hl),a
ROM0:3D45 22               ldi  (hl),a
ROM0:3D46 22               ldi  (hl),a
ROM0:3D47 22               ldi  (hl),a
ROM0:3D48 77               ld   (hl),a
ROM0:3D49 2E 1F            ld   l,1F
ROM0:3D4B 22               ldi  (hl),a
ROM0:3D4C 22               ldi  (hl),a
ROM0:3D4D 22               ldi  (hl),a
ROM0:3D4E 77               ld   (hl),a
ROM0:3D4F 2E 51            ld   l,51
ROM0:3D51 22               ldi  (hl),a
ROM0:3D52 22               ldi  (hl),a
ROM0:3D53 22               ldi  (hl),a
ROM0:3D54 22               ldi  (hl),a
ROM0:3D55 22               ldi  (hl),a
ROM0:3D56 22               ldi  (hl),a
ROM0:3D57 77               ld   (hl),a
ROM0:3D58 EA 1C A7         ld   (A71C),a
ROM0:3D5B EA 1B A7         ld   (A71B),a
ROM0:3D5E 3D               dec  a
ROM0:3D5F EA 0F A7         ld   (A70F),a
ROM0:3D62 C9               ret

0:3F11 - Load pointer to Soundtrack from the start of loaded ROM Bank

ROM0:3F11 CB 27            sla  a            ;a = soundtrack_id << 1
ROM0:3F13 06 00            ld   b,00
ROM0:3F15 CB 10            rl   b
ROM0:3F17 4F               ld   c,a
ROM0:3F18 09               add  hl,bc
ROM0:3F19 2A               ldi  a,(hl)
ROM0:3F1A 66               ld   h,(hl)       ;hl = 0x3FFE + [soundtrack_id << 2 | soundtrack_id << 1]
ROM0:3F1B 6F               ld   l,a
ROM0:3F1C C9               ret

Bank 1

Star Chips

Return number of Star Chips owned

ROM1:551C FA ED C2         ld   a,(C2ED)    ;a = star_chips
ROM1:551F C9               ret

Add 1 Star Chip

ROM1:5520 FA ED C2         ld   a,(C2ED)
ROM1:5523 FE 63            cp   a,63
ROM1:5525 D0               ret  nc          ;if (star_chips ≥ 99), exit
ROM1:5526 3C               inc  a           ;star_chips++
ROM1:5527 EA ED C2         ld   (C2ED),a    ;Store star_chips in wC2ED
ROM1:552A C9               ret

Remove 1 Star Chip

ROM1:552B FA ED C2         ld   a,(C2ED)
ROM1:552E FE 02            cp   a,02
ROM1:5530 D8               ret  c             ;if (star_chips < 2), exit
ROM1:5531 3D               dec  a             ;star_chips--
ROM1:5532 EA ED C2         ld   (C2ED),a      ;Store star_chips in wC2ED
ROM1:5535 C9               ret

1:7A2A - Attempts to remove 1 Star Chip, then wC418 += 5

ROM1:7A2A CD 2B 55         call 552B          ;Remove 1 Star Chip
ROM1:7A2D 38 03            jr   c,7A32        ;if the Star Chip could be removed, skip next instruction
ROM1:7A2F C3 75 7F         jp   7F75          ;wC418++, and exit
ROM1:7A32 3E 04            ld   a,04
ROM1:7A34 06 01            ld   b,01
ROM1:7A36 CD 46 0A         call 0A46
ROM1:7A39 D2 48 03         jp   nc,0348
ROM1:7A3C FA 18 C4         ld   a,(C418)
ROM1:7A3F C6 05            add  a,05
ROM1:7A41 EA 18 C4         ld   (C418),a      ;wC418 += 5
ROM1:7A44 C9               ret

1:7F75 - wC418++

ROM1:7F75 FA 18 C4         ld   a,(C418)
ROM1:7F78 3C               inc  a
ROM1:7F79 EA 18 C4         ld   (C418),a
ROM1:7F7C C9               ret

Bank 3

Sound Test - load Sound Track

ROM3:5222 AF               xor  a                ;soundtrack_id = 0
ROM3:5223 CD 77 3B         call 3B77
ROM3:5226 CD BA 02         call 02BA
ROM3:5229 F0 88            ld   a,(ff00+88)      ;a = soundtrack_id
ROM3:522B CD 77 3B         call 3B77
ROM3:522E C9               ret

Sound Test - load Sound Effect

ROM3:522F F0 89            ld   a,(ff00+89)      ;a = sound_effect_id
ROM3:5231 CD 77 3B         call 3B77
ROM3:5234 C9               ret

Bank 8

8:4E95

ROM8:4E95 CD F6 56         call 56F6          ;00s battle values in wC7E1-wC7F9 area
ROM8:4E98 CD 65 56         call 5665          ;00s battle values in wC69A-wC6BE area
ROM8:4E9B CD AF 62         call 62AF
ROM8:4E9E FA A6 C7         ld   a,(C7A6)
ROM8:4EA1 CD 42 55         call 5542
ROM8:4EA4 CD 36 5A         call 5A36
ROM8:4EA7 FA F9 C7         ld   a,(C7F9)
ROM8:4EAA EA FA C7         ld   (C7FA),a
ROM8:4EAD FA A5 C7         ld   a,(C7A5)
ROM8:4EB0 CB 87            res  0,a
ROM8:4EB2 EA A5 C7         ld   (C7A5),a
ROM8:4EB5 FA 83 C7         ld   a,(C783)
ROM8:4EB8 3C               inc  a
ROM8:4EB9 EA 83 C7         ld   (C783),a
ROM8:4EBC AF               xor  a
ROM8:4EBD EA 84 C7         ld   (C784),a
ROM8:4EC0 18 00            jr   4EC2
ROM8:4EC2 C9               ret

00s battle values in wC69A-wC6BE area

  • 0x21665 - Initializes battle values, including the probability to hit.
ROM8:5665 F5               push af
ROM8:5666 C5               push bc
ROM8:5667 E5               push hl
ROM8:5668 21 9A C6         ld   hl,C69A
ROM8:566B AF               xor  a
ROM8:566C 06 24            ld   b,24
ROM8:566E 22               ldi  (hl),a
ROM8:566F 05               dec  b
ROM8:5670 20 FC            jr   nz,566E
ROM8:5672 E1               pop  hl
ROM8:5673 C1               pop  bc
ROM8:5674 F1               pop  af
ROM8:5675 C9               ret

00s battle values in wC7E1-wC7F9 area

ROM8:56F6 F5               push af
ROM8:56F7 C5               push bc
ROM8:56F8 E5               push hl
ROM8:56F9 21 E1 C7         ld   hl,C7E1
ROM8:56FC AF               xor  a
ROM8:56FD 06 18            ld   b,18
ROM8:56FF 22               ldi  (hl),a
ROM8:5700 05               dec  b
ROM8:5701 20 FC            jr   nz,56FF          ;loop 24 times
ROM8:5703 E1               pop  hl
ROM8:5704 C1               pop  bc
ROM8:5705 F1               pop  af
ROM8:5706 C9               ret  

8:62AF - call 8:6339, set wC732 to 0

ROM8:62AF F5               push af
ROM8:62B0 C5               push bc
ROM8:62B1 D5               push de
ROM8:62B2 E5               push hl
ROM8:62B3 CD 39 63         call 6339
ROM8:62B6 AF               xor  a
ROM8:62B7 EA 32 C7         ld   (C732),a
ROM8:62BA E1               pop  hl
ROM8:62BB D1               pop  de
ROM8:62BC C1               pop  bc
ROM8:62BD F1               pop  af
ROM8:62BE C9               ret  

8:6339

ROM8:6339 06 1B            ld   b,1B
ROM8:633B FA 33 C7         ld   a,(C733)
ROM8:633E FE 02            cp   a,02
ROM8:6340 20 02            jr   nz,6344
ROM8:6342 06 24            ld   b,24
ROM8:6344 FA 34 C7         ld   a,(C734)
ROM8:6347 26 C0            ld   h,C0
ROM8:6349 6F               ld   l,a
ROM8:634A AF               xor  a
ROM8:634B 22               ldi  (hl),a
ROM8:634C 23               inc  hl
ROM8:634D 23               inc  hl
ROM8:634E 23               inc  hl
ROM8:634F 05               dec  b
ROM8:6350 20 F9            jr   nz,634B
ROM8:6352 C9               ret

Bank 18

Title screen

Checks button pressed

RO18:4AF5 5F               ld   e,a
RO18:4AF6 71               ld   (hl),c
RO18:4AF7 1A               ld   a,(de)
RO18:4AF8 7F               ld   a,a
RO18:4AF9 72               ld   (hl),d
RO18:4AFA EA 49 1A         ld   (1A49),a
RO18:4AFD 21 84 03         ld   hl,0384
RO18:4B00 CD 1D 46         call 461D
RO18:4B03 21 09 4B         ld   hl,4B09
RO18:4B06 CD DD 45         call 45DD
RO18:4B09 F0 AA            ld   a,(ff00+AA)
RO18:4B0B E6 90            and  a,90
RO18:4B0D 20 0A            jr   nz,4B19          ;if(button == A || button == Start), jump to 18:4B19
RO18:4B0F CD 26 46         call 4626
RO18:4B12 C0               ret  nz
RO18:4B13 3E 01            ld   a,01
RO18:4B15 EA 01 C2         ld   (C201),a
RO18:4B18 C9               ret  

Button A or Start pressed

RO18:4B19 3E DC            ld   a,DC
RO18:4B1B CD 77 3B         call 3B77
RO18:4B1E AF               xor  a
RO18:4B1F CD 67 4B         call 4B67
RO18:4B22 21 05 00         ld   hl,0005
RO18:4B25 CD 22 47         call 4722
RO18:4B28 3E 01            ld   a,01
RO18:4B2A CD 67 4B         call 4B67
RO18:4B2D 21 05 00         ld   hl,0005
RO18:4B30 CD 22 47         call 4722
RO18:4B33 06 08            ld   b,08
RO18:4B35 21 C8 49         ld   hl,49C8
RO18:4B38 CD D0 15         call 15D0
RO18:4B3B 3E 00            ld   a,00
RO18:4B3D E0 9C            ld   (ff00+9C),a
RO18:4B3F 21 04 00         ld   hl,0004
RO18:4B42 CD 22 47         call 4722
RO18:4B45 AF               xor  a
RO18:4B46 CD 67 4B         call 4B67
RO18:4B49 21 01 00         ld   hl,0001
RO18:4B4C CD 22 47         call 4722
RO18:4B4F 06 08            ld   b,08
RO18:4B51 21 FA 4A         ld   hl,4AFA
RO18:4B54 CD D0 15         call 15D0
RO18:4B57 3E E4            ld   a,E4
RO18:4B59 E0 9C            ld   (ff00+9C),a
RO18:4B5B 21 39 00         ld   hl,0039
RO18:4B5E CD 22 47         call 4722
RO18:4B61 3E 04            ld   a,04
RO18:4B63 EA 01 C2         ld   (C201),a
RO18:4B66 C9               ret