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

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

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