Yu-Gi-Oh! Duel Monsters:ROM map

From Data Crystal
Revision as of 15:18, 19 August 2018 by Dinoguy1000 (talk | contribs) (Bank 9?: from what I can tell, each 0x4000-long block is a bank)
Jump to: navigation, search


Bank 0

ROM start

ROM0:0100 00               nop  
ROM0:0101 C3 50 01         jp   0150
ROM0:0150 E0 DD            ld   (ff00+DD),a
ROM0:0152 21 00 E0         ld   hl,E000
ROM0:0155 F9               ld   sp,hl
ROM0:0156 CD 90 10         call 1090
ROM0:0159 CF               rst  08
ROM0:015A 05               dec  b
ROM0:015B 04               inc  b
ROM0:015C 3E 00            ld   a,00
ROM0:015E CF               rst  08
ROM0:015F 03               inc  bc
ROM0:0160 3F               ccf  
ROM0:0161 CF               rst  08
ROM0:0162 03               inc  bc
ROM0:0163 3E CD            ld   a,CD
ROM0:0165 EA 14 CD         ld   (CD14),a
ROM0:0168 96               sub  (hl)
ROM0:0169 03               inc  bc
ROM0:016A CD D8 0D         call 0DD8
ROM0:016D CD 9F 01         call 019F
ROM0:0170 3E 02            ld   a,02
ROM0:0172 CF               rst  08
ROM0:0173 03               inc  bc
ROM0:0174 3F               ccf  
ROM0:0175 CF               rst  08
ROM0:0176 49               ld   c,c
ROM0:0177 01 3E 04         ld   bc,043E
ROM0:017A CF               rst  08
ROM0:017B 03               inc  bc
ROM0:017C 3F               ccf  
ROM0:017D CF               rst  08
ROM0:017E 4B               ld   c,e
ROM0:017F 01 3E 06         ld   bc,063E
ROM0:0182 CF               rst  08

Joypad input

ROM0:03AA F5               push af
ROM0:03AB C5               push bc
ROM0:03AC D5               push de
ROM0:03AD 3E 20            ld   a,20
ROM0:03AF E0 00            ld   (ff00+00),a
ROM0:03B1 F0 00            ld   a,(ff00+00)	// Joypad input
ROM0:03B3 F0 00            ld   a,(ff00+00)
ROM0:03B5 2F               cpl  
ROM0:03B6 E6 0F            and  a,0F
ROM0:03B8 CB 37            swap a
ROM0:03BA 47               ld   b,a
ROM0:03BB 3E 10            ld   a,10
ROM0:03BD E0 00            ld   (ff00+00),a
ROM0:03BF F0 00            ld   a,(ff00+00)
ROM0:03C1 F0 00            ld   a,(ff00+00)
ROM0:03C3 F0 00            ld   a,(ff00+00)
ROM0:03C5 F0 00            ld   a,(ff00+00)
ROM0:03C7 F0 00            ld   a,(ff00+00)
ROM0:03C9 F0 00            ld   a,(ff00+00)
ROM0:03CB 2F               cpl  
ROM0:03CC E6 0F            and  a,0F
ROM0:03CE B0               or   b
ROM0:03CF 4F               ld   c,a
ROM0:03D0 FA A5 CA         ld   a,(CAA5)
ROM0:03D3 57               ld   d,a
ROM0:03D4 A9               xor  c
ROM0:03D5 A1               and  c
ROM0:03D6 EA A6 CA         ld   (CAA6),a
ROM0:03D9 79               ld   a,c
ROM0:03DA EA A5 CA         ld   (CAA5),a	// Stores input in (CAA5)
ROM0:03DD 3E 30            ld   a,30
ROM0:03DF E0 00            ld   (ff00+00),a
ROM0:03E1 FA A5 CA         ld   a,(CAA5)
ROM0:03E4 BA               cp   d
ROM0:03E5 20 19            jr   nz,0400
ROM0:03E7 3E 00            ld   a,00
ROM0:03E9 EA A7 CA         ld   (CAA7),a
ROM0:03EC FA A8 CA         ld   a,(CAA8)
ROM0:03EF 3D               dec  a
ROM0:03F0 EA A8 CA         ld   (CAA8),a
ROM0:03F3 20 09            jr   nz,03FE
ROM0:03F5 3E 03            ld   a,03
ROM0:03F7 EA A8 CA         ld   (CAA8),a
ROM0:03FA 7A               ld   a,d
ROM0:03FB EA A7 CA         ld   (CAA7),a
ROM0:03FE 18 08            jr   0408
ROM0:0400 EA A7 CA         ld   (CAA7),a
ROM0:0403 3E 14            ld   a,14
ROM0:0405 EA A8 CA         ld   (CAA8),a
ROM0:0408 D1               pop  de
ROM0:0409 C1               pop  bc
ROM0:040A F1               pop  af
ROM0:040B C9               ret

0:041B (to document)

ROM0:041B E5               push hl
ROM0:041C C5               push bc
ROM0:041D D5               push de
ROM0:041E 06 00            ld   b,00
ROM0:0420 FA AC CA         ld   a,(CAAC)
ROM0:0423 4F               ld   c,a
ROM0:0424 21 2C 04         ld   hl,042C
ROM0:0427 09               add  hl,bc
ROM0:0428 2A               ldi  a,(hl)
ROM0:0429 66               ld   h,(hl)
ROM0:042A 6F               ld   l,a
ROM0:042B E9               jp   hl

0:042B (pointers, to document)

44 04
5D 04
83 04
AC 04
1F 05
CE 06
26 08
00 09
0A 0A
62 0B
F0 0B

0:045D ((CAAC) = 0, (CAA9) = 1)

ROM0:045D 3E 00            ld   a,00
ROM0:045F EA AC CA         ld   (CAAC),a
ROM0:0462 3E 01            ld   a,01
ROM0:0464 EA A9 CA         ld   (CAA9),a
ROM0:0467 CD AA 03         call 03AA		// Joypad
ROM0:046A 0E E4            ld   c,E4
ROM0:046C F2               ld   a,(ff00+c)
ROM0:046D F6 80            or   a,80
ROM0:046F E2               ld   (ff00+c),a
ROM0:0470 0E E5            ld   c,E5
ROM0:0472 F2               ld   a,(ff00+c)
ROM0:0473 F6 80            or   a,80
ROM0:0475 E2               ld   (ff00+c),a
ROM0:0476 CD 05 17         call 1705
ROM0:0479 E0 CD            ld   (ff00+CD),a
ROM0:047B 05               dec  b
ROM0:047C 17               rla  
ROM0:047D E1               pop  hl
ROM0:047E D1               pop  de
ROM0:047F C1               pop  bc
ROM0:0480 E1               pop  hl
ROM0:0481 F1               pop  af
ROM0:0482 D9               reti

0:0DE3 (set (CAAB) to accumulator, and (CAAA) to 0)

ROM0:0DE3 F5               push af
ROM0:0DE4 C5               push bc
ROM0:0DE5 E5               push hl
ROM0:0DE6 EA AB CA         ld   (CAAB),a
ROM0:0DE9 4F               ld   c,a
ROM0:0DEA 06 00            ld   b,00
ROM0:0DEC 21 01 0E         ld   hl,0E01
ROM0:0DEF 09               add  hl,bc
ROM0:0DF0 2A               ldi  a,(hl)
ROM0:0DF1 66               ld   h,(hl)
ROM0:0DF2 6F               ld   l,a
ROM0:0DF3 01 F8 0D         ld   bc,0DF8
ROM0:0DF6 C5               push bc
ROM0:0DF7 E9               jp   hl
ROM0:0DF8 3E 00            ld   a,00
ROM0:0DFA EA AA CA         ld   (CAAA),a
ROM0:0DFD E1               pop  hl
ROM0:0DFE C1               pop  bc
ROM0:0DFF F1               pop  af
ROM0:0E00 C9               ret

0:0E01 (pointers to ?)

19 0E 19 0E 19 0E 1A 0E 3F 0E 40 0E 4D 0E 6A 0E B7 0E E4 0E 11 0F 2E 0F

0:0F2F ((CAAB) => (CAAC), (CAAB) = 0)

ROM0:0F2F F5               push af
ROM0:0F30 FA AB CA         ld   a,(CAAB)
ROM0:0F33 EA AC CA         ld   (CAAC),a
ROM0:0F36 3E 00            ld   a,00
ROM0:0F38 EA AB CA         ld   (CAAB),a
ROM0:0F3B F1               pop  af
ROM0:0F3C C9               ret  

0:0F74 (call 0:177B)

ROM0:0F74 F5               push af
ROM0:0F75 CD 7B 17         call 177B

0:0F7A (call 0:168F, 0:175A)

ROM0:0F7A CD 8F 16         call 168F
ROM0:0F7D CD 5A 17         call 175A

0:0FCE (to document)

ROM0:0FCE FA 00 40         ld   a,(4000)
ROM0:0FD1 F5               push af
ROM0:0FD2 3E 3E            ld   a,3E
ROM0:0FD4 CD 9F 10         call 109F
ROM0:0FD7 CD 1A 41         call 411A		// set (CAD1) to 2
ROM0:0FDA F1               pop  af
ROM0:0FDB CD 9F 10         call 109F
ROM0:0FDE CD 7B 17         call 177B
ROM0:0FE1 80               add  b
ROM0:0FE2 E5               push hl
ROM0:0FE3 CD 8F 16         call 168F
ROM0:0FE6 CD 5A 17         call 175A
ROM0:0FE9 80               add  b
ROM0:0FEA E5               push hl
ROM0:0FEB 28 F6            jr   z,0FE3
ROM0:0FED 18 DF            jr   0FCE
ROM0:0FEF C9               ret

rst 08 instructions

  • 0x1033-0x1070 - rst 08 jumps here
ROM0:1033 F5               push af
ROM0:1034 E8 FD            add  sp,FD
ROM0:1036 F5               push af
ROM0:1037 E5               push hl
ROM0:1038 C5               push bc
ROM0:1039 D5               push de
ROM0:103A F8 06            ld   hl,sp+06
ROM0:103C 54               ld   d,h
ROM0:103D 5D               ld   e,l
ROM0:103E F8 0E            ld   hl,sp+0E
ROM0:1040 3A               ldd  a,(hl)
ROM0:1041 47               ld   b,a
ROM0:1042 3A               ldd  a,(hl)
ROM0:1043 4F               ld   c,a
ROM0:1044 FA 00 40         ld   a,(4000)
ROM0:1047 32               ldd  (hl),a
ROM0:1048 7E               ld   a,(hl)
ROM0:1049 12               ld   (de),a
ROM0:104A 3E 10            ld   a,10
ROM0:104C 32               ldd  (hl),a
ROM0:104D 3E 71            ld   a,71
ROM0:104F 32               ldd  (hl),a
ROM0:1050 0A               ld   a,(bc)
ROM0:1051 5F               ld   e,a
ROM0:1052 03               inc  bc
ROM0:1053 16 40            ld   d,40
ROM0:1055 0A               ld   a,(bc)
ROM0:1056 03               inc  bc
ROM0:1057 F3               di   
ROM0:1058 EA 00 30         ld   (3000),a
ROM0:105B 1F               rra  
ROM0:105C CB 37            swap a
ROM0:105E EA 00 50         ld   (5000),a
ROM0:1061 FB               ei   
ROM0:1062 1A               ld   a,(de)
ROM0:1063 32               ldd  (hl),a
ROM0:1064 1D               dec  e
ROM0:1065 1A               ld   a,(de)
ROM0:1066 77               ld   (hl),a
ROM0:1067 F8 0D            ld   hl,sp+0D
ROM0:1069 79               ld   a,c
ROM0:106A 22               ldi  (hl),a
ROM0:106B 70               ld   (hl),b
ROM0:106C D1               pop  de
ROM0:106D C1               pop  bc
ROM0:106E E1               pop  hl
ROM0:106F F1               pop  af
ROM0:1070 C9               ret

0:1071 (to document)

ROM0:1071 F5               push af
ROM0:1072 E5               push hl
ROM0:1073 C5               push bc
ROM0:1074 F8 06            ld   hl,sp+06
ROM0:1076 7E               ld   a,(hl)
ROM0:1077 F3               di   
ROM0:1078 EA 00 30         ld   (3000),a
ROM0:107B 1F               rra  
ROM0:107C CB 37            swap a
ROM0:107E EA 00 50         ld   (5000),a
ROM0:1081 FB               ei   
ROM0:1082 44               ld   b,h
ROM0:1083 4D               ld   c,l
ROM0:1084 0B               dec  bc
ROM0:1085 0A               ld   a,(bc)
ROM0:1086 32               ldd  (hl),a
ROM0:1087 0B               dec  bc
ROM0:1088 0A               ld   a,(bc)
ROM0:1089 77               ld   (hl),a
ROM0:108A C1               pop  bc
ROM0:108B E1               pop  hl
ROM0:108C E8 01            add  sp,01
ROM0:108E F1               pop  af
ROM0:108F C9               ret

0:1090 (to document)

ROM0:1090 F5               push af
ROM0:1091 E5               push hl
ROM0:1092 21 00 10         ld   hl,1000
ROM0:1095 36 0A            ld   (hl),0A
ROM0:1097 21 00 70         ld   hl,7000
ROM0:109A 36 00            ld   (hl),00
ROM0:109C E1               pop  hl
ROM0:109D F1               pop  af
ROM0:109E C9               ret  

0:109F (to document)

ROM0:109F F5               push af
ROM0:10A0 F3               di   
ROM0:10A1 EA 00 30         ld   (3000),a
ROM0:10A4 1F               rra  
ROM0:10A5 CB 37            swap a
ROM0:10A7 EA 00 50         ld   (5000),a
ROM0:10AA FB               ei   
ROM0:10AB F1               pop  af
ROM0:10AC C9               ret

0:123C (to document)

