1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
|
INCLUDE "constants.asm"
;----------------------------------------------------------
;--- Bank 0: $Cxxx ----------------------------------------
;----------------------------------------------------------
SECTION "WRAM0", WRAM0
ds $200
;--- Duels 1 ----------------------------------------------
wPlayerDuelVariables:: ; c200
; 60-byte array that indicates where each of the 60 cards is.
; $00 - deck
; $01 - hand
; $02 - discard pile
; $08 - prize
; $10 - hand
; $1X - bench (where X is bench position from 1 to 5)
wPlayerCardLocations:: ; c200
ds DECK_SIZE
ds $6
; Which cards are in player's hand, as numbers 0 to 59
wPlayerHand:: ; c242
ds DECK_SIZE
; 60-byte array that indicates in which order the cards are in the deck.
; initially numbers 0 to 59 in order, until deck is shuffled.
; the earlier a card appears in the array, the closer to the top of the deck it is.
wPlayerDeckCards:: ; c27e
ds $3c
; stores x = (60 - deck remaining cards)
; the first x cards in the wPlayerDeckCards array are ignored (e.g. when drawing a card)
wPlayerNumberOfCardsNotInDeck:: ; c2ba
ds $1
; Which card is in player's side of the field, as number 0 to 59
wPlayerArenaCard:: ; c2bb
ds $1
; Which cards are in player's bench, as numbers 0 to 59
wPlayerBench:: ; c2bc
ds BENCH_SIZE
ds $7
wPlayerArenaCardHP:: ; c2c8
ds $1
wPlayerBench1CardHP:: ; c2c9
ds $1
wPlayerBench2CardHP:: ; c2ca
ds $1
wPlayerBench3CardHP:: ; c2cb
ds $1
wPlayerBench4CardHP:: ; c2cc
ds $1
wPlayerBench5CardHP:: ; c2cd
ds $1
ds $20
wPlayerNumberOfCardsInHand:: ; c2ee
ds $1
; Pokemon cards in arena + bench
wPlayerNumberOfPokemonInPlay:: ; c2ef
ds $1
wPlayerArenaCardStatus:: ; c2f0
ds $1
; $00 - player
; $01 - link
; other - AI controlled
wPlayerDuelistType:: ; c2f1
ds $1
ds $e
wOpponentDuelVariables:: ; c300
wOpponentCardLocations:: ; c300
ds DECK_SIZE
ds $6
wOpponentHand:: ; c342
ds DECK_SIZE
wOpponentDeckCards:: ; c37e
ds $3c
wOpponentNumberOfCardsNotInDeck:: ; c3ba
ds $1
wOpponentArenaCard:: ; c3bb
ds $1
wOpponentBench:: ; c3bc
ds BENCH_SIZE
ds $7
wOpponentArenaCardHP:: ; c3c8
ds $1
wOpponentBench1CardHP:: ; c3c9
ds $1
wOpponentBench2CardHP:: ; c3ca
ds $1
wOpponentBench3CardHP:: ; c3cb
ds $1
wOpponentBench4CardHP:: ; c3cc
ds $1
wOpponentBench5CardHP:: ; c3cd
ds $1
ds $20
wOpponentNumberOfCardsInHand:: ; c3ee
ds $1
wOpponentNumberOfPokemonInPlay:: ; c3ef
ds $1
wOpponentArenaCardStatus:: ; c3f0
ds $1
; $00 - player
; $01 - link
; other - AI controlled
wOpponentDuelistType:: ; c3f1
ds $1
ds $e
wPlayerDeck:: ; c400
ds $80
wOpponentDeck:: ; c480
ds $80
ds $500
;--- Engine -----------------------------------------------
wBufOAM:: ; ca00
ds $a0
ds $13
; initial value of the A register--used to tell the console when reset
wInitialA:: ; cab3
ds $1
; what console we are playing on, either 0 (DMG), 1 (SGB) or 2 (CGB)
; use constants CONSOLE_DMG, CONSOLE_SGB and CONSOLE_CGB for checks
wConsole:: ; cab4
ds $1
ds $1
wTileMapFill:: ; cab6
ds $1
wIE:: ; cab7
ds $1
wVBlankCtr:: ; cab8
ds $1
ds $1
; bit0: is in vblank interrupt?
; bit1: is in timer interrupt?
wReentrancyFlag:: ; caba
ds $1
wLCDC:: ; cabb
ds $1
wBGP:: ; cabc
ds $1
wOBP0:: ; cabd
ds $1
wOBP1:: ; cabe
ds $1
wFlushPaletteFlags:: ; cabf
ds $1
wVBlankOAMCopyToggle:: ; cac0
ds $1
ds $2
wCounterCtr:: ; cac3
ds $1
wPlayTimeCounterEnable:: ; cac4
ds $1
; byte0: 1/60ths of a second
; byte1: seconds
; byte2: minutes
; byte3: hours (lower byte)
; byte4: hours (upper byte)
wPlayTimeCounter:: ; cac5
ds $5
wRNG1:: ; caca
ds $1
wRNG2:: ; cacb
ds $1
wCounter:: ; cacc
ds $1
ds $3
wVBlankFunctionTrampoline:: ; cad0
ds $20 ; unknown length
wBufPalette:: ; caf0 - cab7f
ds $80
ds $4
;--- Serial transfer bytes (cb74-cbc4) --------------------
wSerialOp:: ; cb74
ds $1
wSerialFlags:: ; cb75
ds $1
wSerialCounter:: ; cb76
ds $1
wSerialCounter2:: ; cb77
ds $1
wSerialTimeoutCounter:: ; cb78
ds $1
ds $4
wSerialSendSave:: ; cb7d
ds $1
wSerialSendBufToggle:: ; cb7e
ds $1
wSerialSendBufIndex:: ; cb7f
ds $1
ds $1
wSerialSendBuf:: ; cb81
ds $20
wSerialLastReadCA:: ; cba1
ds $1
wSerialRecvCounter:: ; cba2
ds $1
ds $1
wSerialRecvIndex:: ; cba4
ds $1
wSerialRecvBuf:: ; $cba5 - $cbc4
ds $20
ds $49
;--- Duels 2 ----------------------------------------------
; this seems to hold the current opponent's deck id - 2,
; perhaps to account for the two unused pointers at the
; beginning of DeckPointers
wOpponentDeckId:: ; cc0e
ds $1
ds $4
wIsPracticeDuel:: ; cc13
ds $1
ds $6
wDuelTheme:: ; cc1a
ds $1
ds $9
; wCardBuffer1 and wCardBuffer2 hold the data of a player's or opponent's card.
; Can be data from a card on either side of the field or hand, or from a card in the bench, depending on the duel state.
; Sometimes the two buffers even hold the same card's data.
wCardBuffer1:: ; cc24
ds CARD_DATA_LENGTH
wCardBuffer2:: ; cc65
ds CARD_DATA_LENGTH
ds $c
wCurrentMoveOrCardEffect:: ; ccb2
ds $1
ds $40
;--- Overworld --------------------------------------------
; color/pattern of the text box border. Values between 0-7?. Interpreted differently depending on console type
; Note that this doesn't appear to be a selectable option, just changes with the situation.
; For example the value 4 seems to be used a lot during duels.
wFrameType:: ; ccf3
ds $1
ds $19
wUppercaseFlag:: ; cd0d
ds $1
ds $1
; Handles timing of (horizontal or vertical) arrow blinking while waiting for user input.
wCursorBlinkCounter:: ; cd0f
ds $1
wCurMenuItem:: ; cd10
ds $1
wCursorXPosition:: ; cd11
ds $1
wCursorYPosition:: ; cd12
ds $1
wYDisplacementBetweenMenuItems:: ; cd13
ds $1
wNumMenuItems:: ; cd14
ds $1
wCursorTileNumber:: ; cd15
ds $1
wTileBehindCursor:: ; cd16
ds $1
ds $10b
; During a duel, this is always $b after the first attack.
; $b is the bank where the functions associated to card or effect commands are.
; Its only purpose seems to be store this value to be read by TryExecuteEffectCommandFunction.
wce22:: ; ce22
;----------------------------------------------------------
;--- Bank 1: $Dxxx ----------------------------------------
;----------------------------------------------------------
SECTION "WRAM1", WRAMX, BANK[1]
ds $113
;--- Music ------------------------------------------------
wMatchStartTheme:: ; d113
ds $1
ds $21b
wCurMap:: ; d32f
ds $1
wPlayerXCoord:: ; d330
ds $1
wPlayerYCoord:: ; d331
ds $1
ds $a52
wMusicDC:: ; dd84
ds $2
wMusicDuty:: ; dd86
ds $4
wMusicWave:: ; dd8a
ds $1
wMusicWaveChange:: ; dd8b
ds $2
wMusicIsPlaying:: ; dd8d
ds $4
wMusicTie:: ; dd91
ds $c
wMusicMainLoop:: ; dd9d
ds $12
wMusicOctave:: ; ddaf
ds $10
wMusicE8:: ; ddbf
ds $8
wMusicE9:: ; ddc7
ds $4
wMusicEC:: ; ddcb
ds $4
wMusicSpeed:: ; ddcf
ds $4
wMusicVibratoType:: ; ddd3
ds $4
wMusicVibratoType2:: ; ddd7
ds $8
wMusicVibratoDelay:: ; dddf
ds $8
wMusicVolume:: ; dde7
ds $3
wMusicE4:: ; ddea
ds $9
wMusicReturnAddress:: ; ddf3
ds $8
|