If you are still using the old URL (datacrystal.romhacking.net), please update your bookmarks! The old URL may stop working soon.
The current URL is datacrystal.tcrf.net.
The current URL is datacrystal.tcrf.net.
Yu-Gi-Oh! Duel Monsters 4: Kaiba Deck/ROM map
Jump to navigation
Jump to search
The following article is a ROM map for Yu-Gi-Oh! Duel Monsters 4: Kaiba Deck.
Bank 0
rst
rst 00
ROM0:0000 D9 reti
rst 08
ROM0:0008 C3 A2 11 jp 125E ;rst 08 instructions
rst 10
ROM0:0010 D9 reti
rst 18
ROM0:0018 D9 reti
rst 20
ROM0:0020 D9 reti
rst 28
ROM0:0028 D9 reti
rst 30
ROM0:0030 D9 reti
rst 38 (error trap)
ROM0:0038 00 nop ROM0:0039 18 FE jr 0039
rst 40 (vblank)
ROM0:0040 C3 1A 05 jp 051A
rst 48 (LCD)
ROM0:0048 00 nop ROM0:0049 D9 reti
rst 50 (timer)
ROM0:0050 C3 88 36 jp 3688
rst 58 (serial)
ROM0:0058 C3 D0 02 jp 02D0
rst 60 (joypad)
ROM0:0060 D9 reti
ROM start
ROM0:0100 00 nop ROM0:0101 C3 50 01 jp 0150 ... ROM0:0150 E0 DD ld (ff00+DD),a ;System running the game ROM0:0152 21 00 D0 ld hl,D000 ROM0:0155 F9 ld sp,hl ROM0:0156 CD AB 12 call 12AB ROM0:0159 CD C5 2C call 2CC5 ROM0:015C 3E 01 ld a,01 ROM0:015E E0 70 ld (ff00+70),a ;WRAM Bank 1 ROM0:0160 CD 84 01 call 0184 ROM0:0163 CF rst 08 ROM0:0164 07 04 ROM0:0166 CF rst 08 ROM0:0167 23 04 ROM0:0169 CD 91 27 call 2791 ROM0:016C CD ED 16 call 16ED ROM0:016F CD 96 04 call 0496 ROM0:0172 CD 7C 0F call 0F7C ROM0:0175 CD 8F 02 call 028F ROM0:0178 CF rst 08 ROM0:0179 03 0B ROM0:017B CD 5F 2A call 2A5F ROM0:017E CF rst 08 ROM0:017F 05 04 ROM0:0181 18 FE jr 0181 ;Error trap ROM0:0183 C9 ret
0:0184
ROM0:0184 F5 push af ROM0:0185 3E E0 ld a,E0 ROM0:0187 E0 DF ld (ff00+DF),a ;hFFDF = 0xE0 ROM0:0189 CD 07 02 call 0207 ROM0:018C CD 91 01 call 0191 ROM0:018F F1 pop af ROM0:0190 C9 ret
0:0191
ROM0:0191 F5 push af ROM0:0192 C5 push bc ROM0:0193 D5 push de ROM0:0194 E5 push hl ROM0:0195 21 B5 01 ld hl,01B5 ROM0:0198 0E E0 ld c,E0 ROM0:019A 06 02 ld b,02 ROM0:019C 1E 05 ld e,05 ROM0:019E 2A ldi a,(hl) ROM0:019F E2 ld (ff00+c),a ROM0:01A0 0C inc c ROM0:01A1 1D dec e ROM0:01A2 20 FA jr nz,019E ROM0:01A4 2A ldi a,(hl) ROM0:01A5 5F ld e,a ROM0:01A6 2A ldi a,(hl) ROM0:01A7 57 ld d,a ROM0:01A8 2A ldi a,(hl) ROM0:01A9 12 ld (de),a ROM0:01AA 13 inc de ROM0:01AB 2A ldi a,(hl) ROM0:01AC 12 ld (de),a ROM0:01AD 05 dec b ROM0:01AE 20 EC jr nz,019C ROM0:01B0 E1 pop hl ROM0:01B1 D1 pop de ROM0:01B2 C1 pop bc ROM0:01B3 F1 pop af ROM0:01B4 C9 ret
0:01B5 (array)
ROM0:01B5 76 CF 04 00 01 7E CF C9 41 76 CD 3D 00 03 7E CD 04 40
0:01C7
ROM0:01C7 F5 push af ROM0:01C8 C5 push bc ROM0:01C9 D5 push de ROM0:01CA E5 push hl ROM0:01CB F8 08 ld hl,sp+08 ROM0:01CD 2A ldi a,(hl) ROM0:01CE 5F ld e,a ROM0:01CF 56 ld d,(hl) ROM0:01D0 1A ld a,(de) ROM0:01D1 47 ld b,a ROM0:01D2 13 inc de ROM0:01D3 7A ld a,d ROM0:01D4 32 ldd (hl),a ROM0:01D5 73 ld (hl),e ROM0:01D6 F0 DF ld a,(ff00+DF) ROM0:01D8 4F ld c,a ROM0:01D9 F8 00 ld hl,sp+00 ROM0:01DB 7D ld a,l ROM0:01DC E2 ld (ff00+c),a ROM0:01DD 0C inc c ROM0:01DE 7C ld a,h ROM0:01DF E2 ld (ff00+c),a ROM0:01E0 0C inc c ROM0:01E1 FA 00 40 ld a,(4000) ROM0:01E4 E2 ld (ff00+c),a ROM0:01E5 0C inc c ROM0:01E6 FA 01 40 ld a,(4001) ROM0:01E9 E2 ld (ff00+c),a ROM0:01EA 0C inc c ROM0:01EB F0 70 ld a,(ff00+70) ROM0:01ED E2 ld (ff00+c),a ROM0:01EE 78 ld a,b ROM0:01EF E0 DF ld (ff00+DF),a ROM0:01F1 4F ld c,a ROM0:01F2 F2 ld a,(ff00+c) ROM0:01F3 6F ld l,a ROM0:01F4 0C inc c ROM0:01F5 F2 ld a,(ff00+c) ROM0:01F6 67 ld h,a ROM0:01F7 F9 ld sp,hl ROM0:01F8 0C inc c ROM0:01F9 F2 ld a,(ff00+c) ROM0:01FA 0C inc c ROM0:01FB 0C inc c ROM0:01FC CD BC 12 call 12BC ROM0:01FF F2 ld a,(ff00+c) ROM0:0200 E0 70 ld (ff00+70),a ROM0:0202 E1 pop hl ROM0:0203 D1 pop de ROM0:0204 C1 pop bc ROM0:0205 F1 pop af ROM0:0206 C9 ret
00s (C5A0) and (C5A1)
ROM0:0207 F5 push af ROM0:0208 AF xor a ROM0:0209 EA A0 C5 ld (C5A0),a ;(C5A0) = 0 ROM0:020C EA A1 C5 ld (C5A1),a ;(C5A1) = 0 ROM0:020F F1 pop af ROM0:0210 C9 ret
0:0211
ROM0:0211 F5 push af ROM0:0212 C5 push bc ROM0:0213 D5 push de ROM0:0214 FA A0 C5 ld a,(C5A0) ROM0:0217 5F ld e,a ROM0:0218 FA A1 C5 ld a,(C5A1) ROM0:021B BB cp e ROM0:021C 20 04 jr nz,0222 ;if((C5A0) ≠ (C5A1)), jump to 0:0222 ROM0:021E CD C7 01 call 01C7 ROM0:0221 E5 push hl ROM0:0222 16 C0 ld d,C0 ;de = 0xC000 ROM0:0224 0E 80 ld c,80 ;c = 128 ROM0:0226 1A ld a,(de) ROM0:0227 22 ldi (hl),a ROM0:0228 1C inc e ;de++ ROM0:0229 0D dec c ;c-- ROM0:022A 20 FA jr nz,0226 ;if(c ≠ 0), loop to 0:0226 ROM0:022C 7B ld a,e ROM0:022D EA A0 C5 ld (C5A0),a ;(C5A0) = e ROM0:0230 D1 pop de ROM0:0231 C1 pop bc ROM0:0232 F1 pop af ROM0:0233 C9 ret
ROM0:0496 F5 push af ROM0:0497 3E FF ld a,FF ROM0:0499 EA A7 C5 ld (C5A7),a ;wC5A7 = 0xFF ROM0:049C AF xor a ROM0:049D EA A8 C5 ld (C5A8),a ;wC5A8 = 0 ROM0:04A0 EA A9 C5 ld (C5A9),a ;wC5A9 = 0 ROM0:04A3 3E 14 ld a,14 ROM0:04A5 EA AA C5 ld (C5AA),a ;wC5AA = 0x14 ; 0d20 ROM0:04A8 F1 pop af ROM0:04A9 C9 ret
0:04AA - PRNG 2 ?
ROM0:04AA F5 push af ROM0:04AB C5 push bc ROM0:04AC D5 push de ROM0:04AD 3E 20 ld a,20 ROM0:04AF E0 00 ld (ff00+00),a ROM0:04B1 F0 00 ld a,(ff00+00) ROM0:04B3 F0 00 ld a,(ff00+00) ROM0:04B5 2F cpl ;inverts all bits of A ROM0:04B6 E6 0F and a,0F ROM0:04B8 CB 37 swap a ROM0:04BA 47 ld b,a ROM0:04BB 3E 10 ld a,10 ROM0:04BD E0 00 ld (ff00+00),a ROM0:04BF F0 00 ld a,(ff00+00) ROM0:04C1 F0 00 ld a,(ff00+00) ROM0:04C3 F0 00 ld a,(ff00+00) ROM0:04C5 F0 00 ld a,(ff00+00) ROM0:04C7 F0 00 ld a,(ff00+00) ROM0:04C9 F0 00 ld a,(ff00+00) ROM0:04CB 2F cpl ROM0:04CC E6 0F and a,0F ROM0:04CE B0 or b ROM0:04CF 4F ld c,a ROM0:04D0 FA A7 C5 ld a,(C5A7) ROM0:04D3 57 ld d,a ROM0:04D4 A9 xor c ROM0:04D5 A1 and c ROM0:04D6 EA A8 C5 ld (C5A8),a ROM0:04D9 79 ld a,c ROM0:04DA EA A7 C5 ld (C5A7),a ;wC5A7 = c ROM0:04DD 3E 30 ld a,30 ROM0:04DF E0 00 ld (ff00+00),a ROM0:04E1 FA A7 C5 ld a,(C5A7) ROM0:04E4 BA cp d ROM0:04E5 20 19 jr nz,0500 ROM0:04E7 3E 00 ld a,00 ROM0:04E9 EA A9 C5 ld (C5A9),a ;wC5A9 = 0 ROM0:04EC FA AA C5 ld a,(C5AA) ROM0:04EF 3D dec a ROM0:04F0 EA AA C5 ld (C5AA),a ROM0:04F3 20 09 jr nz,04FE ROM0:04F5 3E 03 ld a,03 ROM0:04F7 EA AA C5 ld (C5AA),a ;wC5AA = 3 ROM0:04FA 7A ld a,d ROM0:04FB EA A9 C5 ld (C5A9),a ;wC5A9 = d ROM0:04FE 18 08 jr 0508 ;jump to 0:0508 (pop registers af bc de, and exit this function) ROM0:0500 EA A9 C5 ld (C5A9),a ROM0:0503 3E 14 ld a,14 ROM0:0505 EA AA C5 ld (C5AA),a ;wC5AA = 0x14 ; 0d20 ROM0:0508 D1 pop de ROM0:0509 C1 pop bc ROM0:050A F1 pop af ROM0:050B C9 ret
0:0F87
ROM0:0F87 F5 push af ROM0:0F88 C5 push bc ROM0:0F89 E5 push hl ROM0:0F8A EA AE C5 ld (C5AE),a ROM0:0F8D 4F ld c,a ROM0:0F8E 06 00 ld b,00 ROM0:0F90 21 A4 0F ld hl,0FA4 ROM0:0F93 09 add hl,bc ROM0:0F94 2A ldi a,(hl) ROM0:0F95 66 ld h,(hl) ROM0:0F96 6F ld l,a ROM0:0F97 01 9C 0F ld bc,0F9C ROM0:0F9A C5 push bc ROM0:0F9B E9 jp hl ROM0:0F9C AF xor a ROM0:0F9D EA AD C5 ld (C5AD),a ROM0:0FA0 E1 pop hl ROM0:0FA1 C1 pop bc ROM0:0FA2 F1 pop af ROM0:0FA3 C9 ret
0:0FA4 (pointers array)
ROM0:0FA4 C4 0F - ret C4 0F - ret C4 0F - ret C5 0F - C4 0F - ret EA 0F - 47 10 - 7C 10 - E1 10 - 0E 11 - 43 11 - C4 0F - ret C4 0F - ret 60 11 - ret 61 11 - 6E 11 -
0:0FC4 (ret)
ROM0:0FC4 C9 ret
0:0FC5
ROM0:0FC5 F5 push af ROM0:0FC6 E5 push hl ROM0:0FC7 21 00 C1 ld hl,C100 ROM0:0FCA 3E 02 ld a,02 ROM0:0FCC 22 ldi (hl),a ROM0:0FCD 36 C1 ld (hl),C1 ROM0:0FCF 21 16 C1 ld hl,C116 ROM0:0FD2 3E 18 ld a,18 ROM0:0FD4 22 ldi (hl),a ROM0:0FD5 36 C1 ld (hl),C1 ROM0:0FD7 21 2C C1 ld hl,C12C ROM0:0FDA 3E 2E ld a,2E ROM0:0FDC 22 ldi (hl),a ROM0:0FDD 36 C1 ld (hl),C1 ROM0:0FDF 21 42 C1 ld hl,C142 ROM0:0FE2 3E 42 ld a,42 ROM0:0FE4 22 ldi (hl),a ROM0:0FE5 36 C1 ld (hl),C1 ROM0:0FE7 E1 pop hl ROM0:0FE8 F1 pop af ROM0:0FE9 C9 ret
0:0FEA
ROM0:0FEA F5 push af ROM0:0FEB E5 push hl ROM0:0FEC 21 00 C1 ld hl,C100 ROM0:0FEF 3E 02 ld a,02 ROM0:0FF1 22 ldi (hl),a ROM0:0FF2 36 C1 ld (hl),C1 ROM0:0FF4 21 64 C1 ld hl,C164 ROM0:0FF7 3E 66 ld a,66 ROM0:0FF9 22 ldi (hl),a ROM0:0FFA 36 C1 ld (hl),C1 ROM0:0FFC 21 6E C1 ld hl,C16E ROM0:0FFF 3E 70 ld a,70 ROM0:1001 22 ldi (hl),a ROM0:1002 36 C1 ld (hl),C1 ROM0:1004 21 78 C1 ld hl,C178 ROM0:1007 3E 7A ld a,7A ROM0:1009 22 ldi (hl),a ROM0:100A 36 C1 ld (hl),C1 ROM0:100C 21 82 C1 ld hl,C182 ROM0:100F 3E 84 ld a,84 ROM0:1011 22 ldi (hl),a ROM0:1012 36 C1 ld (hl),C1 ROM0:1014 21 8C C1 ld hl,C18C ROM0:1017 3E 8E ld a,8E ROM0:1019 22 ldi (hl),a ROM0:101A 36 C1 ld (hl),C1 ROM0:101C 21 96 C1 ld hl,C196 ROM0:101F 3E 98 ld a,98 ROM0:1021 22 ldi (hl),a ROM0:1022 36 C1 ld (hl),C1 ROM0:1024 21 A0 C1 ld hl,C1A0 ROM0:1027 3E A2 ld a,A2 ROM0:1029 22 ldi (hl),a ROM0:102A 36 C1 ld (hl),C1 ROM0:102C 21 AA C1 ld hl,C1AA ROM0:102F 3E AC ld a,AC ROM0:1031 22 ldi (hl),a ROM0:1032 36 C1 ld (hl),C1 ROM0:1034 21 B4 C1 ld hl,C1B4 ROM0:1037 3E B6 ld a,B6 ROM0:1039 22 ldi (hl),a ROM0:103A 36 C1 ld (hl),C1 ROM0:103C 21 BE C1 ld hl,C1BE ROM0:103F 3E C0 ld a,C0 ROM0:1041 22 ldi (hl),a ROM0:1042 36 C1 ld (hl),C1 ROM0:1044 E1 pop hl ROM0:1045 F1 pop af ROM0:1046 C9 ret
0:1047
ROM0:1047 F5 push af ROM0:1048 E5 push hl ROM0:1049 21 00 C1 ld hl,C100 ROM0:104C 3E 02 ld a,02 ROM0:104E 22 ldi (hl),a ROM0:104F 36 C1 ld (hl),C1 ROM0:1051 21 14 C1 ld hl,C114 ROM0:1054 3E 16 ld a,16 ROM0:1056 22 ldi (hl),a ROM0:1057 36 C1 ld (hl),C1 ROM0:1059 21 28 C1 ld hl,C128 ROM0:105C 3E 2A ld a,2A ROM0:105E 22 ldi (hl),a ROM0:105F 36 C1 ld (hl),C1 ROM0:1061 21 3A C1 ld hl,C13A ROM0:1064 3E 02 ld a,02 ROM0:1066 22 ldi (hl),a ROM0:1067 36 C1 ld (hl),C1 ROM0:1069 21 4E C1 ld hl,C14E ROM0:106C 3E 50 ld a,50 ROM0:106E 22 ldi (hl),a ROM0:106F 36 C1 ld (hl),C1 ROM0:1071 21 62 C1 ld hl,C162 ROM0:1074 3E 64 ld a,64 ROM0:1076 22 ldi (hl),a ROM0:1077 36 C1 ld (hl),C1 ROM0:1079 E1 pop hl ROM0:107A F1 pop af ROM0:107B C9 ret
0:107C
ROM0:107C F5 push af ROM0:107D E5 push hl ROM0:107E 21 00 C1 ld hl,C100 ROM0:1081 3E 02 ld a,02 ROM0:1083 22 ldi (hl),a ROM0:1084 36 C1 ld (hl),C1 ROM0:1086 21 0A C1 ld hl,C10A ROM0:1089 3E 0C ld a,0C ROM0:108B 22 ldi (hl),a ROM0:108C 36 C1 ld (hl),C1 ROM0:108E 21 14 C1 ld hl,C114 ROM0:1091 3E 16 ld a,16 ROM0:1093 22 ldi (hl),a ROM0:1094 36 C1 ld (hl),C1 ROM0:1096 21 1A C1 ld hl,C11A ROM0:1099 3E 1C ld a,1C ROM0:109B 22 ldi (hl),a ROM0:109C 36 C1 ld (hl),C1 ROM0:109E 21 20 C1 ld hl,C120 ROM0:10A1 3E 22 ld a,22 ROM0:10A3 22 ldi (hl),a ROM0:10A4 36 C1 ld (hl),C1 ROM0:10A6 21 26 C1 ld hl,C126 ROM0:10A9 3E 28 ld a,28 ROM0:10AB 22 ldi (hl),a ROM0:10AC 36 C1 ld (hl),C1 ROM0:10AE 21 2C C1 ld hl,C12C ROM0:10B1 3E 2E ld a,2E ROM0:10B3 22 ldi (hl),a ROM0:10B4 36 C1 ld (hl),C1 ROM0:10B6 21 36 C1 ld hl,C136 ROM0:10B9 3E 38 ld a,38 ROM0:10BB 22 ldi (hl),a ROM0:10BC 36 C1 ld (hl),C1 ROM0:10BE 21 40 C1 ld hl,C140 ROM0:10C1 3E 42 ld a,42 ROM0:10C3 22 ldi (hl),a ROM0:10C4 36 C1 ld (hl),C1 ROM0:10C6 21 4A C1 ld hl,C14A ROM0:10C9 3E 4C ld a,4C ROM0:10CB 22 ldi (hl),a ROM0:10CC 36 C1 ld (hl),C1 ROM0:10CE 21 54 C1 ld hl,C154 ROM0:10D1 3E 56 ld a,56 ROM0:10D3 22 ldi (hl),a ROM0:10D4 36 C1 ld (hl),C1 ROM0:10D6 21 5E C1 ld hl,C15E ROM0:10D9 3E 60 ld a,60 ROM0:10DB 22 ldi (hl),a ROM0:10DC 36 C1 ld (hl),C1 ROM0:10DE E1 pop hl ROM0:10DF F1 pop af ROM0:10E0 C9 ret
0:10E1
ROM0:10E1 F5 push af ROM0:10E2 E5 push hl ROM0:10E3 21 00 C1 ld hl,C100 ROM0:10E6 3E 02 ld a,02 ROM0:10E8 22 ldi (hl),a ROM0:10E9 36 C1 ld (hl),C1 ROM0:10EB 21 14 C1 ld hl,C114 ROM0:10EE 3E 16 ld a,16 ROM0:10F0 22 ldi (hl),a ROM0:10F1 36 C1 ld (hl),C1 ROM0:10F3 21 28 C1 ld hl,C128 ROM0:10F6 3E 2A ld a,2A ROM0:10F8 22 ldi (hl),a ROM0:10F9 36 C1 ld (hl),C1 ROM0:10FB 21 3C C1 ld hl,C13C ROM0:10FE 3E 3E ld a,3E ROM0:1100 22 ldi (hl),a ROM0:1101 36 C1 ld (hl),C1 ROM0:1103 21 50 C1 ld hl,C150 ROM0:1106 3E 52 ld a,52 ROM0:1108 22 ldi (hl),a ROM0:1109 36 C1 ld (hl),C1 ROM0:110B E1 pop hl ROM0:110C F1 pop af ROM0:110D C9 ret
0:110E
ROM0:110E F5 push af ROM0:110F E5 push hl ROM0:1110 21 00 C1 ld hl,C100 ROM0:1113 3E DE ld a,DE ROM0:1115 22 ldi (hl),a ROM0:1116 36 C1 ld (hl),C1 ROM0:1118 21 06 C1 ld hl,C106 ROM0:111B 3E DE ld a,DE ROM0:111D 22 ldi (hl),a ROM0:111E 36 C1 ld (hl),C1 ROM0:1120 21 0C C1 ld hl,C10C ROM0:1123 3E DE ld a,DE ROM0:1125 22 ldi (hl),a ROM0:1126 36 C1 ld (hl),C1 ROM0:1128 21 12 C1 ld hl,C112 ROM0:112B 3E DE ld a,DE ROM0:112D 22 ldi (hl),a ROM0:112E 36 C1 ld (hl),C1 ROM0:1130 21 18 C1 ld hl,C118 ROM0:1133 3E DE ld a,DE ROM0:1135 22 ldi (hl),a ROM0:1136 36 C1 ld (hl),C1 ROM0:1138 21 1E C1 ld hl,C11E ROM0:113B 3E DE ld a,DE ROM0:113D 22 ldi (hl),a ROM0:113E 36 C1 ld (hl),C1 ROM0:1140 E1 pop hl ROM0:1141 F1 pop af ROM0:1142 C9 ret
0:1143
ROM0:1143 F5 push af ROM0:1144 E5 push hl ROM0:1145 21 00 C1 ld hl,C100 ROM0:1148 3E 02 ld a,02 ROM0:114A 22 ldi (hl),a ROM0:114B 36 C1 ld (hl),C1 ROM0:114D 21 0A C1 ld hl,C10A ROM0:1150 3E 0C ld a,0C ROM0:1152 22 ldi (hl),a ROM0:1153 36 C1 ld (hl),C1 ROM0:1155 21 8C C1 ld hl,C18C ROM0:1158 3E 8E ld a,8E ROM0:115A 22 ldi (hl),a ROM0:115B 36 C1 ld (hl),C1 ROM0:115D E1 pop hl ROM0:115E F1 pop af ROM0:115F C9 ret
0:1160 (ret)
ROM0:1160 C9 ret
0:1161
ROM0:1161 F5 push af ROM0:1162 E5 push hl ROM0:1163 21 00 C1 ld hl,C100 ROM0:1166 3E 02 ld a,02 ROM0:1168 22 ldi (hl),a ROM0:1169 36 C1 ld (hl),C1 ROM0:116B E1 pop hl ROM0:116C F1 pop af ROM0:116D C9 ret
0:116E
ROM0:116E F5 push af ROM0:116F E5 push hl ROM0:1170 3E D0 ld a,D0 ROM0:1172 EA B0 C5 ld (C5B0),a ROM0:1175 3E 00 ld a,00 ROM0:1177 EA B1 C5 ld (C5B1),a ROM0:117A E1 pop hl ROM0:117B F1 pop af ROM0:117C C9 ret
0:117D
ROM0:117D F5 push af ROM0:117E FA AE C5 ld a,(C5AE) ROM0:1181 EA AF C5 ld (C5AF),a ROM0:1184 3E 00 ld a,00 ROM0:1186 EA AE C5 ld (C5AE),a ROM0:1189 CD 07 12 call 1207 ROM0:118C F1 pop af ROM0:118D C9 ret
0:118E
ROM0:118E F5 push af ROM0:118F E5 push hl ROM0:1190 FA AE C5 ld a,(C5AE) ROM0:1193 FE 1A cp a,1A ROM0:1195 20 0A jr nz,11A1 ROM0:1197 78 ld a,b ROM0:1198 EA B2 C5 ld (C5B2),a ROM0:119B 79 ld a,c ROM0:119C EA B3 C5 ld (C5B3),a ROM0:119F 18 1C jr 11BD ROM0:11A1 FE 1E cp a,1E ROM0:11A3 20 0A jr nz,11AF ROM0:11A5 78 ld a,b ROM0:11A6 EA B2 C5 ld (C5B2),a ROM0:11A9 79 ld a,c ROM0:11AA EA B3 C5 ld (C5B3),a ROM0:11AD 18 0E jr 11BD ROM0:11AF 26 C1 ld h,C1 ROM0:11B1 FA AD C5 ld a,(C5AD) ROM0:11B4 6F ld l,a ROM0:11B5 79 ld a,c ROM0:11B6 22 ldi (hl),a ROM0:11B7 78 ld a,b ROM0:11B8 22 ldi (hl),a ROM0:11B9 7D ld a,l ROM0:11BA EA AD C5 ld (C5AD),a ROM0:11BD E1 pop hl ROM0:11BE F1 pop af ROM0:11BF C9 ret
0:11C0
ROM0:11C0 F5 push af ROM0:11C1 78 ld a,b ROM0:11C2 EA B0 C5 ld (C5B0),a ROM0:11C5 79 ld a,c ROM0:11C6 EA B1 C5 ld (C5B1),a ROM0:11C9 F1 pop af ROM0:11CA C9 ret
0:11CB - Store accumulator in (C5B4)
ROM0:11CB EA B4 C5 ld (C5B4),a ROM0:11CE C9 ret
0:11CF
ROM0:11CF F5 push af ROM0:11D0 E5 push hl ROM0:11D1 F5 push af ROM0:11D2 26 C1 ld h,C1 ROM0:11D4 FA AD C5 ld a,(C5AD) ROM0:11D7 6F ld l,a ROM0:11D8 F1 pop af ROM0:11D9 22 ldi (hl),a ROM0:11DA 7D ld a,l ROM0:11DB EA AD C5 ld (C5AD),a ROM0:11DE E1 pop hl ROM0:11DF F1 pop af ROM0:11E0 C9 ret
0:11E1
ROM0:11E1 F5 push af ROM0:11E2 E5 push hl ROM0:11E3 26 C1 ld h,C1 ROM0:11E5 FA AD C5 ld a,(C5AD) ROM0:11E8 6F ld l,a ROM0:11E9 CD 11 02 call 0211 ROM0:11EC 7D ld a,l ROM0:11ED EA AD C5 ld (C5AD),a ROM0:11F0 E1 pop hl ROM0:11F1 F1 pop af ROM0:11F2 C9 ret
0:11F3
ROM0:11F3 F5 push af ROM0:11F4 E5 push hl ROM0:11F5 21 00 C1 ld hl,C100 ROM0:11F8 CD 11 02 call 0211 ROM0:11FB CD 11 02 call 0211 ROM0:11FE CD 11 02 call 0211 ROM0:1201 CD 11 02 call 0211 ROM0:1204 E1 pop hl ROM0:1205 F1 pop af ROM0:1206 C9 ret
0:1207 (Wait until the player can press a button ?)
ROM0:1207 F5 push af ROM0:1208 AF xor a ROM0:1209 EA AC C5 ld (C5AC),a ROM0:120C FA AC C5 ld a,(C5AC) ROM0:120F B7 or a ROM0:1210 28 FA jr z,120C ROM0:1212 F1 pop af ROM0:1213 C9 ret
0:1214
ROM0:1214 F5 push af ROM0:1215 C5 push bc ROM0:1216 0E 0A ld c,0A ROM0:1218 CD 07 12 call 1207 ROM0:121B 0D dec c ROM0:121C 20 FA jr nz,1218 ROM0:121E C1 pop bc ROM0:121F F1 pop af ROM0:1220 C9 ret
0:1221
ROM0:1221 F5 push af ROM0:1222 E5 push hl ROM0:1223 AF xor a ROM0:1224 EA B5 C5 ld (C5B5),a ROM0:1227 EA B6 C5 ld (C5B6),a ROM0:122A EA B7 C5 ld (C5B7),a ROM0:122D CD 41 12 call 1241 ROM0:1230 FE 01 cp a,01 ROM0:1232 28 06 jr z,123A ROM0:1234 FA A2 C5 ld a,(C5A2) ROM0:1237 B7 or a ROM0:1238 28 F3 jr z,122D ROM0:123A AF xor a ROM0:123B EA A2 C5 ld (C5A2),a ROM0:123E E1 pop hl ROM0:123F F1 pop af ROM0:1240 C9 ret
0:1241
ROM0:1241 FA B5 C5 ld a,(C5B5) ROM0:1244 C6 01 add a,01 ROM0:1246 EA B5 C5 ld (C5B5),a ROM0:1249 FA B6 C5 ld a,(C5B6) ROM0:124C CE 00 adc a,00 ROM0:124E EA B6 C5 ld (C5B6),a ROM0:1251 FE FF cp a,FF ROM0:1253 20 07 jr nz,125C ROM0:1255 CD 59 1B call 1B59 ROM0:1258 3E 01 ld a,01 ROM0:125A 18 01 jr 125D ROM0:125C AF xor a ROM0:125D C9 ret
Banks and Interrupts handling
Initialize Banks
ROM0:12AB F5 push af ROM0:12AC 3E 01 ld a,01 ROM0:12AE EA 00 20 ld (2000),a ;ROM Bank = 1 ROM0:12B1 AF xor a ROM0:12B2 EA 00 30 ld (3000),a ;ROM Bank (High) = 0 ROM0:12B5 EA 00 40 ld (4000),a ;RAM Bank = 0 ROM0:12B8 E0 4F ld (ff00+4F),a ;VRAM Bank = 0 ROM0:12BA F1 pop af ROM0:12BB C9 ret
ROM Bank switch
- 0x12BC-0x12BF - ROM Bank switch
ROM0:12BC EA 00 20 ld (2000),a ROM0:12BF C9 ret
- 0x12C0-0x12CC - ROM Bank switch, two bytes
ROM0:12C0 F5 push af ROM0:12C1 F3 di ROM0:12C2 79 ld a,c ROM0:12C3 EA 00 20 ld (2000),a ;Low ROM0:12C6 78 ld a,b ROM0:12C7 EA 00 30 ld (3000),a ;High ROM0:12CA FB ei ROM0:12CB F1 pop af ROM0:12CC C9 ret
VRAM Bank switch
- 0x12CD-0x12D2 - VRAM bank 0
ROM0:12CD F5 push af ROM0:12CE AF xor a ROM0:12CF E0 4F ld (ff00+4F),a ROM0:12D1 F1 pop af ROM0:12D2 C9 ret
- 0x12D3-0x12D9 - VRAM bank 1
ROM0:12D3 F5 push af ROM0:12D4 3E 01 ld a,01 ROM0:12D6 E0 4F ld (ff00+4F),a ROM0:12D8 F1 pop af ROM0:12D9 C9 ret
- 0x12DA-0x12DF - VRAM bank 0 (initialize)
ROM0:12DA F5 push af ROM0:12DB AF xor a ROM0:12DC E0 4F ld (ff00+4F),a ROM0:12DE F1 pop af ROM0:12DF C9 ret
WRAM Bank switch
- 0x12E0-0x1303 - WRAM Bank switch
ROM0:12E0 F5 push af ROM0:12E1 E8 FF add sp,FF ROM0:12E3 E5 push hl ROM0:12E4 C5 push bc ROM0:12E5 D5 push de ROM0:12E6 4F ld c,a ROM0:12E7 F8 06 ld hl,sp+06 ROM0:12E9 54 ld d,h ROM0:12EA 5D ld e,l ROM0:12EB F8 07 ld hl,sp+07 ROM0:12ED 2A ldi a,(hl) ROM0:12EE 12 ld (de),a ROM0:12EF 13 inc de ROM0:12F0 2A ldi a,(hl) ROM0:12F1 12 ld (de),a ROM0:12F2 13 inc de ROM0:12F3 2A ldi a,(hl) ROM0:12F4 12 ld (de),a ROM0:12F5 13 inc de ROM0:12F6 2A ldi a,(hl) ROM0:12F7 12 ld (de),a ROM0:12F8 13 inc de ROM0:12F9 F0 70 ld a,(ff00+70) ROM0:12FB 12 ld (de),a ROM0:12FC 79 ld a,c ROM0:12FD E0 70 ld (ff00+70),a ;SVBK ROM0:12FF D1 pop de ROM0:1300 C1 pop bc ROM0:1301 E1 pop hl ROM0:1302 F1 pop af ROM0:1303 C9 ret
WRAM Bank restore
ROM0:1304 F5 push af ROM0:1305 E5 push hl ROM0:1306 C5 push bc ROM0:1307 F8 08 ld hl,sp+08 ROM0:1309 7E ld a,(hl) ROM0:130A E0 70 ld (ff00+70),a ;SVBK ROM0:130C 44 ld b,h ROM0:130D 4D ld c,l ROM0:130E 0B dec bc ROM0:130F 0A ld a,(bc) ROM0:1310 32 ldd (hl),a ROM0:1311 0B dec bc ROM0:1312 0A ld a,(bc) ROM0:1313 32 ldd (hl),a ROM0:1314 0B dec bc ROM0:1315 0A ld a,(bc) ROM0:1316 32 ldd (hl),a ROM0:1317 0B dec bc ROM0:1318 0A ld a,(bc) ROM0:1319 32 ldd (hl),a ROM0:131A C1 pop bc ROM0:131B E1 pop hl ROM0:131C E8 01 add sp,01 ROM0:131E F1 pop af ROM0:131F C9 ret
Division
- 0x1490-0x14C5 - Divides register de by register bc, returns result in register de
ROM0:1490 F5 push af ROM0:1491 C5 push bc ROM0:1492 E5 push hl ROM0:1493 21 00 00 ld hl,0000 ROM0:1496 3E 10 ld a,10 ;Loop counter ROM0:1498 F5 push af ROM0:1499 CB 23 sla e ROM0:149B CB 12 rl d ;de << 1 ROM0:149D CB 15 rl l ROM0:149F CB 14 rl h ;hl << 1 ROM0:14A1 7C ld a,h ROM0:14A2 B8 cp b ROM0:14A3 38 19 jr c,14BE ;if(h < b), jump to 0:14BE ROM0:14A5 7C ld a,h ROM0:14A6 B8 cp b ROM0:14A7 20 0D jr nz,14B6 ;if(h ≠ b), jump to 0:1458 ROM0:14A9 7D ld a,l ROM0:14AA B9 cp c ROM0:14AB 38 07 jr c,14B4 ;if(l < c), jump to 0:1456 ROM0:14AD 91 sub c ;Handle carry ROM0:14AE 6F ld l,a ROM0:14AF 7C ld a,h ROM0:14B0 98 sbc b ;bc-- ROM0:14B1 67 ld h,a ROM0:14B2 CB C3 set 0,e ROM0:14B4 18 08 jr 14BE ROM0:14B6 7D ld a,l ROM0:14B7 91 sub c ROM0:14B8 6F ld l,a ROM0:14B9 7C ld a,h ROM0:14BA 98 sbc b ;bc -- ROM0:14BB 67 ld h,a ROM0:14BC CB C3 set 0,e ;Set bit 0 of register e to 1 ROM0:14BE F1 pop af ;pop iterations counter in accumulator ROM0:14BF 3D dec a ;a-- ROM0:14C0 20 D6 jr nz,1498 ;Loop 16 times ROM0:14C2 E1 pop hl ROM0:14C3 C1 pop bc ROM0:14C4 F1 pop af ROM0:14C5 C9 ret
0:16CB
ROM0:16CB C5 push bc ROM0:16CC CD D8 16 call 16D8 ROM0:16CF 4F ld c,a ROM0:16D0 7E ld a,(hl) ROM0:16D1 A1 and c ROM0:16D2 28 02 jr z,16D6 ROM0:16D4 3E 01 ld a,01 ROM0:16D6 C1 pop bc ROM0:16D7 C9 ret
Updates card zone
ROM0:19C8 F5 push af ROM0:19C9 C5 push bc ROM0:19CA E5 push hl ROM0:19CB CD 03 1A call 1A03 ROM0:19CE 60 ld h,b ROM0:19CF 69 ld l,c ROM0:19D0 FA DD C7 ld a,(C7DD) ROM0:19D3 22 ldi (hl),a ROM0:19D4 FA DE C7 ld a,(C7DE) ROM0:19D7 22 ldi (hl),a ROM0:19D8 FA DF C7 ld a,(C7DF) ROM0:19DB 22 ldi (hl),a ROM0:19DC E1 pop hl ROM0:19DD C1 pop bc ROM0:19DE F1 pop af ROM0:19DF C9 ret
Retrieves card zone pointer
ROM0:1A03 F5 push af ROM0:1A04 E5 push hl ROM0:1A05 06 00 ld b,00 ROM0:1A07 FA DC C7 ld a,(C7DC) ROM0:1A0A 4F ld c,a ROM0:1A0B CB 21 sla c ROM0:1A0D 21 2B 1A ld hl,1A2B ROM0:1A10 09 add hl,bc ROM0:1A11 2A ldi a,(hl) ROM0:1A12 66 ld h,(hl) ROM0:1A13 6F ld l,a ROM0:1A14 E5 push hl ROM0:1A15 06 00 ld b,00 ROM0:1A17 FA DB C7 ld a,(C7DB) ROM0:1A1A 4F ld c,a ROM0:1A1B CB 21 sla c ROM0:1A1D 21 33 1A ld hl,1A33 ROM0:1A20 09 add hl,bc ROM0:1A21 2A ldi a,(hl) ROM0:1A22 46 ld b,(hl) ROM0:1A23 4F ld c,a ROM0:1A24 E1 pop hl ROM0:1A25 09 add hl,bc ROM0:1A26 44 ld b,h ROM0:1A27 4D ld c,l ROM0:1A28 E1 pop hl ROM0:1A29 F1 pop af ROM0:1A2A C9 ret
Card zone pointer offset array
ROM0:1A33 00 00 03 00 06 00 09 00 0C 00 0F 00
Checks if bc ≠ 0
0x1A3F-0x1A50
- Returns 0 if bc ≠ 0, returns 1 otherwise.
ROM0:1A3F D5 push de ROM0:1A40 1E 00 ld e,00 ROM0:1A42 78 ld a,b ROM0:1A43 FE 00 cp a,00 ROM0:1A45 20 07 jr nz,1A4E ROM0:1A47 79 ld a,c ROM0:1A48 FE 00 cp a,00 ROM0:1A4A 20 02 jr nz,1A4E ROM0:1A4C 1E 01 ld e,01 ROM0:1A4E 7B ld a,e ROM0:1A4F D1 pop de ROM0:1A50 C9 ret
0:1A51 (card ID validity ?)
ROM0:1A51 C5 push bc ROM0:1A52 D5 push de ROM0:1A53 E5 push hl ROM0:1A54 11 00 00 ld de,0000 ROM0:1A57 CD 86 1A call 1A86 ROM0:1A5A FE 01 cp a,01 ROM0:1A5C 20 04 jr nz,1A62 ROM0:1A5E 0E 00 ld c,00 ROM0:1A60 18 10 jr 1A72 ROM0:1A62 11 85 03 ld de,0385 ;de = 0d901 ROM0:1A65 CD 86 1A call 1A86 ROM0:1A68 FE 01 cp a,01 ROM0:1A6A 20 04 jr nz,1A70 ROM0:1A6C 0E 03 ld c,03 ROM0:1A6E 18 02 jr 1A72 ROM0:1A70 0E 01 ld c,01 ROM0:1A72 79 ld a,c ROM0:1A73 E1 pop hl ROM0:1A74 D1 pop de ROM0:1A75 C1 pop bc ROM0:1A76 C9 ret
0:1A77
ROM0:1A77 E5 push hl ROM0:1A78 2E 01 ld l,01 ROM0:1A7A 78 ld a,b ROM0:1A7B BA cp d ROM0:1A7C 20 05 jr nz,1A83 ROM0:1A7E 79 ld a,c ROM0:1A7F BB cp e ROM0:1A80 20 01 jr nz,1A83 ROM0:1A82 2D dec l ROM0:1A83 7D ld a,l ROM0:1A84 E1 pop hl ROM0:1A85 C9 ret
0:1A86
ROM0:1A86 C5 push bc ROM0:1A87 D5 push de ROM0:1A88 E5 push hl ROM0:1A89 2E 02 ld l,02 ROM0:1A8B CD F0 14 call 14F0 ROM0:1A8E 7B ld a,e ROM0:1A8F FE 01 cp a,01 ROM0:1A91 20 02 jr nz,1A95 ROM0:1A93 2E 01 ld l,01 ROM0:1A95 7B ld a,e ROM0:1A96 FE 00 cp a,00 ROM0:1A98 20 02 jr nz,1A9C ROM0:1A9A 2E 00 ld l,00 ROM0:1A9C 7D ld a,l ROM0:1A9D E1 pop hl ROM0:1A9E D1 pop de ROM0:1A9F C1 pop bc ROM0:1AA0 C9 ret
0:1AA1 - Copy wC7E0-wC7E5 to wC5E7-wC5EC
ROM0:1AA1 D5 push de ROM0:1AA2 E5 push hl ROM0:1AA3 2E 02 ld l,02 ROM0:1AA5 FA E0 C7 ld a,(C7E0) ROM0:1AA8 EA E7 C5 ld (C5E7),a ROM0:1AAB FA E1 C7 ld a,(C7E1) ROM0:1AAE EA E8 C5 ld (C5E8),a ROM0:1AB1 FA E2 C7 ld a,(C7E2) ROM0:1AB4 EA E9 C5 ld (C5E9),a ROM0:1AB7 FA E3 C7 ld a,(C7E3) ROM0:1ABA EA EA C5 ld (C5EA),a ROM0:1ABD FA E4 C7 ld a,(C7E4) ROM0:1AC0 EA EB C5 ld (C5EB),a ROM0:1AC3 FA E5 C7 ld a,(C7E5) ROM0:1AC6 EA EC C5 ld (C5EC),a ROM0:1AC9 CD 10 15 call 1510 ROM0:1ACC 7B ld a,e ROM0:1ACD FE 01 cp a,01 ROM0:1ACF 20 02 jr nz,1AD3 ROM0:1AD1 2E 01 ld l,01 ROM0:1AD3 7B ld a,e ROM0:1AD4 FE 00 cp a,00 ROM0:1AD6 20 02 jr nz,1ADA ROM0:1AD8 2E 00 ld l,00 ROM0:1ADA 7D ld a,l ROM0:1ADB E1 pop hl ROM0:1ADC D1 pop de ROM0:1ADD C9 ret
0:1ADE
ROM0:1ADE F5 push af ROM0:1ADF C5 push bc ROM0:1AE0 D5 push de ROM0:1AE1 E5 push hl ROM0:1AE2 3E 00 ld a,00 ROM0:1AE4 EA A4 C5 ld (C5A4),a ;Store 0 in wC5A4 ROM0:1AE7 3E 00 ld a,00 ROM0:1AE9 EA E6 C7 ld (C7E6),a ;Store 0 in wC7E6 ROM0:1AEC CD F1 1D call 1DF1 ;00s wC8AA-wC8AB ROM0:1AEF 11 FE FE ld de,FEFE ROM0:1AF2 FA A6 C5 ld a,(C5A6) ROM0:1AF5 FE 10 cp a,10 ROM0:1AF7 20 1D jr nz,1B16 ROM0:1AF9 3E 30 ld a,30 ROM0:1AFB CD 57 04 call 0457 ROM0:1AFE CD 07 12 call 1207 ROM0:1B01 FA A4 C5 ld a,(C5A4) ROM0:1B04 E6 F0 and a,F0 ROM0:1B06 FE 40 cp a,40 ROM0:1B08 20 0A jr nz,1B14 ROM0:1B0A CD 3C 1B call 1B3C ROM0:1B0D 3E 01 ld a,01 ROM0:1B0F EA E6 C7 ld (C7E6),a ROM0:1B12 18 23 jr 1B37 ROM0:1B14 18 0F jr 1B25 ROM0:1B16 3E 40 ld a,40 ROM0:1B18 CD 7F 04 call 047F ROM0:1B1B 3E 01 ld a,01 ROM0:1B1D EA E6 C7 ld (C7E6),a ROM0:1B20 CD 21 12 call 1221 ROM0:1B23 18 12 jr 1B37 ROM0:1B25 1D dec e ROM0:1B26 20 0D jr nz,1B35 ROM0:1B28 15 dec d ROM0:1B29 7A ld a,d ROM0:1B2A FE FF cp a,FF ROM0:1B2C 20 07 jr nz,1B35 ROM0:1B2E 3E 02 ld a,02 ROM0:1B30 EA E6 C7 ld (C7E6),a ROM0:1B33 18 02 jr 1B37 ROM0:1B35 18 BB jr 1AF2 ROM0:1B37 E1 pop hl ROM0:1B38 D1 pop de ROM0:1B39 C1 pop bc ROM0:1B3A F1 pop af ROM0:1B3B C9 ret
0:1DF1 - 00s wC8AA-wC8AB
ROM0:1DF1 F5 push af ROM0:1DF2 AF xor a ROM0:1DF3 EA AA C8 ld (C8AA),a ROM0:1DF6 EA AB C8 ld (C8AB),a ROM0:1DF9 F1 pop af ROM0:1DFA C9 ret
Main PRNG
0:1DFB
ROM0:1DFB F5 push af ROM0:1DFC C5 push bc ROM0:1DFD D5 push de ROM0:1DFE E5 push hl ROM0:1DFF 21 FF FF ld hl,FFFF ROM0:1E02 CB 96 res 2,(hl) ROM0:1E04 21 07 FF ld hl,FF07 ROM0:1E07 CB 96 res 2,(hl) ROM0:1E09 3E 01 ld a,01 ROM0:1E0B E0 06 ld (ff00+06),a ROM0:1E0D E0 05 ld (ff00+05),a ROM0:1E0F CB D6 set 2,(hl) ROM0:1E11 06 00 ld b,00 ROM0:1E13 21 AD C8 ld hl,C8AD ROM0:1E16 0E 04 ld c,04 ROM0:1E18 F0 05 ld a,(ff00+05) ROM0:1E1A 22 ldi (hl),a ROM0:1E1B FE 00 cp a,00 ROM0:1E1D 28 01 jr z,1E20 ROM0:1E1F 04 inc b ROM0:1E20 0D dec c ROM0:1E21 20 F5 jr nz,1E18 ROM0:1E23 78 ld a,b ROM0:1E24 FE 00 cp a,00 ROM0:1E26 20 05 jr nz,1E2D ROM0:1E28 3E 01 ld a,01 ROM0:1E2A EA AD C8 ld (C8AD),a ROM0:1E2D CD 41 1E call 1E41 ;PRNG advance ROM0:1E30 CD 41 1E call 1E41 ;PRNG advance ROM0:1E33 CD 41 1E call 1E41 ;PRNG advance ROM0:1E36 CD 41 1E call 1E41 ;PRNG advance ROM0:1E39 CD 41 1E call 1E41 ;PRNG advance ROM0:1E3C E1 pop hl ROM0:1E3D D1 pop de ROM0:1E3E C1 pop bc ROM0:1E3F F1 pop af ROM0:1E40 C9 ret
PRNG advance
ROM0:1E41 F5 push af ROM0:1E42 C5 push bc ROM0:1E43 D5 push de ROM0:1E44 FA B0 C8 ld a,(C8B0) ROM0:1E47 47 ld b,a ROM0:1E48 4F ld c,a ROM0:1E49 FA AF C8 ld a,(C8AF) ROM0:1E4C CB 19 rr c ROM0:1E4E 1F rra ROM0:1E4F CB 1A rr d ROM0:1E51 A8 xor b ROM0:1E52 CB 12 rl d ROM0:1E54 17 rla ROM0:1E55 CB 11 rl c ROM0:1E57 EA B0 C8 ld (C8B0),a ROM0:1E5A FA AE C8 ld a,(C8AE) ROM0:1E5D EA AF C8 ld (C8AF),a ROM0:1E60 FA AD C8 ld a,(C8AD) ROM0:1E63 EA AE C8 ld (C8AE),a ROM0:1E66 79 ld a,c ROM0:1E67 EA AD C8 ld (C8AD),a ROM0:1E6A EA B3 C8 ld (C8B3),a ROM0:1E6D D1 pop de ROM0:1E6E C1 pop bc ROM0:1E6F F1 pop af ROM0:1E70 C9 ret
Card Status
0:1EDD
ROM0:1EDD F5 push af ROM0:1EDE FA DF C7 ld a,(C7DF) ROM0:1EE1 E6 CF and a,CF ROM0:1EE3 F6 10 or a,10 ROM0:1EE5 EA DF C7 ld (C7DF),a ROM0:1EE8 F1 pop af ROM0:1EE9 C9 ret
0:1EDD
ROM0:1EEA FA DF C7 ld a,(C7DF) ROM0:1EED E6 30 and a,30 ROM0:1EEF CB 37 swap a ROM0:1EF1 C9 ret
0:1EDD
ROM0:1EF2 F5 push af ROM0:1EF3 FA DF C7 ld a,(C7DF) ROM0:1EF6 F6 40 or a,40 ROM0:1EF8 EA DF C7 ld (C7DF),a ROM0:1EFB F1 pop af ROM0:1EFC C9 ret
0:1EFD
ROM0:1EFD F5 push af ROM0:1EFE FA DF C7 ld a,(C7DF) ROM0:1F01 E6 BF and a,BF ROM0:1F03 EA DF C7 ld (C7DF),a ROM0:1F06 F1 pop af ROM0:1F07 C9 ret
0:1F08
ROM0:1F08 F5 push af ROM0:1F09 FA DF C7 ld a,(C7DF) ROM0:1F0C F6 08 or a,08 ROM0:1F0E EA DF C7 ld (C7DF),a ROM0:1F11 F1 pop af ROM0:1F12 C9 ret
0:1F13
ROM0:1F13 F5 push af ROM0:1F14 FA DF C7 ld a,(C7DF) ROM0:1F17 E6 F7 and a,F7 ROM0:1F19 EA DF C7 ld (C7DF),a ROM0:1F1C F1 pop af ROM0:1F1D C9 ret
0:1F1E
ROM0:1F1E F5 push af ROM0:1F1F FA DF C7 ld a,(C7DF) ROM0:1F22 F6 80 or a,80 ROM0:1F24 EA DF C7 ld (C7DF),a ROM0:1F27 F1 pop af ROM0:1F28 C9 ret
0:1F29
ROM0:1F29 F5 push af ROM0:1F2A FA DF C7 ld a,(C7DF) ROM0:1F2D E6 7F and a,7F ROM0:1F2F EA DF C7 ld (C7DF),a ROM0:1F32 F1 pop af ROM0:1F33 C9 ret
0:1F34
ROM0:1F34 F5 push af ROM0:1F35 FA DF C7 ld a,(C7DF) ROM0:1F38 E6 F8 and a,F8 ROM0:1F3A F6 00 or a,00 ROM0:1F3C EA DF C7 ld (C7DF),a ROM0:1F3F F1 pop af ROM0:1F40 C9 ret
0:1F41
ROM0:1F41 F5 push af ROM0:1F42 FA DF C7 ld a,(C7DF) ROM0:1F45 E6 F8 and a,F8 ROM0:1F47 F6 01 or a,01 ROM0:1F49 EA DF C7 ld (C7DF),a ROM0:1F4C F1 pop af ROM0:1F4D C9 ret
0:1F4E
ROM0:1F4E F5 push af ROM0:1F4F FA DF C7 ld a,(C7DF) ROM0:1F52 E6 F8 and a,F8 ROM0:1F54 F6 02 or a,02 ROM0:1F56 EA DF C7 ld (C7DF),a ROM0:1F59 F1 pop af ROM0:1F5A C9 ret
0:1F5B
ROM0:1F5B F5 push af ROM0:1F5C FA DF C7 ld a,(C7DF) ROM0:1F5F E6 F8 and a,F8 ROM0:1F61 F6 03 or a,03 ROM0:1F63 EA DF C7 ld (C7DF),a ROM0:1F66 F1 pop af ROM0:1F67 C9 ret
0:1F68
ROM0:1F68 FA DF C7 ld a,(C7DF) ROM0:1F6B E6 07 and a,07 ROM0:1F6D C9 ret
0:1F6E
ROM0:1F6E FA DF C7 ld a,(C7DF) ROM0:1F71 E6 40 and a,40 ROM0:1F73 28 02 jr z,1F77 ROM0:1F75 3E 01 ld a,01 ROM0:1F77 C9 ret
0:1F78
ROM0:1F78 FA DF C7 ld a,(C7DF) ROM0:1F7B E6 08 and a,08 ROM0:1F7D 28 02 jr z,1F81 ROM0:1F7F 3E 01 ld a,01 ROM0:1F81 C9 ret
0:1F82
ROM0:1F82 FA DF C7 ld a,(C7DF) ROM0:1F85 E6 10 and a,10 ROM0:1F87 28 02 jr z,1F8B ROM0:1F89 3E 01 ld a,01 ROM0:1F8B C9 ret
0:1F8C
ROM0:1F8C FA DF C7 ld a,(C7DF) ROM0:1F8F E6 80 and a,80 ROM0:1F91 28 02 jr z,1F95 ROM0:1F93 3E 01 ld a,01 ROM0:1F95 C9 ret
Destroy Player's card
ROM0:1F96 F5 push af ROM0:1F97 C5 push bc ROM0:1F98 CD 9D 19 call 199D ROM0:1F9B CD E0 19 call 19E0 ROM0:1F9E FA DD C7 ld a,(C7DD) // Current card ID ROM0:1FA1 4F ld c,a ROM0:1FA2 FA DE C7 ld a,(C7DE) ROM0:1FA5 47 ld b,a ROM0:1FA6 CD 8E 2D call 2D8E // Add card to Player's Graveyard ROM0:1FA9 CD B3 19 call 19B3 ROM0:1FAC C1 pop bc ROM0:1FAD F1 pop af ROM0:1FAE C9 ret
Destroy CPU's card
ROM0:1FAF F5 push af ROM0:1FB0 C5 push bc ROM0:1FB1 CD 9D 19 call 199D ROM0:1FB4 CD E0 19 call 19E0 ROM0:1FB7 FA DD C7 ld a,(C7DD) // Current card ID ROM0:1FBA 4F ld c,a ROM0:1FBB FA DE C7 ld a,(C7DE) ROM0:1FBE 47 ld b,a ROM0:1FBF CD AA 2D call 2DAA // Add card to CPU's Graveyard ROM0:1FC2 CD B3 19 call 19B3 ROM0:1FC5 C1 pop bc ROM0:1FC6 F1 pop af ROM0:1FC7 C9 ret
0:1FC8
ROM0:1FC8 C5 push bc ROM0:1FC9 CD 9D 19 call 199D ROM0:1FCC CD E0 19 call 19E0 ROM0:1FCF CD 6E 1F call 1F6E ROM0:1FD2 FE 00 cp a,00 ROM0:1FD4 20 08 jr nz,1FDE ROM0:1FD6 CD F2 1E call 1EF2 ROM0:1FD9 CD C8 19 call 19C8 ROM0:1FDC 18 06 jr 1FE4 ROM0:1FDE CD F2 1E call 1EF2 ROM0:1FE1 CD C8 19 call 19C8 ROM0:1FE4 C1 pop bc ROM0:1FE5 C9 ret
0:1FE6 (ret)
ROM0:1FE6 C9 ret
0:1FE7 (00s (C8D7) to (C8DC))
ROM0:1FE7 F5 push af ROM0:1FE8 3E 00 ld a,00 ROM0:1FEA EA D7 C8 ld (C8D7),a ROM0:1FED 3E 00 ld a,00 ROM0:1FEF EA D8 C8 ld (C8D8),a ROM0:1FF2 3E 00 ld a,00 ROM0:1FF4 EA D9 C8 ld (C8D9),a ROM0:1FF7 3E 00 ld a,00 ROM0:1FF9 EA DA C8 ld (C8DA),a ROM0:1FFC 3E 00 ld a,00 ROM0:1FFE EA DB C8 ld (C8DB),a ROM0:2001 3E 00 ld a,00 ROM0:2003 EA DC C8 ld (C8DC),a ROM0:2006 F1 pop af ROM0:2007 C9 ret
0:2008 (00s (C8D7) to (C8DC)) (sic)
ROM0:2008 F5 push af ROM0:2009 3E 00 ld a,00 ROM0:200B EA D7 C8 ld (C8D7),a ROM0:200E 3E 00 ld a,00 ROM0:2010 EA D8 C8 ld (C8D8),a ROM0:2013 3E 00 ld a,00 ROM0:2015 EA D9 C8 ld (C8D9),a ROM0:2018 3E 00 ld a,00 ROM0:201A EA DA C8 ld (C8DA),a ROM0:201D 3E 00 ld a,00 ROM0:201F EA DB C8 ld (C8DB),a ROM0:2022 3E 00 ld a,00 ROM0:2024 EA DC C8 ld (C8DC),a ROM0:2027 F1 pop af ROM0:2028 C9 ret
Starter Deck
Starter deck copy
ROM0:242B F5 push af ROM0:242C C5 push bc ROM0:242D D5 push de ROM0:242E E5 push hl ROM0:242F 21 51 24 ld hl,2451 ROM0:2432 1E 00 ld e,00 ROM0:2434 7B ld a,e ROM0:2435 FE 28 cp a,28 ROM0:2437 30 13 jr nc,244C ;if all 40 cards have been copied, jump to 0:244C (pop registers and exit function) ROM0:2439 CF rst 08 => 21 01 ;Update number of cards in Player's deck ROM0:243C 2A ldi a, (hl) ROM0:243D 4F ld c,a ROM0:243E 2A ldi a,(hl) ROM0:243F 47 ld b,a ROM0:2440 CF rst 08 ;Add card to Player's deck => 23 01 ROM0:2443 CF rst 08 ;1:46B9 ; seems linked to controlling card ID is valid => 09 01 ROM0:2446 CF rst 08 ;Sets unseen card as viewed in Trunk => 13 01 ROM0:2449 1C inc e ;number_of_cards_in_deck ++ ROM0:244A 18 E8 jr 2434 ROM0:244C E1 pop hl ROM0:244D D1 pop de ROM0:244E C1 pop bc ROM0:244F F1 pop af ROM0:2450 C9 ret
Starter deck cards
0x2451-0x24A1
: Starter Deck
8B 01 DB 01 DB 01 8D 01 8D 01 F8 01 4E 02 4E 02 4E 02 92 01 24 02 D3 00 B4 01 33 02 33 02 A6 01 04 02 C5 00 9A 01 BC 01 BC 01 E6 01 0C 02 43 02 CA 00 CF 00 63 02 63 02 89 00 89 00 89 00 50 02 50 02 50 02 7A 00 61 02 25 02 FA 01 B6 00 A4 01
Duel Records
Initialize Duel Records
ROM0:24BF F5 push af ROM0:24C0 C5 push bc ROM0:24C1 D5 push de ROM0:24C2 E5 push hl ROM0:24C3 AF xor a ROM0:24C4 21 43 C9 ld hl,C943 ROM0:24C7 11 EB 24 ld de,24EB ROM0:24CA 0E 19 ld c,19 ;c = 25 ROM0:24CC 1A ld a,(de) ROM0:24CD 22 ldi (hl),a ;Copy initial Duel Records (battles) from 0:24EB to wC943 ROM0:24CE 13 inc de ROM0:24CF 1A ld a,(de) ROM0:24D0 22 ldi (hl),a ROM0:24D1 13 inc de ROM0:24D2 0D dec c ROM0:24D3 20 F7 jr nz,24CC ;Loop 25 times ROM0:24D5 21 75 C9 ld hl,C975 ROM0:24D8 11 1D 25 ld de,251D ROM0:24DB 0E 19 ld c,19 ;c = 25 ROM0:24DD 1A ld a,(de) ROM0:24DE 22 ldi (hl),a ;Copy initial Duel Records (wins) from 0:251D to wC975 ROM0:24DF 13 inc de ROM0:24E0 1A ld a,(de) ROM0:24E1 22 ldi (hl),a ROM0:24E2 13 inc de ROM0:24E3 0D dec c ROM0:24E4 20 F7 jr nz,24DD ;Loop 25 times ROM0:24E6 E1 pop hl ROM0:24E7 D1 pop de ROM0:24E8 C1 pop bc ROM0:24E9 F1 pop af ROM0:24EA C9 ret
0:29F1 - Copy PRNG states to wC9AB-wC9AF, and initialize hFFD9-hFFDC
0x29F1-0x2A17
- Copy PRNG states to wC9AB-wC9AF, and set hFFD9-hFFDC to 0
ROM0:29F1 F5 push af ROM0:29F2 C5 push bc ROM0:29F3 D5 push de ROM0:29F4 E5 push hl ROM0:29F5 21 AD C8 ld hl,C8AD ROM0:29F8 11 AB C9 ld de,C9AB ROM0:29FB 0E 04 ld c,04 ROM0:29FD 2A ldi a,(hl) ;a = current_PRNG_state ROM0:29FE 12 ld (de),a ;store in in wC9AB-wC9AF ROM0:29FF 13 inc de ROM0:2A00 0D dec c ROM0:2A01 20 FA jr nz,29FD ;loop until all PRNG states have been copied to wC9AB-wC9AF ROM0:2A03 3E 00 ld a,00 ROM0:2A05 E0 DA ld (ff00+DA),a ROM0:2A07 3E 00 ld a,00 ROM0:2A09 E0 DB ld (ff00+DB),a ROM0:2A0B 3E 00 ld a,00 ROM0:2A0D E0 D9 ld (ff00+D9),a ROM0:2A0F 3E 00 ld a,00 ROM0:2A11 E0 DC ld (ff00+DC),a ;set hFFD9-hFFDC to 0 ROM0:2A13 E1 pop hl ROM0:2A14 D1 pop de ROM0:2A15 C1 pop bc ROM0:2A16 F1 pop af ROM0:2A17 C9 ret
Graveyard management
Initialize Graveyards
ROM0:2D77 F5 push af ROM0:2D78 3E 00 ld a,00 ROM0:2D7A EA DD CA ld (CADD),a // Player's Graveyard ROM0:2D7D 3E 00 ld a,00 ROM0:2D7F EA DE CA ld (CADE),a ROM0:2D82 3E 00 ld a,00 ROM0:2D84 EA DF CA ld (CADF),a // CPU's Graveyard ROM0:2D87 3E 00 ld a,00 ROM0:2D89 EA E0 CA ld (CAE0),a ROM0:2D8C F1 pop af ROM0:2D8D C9 ret
Add card to Player's Graveyard
ROM0:2D8E F5 push af ROM0:2D8F CD 3F 1A call 1A3F // Checks if bc ≠ 0 ROM0:2D92 FE 01 cp a,01 ROM0:2D94 28 12 jr z,2DA8 // If there's no card, get out of this function ROM0:2D96 CF rst 08 ... ROM0:2D99 FA AF C6 ld a,(C6AF) // Card Effect IDs (Magic Ritual Trap) ROM0:2D9C FE 02 cp a,02 ROM0:2D9E 20 08 jr nz,2DA8 // If it's not a Monster card, get out of this function ROM0:2DA0 79 ld a,c ROM0:2DA1 EA DD CA ld (CADD),a // Player's Graveyard ROM0:2DA4 78 ld a,b ROM0:2DA5 EA DE CA ld (CADE),a ROM0:2DA8 F1 pop af ROM0:2DA9 C9 ret
Add card to CPU's Graveyard
ROM0:2DAA F5 push af ROM0:2DAB CD 3F 1A call 1A3F // Checks if bc ≠ 0 ROM0:2DAE FE 01 cp a,01 ROM0:2DB0 28 12 jr z,2DC4 // If there's no card, get out of this function ROM0:2DB2 CF rst 08 ... ROM0:2DB5 FA AF C6 ld a,(C6AF) // Card Effect IDs (Magic Ritual Trap) ROM0:2DB8 FE 02 cp a,02 ROM0:2DBA 20 08 jr nz,2DC4 // If it's not a Monster card, get out of this function ROM0:2DBC 79 ld a,c ROM0:2DBD EA DF CA ld (CADF),a // CPU's Graveyard ROM0:2DC0 78 ld a,b ROM0:2DC1 EA E0 CA ld (CAE0),a ROM0:2DC4 F1 pop af ROM0:2DC5 C9 ret
Bank 1
Initialize cards in trunk
0x4696-0x46B8
- Loops until the 900 cards quantities are written
ROM1:4696 F5 push af ROM1:4697 C5 push bc ROM1:4698 E5 push hl ROM1:4699 01 00 00 ld bc,0000 ROM1:469C CD B9 46 call 46B9 ROM1:469F 3E FF ld a,FF ;Card not registered ROM1:46A1 CD 1C 47 call 471C ;Write card quantities in Trunk ROM1:46A4 03 inc bc ROM1:46A5 CD 51 1A call 1A51 ;card ID validity ? ROM1:46A8 FE 03 cp a,03 ROM1:46AA 28 02 jr z,46AE ROM1:46AC 18 EE jr 469C ROM1:46AE AF xor a ROM1:46AF EA ED C5 ld (C5ED),a ROM1:46B2 EA EE C5 ld (C5EE),a ;Store 0 in wC5ED (current_card_id) ROM1:46B5 E1 pop hl ROM1:46B6 C1 pop bc ROM1:46B7 F1 pop af ROM1:46B8 C9 ret
1:46B9 - Controls Card ID validity, then stores it in wC5ED
ROM1:46B9 F5 push af ROM1:46BA CD 51 1A call 1A51 ;card ID validity ? ROM1:46BD FE 03 cp a,03 ROM1:46BF 28 0A jr z,46CB ;if (invalid_card_id), jump to 1:46CB ROM1:46C1 79 ld a,c ROM1:46C2 EA ED C5 ld (C5ED),a ROM1:46C5 78 ld a,b ROM1:46C6 EA EE C5 ld (C5EE),a ;Store Current Card ID in wC5ED ROM1:46C9 18 07 jr 46D2 ;exit this function ROM1:46CB AF xor a ROM1:46CC EA ED C5 ld (C5ED),a ;Store 0 in in wC5ED (current_card_id) ROM1:46CF EA EE C5 ld (C5EE),a ROM1:46D2 F1 pop af ROM1:46D3 C9 ret
1:46D4
ROM1:46D4 F5 push af ROM1:46D5 CD 3B 47 call 473B ;Loads number of a specific card in Chest/Trunk ROM1:46D8 FE FF cp a,FF ROM1:46DA 20 05 jr nz,46E1 ROM1:46DC 3E 00 ld a,00 ROM1:46DE CD 1C 47 call 471C ROM1:46E1 CD 3B 47 call 473B ;Loads number of a specific card in Chest/Trunk ROM1:46E4 FE FA cp a,FA ROM1:46E6 28 04 jr z,46EC ROM1:46E8 3C inc a ROM1:46E9 CD 1C 47 call 471C ROM1:46EC F1 pop af ROM1:46ED C9 ret
1:46EE
ROM1:46EE C5 push bc ROM1:46EF D5 push de ROM1:46F0 16 00 ld d,00 ROM1:46F2 CD 3B 47 call 473B ;Loads number of a specific card in Chest/Trunk ROM1:46F5 FE 00 cp a,00 ROM1:46F7 20 04 jr nz,46FD ROM1:46F9 16 01 ld d,01 ROM1:46FB 18 0C jr 4709 ROM1:46FD FE FF cp a,FF ROM1:46FF 20 04 jr nz,4705 ROM1:4701 16 01 ld d,01 ROM1:4703 18 04 jr 4709 ROM1:4705 3D dec a ROM1:4706 CD 1C 47 call 471C ROM1:4709 7A ld a,d ROM1:470A D1 pop de ROM1:470B C1 pop bc ROM1:470C C9 ret
Sets unseen card as viewed in Trunk
ROM1:470D F5 push af ROM1:470E CD 3B 47 call 473B ;Loads number of a specific card in Chest/Trunk ROM1:4711 FE FF cp a,FF ROM1:4713 20 05 jr nz,471A ;if card has already been seen, exit this function ROM1:4715 3E 00 ld a,00 ;else set card_quantity to 0 to make the card visible ROM1:4717 CD 1C 47 call 471C ;Write card quantities in Trunk ROM1:471A F1 pop af ROM1:471B C9 ret
Write card quantities in Trunk
ROM1:471C F5 push af ROM1:471D C5 push bc ROM1:471E D5 push de ROM1:471F E5 push hl ROM1:4720 57 ld d,a ROM1:4721 3E 02 ld a,02 ROM1:4723 CD E0 12 call 12E0 ;WRAM Bank switch ROM1:4726 FA ED C5 ld a,(C5ED) ROM1:4729 4F ld c,a ROM1:472A FA EE C5 ld a,(C5EE) ROM1:472D 47 ld b,a ROM1:472E 21 00 D0 ld hl,D000 ROM1:4731 09 add hl,bc ROM1:4732 72 ld (hl),d ROM1:4733 CD 04 13 call 1304 ;WRAM Bank restore ROM1:4736 E1 pop hl ROM1:4737 D1 pop de ROM1:4738 C1 pop bc ROM1:4739 F1 pop af ROM1:473A C9 ret
1:473B - Loads number of a specific card in Chest/Trunk
ROM1:473B C5 push bc ROM1:473C E5 push hl ROM1:473D 3E 02 ld a,02 ROM1:473F CD E0 12 call 12E0 ;WRAM Bank switch ROM1:4742 FA ED C5 ld a,(C5ED) ROM1:4745 4F ld c,a ROM1:4746 FA EE C5 ld a,(C5EE) ROM1:4749 47 ld b,a ;bc = current_card_id ? ROM1:474A 21 00 D0 ld hl,D000 ;2:D000 stores cards in Chest ROM1:474D 09 add hl,bc ROM1:474E 4E ld c,(hl) ROM1:474F CD 04 13 call 1304 ;WRAM Bank restore ROM1:4752 79 ld a,c ROM1:4753 E1 pop hl ROM1:4754 C1 pop bc ROM1:4755 C9 ret
1:4756
ROM1:4756 C5 push bc ROM1:4757 D5 push de ROM1:4758 1E 01 ld e,01 ROM1:475A FA ED C5 ld a,(C5ED) ROM1:475D 4F ld c,a ROM1:475E FA EE C5 ld a,(C5EE) ROM1:4761 47 ld b,a ROM1:4762 CF rst 08 ... ROM1:4765 FE 00 cp a,00 ROM1:4767 20 04 jr nz,476D ROM1:4769 16 03 ld d,03 ROM1:476B 18 02 jr 476F ROM1:476D 16 01 ld d,01 ROM1:476F CD D8 4D call 4DD8 ROM1:4772 BA cp d ROM1:4773 30 16 jr nc,478B ROM1:4775 C5 push bc ROM1:4776 CD 25 4D call 4D25 ROM1:4779 78 ld a,b ROM1:477A C1 pop bc ROM1:477B FE 00 cp a,00 ROM1:477D 20 0C jr nz,478B ROM1:477F CD EE 46 call 46EE ROM1:4782 FE 00 cp a,00 ROM1:4784 20 05 jr nz,478B ROM1:4786 CD D7 4C call 4CD7 // Add card to deck subroutine ROM1:4789 1E 00 ld e,00 ROM1:478B 7B ld a,e ROM1:478C D1 pop de ROM1:478D C1 pop bc ROM1:478E C9 ret
1:478F
ROM1:478F F5 push af ROM1:4790 C5 push bc ROM1:4791 CD 25 4D call 4D25 ROM1:4794 79 ld a,c ROM1:4795 FE 00 cp a,00 ROM1:4797 28 0C jr z,47A5 ROM1:4799 CD C3 4C call 4CC3 ROM1:479C CD B9 46 call 46B9 ROM1:479F CD D4 46 call 46D4 ROM1:47A2 CD F1 4C call 4CF1 ROM1:47A5 C1 pop bc ROM1:47A6 F1 pop af ROM1:47A7 C9 ret
1:47A8
ROM1:47A8 F5 push af ROM1:47A9 C5 push bc ROM1:47AA CD 0A 66 call 660A ROM1:47AD 79 ld a,c ROM1:47AE FE 00 cp a,00 ROM1:47B0 28 0C jr z,47BE ROM1:47B2 CD AA 65 call 65AA ROM1:47B5 CD B9 46 call 46B9 ROM1:47B8 CD D4 46 call 46D4 ROM1:47BB CD D6 65 call 65D6 ROM1:47BE C1 pop bc ROM1:47BF F1 pop af ROM1:47C0 C9 ret
Update number of cards in Player's deck
ROM1:4CA7 EA F8 C5 ld (C5F8),a ROM1:4CAA C9 ret
Add card to the deck
ROM1:4CAB F5 push af ROM1:4CAC C5 push bc ROM1:4CAD D5 push de ROM1:4CAE E5 push hl ROM1:4CAF 16 00 ld d,00 ROM1:4CB1 FA F8 C5 ld a,(C5F8) ROM1:4CB4 5F ld e,a ROM1:4CB5 CB 23 sla e ROM1:4CB7 21 F9 C5 ld hl,C5F9 ROM1:4CBA 19 add hl,de ROM1:4CBB 79 ld a,c ROM1:4CBC 22 ldi (hl),a ROM1:4CBD 70 ld (hl),b ROM1:4CBE E1 pop hl ROM1:4CBF D1 pop de ROM1:4CC0 C1 pop bc ROM1:4CC1 F1 pop af ROM1:4CC2 C9 ret
1:4CC3
ROM1:4CC3 F5 push af ROM1:4CC4 E5 push hl ROM1:4CC5 06 00 ld b,00 ROM1:4CC7 FA F8 C5 ld a,(C5F8) ROM1:4CCA 4F ld c,a ROM1:4CCB CB 21 sla c ROM1:4CCD 21 F9 C5 ld hl,C5F9 ROM1:4CD0 09 add hl,bc ROM1:4CD1 2A ldi a,(hl) ROM1:4CD2 46 ld b,(hl) ROM1:4CD3 4F ld c,a ROM1:4CD4 E1 pop hl ROM1:4CD5 F1 pop af ROM1:4CD6 C9 ret
Add card to deck subroutine
ROM1:4CD7 F5 push af ROM1:4CD8 C5 push bc ROM1:4CD9 D5 push de ROM1:4CDA 50 ld d,b ROM1:4CDB 59 ld e,c ROM1:4CDC CD 25 4D call 4D25 ROM1:4CDF 78 ld a,b ROM1:4CE0 FE 00 cp a,00 ROM1:4CE2 20 09 jr nz,4CED ROM1:4CE4 79 ld a,c ROM1:4CE5 CD A7 4C call 4CA7 // Store a in (C5F8) ROM1:4CE8 42 ld b,d ROM1:4CE9 4B ld c,e ROM1:4CEA CD AB 4C call 4CAB // Add card to the deck ROM1:4CED D1 pop de ROM1:4CEE C1 pop bc ROM1:4CEF F1 pop af ROM1:4CF0 C9 ret
1:4CF1
ROM1:4CF1 F5 push af ROM1:4CF2 C5 push bc ROM1:4CF3 D5 push de ROM1:4CF4 E5 push hl ROM1:4CF5 FA F8 C5 ld a,(C5F8) ROM1:4CF8 6F ld l,a ROM1:4CF9 16 00 ld d,00 ROM1:4CFB 1E 00 ld e,00 ROM1:4CFD 7B ld a,e ROM1:4CFE CD A7 4C call 4CA7 ROM1:4D01 CD C3 4C call 4CC3 ROM1:4D04 7B ld a,e ROM1:4D05 BD cp l ROM1:4D06 28 08 jr z,4D10 ROM1:4D08 7A ld a,d ROM1:4D09 CD A7 4C call 4CA7 ROM1:4D0C CD AB 4C call 4CAB ROM1:4D0F 14 inc d ROM1:4D10 1C inc e ROM1:4D11 7B ld a,e ROM1:4D12 FE 28 cp a,28 ROM1:4D14 38 E7 jr c,4CFD ROM1:4D16 7A ld a,d ROM1:4D17 CD A7 4C call 4CA7 ROM1:4D1A 01 00 00 ld bc,0000 ROM1:4D1D CD AB 4C call 4CAB ROM1:4D20 E1 pop hl ROM1:4D21 D1 pop de ROM1:4D22 C1 pop bc ROM1:4D23 F1 pop af ROM1:4D24 C9 ret
1:4D25
ROM1:4D25 F5 push af ROM1:4D26 D5 push de ROM1:4D27 E5 push hl ROM1:4D28 21 F9 C5 ld hl,C5F9 ROM1:4D2B 1E 00 ld e,00 ROM1:4D2D 2A ldi a,(hl) ROM1:4D2E 4F ld c,a ROM1:4D2F 2A ldi a,(hl) ROM1:4D30 47 ld b,a ROM1:4D31 CD 3F 1A call 1A3F ROM1:4D34 FE 01 cp a,01 ROM1:4D36 28 06 jr z,4D3E ROM1:4D38 1C inc e ROM1:4D39 7B ld a,e ROM1:4D3A FE 28 cp a,28 ROM1:4D3C 38 EF jr c,4D2D ROM1:4D3E 06 00 ld b,00 ROM1:4D40 4B ld c,e ROM1:4D41 79 ld a,c ROM1:4D42 FE 28 cp a,28 ROM1:4D44 20 01 jr nz,4D47 ROM1:4D46 04 inc b ROM1:4D47 E1 pop hl ROM1:4D48 D1 pop de ROM1:4D49 F1 pop af ROM1:4D4A C9 ret
Card display
ROM1:5E71 F5 push af ROM1:5E72 C5 push bc ROM1:5E73 D5 push de ROM1:5E74 E5 push hl ROM1:5E75 CD 4F 60 call 604F ROM1:5E78 CF rst 08 ROM1:5E78 05 13 ROM1:5E7B CD B9 46 call 46B9 ROM1:5E7E CD 3B 47 call 473B ;Loads number of a specific card in Chest/Trunk ROM1:5E81 FE FF cp a,FF ROM1:5E83 20 09 jr nz,5E8E ROM1:5E85 CD 3C 28 call 283C ROM1:5E88 AF xor a ROM1:5E89 EA DD C5 ld (C5DD),a ROM1:5E8C 18 4E jr 5EDC ROM1:5E8E F5 push af ROM1:5E8F CF rst 08 ROM1:5E90 03 07 => Read card data - main routine ROM1:5E92 CF rst 08 ROM1:5E93 3B 05 => Load Deck Capacity in bc, Duelist Level in e ROM1:5E95 5F ld e,a ROM1:5E96 FA AC C6 ld a,(C6AC) ;a = Card_Cost ROM1:5E99 BB cp e ROM1:5E9A 28 16 jr z,5EB2 ROM1:5E9C 38 14 jr c,5EB2 ;if(Card_Cost ≤ Duelist Level), jump to 1:5EB2 ROM1:5E9E CD 2C 28 call 282C ROM1:5EA1 CF rst 08 ROM1:5EA2 07 05 ROM1:5EA4 CF rst 08 ROM1:5EA5 09 05 ROM1:5EA7 AF xor a ROM1:5EA8 EA DD C5 ld (C5DD),a ;wC5DD = 0 ROM1:5EAB CD 82 40 call 4082 ROM1:5EAE E8 02 add sp,02 ROM1:5EB0 18 2A jr 5EDC ROM1:5EB2 F1 pop af ROM1:5EB3 FE 00 cp a,00 ROM1:5EB5 20 15 jr nz,5ECC ROM1:5EB7 CF rst 08 ROM1:5EB8 03 07 ROM1:5EBA CD 2C 28 call 282C ROM1:5EBD CF rst 08 ROM1:5EBE 05 05 ROM1:5EC0 CF rst 08 ROM1:5EC1 09 05 ROM1:5EC3 AF xor a ROM1:5EC4 EA DD C5 ld (C5DD),a ;wC5DD = 0 ROM1:5EC7 CD 82 40 call 4082 ROM1:5ECA 18 10 jr 5EDC ROM1:5ECC CD 2C 28 call 282C ROM1:5ECF CF rst 08 ROM1:5ED0 03 05 ROM1:5ED2 CF rst 08 ROM1:5ED3 09 05 ROM1:5ED5 AF xor a ROM1:5ED6 EA DD C5 ld (C5DD),a ;wC5DD = 0 ROM1:5ED9 CD 82 40 call 4082 ROM1:5EDC E1 pop hl ROM1:5EDD D1 pop de ROM1:5EDE C1 pop bc ROM1:5EDF F1 pop af ROM1:5EE0 C9 ret
1:5F51
ROM1:5F51 F5 push af ROM1:5F52 C5 push bc ROM1:5F53 D5 push de ROM1:5F54 E5 push hl ROM1:5F55 CD 4F 60 call 604F ROM1:5F58 CF rst 08 ... ROM1:5F5B CF rst 08 ROM1:5F5E FE 00 cp a,00 ROM1:5F60 28 39 jr z,5F9B ROM1:5F62 CF rst 08 ... ROM1:5F65 CF rst 08 ... ROM1:5F68 5F ld e,a ROM1:5F69 FA AC C6 ld a,(C6AC) ROM1:5F6C BB cp e ROM1:5F6D 28 0E jr z,5F7D ROM1:5F6F 38 0C jr c,5F7D ROM1:5F71 CD 3C 28 call 283C ROM1:5F74 AF xor a ROM1:5F75 EA DD C5 ld (C5DD),a ROM1:5F78 EA DF C5 ld (C5DF),a ROM1:5F7B 18 1E jr 5F9B ROM1:5F7D CD B9 46 call 46B9 ROM1:5F80 CD 56 47 call 4756 ROM1:5F83 FE 00 cp a,00 ROM1:5F85 28 0E jr z,5F95 ROM1:5F87 CD 3C 28 call 283C ROM1:5F8A AF xor a ROM1:5F8B EA DD C5 ld (C5DD),a ROM1:5F8E EA DF C5 ld (C5DF),a ROM1:5F91 18 08 jr 5F9B ROM1:5F93 18 06 jr 5F9B ROM1:5F95 CD 2C 28 call 282C ROM1:5F98 CD 64 60 call 6064 ROM1:5F9B E1 pop hl ROM1:5F9C D1 pop de ROM1:5F9D C1 pop bc ROM1:5F9E F1 pop af ROM1:5F9F C9 ret
1:5FA0
ROM1:5FA0 F5 push af ROM1:5FA1 C5 push bc ROM1:5FA2 D5 push de ROM1:5FA3 E5 push hl ROM1:5FA4 CD 4F 60 call 604F ROM1:5FA7 CF rst 08 ROM1:5FA8 05 dec b ROM1:5FA9 13 inc de ROM1:5FAA CD EE 5F call 5FEE ROM1:5FAD FE 00 cp a,00 ROM1:5FAF 20 11 jr nz,5FC2 ROM1:5FB1 CD CD 5F call 5FCD ROM1:5FB4 FE 00 cp a,00 ROM1:5FB6 20 05 jr nz,5FBD ROM1:5FB8 CD 2C 28 call 282C ROM1:5FBB 18 03 jr 5FC0 ROM1:5FBD CD 3C 28 call 283C ROM1:5FC0 18 03 jr 5FC5 ROM1:5FC2 CD 3C 28 call 283C ROM1:5FC5 CD 64 60 call 6064 ROM1:5FC8 E1 pop hl ROM1:5FC9 D1 pop de ROM1:5FCA C1 pop bc ROM1:5FCB F1 pop af ROM1:5FCC C9 ret
1:5FCD
ROM1:5FCD C5 push bc ROM1:5FCE D5 push de ROM1:5FCF CD B9 46 call 46B9 ROM1:5FD2 1E 01 ld e,01 ROM1:5FD4 C5 push bc ROM1:5FD5 CD 0A 66 call 660A ROM1:5FD8 78 ld a,b ROM1:5FD9 C1 pop bc ROM1:5FDA FE 00 cp a,00 ROM1:5FDC 20 0C jr nz,5FEA ROM1:5FDE CD EE 46 call 46EE ROM1:5FE1 FE 00 cp a,00 ROM1:5FE3 20 05 jr nz,5FEA ROM1:5FE5 CD BE 65 call 65BE ROM1:5FE8 1E 00 ld e,00 ROM1:5FEA 7B ld a,e ROM1:5FEB D1 pop de ROM1:5FEC C1 pop bc ROM1:5FED C9 ret
1:5FEE
ROM1:5FEE C5 push bc ROM1:5FEF D5 push de ROM1:5FF0 E5 push hl ROM1:5FF1 FA E2 C5 ld a,(C5E2) ROM1:5FF4 FE 8F cp a,8F ROM1:5FF6 28 03 jr z,5FFB ROM1:5FF8 AF xor a ROM1:5FF9 18 22 jr 601D ROM1:5FFB 50 ld d,b ROM1:5FFC 59 ld e,c ROM1:5FFD 21 21 60 ld hl,6021 ROM1:6000 2A ldi a,(hl) ROM1:6001 4F ld c,a ROM1:6002 2A ldi a,(hl) ROM1:6003 47 ld b,a ROM1:6004 CD 3F 1A call 1A3F ROM1:6007 FE 01 cp a,01 ROM1:6009 20 04 jr nz,600F ROM1:600B 0E 00 ld c,00 ROM1:600D 18 0D jr 601C ROM1:600F CD 77 1A call 1A77 ROM1:6012 FE 00 cp a,00 ROM1:6014 20 04 jr nz,601A ROM1:6016 0E 01 ld c,01 ROM1:6018 18 02 jr 601C ROM1:601A 18 E4 jr 6000 ROM1:601C 79 ld a,c ROM1:601D E1 pop hl ROM1:601E D1 pop de ROM1:601F C1 pop bc ROM1:6020 C9 ret
1:604F
ROM1:604F F5 push af ROM1:6050 FA DE C5 ld a,(C5DE) ROM1:6053 4F ld c,a ROM1:6054 CD 74 46 call 4674 ROM1:6057 FA E4 C5 ld a,(C5E4) ROM1:605A 81 add c ROM1:605B 4F ld c,a ROM1:605C FA E5 C5 ld a,(C5E5) ROM1:605F CE 00 adc a,00 ROM1:6061 47 ld b,a ROM1:6062 F1 pop af ROM1:6063 C9 ret
1:6064
ROM1:6064 F5 push af ROM1:6065 D5 push de ROM1:6066 AF xor a ROM1:6067 EA DD C5 ld (C5DD),a ROM1:606A EA DF C5 ld (C5DF),a ROM1:606D 3E 04 ld a,04 ROM1:606F CD 87 0F call 0F87 ROM1:6072 CD A2 45 call 45A2 ROM1:6075 CD 7D 11 call 117D ROM1:6078 CD C1 40 call 40C1 ROM1:607B D1 pop de ROM1:607C F1 pop af ROM1:607D C9 ret
1:607E
ROM1:607E F5 push af ROM1:607F 3E 0A ld a,0A ROM1:6081 CD 87 0F call 0F87 ROM1:6084 CD A8 60 call 60A8 ROM1:6087 CD 7D 11 call 117D ROM1:608A F1 pop af ROM1:608B C9 ret
1:608C
ROM1:608C F5 push af ROM1:608D 3E 0A ld a,0A ROM1:608F CD 87 0F call 0F87 ROM1:6092 CD B4 60 call 60B4 ROM1:6095 CD 7D 11 call 117D ROM1:6098 F1 pop af ROM1:6099 C9 ret
1:609A
ROM1:609A F5 push af ROM1:609B C5 push bc ROM1:609C FA B7 C6 ld a,(C6B7) ROM1:609F CD 33 19 call 1933 ROM1:60A2 CD E4 60 call 60E4 ROM1:60A5 C1 pop bc ROM1:60A6 F1 pop af ROM1:60A7 C9 ret
Bank 2
Password screen text
0x9C2C
- Password screen text
Bank 3
Field management
Reverts field to Arena
- 0xC12C-0xC133 - Reverts field to Arena
ROM3:412C F5 push af ROM3:412D 3E 00 ld a,00 ROM3:412F EA D9 C5 ld (C5D9),a ROM3:4132 F1 pop af ROM3:4133 C9 ret
Field change
- 0xC134-0xC137 - Changes Field to the value in accumulator
ROM3:4134 EA D9 C5 ld (C5D9),a // Field ID ROM3:4137 C9 ret
Change field to Forest
- 0xC138-0xC13F - Change field to Forest
ROM3:4138 F5 push af ROM3:4139 3E 01 ld a,01 ROM3:413B CD 34 41 call 4134 // Field change ROM3:413E F1 pop af ROM3:413F C9 ret
Change field to Wasteland
- 0xC140-0xC148 - Change field to Wasteland
ROM3:4140 F5 push af ROM3:4141 3E 02 ld a,02 ROM3:4143 CD 34 41 call 4134 // Field change ROM3:4146 F1 pop af ROM3:4147 C9 ret
Change field to Mountain
- 0xC148-0xC14F - Change field to Mountain
ROM3:4148 F5 push af ROM3:4149 3E 03 ld a,03 ROM3:414B CD 34 41 call 4134 // Field change ROM3:414E F1 pop af ROM3:414F C9 ret
Change field to Sogen
- 0xC150-0xC157 - Change field to Sogen
ROM3:4150 F5 push af ROM3:4151 3E 04 ld a,04 ROM3:4153 CD 34 41 call 4134 // Field change ROM3:4156 F1 pop af ROM3:4157 C9 ret
Change field to Umi
- 0xC158-0xC15F - Change field to Umi
ROM3:4158 F5 push af ROM3:4159 3E 05 ld a,05 ROM3:415B CD 34 41 call 4134 // Field change ROM3:415E F1 pop af ROM3:415F C9 ret
Change field to Yami
- 0xC160-0xC167 - Change field to Yami
ROM3:4160 F5 push af ROM3:4161 3E 06 ld a,06 ROM3:4163 CD 34 41 call 4134 // Field change ROM3:4166 F1 pop af ROM3:4167 C9 ret
3:5ED0
ROM3:5ED0 F5 push af ROM3:5ED1 C5 push bc ROM3:5ED2 FA 3A C7 ld a,(C73A) ROM3:5ED5 47 ld b,a ROM3:5ED6 0E 03 ld c,03 ROM3:5ED8 CD 9D 19 call 199D ROM3:5EDB CD E0 19 call 19E0 ROM3:5EDE 01 03 00 ld bc,0003 ROM3:5EE1 CD 9D 19 call 199D ROM3:5EE4 CD 4E 1F call 1F4E ROM3:5EE7 CD C8 19 call 19C8 // Updates card zone ROM3:5EEA FA 3A C7 ld a,(C73A) ROM3:5EED 47 ld b,a ROM3:5EEE 0E 03 ld c,03 ROM3:5EF0 CD 9D 19 call 199D ROM3:5EF3 CD B3 19 call 19B3 ROM3:5EF6 C1 pop bc ROM3:5EF7 F1 pop af ROM3:5EF8 C9 ret
Player's card effects
No effect (ret)
ROM3:61CC C9 ret
3:61CD
ROM3:61CD C5 push bc ROM3:61CE CD 44 28 call 2844 ROM3:61D1 CF rst 08 ROM3:61D2 51 01 ROM3:61D4 C1 pop bc ROM3:61D5 C9 ret
3:61D6
ROM3:61D6 CD 44 28 call 2844 ROM3:61D9 CF rst 08 ROM3:61DA 51 01 ROM3:61DC C1 pop bc ROM3:61DD C9 ret
3:61DD
ROM3:61DD CD 54 7D call 7D54 ROM3:61E0 3E 02 ld a,02 ROM3:61E2 EA AC C8 ld (C8AC),a ROM3:61E5 3E 01 ld a,01 ROM3:61E7 EA FC C8 ld (C8FC),a ROM3:61EA FA D7 C8 ld a,(C8D7) ROM3:61ED EA F6 C8 ld (C8F6),a ROM3:61F0 FA D8 C8 ld a,(C8D8) ROM3:61F3 EA F7 C8 ld (C8F7),a ROM3:61F6 FA D9 C8 ld a,(C8D9) ROM3:61F9 EA F8 C8 ld (C8F8),a ROM3:61FC FA DA C8 ld a,(C8DA) ROM3:61FF EA F9 C8 ld (C8F9),a ROM3:6202 FA DB C8 ld a,(C8DB) ROM3:6205 EA FA C8 ld (C8FA),a ROM3:6208 FA DC C8 ld a,(C8DC) ROM3:620B EA FB C8 ld (C8FB),a ROM3:620E CF rst 08 ROM3:620F 07 06 ROM3:6210 CD 15 5F call 5F15 ROM3:6214 C9 ret
Summon Monster card from hand
ROM3:6215 F5 push af ROM3:6216 CD 6E 20 call 206E ;Fusion subroutine ROM3:6219 FE 00 cp a,00 ROM3:621B 20 05 jr nz,6222 ;If the Fusion failed, jump to 3:6222 ROM3:621D CD DD 61 call 61DD ;SE: Failed Fusion ROM3:6220 18 0F jr 6231 ROM3:6222 CD 54 28 call 2854 ROM3:6225 CD 6F 5E call 5E6F ROM3:6228 CD 54 7D call 7D54 ROM3:622B CD D1 7B call 7BD1 ROM3:622E CD ED 7B call 7BED ROM3:6231 F1 pop af ROM3:6232 C9 ret
Field Spell
Forest
ROM3:6233 F5 push af ROM3:6234 CD 38 41 call 4138 ROM3:6237 CD B0 5F call 5FB0 ROM3:623A CD 68 41 call 4168 ROM3:623D 3E 1D ld a,1D ROM3:623F CF rst 08 ROM3:6240 0B dec bc ROM3:6241 06 F1 ld b,F1 ROM3:6243 C9 ret
Wasteland
ROM3:6244 F5 push af ROM3:6245 CD 40 41 call 4140 ROM3:6248 CD B0 5F call 5FB0 ROM3:624B CD 68 41 call 4168 ROM3:624E 3E 1E ld a,1E ROM3:6250 CF rst 08 ROM3:6251 0B dec bc ROM3:6252 06 F1 ld b,F1 ROM3:6254 C9 ret
Mountain
ROM3:6255 F5 push af ROM3:6256 CD 48 41 call 4148 ROM3:6259 CD B0 5F call 5FB0 ROM3:625C CD 68 41 call 4168 ROM3:625F 3E 1F ld a,1F ROM3:6261 CF rst 08 ROM3:6262 0B dec bc ROM3:6263 06 F1 ld b,F1 ROM3:6265 C9 ret
Sogen
ROM3:6266 F5 push af ROM3:6267 CD 50 41 call 4150 ROM3:626A CD B0 5F call 5FB0 ROM3:626D CD 68 41 call 4168 ROM3:6270 3E 20 ld a,20 ROM3:6272 CF rst 08 ROM3:6273 0B dec bc ROM3:6274 06 F1 ld b,F1 ROM3:6276 C9 ret
Umi
ROM3:6277 F5 push af ROM3:6278 CD 58 41 call 4158 ROM3:627B CD B0 5F call 5FB0 ROM3:627E CD 68 41 call 4168 ROM3:6281 3E 21 ld a,21 ROM3:6283 CF rst 08 ROM3:6284 0B dec bc ROM3:6285 06 F1 ld b,F1 ROM3:6287 C9 ret
Yami
ROM3:6288 F5 push af ROM3:6289 CD 60 41 call 4160 ROM3:628C CD B0 5F call 5FB0 ROM3:628F CD 68 41 call 4168 ROM3:6292 3E 22 ld a,22 ROM3:6294 CF rst 08 ROM3:6295 0B dec bc ROM3:6296 06 F1 ld b,F1 ROM3:6298 C9 ret
Healing Spell
Mooyan Curry
ROM3:6299 F5 push af ROM3:629A C5 push bc ROM3:629B CD C2 5B call 5BC2 ROM3:629E 01 00 02 ld bc,0200 ROM3:62A1 CF rst 08 ROM3:62A2 0D dec c ROM3:62A3 0A ld a,(bc) ROM3:62A4 FE 00 cp a,00 ROM3:62A6 20 10 jr nz,62B8 ROM3:62A8 CD A8 5C call 5CA8 ROM3:62AB CD B0 5F call 5FB0 ROM3:62AE CD 7B 5D call 5D7B ROM3:62B1 3E 25 ld a,25 ROM3:62B3 CF rst 08 ROM3:62B4 0B dec bc ROM3:62B5 06 18 ld b,18 ROM3:62B7 0C inc c ROM3:62B8 CF rst 08 ROM3:62B9 0F rrca ROM3:62BA 0A ld a,(bc) ROM3:62BB CD B0 5F call 5FB0 ROM3:62BE CD 7B 5D call 5D7B ROM3:62C1 CF rst 08 ROM3:62C2 07 rlca ROM3:62C3 06 C1 ld b,C1 ROM3:62C5 F1 pop af ROM3:62C6 C9 ret
Red Medicine
ROM3:62C7 F5 push af ROM3:62C8 C5 push bc ROM3:62C9 CD C2 5B call 5BC2 ROM3:62CC 01 00 05 ld bc,0500 ROM3:62CF CF rst 08 ROM3:62D0 0D dec c ROM3:62D1 0A ld a,(bc) ROM3:62D2 FE 00 cp a,00 ROM3:62D4 20 10 jr nz,62E6 ROM3:62D6 CD A8 5C call 5CA8 ROM3:62D9 CD B0 5F call 5FB0 ROM3:62DC CD 7B 5D call 5D7B ROM3:62DF 3E 26 ld a,26 ROM3:62E1 CF rst 08 ROM3:62E2 0B dec bc ROM3:62E3 06 18 ld b,18 ROM3:62E5 0C inc c ROM3:62E6 CF rst 08 ROM3:62E7 0F rrca ROM3:62E8 0A ld a,(bc) ROM3:62E9 CD B0 5F call 5FB0 ROM3:62EC CD 7B 5D call 5D7B ROM3:62EF CF rst 08 ROM3:62F0 07 rlca ROM3:62F1 06 C1 ld b,C1 ROM3:62F3 F1 pop af ROM3:62F4 C9 ret
Goblin's Secret Remedy
ROM3:62F5 F5 push af ROM3:62F6 C5 push bc ROM3:62F7 CD C2 5B call 5BC2 ROM3:62FA 01 00 10 ld bc,1000 ROM3:62FD CF rst 08 ROM3:62FE 0D dec c ROM3:62FF 0A ld a,(bc) ROM3:6300 FE 00 cp a,00 ROM3:6302 20 10 jr nz,6314 ROM3:6304 CD A8 5C call 5CA8 ROM3:6307 CD B0 5F call 5FB0 ROM3:630A CD 7B 5D call 5D7B ROM3:630D 3E 27 ld a,27 ROM3:630F CF rst 08 ROM3:6310 0B dec bc ROM3:6311 06 18 ld b,18 ROM3:6313 0C inc c ROM3:6314 CF rst 08 ROM3:6315 0F rrca ROM3:6316 0A ld a,(bc) ROM3:6317 CD B0 5F call 5FB0 ROM3:631A CD 7B 5D call 5D7B ROM3:631D CF rst 08 ROM3:631E 07 rlca ROM3:631F 06 C1 ld b,C1 ROM3:6321 F1 pop af ROM3:6322 C9 ret
Soul of the Pure
ROM3:6323 F5 push af ROM3:6324 C5 push bc ROM3:6325 CD C2 5B call 5BC2 ROM3:6328 01 00 20 ld bc,2000 ROM3:632B CF rst 08 ROM3:632C 0D dec c ROM3:632D 0A ld a,(bc) ROM3:632E FE 00 cp a,00 ROM3:6330 20 10 jr nz,6342 ROM3:6332 CD A8 5C call 5CA8 ROM3:6335 CD B0 5F call 5FB0 ROM3:6338 CD 7B 5D call 5D7B ROM3:633B 3E 28 ld a,28 ROM3:633D CF rst 08 ROM3:633E 0B dec bc ROM3:633F 06 18 ld b,18 ROM3:6341 0C inc c ROM3:6342 CF rst 08 ROM3:6343 0F rrca ROM3:6344 0A ld a,(bc) ROM3:6345 CD B0 5F call 5FB0 ROM3:6348 CD 7B 5D call 5D7B ROM3:634B CF rst 08 ROM3:634C 07 rlca ROM3:634D 06 C1 ld b,C1 ROM3:634F F1 pop af ROM3:6350 C9 ret
Dian Keto the Cure Master
ROM3:6351 F5 push af ROM3:6352 C5 push bc ROM3:6353 CD C2 5B call 5BC2 ROM3:6356 01 00 50 ld bc,5000 ROM3:6359 CF rst 08 ROM3:635A 0D dec c ROM3:635B 0A ld a,(bc) ROM3:635C FE 00 cp a,00 ROM3:635E 20 10 jr nz,6370 ROM3:6360 CD A8 5C call 5CA8 ROM3:6363 CD B0 5F call 5FB0 ROM3:6366 CD 7B 5D call 5D7B ROM3:6369 3E 29 ld a,29 ROM3:636B CF rst 08 ROM3:636C 0B dec bc ROM3:636D 06 18 ld b,18 ROM3:636F 0C inc c ROM3:6370 CF rst 08 ROM3:6371 0F rrca ROM3:6372 0A ld a,(bc) ROM3:6373 CD B0 5F call 5FB0 ROM3:6376 CD 7B 5D call 5D7B ROM3:6379 CF rst 08 ROM3:637A 07 rlca ROM3:637B 06 C1 ld b,C1 ROM3:637D F1 pop af ROM3:637E C9 ret
Damage Spell
Sparks
ROM3:637F F5 push af ROM3:6380 C5 push bc ROM3:6381 CD C2 5B call 5BC2 ROM3:6384 01 50 00 ld bc,0050 ROM3:6387 CF rst 08 ROM3:6388 0D dec c ROM3:6389 0A ld a,(bc) ROM3:638A FE 00 cp a,00 ROM3:638C 20 10 jr nz,639E ROM3:638E CD D8 5C call 5CD8 ROM3:6391 CD B0 5F call 5FB0 ROM3:6394 CD 7B 5D call 5D7B ROM3:6397 3E 2A ld a,2A ROM3:6399 CF rst 08 ROM3:639A 0B dec bc ROM3:639B 06 18 ld b,18 ROM3:639D 0C inc c ROM3:639E CF rst 08 ROM3:639F 0F rrca ROM3:63A0 0A ld a,(bc) ROM3:63A1 CD B0 5F call 5FB0 ROM3:63A4 CD 7B 5D call 5D7B ROM3:63A7 CF rst 08 ROM3:63A8 07 rlca ROM3:63A9 06 C1 ld b,C1 ROM3:63AB F1 pop af ROM3:63AC C9 ret
Hinotama
ROM3:63AD F5 push af ROM3:63AE C5 push bc ROM3:63AF D5 push de ROM3:63B0 CD C2 5B call 5BC2 ROM3:63B3 01 00 01 ld bc,0100 ROM3:63B6 CF rst 08 ROM3:63B7 0D dec c ROM3:63B8 0A ld a,(bc) ROM3:63B9 FE 00 cp a,00 ROM3:63BB 20 10 jr nz,63CD ROM3:63BD CD D8 5C call 5CD8 ROM3:63C0 CD B0 5F call 5FB0 ROM3:63C3 CD 7B 5D call 5D7B ROM3:63C6 3E 2B ld a,2B ROM3:63C8 CF rst 08 ROM3:63C9 0B dec bc ROM3:63CA 06 18 ld b,18 ROM3:63CC 0C inc c ROM3:63CD CF rst 08 ROM3:63CE 0F rrca ROM3:63CF 0A ld a,(bc) ROM3:63D0 CD B0 5F call 5FB0 ROM3:63D3 CD 7B 5D call 5D7B ROM3:63D6 CF rst 08 ROM3:63D7 07 rlca ROM3:63D8 06 D1 ld b,D1 ROM3:63DA C1 pop bc ROM3:63DB F1 pop af ROM3:63DC C9 ret
Final Flame
ROM3:63DD F5 push af ROM3:63DE C5 push bc ROM3:63DF D5 push de ROM3:63E0 CD C2 5B call 5BC2 ROM3:63E3 01 00 02 ld bc,0200 ROM3:63E6 CF rst 08 ROM3:63E7 0D dec c ROM3:63E8 0A ld a,(bc) ROM3:63E9 FE 00 cp a,00 ROM3:63EB 20 10 jr nz,63FD ROM3:63ED CD D8 5C call 5CD8 ROM3:63F0 CD B0 5F call 5FB0 ROM3:63F3 CD 7B 5D call 5D7B ROM3:63F6 3E 2C ld a,2C ROM3:63F8 CF rst 08 ROM3:63F9 0B dec bc ROM3:63FA 06 18 ld b,18 ROM3:63FC 0C inc c ROM3:63FD CF rst 08 ROM3:63FE 0F rrca ROM3:63FF 0A ld a,(bc) ROM3:6400 CD B0 5F call 5FB0 ROM3:6403 CD 7B 5D call 5D7B ROM3:6406 CF rst 08 ROM3:6407 07 rlca ROM3:6408 06 D1 ld b,D1 ROM3:640A C1 pop bc ROM3:640B F1 pop af ROM3:640C C9 ret
Ookazi
ROM3:640D F5 push af ROM3:640E C5 push bc ROM3:640F D5 push de ROM3:6410 CD C2 5B call 5BC2 ROM3:6413 01 00 05 ld bc,0500 ROM3:6416 CF rst 08 ROM3:6417 0D dec c ROM3:6418 0A ld a,(bc) ROM3:6419 FE 00 cp a,00 ROM3:641B 20 10 jr nz,642D ROM3:641D CD D8 5C call 5CD8 ROM3:6420 CD B0 5F call 5FB0 ROM3:6423 CD 7B 5D call 5D7B ROM3:6426 3E 2D ld a,2D ROM3:6428 CF rst 08 ROM3:6429 0B dec bc ROM3:642A 06 18 ld b,18 ROM3:642C 0C inc c ROM3:642D CF rst 08 ROM3:642E 0F rrca ROM3:642F 0A ld a,(bc) ROM3:6430 CD B0 5F call 5FB0 ROM3:6433 CD 7B 5D call 5D7B ROM3:6436 CF rst 08 ROM3:6437 07 rlca ROM3:6438 06 D1 ld b,D1 ROM3:643A C1 pop bc ROM3:643B F1 pop af ROM3:643C C9 ret
Tremendous Fire
ROM3:643D F5 push af ROM3:643E C5 push bc ROM3:643F D5 push de ROM3:6440 CD C2 5B call 5BC2 ROM3:6443 01 00 10 ld bc,1000 ROM3:6446 CF rst 08 ROM3:6447 0D dec c ROM3:6448 0A ld a,(bc) ROM3:6449 FE 00 cp a,00 ROM3:644B 20 10 jr nz,645D ROM3:644D CD D8 5C call 5CD8 ROM3:6450 CD B0 5F call 5FB0 ROM3:6453 CD 7B 5D call 5D7B ROM3:6456 3E 2E ld a,2E ROM3:6458 CF rst 08 ROM3:6459 0B dec bc ROM3:645A 06 18 ld b,18 ROM3:645C 0C inc c ROM3:645D CF rst 08 ROM3:645E 0F rrca ROM3:645F 0A ld a,(bc) ROM3:6460 CD B0 5F call 5FB0 ROM3:6463 CD 7B 5D call 5D7B ROM3:6466 CF rst 08 ROM3:6467 07 rlca ROM3:6468 06 D1 ld b,D1 ROM3:646A C1 pop bc ROM3:646B F1 pop af ROM3:646C C9 ret
Dark Hole
ROM3:646D F5 push af ROM3:646E C5 push bc ROM3:646F D5 push de ROM3:6470 E5 push hl ROM3:6471 01 01 00 ld bc,0001 ROM3:6474 78 ld a,b ROM3:6475 FE 05 cp a,05 ROM3:6477 30 06 jr nc,647F ROM3:6479 CD AF 1F call 1FAF ROM3:647C 04 inc b ROM3:647D 18 F5 jr 6474 ROM3:647F 01 02 01 ld bc,0102 ROM3:6482 78 ld a,b ROM3:6483 FE 06 cp a,06 ROM3:6485 30 06 jr nc,648D ROM3:6487 CD 96 1F call 1F96 ROM3:648A 04 inc b ROM3:648B 18 F5 jr 6482 ROM3:648D CD B0 5F call 5FB0 ROM3:6490 CD 9C 28 call 289C ROM3:6493 CD 68 41 call 4168 ROM3:6496 3E 23 ld a,23 ROM3:6498 CF rst 08 ROM3:6499 0B dec bc ROM3:649A 06 E1 ld b,E1 ROM3:649C D1 pop de ROM3:649D C1 pop bc ROM3:649E F1 pop af ROM3:649F C9 ret
Raigeki
ROM3:64A0 F5 push af ROM3:64A1 C5 push bc ROM3:64A2 D5 push de ROM3:64A3 E5 push hl ROM3:64A4 CD C2 5B call 5BC2 ROM3:64A7 CF rst 08 ROM3:64A8 0D dec c ROM3:64A9 0A ld a,(bc) ROM3:64AA FE 00 cp a,00 ROM3:64AC 20 1F jr nz,64CD ROM3:64AE 0E 01 ld c,01 ROM3:64B0 06 00 ld b,00 ROM3:64B2 78 ld a,b ROM3:64B3 FE 05 cp a,05 ROM3:64B5 30 06 jr nc,64BD ROM3:64B7 CD AF 1F call 1FAF ROM3:64BA 04 inc b ROM3:64BB 18 F5 jr 64B2 ROM3:64BD CD B0 5F call 5FB0 ROM3:64C0 CD 9C 28 call 289C ROM3:64C3 CD 68 41 call 4168 ROM3:64C6 3E 24 ld a,24 ROM3:64C8 CF rst 08 ROM3:64C9 0B dec bc ROM3:64CA 06 18 ld b,18 ROM3:64CC 0F rrca ROM3:64CD CF rst 08 ROM3:64CE 0F rrca ROM3:64CF 0A ld a,(bc) ROM3:64D0 CD B0 5F call 5FB0 ROM3:64D3 CD 84 28 call 2884 ROM3:64D6 CD 7B 5D call 5D7B ROM3:64D9 CF rst 08 ROM3:64DA 07 rlca ROM3:64DB 06 E1 ld b,E1 ROM3:64DD D1 pop de ROM3:64DE C1 pop bc ROM3:64DF F1 pop af ROM3:64E0 C9 ret
Bank 4
Menu ID handling
4:43CB
ROM4:43CB CD AC 27 call 27AC ROM4:43CE F1 pop af ROM4:43CF C9 ret
4:43D0
ROM4:43D0 3E 04 ld a,04 ROM4:43D2 CD 87 0F call 0F87 ROM4:43D5 CD 09 44 call 4409 ;Decrement Menu ID ROM4:43D8 CD 1C 44 call 441C ROM4:43DB CD 7D 11 call 117D ROM4:43DE AF xor a ;a = 0 ROM4:43DF C9 ret
4:43E0
ROM4:43E0 3E 04 ld a,04 ROM4:43E2 CD 87 0F call 0F87 ROM4:43E5 CD F7 43 call 43F7 ;Increment Menu ID ROM4:43E8 CD 1C 44 call 441C ROM4:43EB CD 7D 11 call 117D ROM4:43EE AF xor a ;a = 0 ROM4:43EF C9 ret
Sets Menu ID to 0
ROM4:43F0 F5 push af ROM4:43F1 AF xor a ;a = 0 ROM4:43F2 EA B4 C8 ld (C8B4),a ;menu_id = 0 ROM4:43F5 F1 pop af ROM4:43F6 C9 ret
Increment Menu ID
ROM4:43F7 F5 push af ROM4:43F8 CD 34 28 call 2834 ROM4:43FB FA B4 C8 ld a,(C8B4) ROM4:43FE 3C inc a ;a++ ROM4:43FF FE 05 cp a,05 ;Max Menu ID is 4 ROM4:4401 20 01 jr nz,4404 ROM4:4403 AF xor a ROM4:4404 EA B4 C8 ld (C8B4),a ROM4:4407 F1 pop af ROM4:4408 C9 ret
Decrement Menu ID
ROM4:4409 F5 push af ROM4:440A CD 34 28 call 2834 ROM4:440D FA B4 C8 ld a,(C8B4) ROM4:4410 3D dec a ;a-- ROM4:4411 FE FF cp a,FF ;Min Menu ID is 0 ROM4:4413 20 02 jr nz,4417 ROM4:4415 3E 04 ld a,04 ROM4:4417 EA B4 C8 ld (C8B4),a ROM4:441A F1 pop af ROM4:441B C9 ret
4:441C
ROM4:441C F5 push af ROM4:441D C5 push bc ROM4:441E D5 push de ROM4:441F E5 push hl ROM4:4420 CD 79 13 call 1379 ROM4:4423 06 00 ld b,00 ROM4:4425 FA B4 C8 ld a,(C8B4) ;a = menu_id ROM4:4428 4F ld c,a ROM4:4429 CB 21 sla c ROM4:442B 21 4C 44 ld hl,444C ROM4:442E 09 add hl,bc ;hl = 0x444C + (menu_id × 2) ROM4:442F 2A ldi a,(hl) ROM4:4430 66 ld h,(hl) ROM4:4431 6F ld l,a ;hl = (hl) ROM4:4432 11 00 C5 ld de,C500 ROM4:4435 2A ldi a,(hl) ROM4:4436 47 ld b,a ROM4:4437 78 ld a,b ROM4:4438 FE 00 cp a,00 ROM4:443A 28 0B jr z,4447 ROM4:443C 0E 04 ld c,04 ROM4:443E 2A ldi a,(hl) ROM4:443F 12 ld (de),a ROM4:4440 13 inc de ROM4:4441 0D dec c ROM4:4442 20 FA jr nz,443E ROM4:4444 05 dec b ROM4:4445 18 F0 jr 4437 ROM4:4447 E1 pop hl ROM4:4448 D1 pop de ROM4:4449 C1 pop bc ROM4:444A F1 pop af ROM4:444B C9 ret
SRAM Operations
SRAM Initialization
0x1118D-0x111A4
- Blanks SRAM (New Game)
ROM4:518D F5 push af ROM4:518E C5 push bc ROM4:518F D5 push de ROM4:5190 E5 push hl ROM4:5191 21 00 A0 ld hl,A000 ROM4:5194 AF xor a ROM4:5195 06 20 ld b,20 ROM4:5197 0E 00 ld c,00 ROM4:5199 22 ldi (hl),a ROM4:519A 0D dec c ROM4:519B 20 FC jr nz,5199 ROM4:519D 05 dec b ROM4:519E 20 F7 jr nz,5197 ROM4:51A0 E1 pop hl ROM4:51A1 D1 pop de ROM4:51A2 C1 pop bc ROM4:51A3 F1 pop af ROM4:51A4 C9 ret
Initialize new save file (PRNG, Trunk, Starter Deck, HRAM flags, Duel Records, etc.)
ROM4:51A5 CD F1 29 call 29F1 ;Copy PRNG states to wC9AB-wC9AF, and set hFFD9-hFFDC to 0 ROM4:51A8 CF rst 08 => 05 01 ;Initialize cards in trunk ROM4:51AB CD BF 24 call 24BF ;Initialize Duel Records ROM4:51AE CD 2B 24 call 242B ;Starter deck copy ROM4:51B1 CF rst 08 => 0B 09 ;00s wCA64-wCAD5 ? ROM4:51B4 CF rst 08 => 37 05 ;Deck Capacity Initialization ROM4:51B7 CD FB 1D call 1DFB ;PRNG ROM4:51BA C9 ret
SRAM KONAMI check
0x11367-0x1136D
- Date of build and « !KONAMI » string used to check SRAM existence.
00 08 02 00 31 4B 4F 4E 41 4D 49 August 02, 2000 - !KONAMI
Data copy from SRAM to HRAM
0x113C1-0x113F3
- Copies some data (Deck Capacity...) from SRAM to HRAM
ROM4:53C1 F5 push af ROM4:53C2 C5 push bc ROM4:53C3 D5 push de ROM4:53C4 E5 push hl ROM4:53C5 11 00 A0 ld de,A000 ROM4:53C8 01 F4 53 ld bc,53F4 ROM4:53CB 0A ld a,(bc) ROM4:53CC 6F ld l,a ROM4:53CD 03 inc bc ROM4:53CE 0A ld a,(bc) ROM4:53CF 67 ld h,a ROM4:53D0 03 inc bc ROM4:53D1 FE 00 cp a,00 ROM4:53D3 20 05 jr nz,53DA ROM4:53D5 7D ld a,l ROM4:53D6 FE 00 cp a,00 ROM4:53D8 28 11 jr z,53EB ROM4:53DA 0A ld a,(bc) ROM4:53DB E0 70 ld (ff00+70),a ROM4:53DD 03 inc bc ROM4:53DE C5 push bc ROM4:53DF 0A ld a,(bc) ROM4:53E0 4F ld c,a ROM4:53E1 1A ld a,(de) ROM4:53E2 22 ldi (hl),a ROM4:53E3 13 inc de ROM4:53E4 0D dec c ROM4:53E5 20 FA jr nz,53E1 ROM4:53E7 C1 pop bc ROM4:53E8 03 inc bc ROM4:53E9 18 E0 jr 53CB ROM4:53EB 3E 01 ld a,01 ROM4:53ED E0 70 ld (ff00+70),a ROM4:53EF E1 pop hl ROM4:53F0 D1 pop de ROM4:53F1 C1 pop bc ROM4:53F2 F1 pop af ROM4:53F3 C9 ret
Bank 5
Duel text
0x14834
- Text pointers0x14950
- Duel text, cards effects text
Load card Illustration ?
ROM5:5E38 F5 push af ROM5:5E39 C5 push bc ROM5:5E3A D5 push de ROM5:5E3B E5 push hl ROM5:5E3C 3E 05 ld a,05 ROM5:5E3E CD E0 12 call 12E0 ;WRAM Bank switch ROM5:5E41 3E 4F ld a,4F ROM5:5E43 CD CB 11 call 11CB ROM5:5E46 CD 5B 19 call 195B ROM5:5E49 3E 1E ld a,1E ;ROM Bank ? ROM5:5E4B CD 87 0F call 0F87 ROM5:5E4E CD 8E 11 call 118E ROM5:5E51 CD 70 5E call 5E70 ROM5:5E54 CD 7D 11 call 117D ROM5:5E57 01 00 80 ld bc,8000 ;VRAM ROM5:5E5A 3E 1E ld a,1E ;ROM Bank ? ROM5:5E5C CD 87 0F call 0F87 ROM5:5E5F CD 8E 11 call 118E ROM5:5E62 CD 70 5E call 5E70 ROM5:5E65 CD 7D 11 call 117D ROM5:5E68 CD 04 13 call 1304 ;WRAM Bank restore ROM5:5E6B E1 pop hl ROM5:5E6C D1 pop de ROM5:5E6D C1 pop bc ROM5:5E6E F1 pop af
5:5E6F (ret)
ROM5:5E6F C9 ret
5:5E70
ROM5:5E70 F5 push af ROM5:5E71 C5 push bc ROM5:5E72 E5 push hl ROM5:5E73 21 00 D0 ld hl,D000 ROM5:5E76 0E 0A ld c,0A ROM5:5E78 CD 11 02 call 0211 ROM5:5E7B 0D dec c ROM5:5E7C 20 FA jr nz,5E78 ROM5:5E7E E1 pop hl ROM5:5E7F C1 pop bc ROM5:5E80 F1 pop af ROM5:5E81 C9 ret
Deck Capacity
Deck Capacity Initialization
0x15E96-0x15EA0
- Initializes Deck Capacity at 1600 when New Game is selected
ROM5:5E96 F5 push af ROM5:5E97 3E 40 ld a,40 ROM5:5E99 E0 D7 ld (ff00+D7),a ROM5:5E9B 3E 06 ld a,06 ROM5:5E9D E0 D8 ld (ff00+D8),a ;Copies 0x640, 1600 in decimal, to (FFD7) ROM5:5E9F F1 pop af ROM5:5EA0 C9 ret
Load Deck Capacity in bc
ROM5:5EA1 F5 push af ROM5:5EA2 F0 D7 ld a,(ff00+D7) ROM5:5EA4 4F ld c,a ROM5:5EA5 F0 D8 ld a,(ff00+D8) ROM5:5EA7 47 ld b,a ROM5:5EA8 F1 pop af ROM5:5EA9 C9 ret
Load Deck Capacity in bc, Duelist Level in e
ROM5:5EAA C5 push bc ROM5:5EAB F0 D7 ld a,(ff00+D7) ROM5:5EAD 4F ld c,a ROM5:5EAE F0 D8 ld a,(ff00+D8) ROM5:5EB0 47 ld b,a ROM5:5EB1 CD B6 5E call 5EB6 ;Duelist Level calculation ROM5:5EB4 C1 pop bc ROM5:5EB5 C9 ret
Duelist Level calculation
ROM5:5EB6 C5 push bc ROM5:5EB7 D5 push de ROM5:5EB8 79 ld a,c ROM5:5EB9 D6 40 sub a,40 ROM5:5EBB 5F ld e,a ROM5:5EBC 78 ld a,b ROM5:5EBD DE 06 sbc a,06 ROM5:5EBF 57 ld d,a ;de = Deck_Capacity - 1600 ROM5:5EC0 01 03 00 ld bc,0003 ROM5:5EC3 CD 90 14 call 1490 ;de ÷ 3 ROM5:5EC6 7B ld a,e ROM5:5EC7 C6 48 add a,48 ;Duelist Level += 72 ROM5:5EC9 5F ld e,a ROM5:5ECA 7A ld a,d ROM5:5ECB CE 00 adc a,00 ROM5:5ECD 57 ld d,a ROM5:5ECE 7A ld a,d ROM5:5ECF FE 00 cp a,00 ROM5:5ED1 28 02 jr z,5ED5 ;if(Duelist_Level ≤ 255), jump to 5:5ED5 ROM5:5ED3 1E FF ld e,FF ;else Duelist_Level = 255 ROM5:5ED5 7B ld a,e ROM5:5ED6 D1 pop de ROM5:5ED7 C1 pop bc ROM5:5ED8 C9 ret
Copy string to VRAM
ROM5:6095 F5 push af ROM5:6096 C5 push bc ROM5:6097 D5 push de ROM5:6098 E5 push hl ROM5:6099 CF rst 08 ROM5:609A 13 inc de ROM5:609B 08 3E 14 ld (143E),sp ROM5:609E CF rst 08 ROM5:609F 05 dec b ROM5:60A0 0E CF ld c,CF ROM5:60A2 07 rlca ROM5:60A3 0E 21 ld c,21 ROM5:60A5 21 99 11 ld hl,1199 ROM5:60A8 C1 pop bc ROM5:60A9 C5 push bc ROM5:60AA FA D5 C5 ld a,(C5D5) ;# of characters to display ROM5:60AD 4F ld c,a ROM5:60AE 1A ld a,(de) ROM5:60AF CF rst 08 ROM5:60B0 11 08 FA ld de,FA08 ROM5:60B3 D7 rst 10 ROM5:60B4 C5 push bc ROM5:60B5 22 ldi (hl),a ROM5:60B6 13 inc de ROM5:60B7 0D dec c ROM5:60B8 20 F4 jr nz,60AE ROM5:60BA 3E 80 ld a,80 ROM5:60BC 22 ldi (hl),a ROM5:60BD 3E 71 ld a,71 ROM5:60BF 22 ldi (hl),a ROM5:60C0 21 41 99 ld hl,9941 ROM5:60C3 11 C1 C5 ld de,C5C1 ROM5:60C6 FA D5 C5 ld a,(C5D5) ROM5:60C9 4F ld c,a ROM5:60CA 1A ld a,(de) ROM5:60CB CF rst 08 ROM5:60CC 11 08 FA ld de,FA08 ROM5:60CF D8 ret c ROM5:60D0 C5 push bc ROM5:60D1 22 ldi (hl),a ROM5:60D2 13 inc de ROM5:60D3 0D dec c ROM5:60D4 20 F4 jr nz,60CA ROM5:60D6 3E 23 ld a,23 ROM5:60D8 22 ldi (hl),a ROM5:60D9 3E 4F ld a,4F ROM5:60DB 22 ldi (hl),a ROM5:60DC 3E 6D ld a,6D ROM5:60DE 22 ldi (hl),a ROM5:60DF 3E 43 ld a,43 ROM5:60E1 22 ldi (hl),a ROM5:60E2 E1 pop hl ROM5:60E3 D1 pop de ROM5:60E4 C1 pop bc ROM5:60E5 F1 pop af ROM5:60E6 C9 ret
Bank 6
Graphics 1
- 0x019B40 - « This game is designed for use on GAME BOY ® COLOR only »
Bank 7
Card data
7:4078
ROM7:4078 F5 push af ROM7:4079 C5 push bc ROM7:407A 47 ld b,a ROM7:407B FA AB C6 ld a,(C6AB) ROM7:407E 4F ld c,a ROM7:407F CD 6B 43 call 436B ROM7:4082 4F ld c,a ROM7:4083 CD 0D 43 call 430D ROM7:4086 CD 41 43 call 4341 ROM7:4089 C1 pop bc ROM7:408A F1 pop af ROM7:408B C9 ret
7:408C
ROM7:408C F5 push af ROM7:408D 78 ld a,b ROM7:408E EA A5 C6 ld (C6A5),a ROM7:4091 79 ld a,c ROM7:4092 EA A6 C6 ld (C6A6),a ROM7:4095 F1 pop af ROM7:4096 C9 ret
Read card data - main routine
ROM7:4097 F5 push af ROM7:4098 C5 push bc ROM7:4099 CD 3F 1A call 1A3F ;Checks if bc ≠ 0 ROM7:409C FE 00 cp a,00 ROM7:409E 20 05 jr nz,40A5 ;if(card_ID == 0), jump to 7:40A5 (fail-safe) ROM7:40A0 CD AB 40 call 40AB ;Read card data ROM7:40A3 18 03 jr 40A8 ROM7:40A5 CD 0E 41 call 410E ;Set fail-safe card data ROM7:40A8 C1 pop bc ROM7:40A9 F1 pop af ROM7:40AA C9 ret
Read card data
ROM7:40AB F5 push af ROM7:40AC C5 push bc ROM7:40AD D5 push de ROM7:40AE E5 push hl ROM7:40AF 79 ld a,c ROM7:40B0 EA A3 C6 ld (C6A3),a ;wC6A3 = Card ID ROM7:40B3 78 ld a,b ROM7:40B4 EA A4 C6 ld (C6A4),a ROM7:40B7 21 4C 52 ld hl,524C ;Card Type array ROM7:40BA 09 add hl,bc ;pointer = 0x524C + (card_ID) ROM7:40BB 7E ld a,(hl) ROM7:40BC EA AB C6 ld (C6AB),a ;wC6AB = Card Type ROM7:40BF 21 D1 55 ld hl,55D1 ;Card Cost array ROM7:40C2 09 add hl,bc ;pointer = 0x55D1 + (card_ID) ROM7:40C3 7E ld a,(hl) ROM7:40C4 EA AC C6 ld (C6AC),a ;wC6AC = Card Cost ROM7:40C7 21 56 59 ld hl,5956 ;Card Alignment array ROM7:40CA 09 add hl,bc ;pointer = 0x5956 + (card_ID) ROM7:40CB 7E ld a,(hl) ROM7:40CC EA AE C6 ld (C6AE),a ;wC6AE = Card Alignment ROM7:40CF 21 DB 5C ld hl,5CDB ;Card Effect (Magic, Rituals and Traps) array ROM7:40D2 09 add hl,bc ;pointer = 0x5CDB + (card_ID) ROM7:40D3 7E ld a,(hl) ROM7:40D4 EA AF C6 ld (C6AF),a ;wC6AF = Card Effect (Magic, Rituals and Traps) ROM7:40D7 21 60 60 ld hl,6060 ;Card Effect (Monster) array ROM7:40DA 09 add hl,bc ;pointer = 0x6060 + (card_ID) ROM7:40DB 7E ld a,(hl) ROM7:40DC EA B0 C6 ld (C6B0),a ;wC6B0 = Card Effect (Monster) ROM7:40DF 21 49 64 ld hl,6449 ;Card Level array ROM7:40E2 09 add hl,bc ;pointer = 0x6449 + (card_ID) ROM7:40E3 7E ld a,(hl) ROM7:40E4 EA AD C6 ld (C6AD),a ;wC6AD = Card Level ROM7:40E7 CB 21 sla c ;bc = card_ID × 2 ROM7:40E9 CB 10 rl b ROM7:40EB 21 90 43 ld hl,4390 ;Card ATK array ROM7:40EE 09 add hl,bc ;pointer = 0x4390 + (card_ID × 2) ROM7:40EF 2A ldi a,(hl) ROM7:40F0 56 ld d,(hl) ROM7:40F1 5F ld e,a ROM7:40F2 7B ld a,e ROM7:40F3 EA A7 C6 ld (C6A7),a ;wC6A7 = Card ATK ROM7:40F6 7A ld a,d ROM7:40F7 EA A8 C6 ld (C6A8),a ROM7:40FA 21 9A 4A ld hl,4A9A ;Card DEF array ROM7:40FD 09 add hl,bc ;pointer = 0x4A9A + (card_ID × 2) ROM7:40FE 2A ldi a,(hl) ROM7:40FF 56 ld d,(hl) ROM7:4100 5F ld e,a ROM7:4101 7B ld a,e ROM7:4102 EA A9 C6 ld (C6A9),a ;wC6A9 = Card DEF ROM7:4105 7A ld a,d ROM7:4106 EA AA C6 ld (C6AA),a ROM7:4109 E1 pop hl ROM7:410A D1 pop de ROM7:410B C1 pop bc ROM7:410C F1 pop af ROM7:410D C9 ret
Set fail-safe card data
ROM7:410E F5 push af ROM7:410F 79 ld a,c ROM7:4110 EA A3 C6 ld (C6A3),a ;Card_ID = bc ROM7:4113 78 ld a,b ROM7:4114 EA A4 C6 ld (C6A4),a ROM7:4117 3E 17 ld a,17 ROM7:4119 EA AB C6 ld (C6AB),a ;Card_Type = 0x17 (Invalid) ROM7:411C 3E 00 ld a,00 ROM7:411E EA AC C6 ld (C6AC),a ;Card_Cost = 0 ROM7:4121 3E 0B ld a,0B ROM7:4123 EA AE C6 ld (C6AE),a ;Card_Alignment = 0x0B (Non-Monster Card) ROM7:4126 3E 02 ld a,02 ROM7:4128 EA AF C6 ld (C6AF),a ;Card_Effect_MagicRitualTrap = 0x02 (Monster card) ROM7:412B 3E FF ld a,FF ROM7:412D EA A7 C6 ld (C6A7),a ;Card_ATK = 0xFFFF ROM7:4130 3E FF ld a,FF ROM7:4132 EA A8 C6 ld (C6A8),a ROM7:4135 3E FF ld a,FF ROM7:4137 EA A9 C6 ld (C6A9),a ;Card_DEF = 0xFFFF ROM7:413A 3E FF ld a,FF ROM7:413C EA AA C6 ld (C6AA),a ROM7:413F F1 pop af ROM7:4140 C9 ret
Cards data arrays
0x1C390
: ATK0x1CA9A
: DEF0x1D24C
: Types0x1D5D1
: Costs0x1D956
: Alignments0x1DCDB
: Cards Effects IDs (Magic, Rituals and Traps)0x1E060
: Cards Effects IDs (Effect Monsters)0x1E449
: Levels
Bank 8
Graphics 2
- 0x20100-0x20510 - Character table
Bank 9
Cards Passwords
0x2454F
: Passwords
9:5564 - 00s wCA64-wCAD5
ROM9:5564 F5 push af ROM9:5565 C5 push bc ROM9:5566 E5 push hl ROM9:5567 21 64 CA ld hl,CA64 ROM9:556A AF xor a ;a = 0 ROM9:556B 0E 71 ld c,71 ;c = 0x71 ; 0d113 ROM9:556D 22 ldi (hl),a ;write 00 in wCA64-wCAD5 ROM9:556E 0D dec c ROM9:556F 20 FC jr nz,556D ;loop to 9:556D 113 times ROM9:5571 E1 pop hl ROM9:5572 C1 pop bc ROM9:5573 F1 pop af ROM9:5574 C9 ret
Bank A
Opponent's decks
0x28087-0x28716
: Opponent decks
Weevil
0x28087-0x280D6
FB 02 32 00 32 02 D1 00 FA 01 C4 01 16 01 61 02 E5 01 F5 01 DC 01 61 03 31 01 36 00 FB 02 32 00 32 02 D1 00 FA 01 FA 02 61 02 E5 01 F5 01 DC 01 32 01 FC 02 FB 02 32 00 32 02 D1 00 FA 01 C4 01 34 00 61 02 E5 01 F5 01 DC 01 61 03 83 03 25 03 3× Zarigun 3× Winged Cleaver 3× Needle Worm 3× Bladefly 3× Gale Dogra 1× Soldier Ant 3× Korogashi 3× Basic Insect 3× Parasite Paracide 2× Dragon Pirate Soldier 1× Petit Moth
1× Infinite Dismissal
Mako Tsunami
0x28177-0x281C6
8E 01 E4 01 D5 01 0C 02 BC 01 B4 01 DB 01 21 01 A7 00 89 01 ED 00 84 02 98 00 CE 02 8E 01 E4 01 D5 01 0C 02 BC 01 B4 01 DB 01 21 01 A7 00 89 01 ED 00 84 02 98 00 81 03 8E 01 E4 01 D5 01 0C 02 BC 01 B4 01 DB 01 21 01 A7 00 89 01 ED 00 84 02 1× Whale Fortress 3× Star Boy 2× Melting Red Shadow 3× White Dolphin 3× Haniwa 3× Turu-Purun 3× Change Slime 3× Ancient Jar 3× Flame Viper 3× Amoeba 3× Sinister Serpent 3× Armed Ninja 3× Ooguchi 3× Zone Eater 1× Torrential Tribute
A:4D64
ROMA:4D64 F5 push af ROMA:4D65 C5 push bc ROMA:4D66 3E 02 ld a,02 ROMA:4D68 EA AC C8 ld (C8AC),a ROMA:4D6B 3E 03 ld a,03 ROMA:4D6D EA FC C8 ld (C8FC),a ROMA:4D70 FA 62 CA ld a,(CA62) ROMA:4D73 47 ld b,a ROMA:4D74 FA 63 CA ld a,(CA63) ROMA:4D77 4F ld c,a ROMA:4D78 CD 9D 19 call 199D ROMA:4D7B CD E0 19 call 19E0 ROMA:4D7E FA DD C7 ld a,(C7DD) // Current card ID ROMA:4D81 EA F6 C8 ld (C8F6),a ROMA:4D84 FA DE C7 ld a,(C7DE) ROMA:4D87 EA F7 C8 ld (C8F7),a ROMA:4D8A 3E 81 ld a,81 ROMA:4D8C EA F8 C8 ld (C8F8),a ROMA:4D8F 3E 03 ld a,03 ROMA:4D91 EA F9 C8 ld (C8F9),a ROMA:4D94 0E 02 ld c,02 ROMA:4D96 06 01 ld b,01 ROMA:4D98 78 ld a,b ROMA:4D99 FE 06 cp a,06 ROMA:4D9B 30 06 jr nc,4DA3 ROMA:4D9D CD 96 1F call 1F96 // Destroy Player's card ROMA:4DA0 04 inc b ROMA:4DA1 18 F5 jr 4D98 ROMA:4DA3 CD 1D 47 call 471D ROMA:4DA6 C1 pop bc ROMA:4DA7 F1 pop af ROMA:4DA8 C9 ret
Bank B
Limited cards
0x2C04D-0x2C0AC
: Limited cards
ROMB:404D 11 00 12 00 13 00 14 00 15 00 38 00 39 00 43 00 48 00 87 00 E0 00 02 01 16 01 50 01 51 01 56 01 5C 01 91 02 AC 02 AD 02 AE 02 DB 02 DE 02 0D 03 10 03 11 03 15 03 40 03 41 03 42 03 7D 03 7E 03 7F 03 81 03 82 03 64 01 65 01 68 01 6A 01 6C 01 6D 01 76 01 7C 01 BD 02 BE 02 BF 02 C0 02 C1 02 C2 02 C4 02 C5 02 C6 02 CB 02 CC 02 CD 02 CE 02 CF 02 D0 02 D1 02 00 00
Checks if the card is allowed in the version
ROMB:40AF C5 push bc ROMB:40B0 D5 push de ROMB:40B1 E5 push hl ROMB:40B2 AF xor a ROMB:40B3 CB 38 srl b ROMB:40B5 CB 19 rr c ROMB:40B7 1F rra ROMB:40B8 CB 38 srl b ROMB:40BA CB 19 rr c ROMB:40BC 1F rra ROMB:40BD CB 38 srl b ROMB:40BF CB 19 rr c ;bc >> 3 ROMB:40C1 1F rra ROMB:40C2 1F rra ROMB:40C3 CB 37 swap a ROMB:40C5 F5 push af ROMB:40C6 21 DC 40 ld hl,40DC ROMB:40C9 CD 4D 2A call 2A4D ROMB:40CC FE 01 cp a,01 ROMB:40CE 20 03 jr nz,40D3 ;if the player didn't beat Pegasus 5 times, hl = 0x40DC ROMB:40D0 21 4D 41 ld hl,414D ;else hl = 0x414D ROMB:40D3 09 add hl,bc ROMB:40D4 F1 pop af ROMB:40D5 CD CB 16 call 16CB ROMB:40D8 E1 pop hl ROMB:40D9 D1 pop de ROMB:40DA C1 pop bc ROMB:40DB C9 ret
Allowed cards flags
The blocks for pre-credits and post-credits allowed cards are each 904 bits long
0x2C0DC
- Allowed cards flags (pre-credits)
ROMB:40DC 10 F9 01 30 01 08 18 20 31 C0 07 00 70 4E 01 A6 22 C6 AF EF 6D FB FF FF FF FC DE EF FC F3 EB FF EE FF BF FE AF 77 F9 8B FF FD 7C 40 00 00 00 40 F8 FF EF FF FF DD FF FF 9B FF 3F FD EF FF E7 FF FF FF FF EB 7F FF DF FF 7F FF EF BF EF FF FF FF FF FF DD 8F F7 FF FF 1F 08 03 00 04 48 97 9F 66 E1 5F BD F7 97 E7 FF FF F8 FB 9B FF FF 7F F0 37 17
0x2C14D
- Allowed cards flags (post-credits)
ROMB:414D 10 F9 01 30 01 08 FE E3 39 C1 07 00 70 4E 01 A6 22 C6 AF EF 6D FB FF FF FF FC DE EF FC F3 EB FF EE FF FF FE AF 77 FF FB FF FD 7D 40 0A C2 BF 41 FC FF EF FF FF DD FF FF 9B FF 3F FD EF FF E7 FF FF FF FF EB 7F FF DF FF 7F FF EF BF EF FF FF FF FF FF DD 8F F7 FF FF 1F 08 03 00 04 48 97 9F 7E E1 5F BD F7 F7 E7 FF FF FC FB 9B FF FF 7F F0 37 17
Bit flags
01 02 04 08 10 20 40 80
Bank E
Copy Player's Name
ROME:6AAF F5 push af ROME:6AB0 C5 push bc ROME:6AB1 D5 push de ROME:6AB2 E5 push hl ROME:6AB3 21 CB 6A ld hl,6ACB ;Player's name ROME:6AB6 11 C1 C5 ld de,C5C1 ;where to copy the string ROME:6AB9 0E 08 ld c,08 ;# of characters to copy ROME:6ABB 2A ldi a,(hl) ROME:6ABC 12 ld (de),a ROME:6ABD 13 inc de ROME:6ABE 0D dec c ROME:6ABF 20 FA jr nz,6ABB ROME:6AC1 3E 03 ld a,03 ;# of characters to display ROME:6AC3 EA D5 C5 ld (C5D5),a ROME:6AC6 E1 pop hl ROME:6AC7 D1 pop de ROME:6AC8 C1 pop bc ROME:6AC9 F1 pop af ROME:6ACA C9 ret
0x3AACB
- Player's Name
Bank 10
Debug Character Viewer
10:4101
RO10:4101 C5 push bc RO10:4102 E5 push hl RO10:4103 3E 02 ld a,02 RO10:4105 CD 87 0F call 0F87 RO10:4108 CD 7D 11 call 117D RO10:410B FA 55 CA ld a,(CA55) RO10:410E FE 18 cp a,18 RO10:4110 30 10 jr nc,4122 RO10:4112 FA 55 CA ld a,(CA55) RO10:4115 EA 32 C7 ld (C732),a RO10:4118 AF xor a RO10:4119 EA 33 C7 ld (C733),a RO10:411C CF rst 08 RO10:411D 03 inc bc RO10:411E 02 ld (bc),a RO10:411F CF rst 08 RO10:4120 11 02 3E ld de,3E02 RO10:4123 01 E1 C1 ld bc,C1E1 RO10:4126 C9 ret
10:4127
RO10:4127 14 inc d RO10:4128 15 dec d RO10:4129 16 17 ld d,17 RO10:412B 3E 02 ld a,02 RO10:412D CD 87 0F call 0F87 RO10:4130 CD 7D 11 call 117D RO10:4133 3E 01 ld a,01 RO10:4135 C9 ret
Increment Character ID
RO10:4136 FA 55 CA ld a,(CA55) RO10:4139 C6 01 add a,01 RO10:413B EA 55 CA ld (CA55),a RO10:413E 3E 06 ld a,06 ;(C5AE)=6, then ? RO10:4140 CD 87 0F call 0F87 RO10:4143 CD 60 41 call 4160 RO10:4146 CD 7D 11 call 117D RO10:4149 AF xor a RO10:414A C9 ret
Decrement Character ID
RO10:414B FA 55 CA ld a,(CA55) RO10:414E D6 01 sub a,01 RO10:4150 EA 55 CA ld (CA55),a RO10:4153 3E 06 ld a,06 RO10:4155 CD 87 0F call 0F87 RO10:4158 CD 60 41 call 4160 RO10:415B CD 7D 11 call 117D RO10:415E AF xor a RO10:415F C9 ret
10:4160
RO10:4160 F5 push af RO10:4161 C5 push bc RO10:4162 01 46 98 ld bc,9846 RO10:4165 CD 8E 11 call 118E RO10:4168 FA 55 CA ld a,(CA55) RO10:416B EA E7 C5 ld (C5E7),a RO10:416E 3E 00 ld a,00 RO10:4170 EA E8 C5 ld (C5E8),a RO10:4173 CD 61 15 call 1561 RO10:4176 78 ld a,b RO10:4177 E6 0F and a,0F RO10:4179 3C inc a RO10:417A CD CF 11 call 11CF RO10:417D 79 ld a,c RO10:417E E6 F0 and a,F0 RO10:4180 CB 37 swap a RO10:4182 3C inc a RO10:4183 CD CF 11 call 11CF RO10:4186 79 ld a,c RO10:4187 E6 0F and a,0F RO10:4189 3C inc a RO10:418A CD CF 11 call 11CF RO10:418D AF xor a RO10:418E 0E 11 ld c,11 RO10:4190 CD CF 11 call 11CF RO10:4193 0D dec c RO10:4194 20 FA jr nz,4190 RO10:4196 C1 pop bc RO10:4197 F1 pop af RO10:4198 C9 ret
Bank 18
Cards names
0x60014-0x63F4F
- Cards names
Bank D0
Miscellaneous Text
0x340EFD
- Password Entry screen text
Bank FE-FF
Cards texts
0x3F8002-0x3FFE87
- Cards Text
Internal Data for Yu-Gi-Oh! Duel Monsters 4: Kaiba Deck
| |
---|---|