ROM0:123C F5               push af
ROM0:123D C5               push bc
ROM0:123E E5               push hl
ROM0:123F C5               push bc
ROM0:1240 CB 21            sla  c
ROM0:1242 CB 21            sla  c
ROM0:1244 06 00            ld   b,00
ROM0:1246 21 00 CA         ld   hl,CA00
ROM0:1249 09               add  hl,bc
ROM0:124A C1               pop  bc
ROM0:124B 22               ldi  (hl),a
ROM0:124C 7A               ld   a,d
ROM0:124D 22               ldi  (hl),a
ROM0:124E 78               ld   a,b
ROM0:124F 22               ldi  (hl),a
ROM0:1250 36 00            ld   (hl),00
ROM0:1252 E1               pop  hl
ROM0:1253 C1               pop  bc
ROM0:1254 F1               pop  af
ROM0:1255 C9               ret


ROM0:1347 F5               push af
ROM0:1348 C5               push bc
ROM0:1349 1E 00            ld   e,00
ROM0:134B 0E 08            ld   c,08
ROM0:134D CB 22            sla  d
ROM0:134F CB 13            rl   e
ROM0:1351 7B               ld   a,e
ROM0:1352 B8               cp   b
ROM0:1353 38 03            jr   c,1358
ROM0:1355 90               sub  b
ROM0:1356 5F               ld   e,a
ROM0:1357 14               inc  d
ROM0:1358 0D               dec  c
ROM0:1359 20 F2            jr   nz,134D
ROM0:135B C1               pop  bc
ROM0:135C F1               pop  af
ROM0:135D C9               ret


ROM0:135E F5               push af
ROM0:135F C5               push bc
ROM0:1360 E5               push hl
ROM0:1361 21 00 00         ld   hl,0000
ROM0:1364 3E 10            ld   a,10
ROM0:1366 F5               push af
ROM0:1367 CB 23            sla  e
ROM0:1369 CB 12            rl   d
ROM0:136B CB 15            rl   l
ROM0:136D CB 14            rl   h
ROM0:136F 7C               ld   a,h
ROM0:1370 B8               cp   b
ROM0:1371 38 14            jr   c,1387
ROM0:1373 7C               ld   a,h
ROM0:1374 B8               cp   b
ROM0:1375 20 0B            jr   nz,1382
ROM0:1377 7D               ld   a,l
ROM0:1378 B9               cp   c
ROM0:1379 38 05            jr   c,1380
ROM0:137B 91               sub  c
ROM0:137C 6F               ld   l,a
ROM0:137D 7C               ld   a,h
ROM0:137E 98               sbc  b
ROM0:137F 67               ld   h,a
ROM0:1380 18 05            jr   1387
ROM0:1382 91               sub  c
ROM0:1383 6F               ld   l,a
ROM0:1384 7C               ld   a,h
ROM0:1385 98               sbc  b
ROM0:1386 67               ld   h,a
ROM0:1387 F1               pop  af
ROM0:1388 3D               dec  a
ROM0:1389 20 DB            jr   nz,1366
ROM0:138B 54               ld   d,h
ROM0:138C 5D               ld   e,l
ROM0:138D E1               pop  hl
ROM0:138E C1               pop  bc
ROM0:138F F1               pop  af
ROM0:1390 C9               ret  

0:1391 (daa)

ROM0:1391 F5               push af
ROM0:1392 C5               push bc
ROM0:1393 D5               push de
ROM0:1394 16 00            ld   d,00
ROM0:1396 21 00 00         ld   hl,0000
ROM0:1399 0E 08            ld   c,08
ROM0:139B CB 38            srl  b
ROM0:139D 30 01            jr   nc,13A0
ROM0:139F 19               add  hl,de
ROM0:13A0 CB 23            sla  e
ROM0:13A2 CB 12            rl   d
ROM0:13A4 0D               dec  c
ROM0:13A5 20 F4            jr   nz,139B
ROM0:13A7 D1               pop  de
ROM0:13A8 C1               pop  bc
ROM0:13A9 F1               pop  af
ROM0:13AA C9               ret  
ROM0:13AB F5               push af
ROM0:13AC 7B               ld   a,e
ROM0:13AD 81               add  c
ROM0:13AE 27               daa  
ROM0:13AF 4F               ld   c,a
ROM0:13B0 7A               ld   a,d
ROM0:13B1 80               add  b
ROM0:13B2 27               daa  
ROM0:13B3 47               ld   b,a
ROM0:13B4 30 03            jr   nc,13B9     ;if(bc ≤ 9999), exit this function
ROM0:13B6 01 99 99         ld   bc,9999     ;bc = 9999
ROM0:13B9 F1               pop  af
ROM0:13BA C9               ret  


ROM0:13BB F5               push af
ROM0:13BC 78               ld   a,b
ROM0:13BD BA               cp   d
ROM0:13BE 20 0B            jr   nz,13CB
ROM0:13C0 79               ld   a,c
ROM0:13C1 BB               cp   e
ROM0:13C2 20 07            jr   nz,13CB
ROM0:13C4 01 00 00         ld   bc,0000
ROM0:13C7 1E 01            ld   e,01
ROM0:13C9 18 0E            jr   13D9
ROM0:13CB 7B               ld   a,e
ROM0:13CC 91               sub  c
ROM0:13CD 27               daa  
ROM0:13CE 4F               ld   c,a
ROM0:13CF 7A               ld   a,d
ROM0:13D0 98               sbc  b
ROM0:13D1 27               daa  
ROM0:13D2 47               ld   b,a
ROM0:13D3 1E 02            ld   e,02
ROM0:13D5 30 02            jr   nc,13D9
ROM0:13D7 1E 00            ld   e,00
ROM0:13D9 F1               pop  af
ROM0:13DA C9               ret

Checks input at Title Screen for password

ROM0:168F E5               push hl
ROM0:1690 21 FF FF         ld   hl,FFFF
ROM0:1693 CB 96            res  2,(hl)
ROM0:1695 F5               push af
ROM0:1696 C5               push bc
ROM0:1697 D5               push de
ROM0:1698 F3               di   
ROM0:1699 F0 DF            ld   a,(ff00+DF)
ROM0:169B 4F               ld   c,a
ROM0:169C D6 E0            sub  a,E0
ROM0:169E 47               ld   b,a
ROM0:169F 07               rlca 
ROM0:16A0 80               add  b
ROM0:16A1 5F               ld   e,a
ROM0:16A2 3E 00            ld   a,00
ROM0:16A4 E2               ld   (ff00+c),a
ROM0:16A5 0C               inc  c
ROM0:16A6 79               ld   a,c
ROM0:16A7 FE E4            cp   a,E4
ROM0:16A9 20 02            jr   nz,16AD
ROM0:16AB 0E E0            ld   c,E0
ROM0:16AD F2               ld   a,(ff00+c)
ROM0:16AE FE 01            cp   a,01
ROM0:16B0 20 F3            jr   nz,16A5
ROM0:16B2 79               ld   a,c
ROM0:16B3 E0 DF            ld   (ff00+DF),a
ROM0:16B5 3E 02            ld   a,02
ROM0:16B7 E2               ld   (ff00+c),a
ROM0:16B8 3E E8            ld   a,E8
ROM0:16BA 83               add  e
ROM0:16BB 4F               ld   c,a
ROM0:16BC F8 00            ld   hl,sp+00
ROM0:16BE 7D               ld   a,l
ROM0:16BF E2               ld   (ff00+c),a
ROM0:16C0 0C               inc  c
ROM0:16C1 7C               ld   a,h
ROM0:16C2 E2               ld   (ff00+c),a
ROM0:16C3 0C               inc  c
ROM0:16C4 FA 00 40         ld   a,(4000)
ROM0:16C7 E2               ld   (ff00+c),a
ROM0:16C8 F0 DF            ld   a,(ff00+DF)
ROM0:16CA D6 E0            sub  a,E0
ROM0:16CC 47               ld   b,a
ROM0:16CD 07               rlca 
ROM0:16CE 80               add  b
ROM0:16CF 5F               ld   e,a
ROM0:16D0 C6 E8            add  a,E8
ROM0:16D2 4F               ld   c,a
ROM0:16D3 F2               ld   a,(ff00+c)
ROM0:16D4 6F               ld   l,a
ROM0:16D5 0C               inc  c
ROM0:16D6 F2               ld   a,(ff00+c)
ROM0:16D7 67               ld   h,a
ROM0:16D8 F9               ld   sp,hl
ROM0:16D9 0C               inc  c
ROM0:16DA F2               ld   a,(ff00+c)
ROM0:16DB EA 00 30         ld   (3000),a
ROM0:16DE 1F               rra  
ROM0:16DF CB 37            swap a
ROM0:16E1 EA 00 50         ld   (5000),a
ROM0:16E4 16 00            ld   d,00
ROM0:16E6 21 DD 15         ld   hl,15DD
ROM0:16E9 19               add  hl,de
ROM0:16EA 7E               ld   a,(hl)
ROM0:16EB E0 05            ld   (ff00+05),a
ROM0:16ED 2A               ldi  a,(hl)
ROM0:16EE E0 06            ld   (ff00+06),a
ROM0:16F0 2A               ldi  a,(hl)
ROM0:16F1 E0 07            ld   (ff00+07),a
ROM0:16F3 7E               ld   a,(hl)
ROM0:16F4 E0 07            ld   (ff00+07),a
ROM0:16F6 D1               pop  de
ROM0:16F7 C1               pop  bc
ROM0:16F8 F1               pop  af
ROM0:16F9 21 0F FF         ld   hl,FF0F
ROM0:16FC CB 96            res  2,(hl)
ROM0:16FE 2E FF            ld   l,FF
ROM0:1700 CB D6            set  2,(hl)
ROM0:1702 E1               pop  hl
ROM0:1703 D9               reti 
ROM0:1704 C9               ret

0:1705 (to document)

ROM0:1705 F5               push af
ROM0:1706 C5               push bc
ROM0:1707 D5               push de
ROM0:1708 E5               push hl
ROM0:1709 F8 08            ld   hl,sp+08
ROM0:170B 2A               ldi  a,(hl)
ROM0:170C 5F               ld   e,a
ROM0:170D 56               ld   d,(hl)
ROM0:170E 1A               ld   a,(de)
ROM0:170F 4F               ld   c,a
ROM0:1710 13               inc  de
ROM0:1711 7A               ld   a,d
ROM0:1712 32               ldd  (hl),a
ROM0:1713 73               ld   (hl),e
ROM0:1714 3E 01            ld   a,01
ROM0:1716 E2               ld   (ff00+c),a
ROM0:1717 E1               pop  hl
ROM0:1718 D1               pop  de
ROM0:1719 C1               pop  bc
ROM0:171A F1               pop  af
ROM0:171B C9               ret

0:175A (to document))

ROM0:175A C5               push bc
ROM0:175B D5               push de
ROM0:175C E5               push hl
ROM0:175D F8 06            ld   hl,sp+06
ROM0:175F 2A               ldi  a,(hl)
ROM0:1760 5F               ld   e,a
ROM0:1761 56               ld   d,(hl)
ROM0:1762 1A               ld   a,(de)
ROM0:1763 47               ld   b,a
ROM0:1764 13               inc  de
ROM0:1765 1A               ld   a,(de)
ROM0:1766 4F               ld   c,a
ROM0:1767 13               inc  de
ROM0:1768 7A               ld   a,d
ROM0:1769 32               ldd  (hl),a
ROM0:176A 73               ld   (hl),e
ROM0:176B F3               di   
ROM0:176C 3E FF            ld   a,FF
ROM0:176E A8               xor  b
ROM0:176F 57               ld   d,a
ROM0:1770 F2               ld   a,(ff00+c)
ROM0:1771 5F               ld   e,a
ROM0:1772 A2               and  d
ROM0:1773 E2               ld   (ff00+c),a
ROM0:1774 7B               ld   a,e
ROM0:1775 A0               and  b
ROM0:1776 E1               pop  hl
ROM0:1777 D1               pop  de
ROM0:1778 C1               pop  bc
ROM0:1779 D9               reti 
ROM0:177A C9               ret  

0:177B (to document))

ROM0:177B F5               push af
ROM0:177C C5               push bc
ROM0:177D D5               push de
ROM0:177E E5               push hl
ROM0:177F F8 08            ld   hl,sp+08
ROM0:1781 2A               ldi  a,(hl)
ROM0:1782 5F               ld   e,a
ROM0:1783 56               ld   d,(hl)
ROM0:1784 1A               ld   a,(de)
ROM0:1785 47               ld   b,a
ROM0:1786 13               inc  de
ROM0:1787 1A               ld   a,(de)
ROM0:1788 4F               ld   c,a
ROM0:1789 13               inc  de
ROM0:178A 7A               ld   a,d
ROM0:178B 32               ldd  (hl),a
ROM0:178C 73               ld   (hl),e
ROM0:178D F3               di   
ROM0:178E 3E FF            ld   a,FF
ROM0:1790 A8               xor  b
ROM0:1791 47               ld   b,a
ROM0:1792 F2               ld   a,(ff00+c)
ROM0:1793 A0               and  b
ROM0:1794 E2               ld   (ff00+c),a
ROM0:1795 E1               pop  hl
ROM0:1796 D1               pop  de
ROM0:1797 C1               pop  bc
ROM0:1798 F1               pop  af
ROM0:1799 D9               reti 
ROM0:179A C9               ret

Check if(card_id == 365)

  • 0x1CEF-0x1CFF - Returns 1 if (card_id == 365), 0 otherwise
ROM0:1CEF D5               push de
ROM0:1CF0 1E 00            ld   e,00
ROM0:1CF2 78               ld   a,b
ROM0:1CF3 FE 01            cp   a,01
ROM0:1CF5 20 06            jr   nz,1CFD
ROM0:1CF7 79               ld   a,c
ROM0:1CF8 FE 6D            cp   a,6D
ROM0:1CFA 20 01            jr   nz,1CFD
ROM0:1CFC 1C               inc  e
ROM0:1CFD 7B               ld   a,e
ROM0:1CFE D1               pop  de
ROM0:1CFF C9               ret


ROM0:1D00 E5               push hl
ROM0:1D01 2E 01            ld   l,01
ROM0:1D03 78               ld   a,b
ROM0:1D04 BA               cp   d
ROM0:1D05 20 05            jr   nz,1D0C
ROM0:1D07 79               ld   a,c
ROM0:1D08 BB               cp   e
ROM0:1D09 20 01            jr   nz,1D0C
ROM0:1D0B 2D               dec  l
ROM0:1D0C 7D               ld   a,l
ROM0:1D0D E1               pop  hl
ROM0:1D0E C9               ret  


ROM0:1D0F C5               push bc
ROM0:1D10 D5               push de
ROM0:1D11 E5               push hl
ROM0:1D12 2E 02            ld   l,02
ROM0:1D14 CD BB 13         call 13BB
ROM0:1D17 7B               ld   a,e
ROM0:1D18 FE 01            cp   a,01
ROM0:1D1A 20 02            jr   nz,1D1E
ROM0:1D1C 2E 01            ld   l,01
ROM0:1D1E 7B               ld   a,e
ROM0:1D1F FE 00            cp   a,00
ROM0:1D21 20 02            jr   nz,1D25
ROM0:1D23 2E 00            ld   l,00
ROM0:1D25 7D               ld   a,l
ROM0:1D26 E1               pop  hl
ROM0:1D27 D1               pop  de
ROM0:1D28 C1               pop  bc
ROM0:1D29 C9               ret


ROM0:20E2 F5               push af
ROM0:20E3 C5               push bc
ROM0:20E4 D5               push de
ROM0:20E5 FA 9C CE         ld   a,(CE9C)
ROM0:20E8 47               ld   b,a
ROM0:20E9 4F               ld   c,a
ROM0:20EA FA 9B CE         ld   a,(CE9B)
ROM0:20ED CB 19            rr   c
ROM0:20EF 1F               rra  
ROM0:20F0 CB 1A            rr   d
ROM0:20F2 A8               xor  b
ROM0:20F3 CB 12            rl   d
ROM0:20F5 17               rla  
ROM0:20F6 CB 11            rl   c
ROM0:20F8 EA 9C CE         ld   (CE9C),a
ROM0:20FB FA 9A CE         ld   a,(CE9A)
ROM0:20FE EA 9B CE         ld   (CE9B),a
ROM0:2101 FA 99 CE         ld   a,(CE99)
ROM0:2104 EA 9A CE         ld   (CE9A),a
ROM0:2107 79               ld   a,c
ROM0:2108 EA 99 CE         ld   (CE99),a
ROM0:210B EA 9F CE         ld   (CE9F),a
ROM0:210E D1               pop  de
ROM0:210F C1               pop  bc
ROM0:2110 F1               pop  af
ROM0:2111 C9               ret

Pseudo-Random Number

ROM0:2112 F5               push af
ROM0:2113 C5               push bc
ROM0:2114 D5               push de
ROM0:2115 FA 9D CE         ld   a,(CE9D)
ROM0:2118 4F               ld   c,a
ROM0:2119 FA 9E CE         ld   a,(CE9E)
ROM0:211C B9               cp   c
ROM0:211D 20 05            jr   nz,2124
ROM0:211F EA 9F CE         ld   (CE9F),a
ROM0:2122 18 12            jr   2136
ROM0:2124 91               sub  c
ROM0:2125 47               ld   b,a
ROM0:2126 04               inc  b
ROM0:2127 CD E2 20         call 20E2          ;PRNG
ROM0:212A FA 9F CE         ld   a,(CE9F)
ROM0:212D 57               ld   d,a
ROM0:212E CD 47 13         call 1347
ROM0:2131 7B               ld   a,e
ROM0:2132 81               add  c
ROM0:2133 EA 9F CE         ld   (CE9F),a
ROM0:2136 D1               pop  de
ROM0:2137 C1               pop  bc
ROM0:2138 F1               pop  af
ROM0:2139 C9               ret


ROM0:23F7 FA 00 CE         ld   a,(CE00)
ROM0:23FA FE 01            cp   a,01
ROM0:23FC 20 0E            jr   nz,240C
ROM0:23FE FA 02 CF         ld   a,(CF02)
ROM0:2401 FE 02            cp   a,02
ROM0:2403 20 03            jr   nz,2408
ROM0:2405 AF               xor  a
ROM0:2406 18 02            jr   240A
ROM0:2408 3E 01            ld   a,01
ROM0:240A 18 28            jr   2434
ROM0:240C FA 02 CF         ld   a,(CF02)
ROM0:240F FE 03            cp   a,03
ROM0:2411 20 04            jr   nz,2417
ROM0:2413 3E 01            ld   a,01
ROM0:2415 18 1D            jr   2434
ROM0:2417 FA 02 CF         ld   a,(CF02)
ROM0:241A FE 02            cp   a,02
ROM0:241C 20 03            jr   nz,2421
ROM0:241E AF               xor  a
ROM0:241F 18 13            jr   2434
ROM0:2421 FA 03 CF         ld   a,(CF03)
ROM0:2424 FE 03            cp   a,03
ROM0:2426 20 03            jr   nz,242B
ROM0:2428 AF               xor  a
ROM0:2429 18 09            jr   2434
ROM0:242B FA 03 CF         ld   a,(CF03)
ROM0:242E FE 03            cp   a,03
ROM0:2430 20 02            jr   nz,2434
ROM0:2432 3E 01            ld   a,01
ROM0:2434 C9               ret


ROM0:265B F5               push af
ROM0:265C C5               push bc
ROM0:265D FA 19 CF         ld   a,(CF19)
ROM0:2660 CF               rst  08
ROM0:2661 25               dec  h
ROM0:2662 03               inc  bc
ROM0:2663 C1               pop  bc
ROM0:2664 F1               pop  af
ROM0:2665 C9               ret  

Starter deck routine

ROM0:2666 CD 70 26         call 2670          ;Starter Deck - 33 random cards
ROM0:2669 CD 74 27         call 2774          ;Starter Deck - 7 fixed cards
ROM0:266C CD A9 27         call 27A9
ROM0:266F C9               ret

Starter Deck - 33 random cards

ROM0:2670 F5               push af
ROM0:2671 C5               push bc
ROM0:2672 D5               push de
ROM0:2673 E5               push hl
ROM0:2674 3E 00            ld   a,00
ROM0:2676 EA 9D CE         ld   (CE9D),a
ROM0:2679 3E 63            ld   a,63
ROM0:267B EA 9E CE         ld   (CE9E),a      ;PRN[0;99]
ROM0:267E 1E 00            ld   e,00
ROM0:2680 D5               push de
ROM0:2681 16 00            ld   d,00
ROM0:2683 CD 12 21         call 2112          ;Pseudo-Random Number
ROM0:2686 FA 9F CE         ld   a,(CE9F)
ROM0:2689 5F               ld   e,a
ROM0:268A CB 23            sla  e
ROM0:268C 21 AC 26         ld   hl,26AC       ;pointer to the random card pool
ROM0:268F 19               add  hl,de
ROM0:2690 D1               pop  de
ROM0:2691 2A               ldi  a,(hl)
ROM0:2692 46               ld   b,(hl)
ROM0:2693 4F               ld   c,a           ;bc = card_id
ROM0:2694 7B               ld   a,e
ROM0:2695 CF               rst  08
          61 03
ROM0:2698 CF               rst  08
          63 03
ROM0:269B CF               rst  08
          11 01
ROM0:269E CF               rst  08
          43 01         => Set card as visible in trunk
ROM0:26A1 1C               inc e
ROM0:26A2 7B               ld a,e
ROM0:26A3 FE 21            cp   a,21
ROM0:26A5 20 D9            jr   nz,2680       ;loop 33 times
ROM0:26A7 E1               pop  hl
ROM0:26A8 D1               pop  de
ROM0:26A9 C1               pop  bc
ROM0:26AA F1               pop  af
ROM0:26AB C9               ret

Starter Deck - Random card pool

04 00 - Ryu-Kishin
07 00 - Mushroom Man
08 00 - Shadow Specter
17 00 - Skull Servant
1C 00 - Mountain Warrior
2C 00 - Oscillo Hero #2
2F 00 - Sangan
39 00 - Kuriboh
4A 00 - Man-Eating Plant
64 00 - Wings of Wicked Flame
65 00 - Mask of Darkness
68 00 - Tomozaurus
6A 00 - Kageningen
7A 00 - Dark Plant
80 00 - Nemuriko
81 00 - Weather Control
85 00 - Mystical Capture Chain
8A 00 - Blue-Eyed Silver Zombie
8B 00 - Toad Master
8D 00 - Flame Manipulator
8E 00 - Chronolord
8F 00 - Wind Djinn
90 00 - Phantom Thief
92 00 - Monster Egg
93 00 - Sinister Shadow
97 00 - The Melting Red Shadow
99 00 - Fire Reaper
9A 00 - Larvas
9C 00 - Firegrass
9D 00 - Man Eater
9E 00 - Dig Beak
9F 00 - M-warrior #1
A0 00 - M-warrior #2
A6 00 - Ancient Jar
AC 00 - Dark Prisoner
AD 00 - Hurricail
AF 00 - Fire Eye
B0 00 - Monsturtle
B2 00 - Phantom Dewan
B3 00 - Arlownay
B4 00 - Dark Shade
B5 00 - Masked Clown
B6 00 - Lucky Trinket
B7 00 - Genin
B8 00 - Eyearmor
BA 00 - Gate Deeg
BB 00 - Synchar
BC 00 - Fusionist
BD 00 - Akakieisu
BE 00 - LaLa Li-oon
BF 00 - Key Mace
C0 00 - Turtle Tiger
C1 00 - Terra the Terrible
C2 00 - Doron
C3 00 - Arma Knight
C4 00 - Mech Mole Zombie
C5 00 - Happy Lover
C6 00 - Penguin Knight
C7 00 - Petit Dragon
C9 00 - Air Marmot of Nefa
CA 00 - Phantom Ghost
CC 00 - Dorover
CD 00 - Twin Long Rods #1
CE 00 - Droll Bird
CF 00 - Petit Angel
D0 00 - Winged Cleaver
D1 00 - Hinotama Soul
D2 00 - Kaminarikozou
D3 00 - Meotoko
D5 00 - B. Flame Kagemusha
D6 00 - Flame Ghost
D9 00 - Two-mouth Darkrule
DD 00 - Midnight Fiend
E1 00 - Skull Stalker
E2 00 - Hitodenchak
E3 00 - Wood Remains
E4 00 - Hourglass of Life
E7 00 - Madjinn Gunn
EC 00 - Haniwa
ED 00 - Yashinoki
EE 00 - Vishwar Randi
EF 00 - The Drdek
F1 00 - Candle of Destiny
F2 00 - Water Element
F3 00 - Dissolverock
F4 00 - Meda Bat
F6 00 - Root Water
FC 00 - Angelwitch
FD 00 - Embryonic Beast
04 01 - Wicked Mirror
0B 01 - Sectarian of Secrets
0E 01 - Megirus Light
13 01 - Ray & Temperature
16 01 - King Fog
19 01 - Mystical Sheep #2
1C 01 - Serpent Marauder
20 01 - Change Slime
23 01 - Psychic Kappa
29 01 - Wicked Dragon with the Ersatz Head
2B 01 - Kurama

Starter Deck - 7 fixed cards

ROM0:2774 F5               push af
ROM0:2775 C5               push bc
ROM0:2776 D5               push de
ROM0:2777 E5               push hl
ROM0:2778 1E 21            ld   e,21
ROM0:277A 21 9B 27         ld   hl,279B     ;hl = pointer to Fixed cards list
ROM0:277D 7B               ld   a,e
ROM0:277E FE 28            cp   a,28
ROM0:2780 30 14            jr   nc,2796     ;if the Starter Deck has 40 cards, exit this function
ROM0:2782 7B               ld   a,e
ROM0:2783 CF               rst  08
          61 03
ROM0:2786 2A               ldi  a,(hl)
ROM0:2787 4F               ld   c,a
ROM0:2788 2A               ldi  a,(hl)
ROM0:2789 47               ld   b,a         ;bc = card_id
ROM0:278A CF               rst  08
          63 03
ROM0:278D CF               rst  08
          11 01
ROM0:2790 CF               rst  08
          43 01         => Set card as visible in trunk
ROM0:2793 1C               inc e            ;e++
ROM0:2794 18 E7            jr 277D          ;loop to 0:277D
ROM0:2796 E1               pop  hl
ROM0:2797 D1               pop  de
ROM0:2798 C1               pop  bc
ROM0:2799 F1               pop  af
ROM0:279A C9               ret  

Starter Deck - Fixed cards list

50 01 - Raigeki
56 01 - Sparks
56 01 - Sparks
57 01 - Hinotama
51 01 - Mooyan Curry
52 01 - Red Medicine
5D 01 - Dark-Piercing Light


ROM0:27A9 F5               push af
ROM0:27AA C5               push bc
ROM0:27AB D5               push de
ROM0:27AC E5               push hl
ROM0:27AD 3E 00            ld   a,00
ROM0:27AF EA 9D CE         ld   (CE9D),a
ROM0:27B2 3E FF            ld   a,FF
ROM0:27B4 EA 9E CE         ld   (CE9E),a
ROM0:27B7 CD 12 21         call 2112          ;Pseudo-Random Number
ROM0:27BA FA 9F CE         ld   a,(CE9F)
ROM0:27BD 5F               ld   e,a
ROM0:27BE 3E 00            ld   a,00
ROM0:27C0 EA 9D CE         ld   (CE9D),a
ROM0:27C3 3E 07            ld   a,07
ROM0:27C5 EA 9E CE         ld   (CE9E),a
ROM0:27C8 CD 12 21         call 2112          ;Pseudo-Random Number
ROM0:27CB FA 9F CE         ld   a,(CE9F)
ROM0:27CE 57               ld   d,a
ROM0:27CF 7A               ld   a,d
ROM0:27D0 FE 01            cp   a,01
ROM0:27D2 20 1E            jr   nz,27F2
ROM0:27D4 7B               ld   a,e
ROM0:27D5 FE 03            cp   a,03
ROM0:27D7 20 0B            jr   nz,27E4
ROM0:27D9 01 25 00         ld   bc,0025
ROM0:27DC CF               rst  08
          11 01
ROM0:27DF CF               rst  08
          41 01
ROM0:27E2 18 0E            jr   27F2 
ROM0:27E4 7B               ld   a,e
ROM0:27E5 FE 0E            cp   a,0E
ROM0:27E7 20 09            jr   nz,27F2
ROM0:27E9 01 22 00         ld   bc,0022
ROM0:27EC CF               rst  08
          11 01
ROM0:27EF CF               rst  08
          41 01
ROM0:27F2 E1               pop  hl
ROM0:27F3 D1               pop  de
ROM0:27F4 C1               pop  bc
ROM0:27F5 F1               pop  af
ROM0:27F6 C9               ret  

0:29F1 (to document)

ROM0:29F1 F5               push af
ROM0:29F2 C5               push bc
ROM0:29F3 D5               push de
ROM0:29F4 E5               push hl
ROM0:29F5 CF               rst  08

0:29F8 (pop registers, ret)

ROM0:29F8 E1               pop  hl
ROM0:29F9 D1               pop  de
ROM0:29FA C1               pop  bc
ROM0:29FB F1               pop  af
ROM0:29FC C9               ret

0:2B26 (to document, called by Password #3))

ROM0:2B26 F5               push af
ROM0:2B27 3E 9D            ld   a,9D
ROM0:2B29 CD F1 29         call 29F1
ROM0:2B2C CD 74 0F         call 0F74
ROM0:2B2F F1               pop  af
ROM0:2B30 C9               ret

0:2B7E (to document))

ROM0:2B7E F5               push af
ROM0:2B7F 3E A1            ld   a,A1
ROM0:2B81 CD F1 29         call 29F1
ROM0:2B84 CD 74 0F         call 0F74
ROM0:2B87 F1               pop  af
ROM0:2B88 C9               ret

Bank 1

Card names text table

  • 0x46ED-0x5292 - Card names text table

Write card_id to wCAE2

ROM1:5AF2 F5               push af
ROM1:5AF3 CD EF 1C         call 1CEF         ;check if(card_id == 365)
ROM1:5AF6 FE 00            cp   a,00
ROM1:5AF8 20 08            jr   nz,5B02      ;if(card_id == 365), exit this function
ROM1:5AFA 79               ld   a,c
ROM1:5AFB EA E2 CA         ld   (CAE2),a
ROM1:5AFE 78               ld   a,b
ROM1:5AFF EA E3 CA         ld   (CAE3),a     ;write card_id to wCAE2
ROM1:5B02 F1               pop  af
ROM1:5B03 C9               ret

Add card to trunk

ROM1:5B04 F5               push af
ROM1:5B05 C5               push bc
ROM1:5B06 E5               push hl
ROM1:5B07 CD 80 5B         call 5B80         ;a = card_quantity
ROM1:5B0A FE FF            cp   a,FF
ROM1:5B0C 20 04            jr   nz,5B12      ;if the card is already visible in trunk, jump to 1:5B12
ROM1:5B0E AF               xor  a
ROM1:5B0F CD 6C 5B         call 5B6C         ;set card_quantity to 0
ROM1:5B12 FA E2 CA         ld   a,(CAE2)
ROM1:5B15 4F               ld   c,a
ROM1:5B16 FA E3 CA         ld   a,(CAE3)
ROM1:5B19 47               ld   b,a          ;bc = card_id
ROM1:5B1A 21 E4 CA         ld   hl,CAE4
ROM1:5B1D 09               add  hl,bc
ROM1:5B1E 7E               ld   a,(hl)       ;a = card_id_quantity
ROM1:5B1F FE 63            cp   a,63
ROM1:5B21 28 02            jr   z,5B25       ;if there is already 99 copies of the card, exit this function
ROM1:5B23 3C               inc  a            ;card_quantity ++
ROM1:5B24 77               ld   (hl),a       ;store new card quantity
ROM1:5B25 E1               pop  hl
ROM1:5B26 C1               pop  bc
ROM1:5B27 F1               pop  af
ROM1:5B28 C9               ret


ROM1:5B29 C5               push bc
ROM1:5B2A D5               push de
ROM1:5B2B E5               push hl
ROM1:5B2C 16 00            ld   d,00
ROM1:5B2E FA E2 CA         ld   a,(CAE2)
ROM1:5B31 4F               ld   c,a
ROM1:5B32 FA E3 CA         ld   a,(CAE3)
ROM1:5B35 47               ld   b,a
ROM1:5B36 21 E4 CA         ld   hl,CAE4
ROM1:5B39 09               add  hl,bc
ROM1:5B3A 7E               ld   a,(hl)
ROM1:5B3B FE 00            cp   a,00
ROM1:5B3D 20 04            jr   nz,5B43
ROM1:5B3F 16 01            ld   d,01
ROM1:5B41 18 0A            jr   5B4D
ROM1:5B43 FE FF            cp   a,FF
ROM1:5B45 20 04            jr   nz,5B4B
ROM1:5B47 16 01            ld   d,01
ROM1:5B49 18 02            jr   5B4D
ROM1:5B4B 3D               dec  a
ROM1:5B4C 77               ld   (hl),a
ROM1:5B4D 7A               ld   a,d
ROM1:5B4E E1               pop  hl
ROM1:5B4F D1               pop  de
ROM1:5B50 C1               pop  bc
ROM1:5B51 C9               ret  

Set card as visible in trunk

ROM1:5B52 F5               push af
ROM1:5B53 C5               push bc
ROM1:5B54 E5               push hl
ROM1:5B55 FA E2 CA         ld   a,(CAE2)
ROM1:5B58 4F               ld   c,a
ROM1:5B59 FA E3 CA         ld   a,(CAE3)
ROM1:5B5C 47               ld   b,a          ;bc = card_id
ROM1:5B5D 21 E4 CA         ld   hl,CAE4
ROM1:5B60 09               add  hl,bc
ROM1:5B61 7E               ld   a,(hl)       ;a = card_id_quantity
ROM1:5B62 FE FF            cp   a,FF
ROM1:5B64 20 02            jr   nz,5B68      ;if the card is already visible in trunk, exit this function
ROM1:5B66 36 00            ld   (hl),00      ;else set card as visible in trunk
ROM1:5B68 E1               pop  hl
ROM1:5B69 C1               pop  bc
ROM1:5B6A F1               pop  af
ROM1:5B6B C9               ret  

Set card quantity

ROM1:5B6C C5               push bc
ROM1:5B6D E5               push hl
ROM1:5B6E F5               push af
ROM1:5B6F FA E2 CA         ld   a,(CAE2)
ROM1:5B72 4F               ld   c,a
ROM1:5B73 FA E3 CA         ld   a,(CAE3)
ROM1:5B76 47               ld   b,a          ;bc = card_id
ROM1:5B77 21 E4 CA         ld   hl,CAE4
ROM1:5B7A 09               add  hl,bc        ;pointer to card_id_quantity
ROM1:5B7B F1               pop  af
ROM1:5B7C 77               ld   (hl),a       ;store new card_id_quantity in (hl)
ROM1:5B7D E1               pop  hl
ROM1:5B7E C1               pop  bc
ROM1:5B7F C9               ret

Retrieve card quantity

ROM1:5B80 C5               push bc
ROM1:5B81 E5               push hl
ROM1:5B82 FA E2 CA         ld   a,(CAE2)
ROM1:5B85 4F               ld   c,a
ROM1:5B86 FA E3 CA         ld   a,(CAE3)
ROM1:5B89 47               ld   b,a          ;bc = card_id
ROM1:5B8A 21 E4 CA         ld   hl,CAE4
ROM1:5B8D 09               add  hl,bc
ROM1:5B8E 7E               ld   a,(hl)       ;a = card_id_quantity
ROM1:5B8F E1               pop  hl
ROM1:5B90 C1               pop  bc
ROM1:5B91 C9               ret


ROM1:5B92 C5               push bc
ROM1:5B93 D5               push de
ROM1:5B94 1E 01            ld   e,01
ROM1:5B96 FA E2 CA         ld   a,(CAE2)
ROM1:5B99 4F               ld   c,a
ROM1:5B9A FA E3 CA         ld   a,(CAE3)
ROM1:5B9D 47               ld   b,a
ROM1:5B9E C5               push bc
ROM1:5B9F CF               rst  08
          1D 03
ROM1:5BA2 78               ld   a,b
ROM1:5BA3 C1               pop  bc
ROM1:5BA4 FE 00            cp   a,00
ROM1:5BA6 20 0C            jr   nz,5BB4
ROM1:5BA8 CD 29 5B         call 5B29
ROM1:5BAB FE 00            cp   a,00
ROM1:5BAD 20 05            jr   nz,5BB4
ROM1:5BAF CF               rst  08
          1B 03
ROM1:5BB2 1E 00            ld   e,00
ROM1:5BB4 7B               ld   a,e
ROM1:5BB5 D1               pop  de
ROM1:5BB6 C1               pop  bc
ROM1:5BB7 C9               ret  

Graphics 1

  • 0x6480 - Menu cursors

Bank 2

Graphics 2

  • 0x80D9 - 0x84C0 - Text table (1bpp; stored tiled instead of linear)
  • 0x8CA0 - 0xB051 - CPU opponents illustrations + mouths animations


ROM2:7711 F5               push af
ROM2:7712 3E 06            ld   a,06
ROM2:7714 EA 50 CD         ld   (CD50),a
ROM2:7717 3E 00            ld   a,00
ROM2:7719 EA 51 CD         ld   (CD51),a
ROM2:771C CF               rst  08
ROM2:771D 03               inc  bc
ROM2:771E 06 CD            ld   b,CD
ROM2:7720 4A               ld   c,d
ROM2:7721 48               ld   c,b
ROM2:7722 F1               pop  af
ROM2:7723 C9               ret  

duelist_id handling

Return duelist_id drops pointer

ROM2:7724 C5               push bc
ROM2:7725 E5               push hl
ROM2:7726 06 00            ld   b,00
ROM2:7728 FA EF CE         ld   a,(CEEF)    ;a = selected_duelist
ROM2:772B 4F               ld   c,a
ROM2:772C 21 34 77         ld   hl,7734     ;duelist_id drops pointers
ROM2:772F 09               add  hl,bc
ROM2:7730 7E               ld   a,(hl)      ;a = duelist_id
ROM2:7731 E1               pop  hl
ROM2:7732 C1               pop  bc
ROM2:7733 C9               ret  

duelist_id drops pointers

00 - Insector Haga
01 - Kujaku Mai
02 - Dinosaur Ryuzaki
03 - Ryota Kajiki
08 - Seto Kaiba
09 - Mokuba Kaiba
0C - Ventriloquist of the Dead
0D - Player Killer of Darkness
0E - Bandit Keith
05 - Yugi Muto
0A - Hiroto Honda
07 - Katsuya Jonouchi
0B - Ryo Bakura
10 - Shimon Muran
0F - Pegasus J. Crawford
04 - Yami Yugi


ROM2:7744 C5               push bc
ROM2:7745 E5               push hl
ROM2:7746 06 00            ld   b,00
ROM2:7748 FA EF CE         ld   a,(CEEF)     ;a = selected_duelist
ROM2:774B CD CD 28         call 28CD
ROM2:774E 21 79 77         ld   hl,7779
ROM2:7751 79               ld   a,c
ROM2:7752 FE 00            cp   a,00
ROM2:7754 20 08            jr   nz,775E
ROM2:7756 78               ld   a,b
ROM2:7757 FE 00            cp   a,00
ROM2:7759 20 03            jr   nz,775E
ROM2:775B 21 69 77         ld   hl,7769
ROM2:775E 06 00            ld   b,00
ROM2:7760 FA EF CE         ld   a,(CEEF)     ;a = selected_duelist
ROM2:7763 4F               ld   c,a
ROM2:7764 09               add  hl,bc
ROM2:7765 7E               ld   a,(hl)
ROM2:7766 E1               pop  hl
ROM2:7767 C1               pop  bc
ROM2:7768 C9               ret

2:7769 (array of duelists ?)

01 02 03 04 08 09 0C 0D 0E 06 0A 07 0B 10 0F 05
11 12 13 14 18 19 1C 1D 1E 16 1A 17 1B 20 1F 15

Bank 3

3:410E (set (CAD1) to accumulator)

ROM3:410E EA D1 CA         ld   (CAD1),a
ROM3:4111 C9               ret  

3:4112 (set (CAD1) to 1)

ROM3:4112 F5               push af
ROM3:4113 3E 01            ld   a,01
ROM3:4115 CD 0E 41         call 410E		// set (CAD1) to 1
ROM3:4118 F1               pop  af
ROM3:4119 C9               ret  

3:411A (set (CAD1) to 2)

ROM3:411A F5               push af
ROM3:411B 3E 02            ld   a,02
ROM3:411D CD 0E 41         call 410E		// set (CAD1) to 2
ROM3:4120 F1               pop  af
ROM3:4121 C9               ret  

3:4122 (set (CAD1) to 3)

ROM3:4122 F5               push af
ROM3:4123 3E 03            ld   a,03
ROM3:4125 CD 0E 41         call 410E		// set (CAD1) to 3
ROM3:4128 F1               pop  af
ROM3:4129 C9               ret  

3:412A (set (CAD1) to 4)

ROM3:412A F5               push af
ROM3:412B 3E 04            ld   a,04
ROM3:412D CD 0E 41         call 410E		// set (CAD1) to 4
ROM3:4130 F1               pop  af
ROM3:4131 C9               ret  

3:4132 (set (CAD1) to 5)

ROM3:4132 F5               push af
ROM3:4133 3E 05            ld   a,05
ROM3:4135 CD 0E 41         call 410E		// set (CAD1) to 5
ROM3:4138 F1               pop  af
ROM3:4139 C9               ret  

3:413A (set (CAD1) to 6)

ROM3:413A F5               push af
ROM3:413B 3E 06            ld   a,06
ROM3:413D CD 0E 41         call 410E          ;set (CAD1) to 6
ROM3:4140 F1               pop  af
ROM3:4141 C9               ret

Player's Deck handling

Starter Deck initialization

ROM3:45CC F5               push af
ROM3:45CD C5               push bc
ROM3:45CE D5               push de
ROM3:45CF E5               push hl
ROM3:45D0 3E 00            ld   a,00
ROM3:45D2 EA 5A CC         ld   (CC5A),a     ;wCC5A = 0
ROM3:45D5 21 5B CC         ld   hl,CC5B
ROM3:45D8 0E 28            ld   c,28         ;40 cards
ROM3:45DA 3E 6D            ld   a,6D
ROM3:45DC 22               ldi  (hl),a
ROM3:45DD 3E 01            ld   a,01
ROM3:45DF 22               ldi  (hl),a       ;write 0x16D to Player's Deck
ROM3:45E0 0D               dec  c
ROM3:45E1 20 F7            jr   nz,45DA      ;loop 40 times to 3:45DA
ROM3:45E3 E1               pop  hl
ROM3:45E4 D1               pop  de
ROM3:45E5 C1               pop  bc
ROM3:45E6 F1               pop  af
ROM3:45E7 C9               ret  

3:45E8 (updates wCC5A)

ROM3:45E8 EA 5A CC         ld   (CC5A),a
ROM3:45EB C9               ret

Add card to deck

  • 0xC5EC-0xC603 - Write card_id (bc) to wCC5B + offset (wCC5A)
ROM3:45EC F5               push af
ROM3:45ED C5               push bc
ROM3:45EE D5               push de
ROM3:45EF E5               push hl
ROM3:45F0 16 00            ld   d,00
ROM3:45F2 FA 5A CC         ld   a,(CC5A)     ;current deck slot
ROM3:45F5 5F               ld   e,a
ROM3:45F6 CB 23            sla  e
ROM3:45F8 21 5B CC         ld   hl,CC5B
ROM3:45FB 19               add  hl,de
ROM3:45FC 79               ld   a,c
ROM3:45FD 22               ldi  (hl),a
ROM3:45FE 70               ld   (hl),b
ROM3:45FF E1               pop  hl
ROM3:4600 D1               pop  de
ROM3:4601 C1               pop  bc
ROM3:4602 F1               pop  af
ROM3:4603 C9               ret

CPU's deck handling

Add card to CPU's deck

ROM3:4715 F5               push af
ROM3:4716 E5               push hl
ROM3:4717 C5               push bc
ROM3:4718 06 00            ld   b,00
ROM3:471A FA AB CC         ld   a,(CCAB)     ;current deck slot
ROM3:471D 4F               ld   c,a
ROM3:471E CB 21            sla  c
ROM3:4720 21 AC CC         ld   hl,CCAC
ROM3:4723 09               add  hl,bc        ;deck_slot pointer
ROM3:4724 C1               pop  bc
ROM3:4725 79               ld   a,c
ROM3:4726 22               ldi  (hl),a       ;Store card_id to (wCCAC+deck_slot)
ROM3:4727 70               ld   (hl),b
ROM3:4728 E1               pop  hl
ROM3:4729 F1               pop  af
ROM3:472A C9               ret

Button Password check

  • 0xE4FB-0xE521 - Button Password check
ROM3:64FB F5               push af
ROM3:64FC C5               push bc
ROM3:64FD D5               push de
ROM3:64FE E5               push hl
ROM3:64FF 1E 00            ld   e,00
ROM3:6501 CD E2 20         call 20E2		// PRNG
ROM3:6504 CD 2E 65         call 652E
ROM3:6507 CD 26 66         call 6626
ROM3:650A 06 00            ld   b,00
ROM3:650C 4F               ld   c,a
ROM3:650D 21 22 65         ld   hl,6522
ROM3:6510 09               add  hl,bc
ROM3:6511 2A               ldi  a,(hl)
ROM3:6512 66               ld   h,(hl)
ROM3:6513 6F               ld   l,a
ROM3:6514 01 19 65         ld   bc,6519
ROM3:6517 C5               push bc
ROM3:6518 E9               jp   hl
ROM3:6519 FE 01            cp   a,01
ROM3:651B 20 E4            jr   nz,6501
ROM3:651D E1               pop  hl
ROM3:651E D1               pop  de
ROM3:651F C1               pop  bc
ROM3:6520 F1               pop  af
ROM3:6521 C9               ret

3:6522 (Button Password check array)

68 65 - Password #3
75 65
F3 65
06 66 - Wipe out SRAM
19 66

3:652E (to document)

  • 0xE52E-0xE55F - To document
ROM3:652E C5               push bc
ROM3:652F D5               push de
ROM3:6530 E5               push hl
ROM3:6531 16 00            ld   d,00
ROM3:6533 FA A6 CA         ld   a,(CAA6)
ROM3:6536 E6 FF            and  a,FF
ROM3:6538 28 0D            jr   z,6547
ROM3:653A 0E 08            ld   c,08
ROM3:653C 0D               dec  c
ROM3:653D 07               rlca 
ROM3:653E 30 FC            jr   nc,653C
ROM3:6540 06 00            ld   b,00
ROM3:6542 21 60 65         ld   hl,6560
ROM3:6545 09               add  hl,bc
ROM3:6546 56               ld   d,(hl)
ROM3:6547 FA A7 CA         ld   a,(CAA7)
ROM3:654A E6 C0            and  a,C0
ROM3:654C 28 0D            jr   z,655B
ROM3:654E 0E 08            ld   c,08
ROM3:6550 0D               dec  c
ROM3:6551 07               rlca 
ROM3:6552 30 FC            jr   nc,6550
ROM3:6554 06 00            ld   b,00
ROM3:6556 21 60 65         ld   hl,6560
ROM3:6559 09               add  hl,bc
ROM3:655A 56               ld   d,(hl)
ROM3:655B 7A               ld   a,d
ROM3:655C E1               pop  hl
ROM3:655D D1               pop  de
ROM3:655E C1               pop  bc
ROM3:655F C9               ret
  • 0xE560-0xE567 - Array ?
02 0A 00 08 00 00 04 06

3:6568 (to document)

ROM3:6568 3E 02            ld   a,02
ROM3:656A CD E3 0D         call 0DE3		// (CAAA) = 0, (CAAB) = 2
ROM3:656D CD 2F 0F         call 0F2F		// (CAAB) = 0, (CAAC) = 2
ROM3:6570 CD 74 0F         call 0F74
ROM3:6573 AF               xor  a
ROM3:6574 C9               ret

Loads requested Menu

  • 0xE575-0xE5CE - Loads requested Menu
ROM3:6575 3E 04            ld   a,04
ROM3:6577 CD E3 0D         call 0DE3
ROM3:657A CD E9 66         call 66E9
ROM3:657D CD 2F 0F         call 0F2F
ROM3:6580 CD 74 0F         call 0F74
ROM3:6583 FA A0 CE         ld   a,(CEA0)		// a = Menu ID
ROM3:6586 FE 00            cp   a,00
ROM3:6588 20 0E            jr   nz,6598		// If not Campaign, jump to 3:6598
ROM3:658A CD A8 1F         call 1FA8
ROM3:658D CF               rst  08
ROM3:658E 0D               dec  c
ROM3:658F 04               inc  b
ROM3:6590 CD BE 66         call 66BE
ROM3:6593 CD 9C 64         call 649C
ROM3:6596 18 34            jr   65CC
ROM3:6598 FE 01            cp   a,01
ROM3:659A 20 0E            jr   nz,65AA		// If not Versus, jump to 3:65AA
ROM3:659C CD B0 1F         call 1FB0
ROM3:659F CF               rst  08
ROM3:65A0 0F               rrca 
ROM3:65A1 04               inc  b
ROM3:65A2 CD BE 66         call 66BE
ROM3:65A5 CD 9C 64         call 649C
ROM3:65A8 18 22            jr   65CC
ROM3:65AA FE 02            cp   a,02
ROM3:65AC 20 0E            jr   nz,65BC		// If not Trade, jump to 3:65BC
ROM3:65AE CD B8 1F         call 1FB8
ROM3:65B1 CF               rst  08
ROM3:65B2 11 04 CD         ld   de,CD04
ROM3:65B5 BE               cp   (hl)
ROM3:65B6 66               ld   h,(hl)
ROM3:65B7 CD 9C 64         call 649C
ROM3:65BA 18 10            jr   65CC
ROM3:65BC FE 03            cp   a,03
ROM3:65BE 20 0C            jr   nz,65CC		// If not Records, jump to 3:65CC
ROM3:65C0 CD C0 1F         call 1FC0
ROM3:65C3 CF               rst  08
ROM3:65C4 17               rla  
ROM3:65C5 04               inc  b
ROM3:65C6 CD BE 66         call 66BE
ROM3:65C9 CD 9C 64         call 649C
ROM3:65CC 3E 01            ld   a,01		// Invalid Menu ID
ROM3:65CE C9               ret

Button Password - Wipe out save file

ROM3:6606 3E 04            ld   a,04
ROM3:6608 CD E3 0D         call 0DE3
ROM3:660B CD C7 66         call 66C7
ROM3:660E CD E9 66         call 66E9
ROM3:6611 CD 2F 0F         call 0F2F
ROM3:6614 CD 74 0F         call 0F74
ROM3:6617 AF               xor  a
ROM3:6618 C9               ret

Compares input with Button Password

  • 0xE626-0xE689 - Compares input with Button Password
ROM3:6626 F5               push af
ROM3:6627 C5               push bc
ROM3:6628 E5               push hl
ROM3:6629 FA A6 CA         ld   a,(CAA6)
ROM3:662C FE 00            cp   a,00
ROM3:662E 28 56            jr   z,6686
ROM3:6630 7B               ld   a,e
ROM3:6631 FE 00            cp   a,00
ROM3:6633 20 17            jr   nz,664C
ROM3:6635 FA A6 CA         ld   a,(CAA6)
ROM3:6638 FE 40            cp   a,40
ROM3:663A 20 02            jr   nz,663E
ROM3:663C 1E 01            ld   e,01
ROM3:663E FE 80            cp   a,80
ROM3:6640 20 02            jr   nz,6644
ROM3:6642 1E 08            ld   e,08
ROM3:6644 FE 20            cp   a,20
ROM3:6646 20 02            jr   nz,664A
ROM3:6648 1E 13            ld   e,13
ROM3:664A 18 15            jr   6661
ROM3:664C 16 00            ld   d,00
ROM3:664E 21 8A 66         ld   hl,668A
ROM3:6651 19               add  hl,de		// hl = (668A) + current position in Button Password
ROM3:6652 FA A6 CA         ld   a,(CAA6)	// Load key pressed
ROM3:6655 BE               cp   (hl)		// Compare with Button Password
ROM3:6656 20 07            jr   nz,665F		// If invalid Button Password, jump to 3:665F
ROM3:6658 21 A4 66         ld   hl,66A4
ROM3:665B 19               add  hl,de
ROM3:665C 5E               ld   e,(hl)
ROM3:665D 18 02            jr   6661
ROM3:665F 1E 00            ld   e,00
ROM3:6661 7B               ld   a,e		// a = Button Password cursor
ROM3:6662 FE 81            cp   a,81
ROM3:6664 20 0C            jr   nz,6672		// If it's not the last Button of Password #2, jump to 3:6672
ROM3:6666 3E 22            ld   a,22
ROM3:6668 EA F1 B7         ld   (B7F1),a	// (B7F1) = 0x22, wipe out save file
ROM3:666B CD 7E 2B         call 2B7E
ROM3:666E 1E 00            ld   e,00
ROM3:6670 18 14            jr   6686
ROM3:6672 7B               ld   a,e
ROM3:6673 FE 82            cp   a,82
ROM3:6675 20 0F            jr   nz,6686		// If it's not the last Button of Password #3, jump to 3:6686
ROM3:6677 F0 DE            ld   a,(ff00+DE)
ROM3:6679 FE 03            cp   a,03
ROM3:667B 20 04            jr   nz,6681		// If not playing on Super Game Boy 2, jump to 3:6681
ROM3:667D 3E 02            ld   a,02
ROM3:667F E0 DE            ld   (ff00+DE),a	// Else (FFDE) = 2 (Disables Super Game Boy 2 flag)
ROM3:6681 CD 26 2B         call 2B26
ROM3:6684 1E 00            ld   e,00
ROM3:6686 E1               pop  hl
ROM3:6687 C1               pop  bc
ROM3:6688 F1               pop  af
ROM3:6689 C9               ret

Button Passwords

  • 0xE68A - Button Passwords
40 80 02 80 80 42 02
80 40 02 80 80 10 40 40 40 40 82
20 02 02 02 40 02 02 12

Increment Menu ID

  • 0xE6C7-0xE6D7 - Menu ID + 1
ROM3:66C7 F5               push af
ROM3:66C8 FA A0 CE         ld   a,(CEA0)	// Current selected Menu
ROM3:66CB FE 03            cp   a,03
ROM3:66CD 28 07            jr   z,66D6		// If(Menu ID == 3), get out of this function
ROM3:66CF FA A0 CE         ld   a,(CEA0)
ROM3:66D2 3C               inc  a
ROM3:66D3 EA A0 CE         ld   (CEA0),a	// Menu ID ++
ROM3:66D6 F1               pop  af
ROM3:66D7 C9               ret

Button Password cursor

  • 0xE6A4-0xE6BD - Button Password cursor, last value is the function called
01 02 03 04 05 06 80			- Card Password
08 09 0A 0B 0C 0D 0E 0F 10 11 81	- Wipe out SRAM
13 14 15 16 17 18 19 82			- Disables Super Game Boy 2 flag

3:66E9 (to document)

ROM3:66E9 F5               push af
ROM3:66EA C5               push bc
ROM3:66EB D5               push de
ROM3:66EC E5               push hl
ROM3:66ED 01 02 00         ld   bc,0002
ROM3:66F0 FA A0 CE         ld   a,(CEA0)	// a = Menu ID
ROM3:66F3 CD 00 67         call 6700
ROM3:66F6 16 60            ld   d,60
ROM3:66F8 CD 3C 12         call 123C
ROM3:66FB E1               pop  hl
ROM3:66FC D1               pop  de
ROM3:66FD C1               pop  bc
ROM3:66FE F1               pop  af
ROM3:66FF C9               ret

Pointer to appropriate Menu

ROM3:6700 C5               push bc
ROM3:6701 E5               push hl
ROM3:6702 06 00            ld   b,00
ROM3:6704 4F               ld   c,a
ROM3:6705 21 0D 67         ld   hl,670D
ROM3:6708 09               add  hl,bc
ROM3:6709 7E               ld   a,(hl)
ROM3:670A E1               pop  hl
ROM3:670B C1               pop  bc
ROM3:670C C9               ret

Menus pointers

60 68 70 78

Bank 4

SRAM management

Save file sanity check

  • 0x10484-0x104B2 - Save file sanity check, creates a new save file if the current save is corrupted
ROM4:4484 F5               push af
ROM4:4485 3E 00            ld   a,00
ROM4:4487 EA 17 CF         ld   (CF17),a	// (CF17) = 0
ROM4:448A CD 67 46         call 4667		// SRAM KONAMI check
ROM4:448D FE 01            cp   a,01
ROM4:448F 20 0B            jr   nz,449C		// If the « KONAMI » string is correct, jump to 4:449C
ROM4:4491 CD F2 49         call 49F2		// Name Input screen
ROM4:4494 CD B3 44         call 44B3		// Erase SRAM and create a new Save File
ROM4:4497 3E 01            ld   a,01
ROM4:4499 EA 17 CF         ld   (CF17),a	// (CF17) = 1
ROM4:449C CD BC 45         call 45BC		// Check SRAM Block and Checksum
ROM4:449F FE 01            cp   a,01
ROM4:44A1 20 0B            jr   nz,44AE
ROM4:44A3 CD F2 49         call 49F2		// Name Input screen
ROM4:44A6 CD B3 44         call 44B3		// Erase SRAM and create a new Save File
ROM4:44A9 3E 01            ld   a,01
ROM4:44AB EA 17 CF         ld   (CF17),a	// (CF17) = 1
ROM4:44AE CD 0F 45         call 450F		// Clones SRAM if SRAM block 2
ROM4:44B1 F1               pop  af
ROM4:44B2 C9               ret


  • 0x1065C-0x10666 - Date of build and « KONAMI » string used to check SRAM existence
98 10 10 00 10 4B 4F 4E 41 4D 49
October 10, 1998 - KONAMI
  • 0x10667-0x10683 - Control the presence of date of build and « KONAMI » string in SRAM at 0xB7F1-0xB7FB, to determine if save data exists.
ROM4:4667 C5               push bc
ROM4:4668 D5               push de
ROM4:4669 E5               push hl
ROM4:466A 06 00            ld   b,00
ROM4:466C 21 F1 B7         ld   hl,B7F1
ROM4:466F 11 5C 46         ld   de,465C
ROM4:4672 0E 0B            ld   c,0B
ROM4:4674 1A               ld   a,(de)
ROM4:4675 BE               cp   (hl)
ROM4:4676 28 02            jr   z,467A		// If the current character is ok, jump to 4:467A
ROM4:4678 06 01            ld   b,01		// Else b = 1
ROM4:467A 23               inc  hl
ROM4:467B 13               inc  de
ROM4:467C 0D               dec  c
ROM4:467D 20 F5            jr   nz,4674		// Loops 11 times to see if « 98 10 10 KONAMI » is present in SRAM at (B7F1)-(B7FB).
ROM4:467F 78               ld   a,b
ROM4:4680 E1               pop  hl
ROM4:4681 D1               pop  de
ROM4:4682 C1               pop  bc
ROM4:4683 C9               ret

Graphics 3

  • 0x1132B - Cursors in Campaign mode

Bank 6

Graphics 4

  • 0x18060 - Duel HUD

Bank 8

CPU Decks

Generate CPU Deck

ROM8:4004 F5               push af
ROM8:4005 C5               push bc
ROM8:4006 D5               push de
ROM8:4007 E5               push hl
ROM8:4008 1E 00            ld   e,00            ;deck_size = 0
ROM8:400A 7B               ld   a,e
ROM8:400B FE 28            cp   a,28
ROM8:400D 30 0D            jr   nc,401C         ;if(deck_size ≥ 40), exit this function
ROM8:400F 7B               ld   a,e
ROM8:4010 CF               rst  08
          5D 03
ROM8:4013 CD 21 40         call 4021            ;Generate CPU Card
ROM8:4016 CF               rst  08
          5F 03        => Add card to CPU's deck
ROM8:4019 1C               inc  e               ;deck_size ++
ROM8:401A 18 EE            jr   400A            ;loop to 8:400A
ROM8:401C E1               pop  hl
ROM8:401D D1               pop  de
ROM8:401E C1               pop  bc
ROM8:401F F1               pop  af
ROM8:4020 C9               ret

Generate CPU Card

ROM8:4021 F5               push af
ROM8:4022 D5               push de
ROM8:4023 E5               push hl
ROM8:4024 3E 00            ld   a,00
ROM8:4026 EA 9D CE         ld   (CE9D),a
ROM8:4029 3E FF            ld   a,FF
ROM8:402B EA 9E CE         ld   (CE9E),a      ;PRN[0;255]
ROM8:402E CD 12 21         call 2112          ;Pseudo-Random Number
ROM8:4031 FA 9F CE         ld   a,(CE9F)
ROM8:4034 5F               ld   e,a
ROM8:4035 3E 00            ld   a,00
ROM8:4037 EA 9D CE         ld   (CE9D),a
ROM8:403A 3E 07            ld   a,07
ROM8:403C EA 9E CE         ld   (CE9E),a      ;PRN[0;7]
ROM8:403F CD 12 21         call 2112          ;Pseudo-Random Number
ROM8:4042 FA 9F CE         ld   a,(CE9F)
ROM8:4045 57               ld   d,a           ;de = [0;2047]
ROM8:4046 06 00            ld   b,00
ROM8:4048 CF               rst  08
          19 02
ROM8:404B 4F               ld   c,a
ROM8:404C CB 21            sla  c              ;c = CPU opponent deck offset
ROM8:404E 21 6C 40         ld   hl,406C
ROM8:4051 09               add  hl,bc          ;hl = CPU Deck pointer
ROM8:4052 2A               ldi  a,(hl)
ROM8:4053 66               ld   h,(hl)
ROM8:4054 6F               ld   l,a
ROM8:4055 01 00 00         ld   bc,0000        ;card_id = 0
ROM8:4058 C5               push bc
ROM8:4059 2A               ldi  a,(hl)
ROM8:405A 4F               ld   c,a
ROM8:405B 2A               ldi  a,(hl)
ROM8:405C 47               ld   b,a            ;bc = card_probability
ROM8:405D CD 0F 1D         call 1D0F
ROM8:4060 C1               pop  bc             ;bc = card_id
ROM8:4061 FE 00            cp   a,00
ROM8:4063 28 03            jr   z,4068         ;if card_probability > PRN, exit this function
ROM8:4065 03               inc  bc             ;card_id ++
ROM8:4066 18 F0            jr   4058           ;loop to 8:4058 (next card probability)
ROM8:4068 E1               pop  hl
ROM8:4069 D1               pop  de
ROM8:406A F1               pop  af
ROM8:406B C9               ret

CPU Decks pointers

8E 40 - Insector Haga
68 43 - Kujaku Mai
42 46 - Dinosaur Ryuzaki
1C 49 - Ryota Kajiki
F6 4B - Yami Yugi
D0 4E - Yugi Muto
AA 51 - ?
D6 51 - Katsuya Jonouchi
B0 54 - Seto Kaiba
8A 57 - Mokuba Kaiba
64 5A - Hiroto Honda
3E 5D - Ryo Bakura
18 60 - Ventriloquist of the Dead
F2 62 - Player Killer of Darkness
CC 65 - Bandit Keith
A6 68 - Pegasus J. Crawford
80 6B - Shimon Muran

CPU Decks data

0x2008E-0x22E5A - CPU Decks cards cumulative probabilities, from 0 to 2048, using the CPU Decks pointers

Array ?

0x211AA-0x211D5 - ?

01 00 02 00 03 00 04 00 0A 00 0F 00 14 00 19 00
1E 00 23 00 28 00 2D 00 32 00 37 00 3C 00 41 00
46 00 4B 00 50 00 55 00 5A 00 63 00

Bank 9

0x2409E-0x2420A - Card type array

0x2420B-0x24380 - ?

0x24381-0x2465C - Cards original ATK array

0x2465D-0x24938 - Cards original DEF array

0x24939-0x24C14 - Cards modified ATK array (while "Forest" is active)

0x24C15-0x24EF0 - Cards modified DEF array (while "Forest" is active)

0x24EF1-0x251CC - Cards modified ATK array (while "Wasteland" is active)

0x251CD-0x254A8 - Cards modified DEF array (while "Wasteland" is active)

0x254A9-0x25784 - Cards modified ATK array (while "Mountain" is active)

0x25785-0x25A60 - Cards modified DEF array (while "Mountain" is active)

0x25A61-0x25D3C - Cards modified ATK array (while "Sogen" is active)

0x25D3D-0x26018 - Cards modified DEF array (while "Sogen" is active)

0x26019-0x262F4 - Cards modified ATK array (while "Umi" is active)

0x262F5-0x265D0 - Cards modified DEF array (while "Umi" is active)

0x265D1-0x268AC - Cards modified ATK array (while "Yami" is active)

0x268AD-0x26B88 - Cards modified DEF array (while "Yami" is active)

Bank A

Graphics 5

  • 0x28060 - Duel area
  • 0x294B0 - Title Screen
  • 0x2A810 - Campaign map screens

Bank B

Graphics 6

  • 0x2C050 - KONAMI / KCE Shinjuku / Yu-Gi-Oh screens
  • 0x2D770 - Campaign opponents pictures

Bank C

Graphics 7

  • 0x30060 - Stage 3 / 4 / 5 Campaign opponents pictures

Bank D

Card drop

Card drop - main routine

ROMD:400C F5               push af
ROMD:400D C5               push bc
ROMD:400E CD F7 23         call 23F7
ROMD:4011 FE 00            cp   a,00
ROMD:4013 28 0F            jr   z,4024
ROMD:4015 CD 27 40         call 4027          ;Card drop - random card
ROMD:4018 CF               rst  08
          11 01
ROMD:401B CF               rst  08
          41 01
ROMD:401E CF               rst  08
          29 02
ROMD:4021 CD 8E 6E         call 6E8E
ROMD:4024 C1               pop  bc
ROMD:4025 F1               pop  af
ROMD:4026 C9               ret  

Card drop - random card

ROMD:4027 F5               push af
ROMD:4028 D5               push de
ROMD:4029 E5               push hl
ROMD:402A 3E 00            ld   a,00
ROMD:402C EA 9D CE         ld   (CE9D),a
ROMD:402F 3E FF            ld   a,FF
ROMD:4031 EA 9E CE         ld   (CE9E),a      ;PRN[0;255]
ROMD:4034 CD 12 21         call 2112          ;Pseudo-Random Number
ROMD:4037 FA 9F CE         ld   a,(CE9F)
ROMD:403A 5F               ld   e,a
ROMD:403B 3E 00            ld   a,00
ROMD:403D EA 9D CE         ld   (CE9D),a
ROMD:4040 3E 07            ld   a,07
ROMD:4042 EA 9E CE         ld   (CE9E),a      ;PRN[0;7]
ROMD:4045 CD 12 21         call 2112          ;Pseudo-Random Number
ROMD:4048 FA 9F CE         ld   a,(CE9F)
ROMD:404B 57               ld   d,a           ;de = [0;2047]
ROMD:404C 06 00            ld   b,00
ROMD:404E CF               rst  08
          19 02
ROMD:4051 4F               ld   c,a
ROMD:4052 CB 21            sla  c
ROMD:4054 21 72 40         ld   hl,4072
ROMD:4057 09               add  hl,bc
ROMD:4058 2A               ldi  a,(hl)
ROMD:4059 66               ld   h,(hl)
ROMD:405A 6F               ld   l,a           ;hl = pointer to card pool
ROMD:405B 01 00 00         ld   bc,0000       ;card_id = 0
ROMD:405E C5               push bc
ROMD:405F 2A               ldi  a,(hl)
ROMD:4060 4F               ld   c,a
ROMD:4061 2A               ldi  a,(hl)
ROMD:4062 47               ld   b,a           ;bc = card drop rate
ROMD:4063 CD 0F 1D         call 1D0F
ROMD:4066 C1               pop  bc            ;bc = card_id
ROMD:4067 FE 00            cp   a,00
ROMD:4069 28 03            jr   z,406E
ROMD:406B 03               inc  bc            ;bc ++
ROMD:406C 18 F0            jr   405E
ROMD:406E E1               pop  hl
ROMD:406F D1               pop  de
ROMD:4070 F1               pop  af
ROMD:4071 C9               ret  

Card drop - card pools pointers

94 40 - Weevil
6E 43 - 
48 46 - 
22 49 - 
FC 4B - 
D6 4E - 
B0 51 - 
B0 51 - 
8A 54 - 
64 57 - 
3E 5A - 
18 5D - 
F2 5F - 
CC 62 - 
A6 65 - 
80 68 - 
5A 6B - Yami Yugi

Card drop - card pools

  • 0x34094-0x36E33 - Card drop pools, cumulative drop rates from 0 to 2048.

Card Password check

  • 0x37151-0x37172 - Card Password check
ROMD:7151 E5               push hl
ROMD:7152 06 00            ld   b,00
ROMD:7154 4F               ld   c,a
ROMD:7155 CB 21            sla  c
ROMD:7157 21 73 71         ld   hl,7173
ROMD:715A 09               add  hl,bc
ROMD:715B 2A               ldi  a,(hl)
ROMD:715C 56               ld   d,(hl)
ROMD:715D 5F               ld   e,a
ROMD:715E 21 A1 CF         ld   hl,CFA1
ROMD:7161 0E 08            ld   c,08
ROMD:7163 1A               ld   a,(de)		// Load next character from valid Password
ROMD:7164 BE               cp   (hl)		// Compare with next character from submitted Password
ROMD:7165 28 02            jr   z,7169		// If it matches, jump to D:7169
ROMD:7167 06 01            ld   b,01		// If the Password is invalid, set b to 1
ROMD:7169 13               inc  de
ROMD:716A 23               inc  hl
ROMD:716B 0D               dec  c
ROMD:716C 20 F5            jr   nz,7163		// Loop until the 8 characters have been checked
ROMD:716E 78               ld   a,b
ROMD:716F E1               pop  hl
ROMD:7170 D1               pop  de
ROMD:7171 C1               pop  bc
ROMD:7172 C9               ret

Cards Passwords

  • 0x37185 - Cards Passwords
4C 42 56 48 42 99 43 00 - Fairy's Gift (タカハシカズキ)
60 5B 9C 55 A3 57 67 00 - Flying Penguin (ヤマダノブヒロ)
48 5F 5D 63 47 50 48 00 - Megasonic Eye (シモムラサトシ)
4D 9C 4C 44 32 00 00 00 - Takriminos (チダタクリ)
56 48 5F 50 42 51 46 00 - Kanan the Swordmis (ハシモトカナコ)
27 3E 48 62 48 57 47 00 - Yaranzo (ヘイシヨシヒサ)
43 4C 3F 40 42 99 5C 00 - Stuffed Animal (キタウエカズミ)
50 32 48 5B 42 99 57 46 - Seiyaryu (トリシマカズヒコ)
4C 42 56 48 50 48 5B 47 - Three-legged Zombi (タカハシトシマサ)

Bank E

Graphics 8

  • 0x382A0 - I don't know what this is (some weird shapes, and a worn out mat ?

Bank 10

Graphics 9

  • 0x40300 - Cards illustrations ?

Bank ??

Card lores text

  • 0xF036A - 0xF368D - Card lores text

Bank 3E

3E:407A (Called by Button Password 3)

  • 0xF807A-0xF80C0 - Stores value from array at 3E:4660 to (C863)-(C864), (C8A4), (C8A4), and (C902)-(C905)
RO3E:407A E5               push hl
RO3E:407B C5               push bc
RO3E:407C D5               push de
RO3E:407D FE 81            cp   a,81
RO3E:407F 30 40            jr   nc,40C1
RO3E:4081 11 24 C7         ld   de,C724
RO3E:4084 CD 8D 40         call 408D
RO3E:4087 21 00 C7         ld   hl,C700
RO3E:408A C3 CC 40         jp   40CC
RO3E:408D 87               add  a
RO3E:408E 87               add  a
RO3E:408F 21 60 46         ld   hl,4660		// array at 3E:4660
RO3E:4092 06 00            ld   b,00
RO3E:4094 4F               ld   c,a
RO3E:4095 09               add  hl,bc		// Stores value from array at 3E:4660 to...
RO3E:4096 01 02 C9         ld   bc,C902
RO3E:4099 2A               ldi  a,(hl)
RO3E:409A 12               ld   (de),a		// (C863)
RO3E:409B 02               ld   (bc),a		// (C902)
RO3E:409C 03               inc  bc
RO3E:409D E5               push hl
RO3E:409E 21 40 00         ld   hl,0040
RO3E:40A1 19               add  hl,de
RO3E:40A2 E5               push hl
RO3E:40A3 D1               pop  de
RO3E:40A4 E1               pop  hl
RO3E:40A5 2A               ldi  a,(hl)
RO3E:40A6 12               ld   (de),a		// (C864)
RO3E:40A7 02               ld   (bc),a		// (C903)
RO3E:40A8 03               inc  bc
RO3E:40A9 E5               push hl
RO3E:40AA 21 40 00         ld   hl,0040
RO3E:40AD 19               add  hl,de
RO3E:40AE E5               push hl
RO3E:40AF D1               pop  de
RO3E:40B0 E1               pop  hl
RO3E:40B1 2A               ldi  a,(hl)
RO3E:40B2 12               ld   (de),a		// (C8A4)
RO3E:40B3 02               ld   (bc),a		// (C904)
RO3E:40B4 03               inc  bc
RO3E:40B5 E5               push hl
RO3E:40B6 21 40 00         ld   hl,0040
RO3E:40B9 19               add  hl,de
RO3E:40BA E5               push hl
RO3E:40BB D1               pop  de
RO3E:40BC E1               pop  hl
RO3E:40BD 7E               ld   a,(hl)
RO3E:40BE 12               ld   (de),a		// (C8E4)
RO3E:40BF 02               ld   (bc),a		// (C905)
RO3E:40C0 C9               ret

3E:40C1 (to document)

RO3E:40C1 E6 7F            and  a,7F
RO3E:40C3 11 24 C8         ld   de,C824
RO3E:40C6 CD 8D 40         call 408D
RO3E:40C9 21 00 C8         ld   hl,C800
RO3E:40CC 11 02 C9         ld   de,C902
RO3E:40CF 16 80            ld   d,80
RO3E:40D1 06 04            ld   b,04
RO3E:40D3 3E 12            ld   a,12
RO3E:40D5 4F               ld   c,a
RO3E:40D6 7D               ld   a,l
RO3E:40D7 E6 C0            and  a,C0
RO3E:40D9 2E 21            ld   l,21
RO3E:40DB B5               or   l
RO3E:40DC 6F               ld   l,a
RO3E:40DD AF               xor  a
RO3E:40DE 77               ld   (hl),a
RO3E:40DF 7D               ld   a,l
RO3E:40E0 E6 C0            and  a,C0
RO3E:40E2 2E 2F            ld   l,2F
RO3E:40E4 B5               or   l
RO3E:40E5 6F               ld   l,a
RO3E:40E6 AF               xor  a
RO3E:40E7 77               ld   (hl),a
RO3E:40E8 7D               ld   a,l
RO3E:40E9 E6 C0            and  a,C0
RO3E:40EB 2E 2E            ld   l,2E
RO3E:40ED B5               or   l
RO3E:40EE 6F               ld   l,a
RO3E:40EF AF               xor  a
RO3E:40F0 77               ld   (hl),a
RO3E:40F1 7D               ld   a,l
RO3E:40F2 E6 C0            and  a,C0
RO3E:40F4 2E 23            ld   l,23
RO3E:40F6 B5               or   l
RO3E:40F7 6F               ld   l,a
RO3E:40F8 72               ld   (hl),d		// (C823) = 0x80
RO3E:40F9 7D               ld   a,l
RO3E:40FA E6 C0            and  a,C0
RO3E:40FC 2E 35            ld   l,35
RO3E:40FE B5               or   l
RO3E:40FF 6F               ld   l,a
RO3E:4100 AF               xor  a
RO3E:4101 77               ld   (hl),a
RO3E:4102 1A               ld   a,(de)
RO3E:4103 13               inc  de
RO3E:4104 FE 80            cp   a,80
RO3E:4106 30 02            jr   nc,410A
RO3E:4108 AF               xor  a
RO3E:4109 E2               ld   (ff00+c),a
RO3E:410A C5               push bc
RO3E:410B 01 40 00         ld   bc,0040
RO3E:410E 09               add  hl,bc
RO3E:410F C1               pop  bc
RO3E:4110 79               ld   a,c
RO3E:4111 C6 05            add  a,05
RO3E:4113 05               dec  b
RO3E:4114 20 BF            jr   nz,40D5		// Loop 4 times
RO3E:4116 D1               pop  de
RO3E:4117 C1               pop  bc
RO3E:4118 E1               pop  hl
RO3E:4119 C9               ret

3E:411A (to document)

RO3E:411A FA 20 C9         ld   a,(C920)
RO3E:411D FE FF            cp   a,FF
RO3E:411F 28 08            jr   z,4129			// If((C920)==0xFF), jump to 3E:4129
RO3E:4121 CD 7A 40         call 407A
RO3E:4124 3E FF            ld   a,FF
RO3E:4126 EA 20 C9         ld   (C920),a		// (C920) = 0xFF
RO3E:4129 21 0C C9         ld   hl,C90C
RO3E:412C 11 18 C9         ld   de,C918
RO3E:412F 01 12 C9         ld   bc,C912
RO3E:4132 7E               ld   a,(hl)
RO3E:4133 12               ld   (de),a
RO3E:4134 0A               ld   a,(bc)
RO3E:4135 22               ldi  (hl),a
RO3E:4136 03               inc  bc
RO3E:4137 13               inc  de
RO3E:4138 7E               ld   a,(hl)
RO3E:4139 12               ld   (de),a
RO3E:413A 0A               ld   a,(bc)
RO3E:413B 22               ldi  (hl),a
RO3E:413C 03               inc  bc
RO3E:413D 13               inc  de
RO3E:413E 7E               ld   a,(hl)
RO3E:413F 12               ld   (de),a
RO3E:4140 0A               ld   a,(bc)
RO3E:4141 22               ldi  (hl),a
RO3E:4142 03               inc  bc
RO3E:4143 13               inc  de
RO3E:4144 7E               ld   a,(hl)
RO3E:4145 12               ld   (de),a
RO3E:4146 0A               ld   a,(bc)
RO3E:4147 22               ldi  (hl),a
RO3E:4148 03               inc  bc
RO3E:4149 13               inc  de
RO3E:414A 7E               ld   a,(hl)
RO3E:414B 12               ld   (de),a
RO3E:414C 0A               ld   a,(bc)
RO3E:414D 22               ldi  (hl),a
RO3E:414E 03               inc  bc
RO3E:414F 13               inc  de
RO3E:4150 7E               ld   a,(hl)
RO3E:4151 12               ld   (de),a
RO3E:4152 0A               ld   a,(bc)
RO3E:4153 22               ldi  (hl),a
RO3E:4154 03               inc  bc
RO3E:4155 13               inc  de
RO3E:4156 AF               xor  a
RO3E:4157 21 37 C8         ld   hl,C837
RO3E:415A 77               ld   (hl),a
RO3E:415B C5               push bc
RO3E:415C 01 40 00         ld   bc,0040
RO3E:415F 09               add  hl,bc
RO3E:4160 C1               pop  bc
RO3E:4161 AF               xor  a
RO3E:4162 77               ld   (hl),a
RO3E:4163 C5               push bc
RO3E:4164 01 40 00         ld   bc,0040
RO3E:4167 09               add  hl,bc
RO3E:4168 C1               pop  bc
RO3E:4169 AF               xor  a
RO3E:416A 77               ld   (hl),a
RO3E:416B C5               push bc
RO3E:416C 01 40 00         ld   bc,0040
RO3E:416F 09               add  hl,bc
RO3E:4170 C1               pop  bc
RO3E:4171 AF               xor  a
RO3E:4172 77               ld   (hl),a
RO3E:4173 F0 11            ld   a,(ff00+11)
RO3E:4175 EA 1E C9         ld   (C91E),a
RO3E:4178 F0 16            ld   a,(ff00+16)
RO3E:417A EA 1F C9         ld   (C91F),a
RO3E:417D AF               xor  a
RO3E:417E EA 00 C9         ld   (C900),a
RO3E:4181 21 00 C8         ld   hl,C800
RO3E:4184 3E 10            ld   a,10
RO3E:4186 CD F2 41         call 41F2
RO3E:4189 21 0C C9         ld   hl,C90C
RO3E:418C 11 18 C9         ld   de,C918
RO3E:418F 01 12 C9         ld   bc,C912
RO3E:4192 7E               ld   a,(hl)
RO3E:4193 02               ld   (bc),a
RO3E:4194 1A               ld   a,(de)
RO3E:4195 22               ldi  (hl),a
RO3E:4196 03               inc  bc
RO3E:4197 13               inc  de
RO3E:4198 7E               ld   a,(hl)
RO3E:4199 02               ld   (bc),a
RO3E:419A 1A               ld   a,(de)
RO3E:419B 22               ldi  (hl),a
RO3E:419C 03               inc  bc
RO3E:419D 13               inc  de
RO3E:419E 7E               ld   a,(hl)
RO3E:419F 02               ld   (bc),a
RO3E:41A0 1A               ld   a,(de)
RO3E:41A1 22               ldi  (hl),a
RO3E:41A2 03               inc  bc
RO3E:41A3 13               inc  de
RO3E:41A4 7E               ld   a,(hl)
RO3E:41A5 02               ld   (bc),a
RO3E:41A6 1A               ld   a,(de)
RO3E:41A7 22               ldi  (hl),a
RO3E:41A8 03               inc  bc
RO3E:41A9 13               inc  de
RO3E:41AA 7E               ld   a,(hl)
RO3E:41AB 02               ld   (bc),a
RO3E:41AC 1A               ld   a,(de)
RO3E:41AD 22               ldi  (hl),a
RO3E:41AE 03               inc  bc
RO3E:41AF 13               inc  de
RO3E:41B0 7E               ld   a,(hl)
RO3E:41B1 02               ld   (bc),a
RO3E:41B2 1A               ld   a,(de)
RO3E:41B3 22               ldi  (hl),a
RO3E:41B4 03               inc  bc
RO3E:41B5 13               inc  de
RO3E:41B6 21 37 C8         ld   hl,C837
RO3E:41B9 11 37 C7         ld   de,C737
RO3E:41BC 0E 04            ld   c,04
RO3E:41BE 7E               ld   a,(hl)
RO3E:41BF 12               ld   (de),a
RO3E:41C0 C5               push bc
RO3E:41C1 01 40 00         ld   bc,0040
RO3E:41C4 09               add  hl,bc
RO3E:41C5 C1               pop  bc
RO3E:41C6 E5               push hl
RO3E:41C7 21 40 00         ld   hl,0040
RO3E:41CA 19               add  hl,de
RO3E:41CB E5               push hl
RO3E:41CC D1               pop  de
RO3E:41CD E1               pop  hl
RO3E:41CE 0D               dec  c
RO3E:41CF 20 ED            jr   nz,41BE		// Loop 4 times
RO3E:41D1 FA 1E C9         ld   a,(C91E)
RO3E:41D4 E0 11            ld   (ff00+11),a
RO3E:41D6 FA 1F C9         ld   a,(C91F)
RO3E:41D9 E0 16            ld   (ff00+16),a
RO3E:41DB AF               xor  a
RO3E:41DC EA 00 C9         ld   (C900),a
RO3E:41DF 21 00 C7         ld   hl,C700
RO3E:41E2 3E 10            ld   a,10
RO3E:41E4 CD F2 41         call 41F2
RO3E:41E7 FA 0A C9         ld   a,(C90A)
RO3E:41EA E0 24            ld   (ff00+24),a
RO3E:41EC FA 0B C9         ld   a,(C90B)
RO3E:41EF E0 25            ld   (ff00+25),a
RO3E:41F1 C9               ret

3E:41F2 (to document)

RO3E:41F2 EA 01 C9         ld   (C901),a
RO3E:41F5 7D               ld   a,l
RO3E:41F6 E6 C0            and  a,C0
RO3E:41F8 2E 24            ld   l,24
RO3E:41FA B5               or   l
RO3E:41FB 6F               ld   l,a
RO3E:41FC 7E               ld   a,(hl)
RO3E:41FD 0E 80            ld   c,80
RO3E:41FF B9               cp   c
RO3E:4200 30 34            jr   nc,4236
RO3E:4202 71               ld   (hl),c
RO3E:4203 87               add  a
RO3E:4204 C6 F0            add  a,F0
RO3E:4206 5F               ld   e,a
RO3E:4207 3E 00            ld   a,00
RO3E:4209 CE 46            adc  a,46
RO3E:420B 57               ld   d,a
RO3E:420C 7D               ld   a,l
RO3E:420D E6 C0            and  a,C0
RO3E:420F 2E 22            ld   l,22
RO3E:4211 B5               or   l
RO3E:4212 6F               ld   l,a
RO3E:4213 1A               ld   a,(de)
RO3E:4214 77               ld   (hl),a		// (C822) = a
RO3E:4215 13               inc  de
RO3E:4216 2C               inc  l
RO3E:4217 1A               ld   a,(de)
RO3E:4218 77               ld   (hl),a
RO3E:4219 F5               push af
RO3E:421A 7D               ld   a,l
RO3E:421B E6 C0            and  a,C0
RO3E:421D 2E 20            ld   l,20
RO3E:421F B5               or   l
RO3E:4220 6F               ld   l,a
RO3E:4221 F1               pop  af
RO3E:4222 36 1F            ld   (hl),1F		// (C820) = 0x1F
RO3E:4224 7D               ld   a,l
RO3E:4225 E6 C0            and  a,C0
RO3E:4227 2E 2F            ld   l,2F
RO3E:4229 B5               or   l
RO3E:422A 6F               ld   l,a
RO3E:422B AF               xor  a
RO3E:422C 77               ld   (hl),a
RO3E:422D 7D               ld   a,l
RO3E:422E E6 C0            and  a,C0
RO3E:4230 2E 21            ld   l,21
RO3E:4232 B5               or   l
RO3E:4233 6F               ld   l,a
RO3E:4234 AF               xor  a
RO3E:4235 77               ld   (hl),a
RO3E:4236 7D               ld   a,l
RO3E:4237 E6 C0            and  a,C0
RO3E:4239 2E 23            ld   l,23
RO3E:423B B5               or   l
RO3E:423C 6F               ld   l,a
RO3E:423D 7E               ld   a,(hl)
RO3E:423E B9               cp   c
RO3E:423F 30 37            jr   nc,4278
RO3E:4241 7D               ld   a,l
RO3E:4242 E6 C0            and  a,C0
RO3E:4244 2E 2F            ld   l,2F
RO3E:4246 B5               or   l
RO3E:4247 6F               ld   l,a
RO3E:4248 7E               ld   a,(hl)
RO3E:4249 F5               push af
RO3E:424A 7D               ld   a,l
RO3E:424B E6 C0            and  a,C0
RO3E:424D 2E 21            ld   l,21
RO3E:424F B5               or   l
RO3E:4250 6F               ld   l,a
RO3E:4251 F1               pop  af
RO3E:4252 96               sub  (hl)
RO3E:4253 38 0D            jr   c,4262
RO3E:4255 F5               push af
RO3E:4256 7D               ld   a,l
RO3E:4257 E6 C0            and  a,C0
RO3E:4259 2E 2F            ld   l,2F
RO3E:425B B5               or   l
RO3E:425C 6F               ld   l,a
RO3E:425D F1               pop  af
RO3E:425E 77               ld   (hl),a
RO3E:425F CD 88 44         call 4488
RO3E:4262 7D               ld   a,l
RO3E:4263 E6 C0            and  a,C0
RO3E:4265 2E 2F            ld   l,2F
RO3E:4267 B5               or   l
RO3E:4268 6F               ld   l,a
RO3E:4269 FA 0C C9         ld   a,(C90C)
RO3E:426C 86               add  (hl)
RO3E:426D 77               ld   (hl),a
RO3E:426E 7D               ld   a,l
RO3E:426F E6 C0            and  a,C0
RO3E:4271 2E 37            ld   l,37
RO3E:4273 B5               or   l
RO3E:4274 6F               ld   l,a
RO3E:4275 3E FF            ld   a,FF
RO3E:4277 77               ld   (hl),a
RO3E:4278 FA 00 C9         ld   a,(C900)
RO3E:427B 3C               inc  a
RO3E:427C EA 00 C9         ld   (C900),a
RO3E:427F C5               push bc
RO3E:4280 01 40 00         ld   bc,0040
RO3E:4283 09               add  hl,bc
RO3E:4284 C1               pop  bc
RO3E:4285 FA 01 C9         ld   a,(C901)
RO3E:4288 C6 05            add  a,05
RO3E:428A FE 24            cp   a,24
RO3E:428C 30 03            jr   nc,4291
RO3E:428E C3 F2 41         jp   41F2
RO3E:4291 FA 08 C9         ld   a,(C908)
RO3E:4294 3C               inc  a
RO3E:4295 EA 08 C9         ld   (C908),a
RO3E:4298 E6 1F            and  a,1F
RO3E:429A 5F               ld   e,a
RO3E:429B FA 0E C9         ld   a,(C90E)
RO3E:429E 47               ld   b,a
RO3E:429F E6 70            and  a,70
RO3E:42A1 4F               ld   c,a
RO3E:42A2 CB 31            swap c
RO3E:42A4 B1               or   c
RO3E:42A5 EA 0A C9         ld   (C90A),a
RO3E:42A8 1D               dec  e
RO3E:42A9 20 13            jr   nz,42BE
RO3E:42AB FA 10 C9         ld   a,(C910)
RO3E:42AE 80               add  b
RO3E:42AF 4F               ld   c,a
RO3E:42B0 A8               xor  b
RO3E:42B1 07               rlca 
RO3E:42B2 30 06            jr   nc,42BA
RO3E:42B4 79               ld   a,c
RO3E:42B5 07               rlca 
RO3E:42B6 07               rlca 
RO3E:42B7 9F               sbc  a
RO3E:42B8 2F               cpl  
RO3E:42B9 4F               ld   c,a
RO3E:42BA 79               ld   a,c
RO3E:42BB EA 0E C9         ld   (C90E),a
RO3E:42BE FA 0F C9         ld   a,(C90F)
RO3E:42C1 4F               ld   c,a
RO3E:42C2 FA 0E C9         ld   a,(C90E)
RO3E:42C5 A7               and  a
RO3E:42C6 20 02            jr   nz,42CA
RO3E:42C8 0E 00            ld   c,00
RO3E:42CA 79               ld   a,c
RO3E:42CB EA 0B C9         ld   (C90B),a
RO3E:42CE C9               ret

3F:4660 (array for (C863) to (C864), (C8A4), (C8E4), and (C902) to (C905))

00 01 02 03
04 05 06 07 - Title Screen
08 09 0A 0B
0C 0D 0E 0F - Character speech
10 11 12 13
14 15 16 17
18 19 1A 1B - Campaign, Duel Records
1C 1D 1E 1F - Password Screen
20 21 22 23
24 25 26 27 - Pre-Duel screen
28 29 2A 2B
2C 2D 2E 2F - Tea speech
30 31 32 33 - Duel win
34 35 36 37
38 39 3A 3B
3C 3D 3E 3F
40 41 42 43
80 80 80 80
44 45 80 80
80 46 80 80
80 47 80 80 - Duel screen
80 48 80 80
49 80 80 80
4A 80 80 80
4B 80 80 80 - Card trunk
80 4C 80 80 - Card trunk, Deck list, Card display
80 4D 80 80 - Pre-Duel screen
80 4E 80 80 - Duel Screen
80 80 80 4F
50 80 80 80 - Button Password #3
51 80 80 80
52 80 80 80
53 54 80 80
80 80 80 55 - Button Password #2 (Wipe out save file)
80 80 80 56
57 80 80 58


  • 0xF86F0 - 0xF8BFF - Sound track

Bank 3F

3F:404E (to document)

RO3F:404E F5               push af
RO3F:404F C5               push bc
RO3F:4050 D5               push de
RO3F:4051 E5               push hl
RO3F:4052 FE 00            cp   a,00
RO3F:4054 20 70            jr   nz,40C6
RO3F:4056 3E 00            ld   a,00
RO3F:4058 E0 47            ld   (ff00+47),a
RO3F:405A 21 40 FF         ld   hl,FF40
RO3F:405D CB FE            set  7,(hl)
RO3F:405F 21 21 44         ld   hl,4421
RO3F:4062 CD 14 41         call 4114
RO3F:4065 1E 00            ld   e,00
RO3F:4067 F0 44            ld   a,(ff00+44)
RO3F:4069 FE 00            cp   a,00
RO3F:406B 20 FA            jr   nz,4067
RO3F:406D F0 44            ld   a,(ff00+44)
RO3F:406F FE 90            cp   a,90
RO3F:4071 38 FA            jr   c,406D
RO3F:4073 16 0A            ld   d,0A
RO3F:4075 3E 20            ld   a,20
RO3F:4077 E0 00            ld   (ff00+00),a
RO3F:4079 F0 00            ld   a,(ff00+00)
RO3F:407B F0 00            ld   a,(ff00+00)
RO3F:407D 3E 10            ld   a,10
RO3F:407F E0 00            ld   (ff00+00),a
RO3F:4081 F0 00            ld   a,(ff00+00)
RO3F:4083 F0 00            ld   a,(ff00+00)
RO3F:4085 F0 00            ld   a,(ff00+00)
RO3F:4087 F0 00            ld   a,(ff00+00)
RO3F:4089 F0 00            ld   a,(ff00+00)
RO3F:408B F0 00            ld   a,(ff00+00)
RO3F:408D 3E 30            ld   a,30
RO3F:408F E0 00            ld   (ff00+00),a
RO3F:4091 3E 30            ld   a,30
RO3F:4093 E0 00            ld   (ff00+00),a
RO3F:4095 3E 30            ld   a,30
RO3F:4097 E0 00            ld   (ff00+00),a
RO3F:4099 3E 30            ld   a,30
RO3F:409B E0 00            ld   (ff00+00),a
RO3F:409D F0 00            ld   a,(ff00+00)
RO3F:409F FE FE            cp   a,FE
RO3F:40A1 20 02            jr   nz,40A5
RO3F:40A3 1E 01            ld   e,01
RO3F:40A5 15               dec  d
RO3F:40A6 20 CD            jr   nz,4075
RO3F:40A8 21 31 44         ld   hl,4431
RO3F:40AB CD 14 41         call 4114
RO3F:40AE 16 00            ld   d,00
RO3F:40B0 06 00            ld   b,00
RO3F:40B2 CB 23            sla  e
RO3F:40B4 0E 00            ld   c,00
RO3F:40B6 F0 DD            ld   a,(ff00+DD)
RO3F:40B8 FE FF            cp   a,FF
RO3F:40BA 20 02            jr   nz,40BE
RO3F:40BC 0E 01            ld   c,01
RO3F:40BE 21 CB 40         ld   hl,40CB
RO3F:40C1 19               add  hl,de
RO3F:40C2 09               add  hl,bc		// hl = 0x40CB + de + bc
RO3F:40C3 7E               ld   a,(hl)		// Load value from the array at 3F:40CB
RO3F:40C4 E0 DE            ld   (ff00+DE),a
RO3F:40C6 E1               pop  hl
RO3F:40C7 D1               pop  de
RO3F:40C8 C1               pop  bc
RO3F:40C9 F1               pop  af
RO3F:40CA C9               ret  

Gaming consoles array

00 - Game Boy Color
02 - Game Boy
03 - Super Game Boy 2

3F:4114 (to document)

RO3F:4114 F5               push af
RO3F:4115 C5               push bc
RO3F:4116 D5               push de
RO3F:4117 F0 44            ld   a,(ff00+44)
RO3F:4119 FE 90            cp   a,90
RO3F:411B 38 FA            jr   c,4117
RO3F:411D 3E 30            ld   a,30
RO3F:411F E0 00            ld   (ff00+00),a
RO3F:4121 3E 00            ld   a,00
RO3F:4123 E0 00            ld   (ff00+00),a
RO3F:4125 3E 30            ld   a,30
RO3F:4127 E0 00            ld   (ff00+00),a
RO3F:4129 16 10            ld   d,10
RO3F:412B 2A               ldi  a,(hl)
RO3F:412C 47               ld   b,a
RO3F:412D 1E 08            ld   e,08
RO3F:412F CB 38            srl  b
RO3F:4131 38 0A            jr   c,413D
RO3F:4133 3E 20            ld   a,20
RO3F:4135 E0 00            ld   (ff00+00),a
RO3F:4137 3E 30            ld   a,30
RO3F:4139 E0 00            ld   (ff00+00),a
RO3F:413B 18 08            jr   4145
RO3F:413D 3E 10            ld   a,10
RO3F:413F E0 00            ld   (ff00+00),a
RO3F:4141 3E 30            ld   a,30
RO3F:4143 E0 00            ld   (ff00+00),a
RO3F:4145 1D               dec  e
RO3F:4146 20 E7            jr   nz,412F
RO3F:4148 15               dec  d
RO3F:4149 20 E0            jr   nz,412B
RO3F:414B 3E 20            ld   a,20
RO3F:414D E0 00            ld   (ff00+00),a
RO3F:414F 3E 30            ld   a,30
RO3F:4151 E0 00            ld   (ff00+00),a
RO3F:4153 CD 5A 41         call 415A
RO3F:4156 D1               pop  de
RO3F:4157 C1               pop  bc
RO3F:4158 F1               pop  af
RO3F:4159 C9               ret

Graphics 10

  • 0xFCDA0 - Millenium tablet (Stage 3 / 4 / 5 opponents background)

Internal Data for Yu-Gi-Oh! Duel Monsters

ROM MapRAM MapText TableNotesTutorials