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
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
|
INCLUDE "macros.asm"
INCLUDE "constants.asm"
INCLUDE "vram.asm"
SECTION "WRAM0", WRAM0
UNION
wTempCardCollection:: ; c000
ds $100
NEXTU
wc000:: ; c000
ds $100
NEXTU
; aside from wDecompressionBuffer, which stores the
; de facto final decompressed data after decompression,
; this buffer stores a secondary buffer that is used
; for "lookbacks" when repeating byte sequences.
; actually starts in the middle of the buffer,
; at wDecompressionSecondaryBufferStart, then wraps back up
; to wDecompressionSecondaryBuffer.
; this is used so that $00 can be "looked back", since anything
; before $ef is initialized to 0 when starting decompression.
wDecompressionSecondaryBuffer:: ; c000
ds $ef
wDecompressionSecondaryBufferStart:: ; c0ef
ds $11
NEXTU
; names of the last players who have done
; Card Pop! with current save file
wCardPopNameList:: ; c000
ds CARDPOP_NAME_LIST_SIZE
NEXTU
; buffer used to store a deck that will be built
wDeckToBuild:: ; c000
ds DECK_STRUCT_SIZE
ENDU
ds $100
SECTION "WRAM0 Duels 1", WRAM0
; this union spans from c200 to c3ff
UNION
; In order to be identified during a duel, the 60 cards of each duelist are given an index between 0 and 59.
; These indexes are assigned following the order of the card list in wPlayerDeck or wOpponentDeck,
; which, in turn, follows the internal order of the cards.
; This temporary index of a card identifies the card within the duelist's deck during an ongoing duel.
; Terminology used in labels and comments:
; - The deck index, or the index within the deck of a card refers to the identifier mentioned just above,
; that is, its temporary position in the wPlayerDeck or wOpponentDeck card list during the current duel.
; - The card ID is its actual internal identifier, that is, its number from card_constants.asm.
wPlayerDuelVariables:: ; c200
; 60-byte array that indicates where each of the 60 cards is.
; $00 - deck
; $01 - hand
; $02 - discard pile
; $08 - prize
; $10 - arena (active pokemon or a card attached to it)
; $1X - bench (where X is bench position from 1 to 5)
wPlayerCardLocations:: ; c200
ds DECK_SIZE
; deck indexes of the up to 6 cards placed as prizes
wPlayerPrizeCards:: ; c23c
ds $6
; Deck indexes of the cards that are in the player's hand
wPlayerHand:: ; c242
ds DECK_SIZE
; 60-byte array that maps each card to its position in the deck or anywhere else
; This array is initialized to 00, 01, 02, ..., 59, until deck is shuffled.
; Cards in the discard pile go first, cards still in the deck go last, and others go in-between.
wPlayerDeckCards:: ; c27e
ds DECK_SIZE
; Stores x = (60 - deck remaining cards).
; The first x cards in the wPlayerDeckCards array are no longer in the drawable deck this duel.
; The top card of the player's deck is at wPlayerDeckCards + [wPlayerNumberOfCardsNotInDeck].
wPlayerNumberOfCardsNotInDeck:: ; c2ba
ds $1
; Deck index of the card that is in player's side of the field
; -1 indicates no pokemon
wPlayerArenaCard:: ; c2bb
ds $1
; Deck indexes of the cards that are in player's bench, plus an $ff (-1) terminator
; -1 indicates no pokemon
wPlayerBench:: ; c2bc
ds MAX_BENCH_POKEMON + 1
wPlayerArenaCardFlags:: ; c2c2
ds $1
ds $5
wPlayerArenaCardHP:: ; c2c8
ds $1
wPlayerBench1CardHP:: ; c2c9
ds $1
wPlayerBench2CardHP:: ; c2ca
ds $1
wPlayerBench3CardHP:: ; c2cb
ds $1
wPlayerBench4CardHP:: ; c2cc
ds $1
wPlayerBench5CardHP:: ; c2cd
ds $1
wPlayerArenaCardStage:: ; c2ce
ds $1
wPlayerBench1CardStage:: ; c2cf
ds $1
wPlayerBench2CardStage:: ; c2d0
ds $1
wPlayerBench3CardStage:: ; c2d1
ds $1
wPlayerBench4CardStage:: ; c2d2
ds $1
wPlayerBench5CardStage:: ; c2d3
ds $1
; changed type from Venomoth's Shift Pokemon Power
; if bit 7 == 1, then bits 0-3 override the Pokemon's actual color
wPlayerArenaCardChangedType:: ; c2d4
ds $1
wPlayerBench1CardChangedType:: ; c2d5
ds $1
wPlayerBench2CardChangedType:: ; c2d6
ds $1
wPlayerBench3CardChangedType:: ; c2d7
ds $1
wPlayerBench4CardChangedType:: ; c2d8
ds $1
wPlayerBench5CardChangedType:: ; c2d9
ds $1
wPlayerArenaCardAttachedDefender:: ; c2da
ds $1
wPlayerBench1CardAttachedDefender:: ; c2db
ds $1
wPlayerBench2CardAttachedDefender:: ; c2dc
ds $1
wPlayerBench3CardAttachedDefender:: ; c2dd
ds $1
wPlayerBench4CardAttachedDefender:: ; c2de
ds $1
wPlayerBench5CardAttachedDefender:: ; c2df
ds $1
wPlayerArenaCardAttachedPluspower:: ; c2e0
ds $1
wPlayerBench1CardAttachedPluspower:: ; c2e1
ds $1
wPlayerBench2CardAttachedPluspower:: ; c2e2
ds $1
wPlayerBench3CardAttachedPluspower:: ; c2e3
ds $1
wPlayerBench4CardAttachedPluspower:: ; c2e4
ds $1
wPlayerBench5CardAttachedPluspower:: ; c2e5
ds $1
ds $1
wPlayerArenaCardSubstatus1:: ; c2e7
ds $1
wPlayerArenaCardSubstatus2:: ; c2e8
ds $1
; changed weakness from Conversion 1
wPlayerArenaCardChangedWeakness:: ; c2e9
ds $1
; changed resistance from Conversion 2
wPlayerArenaCardChangedResistance:: ; c2ea
ds $1
wPlayerArenaCardSubstatus3:: ; c2eb
ds $1
; each bit represents a prize that this duelist can draw (1 = not drawn ; 0 = drawn)
wPlayerPrizes:: ; c2ec
ds $1
wPlayerNumberOfCardsInDiscardPile:: ; c2ed
ds $1
wPlayerNumberOfCardsInHand:: ; c2ee
ds $1
; Pokemon cards in arena + bench
wPlayerNumberOfPokemonInPlayArea:: ; c2ef
ds $1
wPlayerArenaCardStatus:: ; c2f0
ds $1
; $00 - player
; $01 - link
; other - AI controlled
wPlayerDuelistType:: ; c2f1
ds $1
; if under the effects of amnesia, which attack (0 or 1) can't be used
wPlayerArenaCardDisabledAttackIndex:: ; c2f2
ds $1
; damage taken the last time the opponent attacked (0 if no damage)
wPlayerArenaCardLastTurnDamage:: ; c2f3
ds $2
; status condition received the last time the opponent attacked (0 if none)
wPlayerArenaCardLastTurnStatus:: ; c2f5
ds $1
; substatus2 that the opponent card got last turn
wPlayerArenaCardLastTurnSubstatus2:: ; c2f6
ds $1
; indicates color of weakness that was changed
; for this card last turn
wPlayerArenaCardLastTurnChangeWeak:: ; c2f7
ds $1
; stores an effect that was used on the Arena card last turn.
; see LAST_TURN_EFFECT_* constants.
wPlayerArenaCardLastTurnEffect:: ; c2f8
ds $1
ds $7
wOpponentDuelVariables:: ; c300
wOpponentCardLocations:: ; c300
ds DECK_SIZE
wOpponentPrizeCards:: ; c33c
ds $6
wOpponentHand:: ; c342
ds DECK_SIZE
wOpponentDeckCards:: ; c37e
ds DECK_SIZE
wOpponentNumberOfCardsNotInDeck:: ; c3ba
ds $1
wOpponentArenaCard:: ; c3bb
ds $1
wOpponentBench:: ; c3bc
ds MAX_BENCH_POKEMON + 1
wOpponentArenaCardFlags:: ; c3c2
ds $1
ds $5
wOpponentArenaCardHP:: ; c3c8
ds $1
wOpponentBench1CardHP:: ; c3c9
ds $1
wOpponentBench2CardHP:: ; c3ca
ds $1
wOpponentBench3CardHP:: ; c3cb
ds $1
wOpponentBench4CardHP:: ; c3cc
ds $1
wOpponentBench5CardHP:: ; c3cd
ds $1
wOpponentArenaCardStage:: ; c3ce
ds $1
wOpponentBench1CardStage:: ; c3cf
ds $1
wOpponentBench2CardStage:: ; c3d0
ds $1
wOpponentBench3CardStage:: ; c3d1
ds $1
wOpponentBench4CardStage:: ; c3d2
ds $1
wOpponentBench5CardStage:: ; c3d3
ds $1
wOpponentArenaCardChangedType:: ; c3d4
ds $1
wOpponentBench1CardChangedType:: ; c3d5
ds $1
wOpponentBench2CardChangedType:: ; c3d6
ds $1
wOpponentBench3CardChangedType:: ; c3d7
ds $1
wOpponentBench4CardChangedType:: ; c3d8
ds $1
wOpponentBench5CardChangedType:: ; c3d9
ds $1
wOpponentArenaCardAttachedDefender:: ; c3da
ds $1
wOpponentBench1CardAttachedDefender:: ; c3db
ds $1
wOpponentBench2CardAttachedDefender:: ; c3dc
ds $1
wOpponentBench3CardAttachedDefender:: ; c3dd
ds $1
wOpponentBench4CardAttachedDefender:: ; c3de
ds $1
wOpponentBench5CardAttachedDefender:: ; c3df
ds $1
wOpponentArenaCardAttachedPluspower:: ; c3e0
ds $1
wOpponentBench1CardAttachedPluspower:: ; c3e1
ds $1
wOpponentBench2CardAttachedPluspower:: ; c3e2
ds $1
wOpponentBench3CardAttachedPluspower:: ; c3e3
ds $1
wOpponentBench4CardAttachedPluspower:: ; c3e4
ds $1
wOpponentBench5CardAttachedPluspower:: ; c3e5
ds $1
ds $1
wOpponentArenaCardSubstatus1:: ; c3e7
ds $1
wOpponentArenaCardSubstatus2:: ; c3e8
ds $1
wOpponentArenaCardChangedWeakness:: ; c3e9
ds $1
wOpponentArenaCardChangedResistance:: ; c3ea
ds $1
wOpponentArenaCardSubstatus3:: ; c3eb
ds $1
wOpponentPrizes:: ; c3ec
ds $1
wOpponentNumberOfCardsInDiscardPile:: ; c3ed
ds $1
wOpponentNumberOfCardsInHand:: ; c3ee
ds $1
wOpponentNumberOfPokemonInPlayArea:: ; c3ef
ds $1
wOpponentArenaCardStatus:: ; c3f0
ds $1
; $00 - player
; $01 - link
; other - AI controlled
; this is equal to wDuelType
wOpponentDuelistType:: ; c3f1
ds $1
wOpponentArenaCardDisabledAttackIndex:: ; c3f2
ds $1
wOpponentArenaCardLastTurnDamage:: ; c3f3
ds $2
wOpponentArenaCardLastTurnStatus:: ; c3f5
ds $1
; substatus2 that the player card got last turn
wOpponentArenaCardLastTurnSubstatus2:: ; c3f6
ds $1
; indicates color of weakness that was changed
; for this card last turn
wOpponentArenaCardLastTurnChangeWeak:: ; c3f7
ds $1
; whether any attached energy card was discarded last turn (0 if not)
wOpponentArenaCardLastTurnEffect:: ; c3f8
ds $1
ds $7
NEXTU
; buffer used to store the Card Pop! name list
; that is received from the other player
wOtherPlayerCardPopNameList:: ; c200
ds CARDPOP_NAME_LIST_SIZE
ENDU
UNION
; temporary list of the cards drawn from a booster pack
wBoosterCardsDrawn:: ; c400
wBoosterTempNonEnergiesDrawn:: ; c400
ds $b
wBoosterTempEnergiesDrawn:: ; c40b
ds $b
wBoosterCardsDrawnEnd:: ; c416
ds $6a
NEXTU
wPlayerDeck:: ; c400
ds $80
NEXTU
; lists all the possible candidates of cards
; that can be received through Card Pop!
wCardPopCardCandidates:: ; c400
ds $80
ENDU
wOpponentDeck:: ; c480
ds $80
; this holds names like player's or opponent's.
wNameBuffer:: ; c500
ds NAME_BUFFER_LENGTH
; this holds an $ff-terminated list of card deck indexes (e.g. cards in hand or in bench)
; or (less often) the attack list of a Pokemon card
wDuelTempList:: ; c510
ds $80
UNION
; this is kept updated with some default text that is used
; when the text printing functions are called with text id $0000
wDefaultText:: ; c590
ds $3c
NEXTU
; used in CheckIfCurrentDeckWasChanged to determine whether
; wCurDeckCards was changed from the original
; deck it was based on
wCurDeckCardChanges:: ; c590
ds DECK_SIZE + 1
ENDU
ds $1d
; signals what error, if any, occurred
; during IR communications
; 0 means there was no error
wIRCommunicationErrorCode:: ; c5ea
ds $1
; parameters set for IR communications on own device
; and received from the other device respectively
; these must match for successful communication
wOwnIRCommunicationParams:: ; c5eb
ds $4
wOtherIRCommunicationParams:: ; c5ef
ds $4
; stores the result from LookUpNameInCardPopNameList
; is $ff if name was found in the Card Pop! list
; is $00 otherwise
wCardPopNameSearchResult:: ; c5f3
ds $1
ds $c
SECTION "WRAM0 Text Engine", WRAM0
wc600:: ; c600
ds $100
wc700:: ; c700
ds $100
wc800:: ; c800
ds $100
wc900:: ; c900
ds $100
SECTION "WRAM0 1", WRAM0
wOAM:: ; ca00
ds $a0
; 16-byte buffer to store text, usually a name or a number
; used by TX_RAM1 but not exclusively
wStringBuffer:: ; caa0
ds $10
wcab0:: ; cab0
ds $1
wcab1:: ; cab1
ds $1
wcab2:: ; cab2
ds $1
; 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
; used to select a sprite or a starting sprite from wOAM
wOAMOffset:: ; cab5
ds $1
; FillTileMap fills VRAM0 BG Maps with the tile stored here
wTileMapFill:: ; cab6
ds $1
wIE:: ; cab7
ds $1
; incremented whenever the vblank handler ends. used to wait for it to end,
; or to delay a specific amount of frames
wVBlankCounter:: ; 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
; used to request palette(s) to be flushed by FlushPalettes from wBGP, wOBP0, wOBP1,
; wBackgroundPalettesCGB, and/or wBackgroundPalettesCGB to the corresponding hw registers
wFlushPaletteFlags:: ; cabf
ds $1
; set to non-0 to request OAM copy during vblank
wVBlankOAMCopyToggle:: ; cac0
ds $1
; used by HblankWriteByteToBGMap0
wTempByte:: ; cac1
ds $1
; which screen or interface is currently displayed in the screen during a duel
; used to prevent loading graphics or drawing stuff more times than necessary
wDuelDisplayedScreen:: ; cac2
ds $1
; used to increase the play time counter every four timer interrupts (60.24 Hz)
wTimerCounter:: ; 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
wRNGCounter:: ; cacc
ds $1
; the LCDC status interrupt is always disabled and this always reads as jp $0000
wLCDCFunctionTrampoline:: ; cacd
ds $3
; a jp $nnnn instruction called by the vblank handler. calls a single ret by default
wVBlankFunctionTrampoline:: ; cad0
ds $3
; pointer to a function to be called by DoFrame
wDoFrameFunction:: ; cad3
ds $2
; if non-zero, the game screen can be paused at any time with the select button
wDebugPauseAllowed:: ; cad5
ds $1
; pointer to keep track of where
; in the source data we are while
; running the decompression algorithm
wDecompSourcePosPtr:: ; cad6
ds $2
; number of bits that are still left
; to read from the current command byte
wDecompNumCommandBitsLeft:: ; cad8
ds $1
; command byte from which to read the bits
; to decompress source data
wDecompCommandByte:: ; cad9
ds $1
; if bit 7 is changed from off to on, then
; decompression routine will read next two bytes
; for repeating previous sequence (length, offset)
; if it changes from on to off, then the routine
; will only read one byte, and reuse previous length byte
wDecompRepeatModeToggle:: ; cada
ds $1
; stores in both nybbles the length of the
; sequences to copy in decompression
; the high nybble is used first, then the low nybble
; for a subsequent sequence repetition
wDecompRepeatLengths:: ; cadb
ds $1
wDecompNumBytesToRepeat:: ; cadc
ds $1
wDecompSecondaryBufferPtrHigh:: ; cadd
ds $1
; offset to repeat byte from decompressed data
wDecompRepeatSeqOffset:: ; cade
ds $1
wDecompSecondaryBufferPtrLow:: ; cadf
ds $1
wTempSGBPacket:: ; cae0
ds $10
; temporary CGB palette data buffer to eventually save into BGPD registers.
wBackgroundPalettesCGB:: ; caf0
ds NUM_BACKGROUND_PALETTES palettes
; temporary CGB palette data buffer to eventually save into OBPD registers.
wObjectPalettesCGB:: ; cb30
ds NUM_OBJECT_PALETTES palettes
ds $2
; stores a pointer to a temporary list of elements (e.g. pointer to wDuelTempList)
; to be read or written sequentially
wListPointer:: ; cb72
ds $2
SECTION "WRAM0 Serial Transfer", WRAM0
wSerialOp:: ; cb74
ds $1
wSerialFlags:: ; cb75
ds $1
wSerialCounter:: ; cb76
ds $1
wSerialCounter2:: ; cb77
ds $1
wSerialTimeoutCounter:: ; cb78
ds $1
wcb79:: ; cb79
ds $2
wcb7b:: ; cb7b
ds $2
wSerialSendSave:: ; cb7d
ds $1
wSerialSendBufToggle:: ; cb7e
ds $1
wSerialSendBufIndex:: ; cb7f
ds $1
wcb80:: ; cb80
ds $1
wSerialSendBuf:: ; cb81
ds $20
wSerialLastReadCA:: ; cba1
ds $1
wSerialRecvCounter:: ; cba2
ds $1
wcba3:: ; cba3
ds $1
wSerialRecvIndex:: ; cba4
ds $1
wSerialRecvBuf:: ; cba5
ds $20
wSerialEnd:: ; cbc5
SECTION "WRAM0 Duels 2", WRAM0
ds $1
; In a duel, the main menu current or last selected menu item
; From 0 to 5: Hand, Attack, Check, Pkmn Power, Retreat, Done
wCurrentDuelMenuItem:: ; cbc6
ds $1
; When we're viewing a card's information, the page we are currently at.
; For Pokemon cards, values from $1 to $6 (two pages for attack descriptions)
; For Energy cards, it's always $9
; For Trainer cards, $d or $e (two pages for trainer card descriptions)
; see CARDPAGE_* constants
wCardPageNumber:: ; cbc7
ds $1
; how many selectable items are in a play area screen. used to set wNumMenuItems
; in order to navigate through a play area screen. this becomes the number of bench
; Pokemon cards if wExcludeArenaPokemon is 1, and that number plus 1 if it's 0.
wNumPlayAreaItems:: ; cbc8
ds $1
; selects a PLAY_AREA_* slot in order to display information related to it. used by functions
; such as PrintPlayAreaCardLocation, PrintPlayAreaCardInformation and PrintPlayAreaCardHeader
wCurPlayAreaSlot:: ; cbc9
; X position to display the attached energies, HP bar, and Pluspower/Defender icons
; obviously different for player and opponent side. used by DrawDuelHUD.
wHUDEnergyAndHPBarsX:: ; cbc9
ds $1
; current Y coordinate where some play area information is being printed at. used by functions
; such as PrintPlayAreaCardLocation, PrintPlayAreaCardInformation and PrintPlayAreaCardHeader
wCurPlayAreaY:: ; cbca
; Y position to display the attached energies, HP bar, and Pluspower/Defender icons
; obviously different for player and opponent side. used by DrawDuelHUD.
wHUDEnergyAndHPBarsY:: ; cbca
wPracticeDuelTextY:: ; cbca
ds $1
; selected bench slot (1-5, that is, a PLAY_AREA_BENCH_* constant)
wBenchSelectedPokemon:: ; cbcb
ds $1
; used by CheckIfEnoughEnergiesToRetreat and DisplayRetreatScreen
wEnergyCardsRequiredToRetreat:: ; cbcc
ds $1
wNumRetreatEnergiesSelected:: ; cbcd
ds $1
; used in CheckIfEnoughEnergiesToAttack for the calculation
wAttachedEnergiesAccum:: ; cbce
ds $1
; when you're in a duel submenu like the cards in your hand and you press A,
; the following two addresses keep track of which item was selected by the cursor
wSelectedDuelSubMenuItem:: ; cbcf
ds $1
wSelectedDuelSubMenuScrollOffset:: ; cbd0
ds $1
; CARDPAGETYPE_PLAY_AREA or CARDPAGETYPE_NOT_PLAY_AREA
; some of the elements displayed in a card page change depending on which value
wCardPageType:: ; cbd1
ds $1
; when processing or displaying the play area Pokemon cards of a duelist,
; whether to account for only the benched Pokemon ($01) or also the arena Pokemon ($00).
wExcludeArenaPokemon:: ; cbd2
ds $1
wPlayAreaScreenLoaded:: ; cbd3
ds $1
wcbd4:: ; cbd4
ds $1
; low byte of the address of the next slot in the hTempRetreatCostCards array to be used
wTempRetreatCostCardsPos:: ; cbd5
ds $1
; in a card list, which keys (among START and A_BUTTON) do not open the item selection
; menu when a card is selected, directly "submitting" the selected card instead.
wNoItemSelectionMenuKeys:: ; cbd6
ds $1
; when viewing a card page, which keys (among B_BUTTON, D_UP, and D_DOWN) will exit the page,
; either to go back to the previous menu or list, or to load the card page of the card above/below it
wCardPageExitKeys:: ; cbd7
ds $1
; used to store function pointer for printing card order
; in card list reordering screen.
wPrintSortNumberInCardListPtr:: ; cbd8
ds $2
; in the hand or discard pile card screen, id of the text printed in the bottom-left box
wCardListInfoBoxText:: ; cbda
ds $2
; in the hand or discard pile card screen, id of the text printed as the header title
wCardListHeaderText:: ; cbdc
ds $2
; when selecting an item of a list of cards which type of menu shows up.
; PLAY_CHECK, SELECT_CHECK, or $00 for none.
wCardListItemSelectionMenuType:: ; cbde
ds $1
; flag indicating whether a list of cards should be sorted by ID
wSortCardListByID:: ; cbdf
ds $1
wcbe0:: ; cbe0
ds $1
wOpponentTurnEnded:: ; cbe1
ds $1
wOppRNG1:: ; cbe2
ds $1
wOppRNG2:: ; cbe3
ds $1
wOppRNGCounter:: ; cbe4
ds $1
; sp is saved here when starting a duel, in order to save the return address
; however, it only seems to be read after a transmission error in a link duel
wDuelReturnAddress:: ; cbe5
ds $2
; if non-zero, duel menu input is not checked
wDebugSkipDuelMenuInput:: ; cbe7
ds $1
wNumCardsTryingToDraw:: ; cbe8
ds $1
; number of cards being drawn in order to animate the number of cards in
; the hand and in the deck in the draw card screen
wNumCardsBeingDrawn:: ; cbe9
ds $1
ds $3
; temporarily stores 8 bytes for serial send/recv.
; used by SerialSend8Bytes and SerialRecv8Bytes
wTempSerialBuf:: ; cbed
ds $8
ds $2
wcbf7:: ; cbf7
ds $2
; when non-0, AIMakeDecision doesn't wait 60 frames and print DuelistIsThinkingText
wSkipDuelistIsThinkingDelay:: ; cbf9
ds $1
wEnergyDiscardMenuDenominator:: ; cbfa
ds $1
wEnergyDiscardMenuNumerator:: ; cbfb
ds $1
; used by Func_5805 to store the remaining Prizes, so that if more than that
; amount would be taken, only the remaining amount is taken
wTempNumRemainingPrizeCards:: ; cbfc
ds $1
; if FALSE, player is placing initial arena pokemon
; if TRUE, player is placing initial bench pokemon
wPlacingInitialBenchPokemon:: ; cbfd
ds $1
; during a practice duel, identifies an entry of PracticeDuelActionTable
wPracticeDuelAction:: ; cbfe
ds $1
wcbff:: ; cbff
ds $1
wPracticeDuelTurn:: ; cc00
ds $1
; pointer from PracticeDuelTextPointerTable
wPracticeDuelTextPointer:: ; cc01
ds $2
; used to print a Pokemon card's length in feet and inches
wPokemonLengthPrintOffset:: ; cc03
ds $1
; used when opening the card page of an attack when attacking,
; serving as an index for AttackPageDisplayPointerTable.
; see ATTACKPAGE_* constants
wAttackPageNumber:: ; cc04
ds $1
; the value of hWhoseTurn gets loaded here at the beginning of each duelist's turn.
; more reliable than hWhoseTurn, as hWhoseTurn may change temporarily in order to handle status
; conditions or other events of the non-turn duelist. used mostly between turns (to check which
; duelist's turn just finished), or to restore the value of hWhoseTurn at some point.
wWhoseTurn:: ; cc05
ds $1
; number of turns taken by both players
wDuelTurns:: ; cc06
ds $1
; used to signal that the current duel has finished, not to be mistaken with wDuelResult
; 0 = no one has won duel yet
; 1 = player whose turn it is has won the duel
; 2 = player whose turn it is has lost the duel
; 3 = duel ended in a draw (start sudden death match)
wDuelFinished:: ; cc07
ds $1
; current duel is a [wDuelInitialPrizes]-prize match
wDuelInitialPrizes:: ; cc08
ds $1
; a DUELTYPE_* constant. note that for a practice duel, wIsPracticeDuel must also be set to $1
wDuelType:: ; cc09
ds $1
; set to 1 if the coin toss during the CheckSandAttackOrSmokescreenSubstatus check is heads
wGotHeadsFromSandAttackOrSmokescreenCheck:: ; cc0a
ds $1
wAlreadyPlayedEnergy:: ; cc0b
ds $1
; set to 1 if the confusion check coin toss in AttemptRetreat is heads
wGotHeadsFromConfusionCheckDuringRetreat:: ; cc0c
ds $1
; DUELIST_TYPE_* of the turn holder
wDuelistType:: ; cc0d
ds $1
; this holds the current opponent's deck minus 2 (that is, a *_DECK_ID constant),
; in order to account for the two unused pointers at the beginning of DeckPointers.
wOpponentDeckID:: ; cc0e
ds $1
wcc0f:: ; cc0f
ds $1
; index (0-1) of the attack or Pokemon Power being used by the player's arena card
; set to $ff when the duel starts and at the end of the opponent's turn
wPlayerAttackingAttackIndex:: ; cc10
ds $1
; deck index of the player's arena card that is attacking or using a Pokemon Power
; set to $ff when the duel starts and at the end of the opponent's turn
wPlayerAttackingCardIndex:: ; cc11
ds $1
; ID of the player's arena card that is attacking or using a Pokemon Power
wPlayerAttackingCardID:: ; cc12
ds $1
wIsPracticeDuel:: ; cc13
ds $1
wNPCDuelistCopy:: ; cc14
ds $1
wOpponentPortrait:: ; cc15
ds $1
; text id of the opponent's name
wOpponentName:: ; cc16
ds $2
; an overworld script starting a duel sets this address to the value to be written into wDuelInitialPrizes
wNPCDuelPrizes:: ; cc18
ds $1
; an overworld script starting a duel sets this address to the value to be written into wOpponentDeckID
wNPCDuelDeckID:: ; cc19
ds $1
; song played during a duel
wDuelTheme:: ; cc1a
ds $1
; holds the energies attached to a given pokemon card. 1 byte for each of the
; 8 energy types (includes the unused one that shares byte with the colorless energy)
wAttachedEnergies:: ; cc1b
ds NUM_TYPES
; holds the total amount of energies attached to a given pokemon card
wTotalAttachedEnergies:: ; cc23
ds $1
; Used as temporary storage for a card's data
wLoadedCard1:: ; cc24
card_data_struct wLoadedCard1
wLoadedCard2:: ; cc65
card_data_struct wLoadedCard2
wLoadedAttack:: ; cca6
atk_data_struct wLoadedAttack
; the damage field of a used attack is loaded here
; doubles as "wAIAverageDamage" when complementing wAIMinDamage and wAIMaxDamage
; little-endian
; second byte may have UNAFFECTED_BY_WEAKNESS_RESISTANCE_F set/unset
wDamage:: ; ccb9
ds $2
; wAIMinDamage and wAIMaxDamage appear to be used for AI scoring
; they are updated with the minimum (or floor) damage of the current attack
; and with the maximum (or ceiling) damage of the current attack
wAIMinDamage:: ; ccbb
ds $1
wAIMaxDamage:: ; ccbc
ds $1
wccbd:: ; ccbd
ds $2
; damage dealt by an attack to a target
wDealtDamage:: ; ccbf
ds $2
; WEAKNESS and RESISTANCE flags for a damaging attack
wDamageEffectiveness:: ; ccc1
ds $1
; used in damage related functions
wTempCardID_ccc2:: ; ccc2
ds $1
wTempTurnDuelistCardID:: ; ccc3
ds $1
wTempNonTurnDuelistCardID:: ; ccc4
ds $1
; the status condition of the defending Pokemon is loaded here after an attack
wccc5:: ; ccc5
ds $1
; *_ATTACK constants for selected attack
; 0 for the first attack (or PKMN Power)
; 1 for the second attack
wSelectedAttack:: ; ccc6
ds $1
; if affected by a no damage or effect substatus, this flag indicates what the cause was
wNoDamageOrEffect:: ; ccc7
ds $1
; used by CountKnockedOutPokemon and Func_5805 to store the amount
; of prizes to take (equal to the number of Pokemon knocked out)
wNumberPrizeCardsToTake:: ; ccc8
ds $1
; set to 1 if the coin toss in the confusion check is heads (CheckSelfConfusionDamage)
wGotHeadsFromConfusionCheck:: ; ccc9
ds $1
; used to store card indices of all stages, in order, of a Play Area Pokémon
wAllStagesIndices:: ; ccca
ds $3
wEffectFunctionsFeedbackIndex:: ; cccd
ds $1
; some array used in effect functions with wEffectFunctionsFeedbackIndex
; as the index, used to return feedback. unknown length.
wEffectFunctionsFeedback:: ; ccce
ds $18
; this is 1 (non-0) if dealing damage to self due to confusion
; or a self-destruct type attack
wIsDamageToSelf:: ; cce6
ds $1
wcce7:: ; cce7
ds $1
wcce8:: ; cce8
ds $1
; text ID of the name of the deck loaded by CopyDeckData
wDeckName:: ; cce9
ds $2
; a PLAY_AREA_* constant (0: arena card, 1-5: bench card)
wTempPlayAreaLocation_cceb:: ; cceb
ds $1
wccec:: ; ccec
ds $1
; used by the effect functions to return the cause of an effect to fail
; in order print the appropriate text
wEffectFailed:: ; cced
ds $1
wPreEvolutionPokemonCard:: ; ccee
ds $1
; flag to determine whether DUELVARS_ARENA_CARD_LAST_TURN_DAMAGE
; gets zeroed or gets updated with wDealtDamage
wccef:: ; ccef
ds $1
; stores the energy cost of the Metronome attack being used.
; it's used to know how many attached Energy cards are being used
; to pay for the attack for damage calculation.
; if equal to 0, then the attack wasn't invoked by Metronome.
wMetronomeEnergyCost:: ; ccf0
ds $1
; effect functions return a status condition constant here when it had no effect
; on the target, in order to print one of the ThereWasNoEffectFrom* texts
wNoEffectFromWhichStatus:: ; ccf1
ds $1
; when non-0, allows the player to skip some delays during a duel by pressing B.
; value read from sSkipDelayAllowed. probably only used for debugging.
wSkipDelayAllowed:: ; ccf2
ds $1
SECTION "WRAM0 2", WRAM0
; on CGB, attributes of the text box borders. (values 0-7 seem to be used, which only affect palette)
; on SGB, colorize text box border with SGB1 if non-0
wTextBoxFrameType:: ; ccf3
ds $1
; pixel data of a tile used for text
; either a combination of two half-width characters or a full-width character
wTextTileBuffer:: ; ccf4
ds TILE_SIZE
wcd04:: ; cd04
ds $1
; used by PlaceNextTextTile
wCurTextTile:: ; cd05
ds $1
; VRAM tile patterns selector for text tiles
; if wTilePatternSelector == $80 and wTilePatternSelectorCorrection == $00 -> select tiles at $8000-$8FFF
; if wTilePatternSelector == $88 and wTilePatternSelectorCorrection == $80 -> select tiles at $8800-$97FF
wTilePatternSelector:: ; cd06
ds $1
; complements wTilePatternSelector by correcting the VRAM tile order when $8800-$97FF is selected
; a value of $80 in wTilePatternSelectorCorrection reflects tiles $00-$7f being located after tiles $80-$ff
wTilePatternSelectorCorrection:: ; cd07
ds $1
; if 0, text lines are separated by a blank line
wLineSeparation:: ; cd08
ds $1
; line number in which text is being printed as an offset to
; the topmost line, including separator lines
wCurTextLine:: ; cd09
ds $1
; how to process the current text tile
; 0: full-width font | non-0: half-width font
wFontWidth:: ; cd0a
ds $1
; when printing half-width text, this variable alternates between 0 and the value
; of the first character. 0 signals that no text should be printed in the current
; iteration of Func_235e, while non-0 means to print the character pair
; made of [wHalfWidthPrintState] (first char) and register e (second char).
wHalfWidthPrintState:: ; cd0b
ds $1
; used by CopyTextData
wTextMaxLength:: ; cd0c
ds $1
; half-width font letters become uppercase if non-0, lowercase if 0
wUppercaseHalfWidthLetters:: ; 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
wCursorTile:: ; cd15
ds $1
wTileBehindCursor:: ; cd16
ds $1
; if non-$0000, the function loaded here is called once per frame by HandleMenuInput
wMenuFunctionPointer:: ; cd17
ds $2
wListScrollOffset:: ; cd19
ds $1
wListItemXPosition:: ; cd1a
ds $1
wNumListItems:: ; cd1b
ds $1
wListItemNameMaxLength:: ; cd1c
ds $1
; if non-$0000, the function loaded here is called once per frame by CardListMenuFunction,
; which is the function loaded to wMenuFunctionPointer for card lists
wListFunctionPointer:: ; cd1d
ds $2
ds $78
; in a card list, the Y position where the <sel_item>/<num_items> indicator is placed
; if wCardListIndicatorYPosition == $ff, no indicator is displayed
wCardListIndicatorYPosition:: ; cd97
ds $1
; x coord of the leftmost item in a horizontal menu
wLeftmostItemCursorX:: ; cd98
ds $1
; used in RefreshMenuCursor_CheckPlaySFX to play a sound during any frame when this address is non-0
wRefreshMenuCursorSFX:: ; cd99
ds $1
; when printing a YES/NO menu, whether the cursor is
; initialized to the YES ($01) or to the NO ($00) item
wDefaultYesOrNo:: ; cd9a
ds $1
; used in _CopyCardNameAndLevel to keep track of the remaining space to copy the text
wCardNameLength:: ; cd9b
ds $1
; stores the total number of coins to flip
wCoinTossTotalNum:: ; cd9c
ds $1
; this stores the result from a coin toss (number of heads)
wCoinTossNumHeads:: ; cd9d
ds $1
; stores type of the duelist that is tossing coins
wCoinTossDuelistType:: ; cd9e
ds $1
; holds the number of coins that have already been tossed
wCoinTossNumTossed:: ; cd9f
ds $1
ds $5
wAIDuelVars::
; saves the prizes that the AI already used Peek on
; each bit corresponds to a Prize card
wAIPeekedPrizes:: ; cda5
ds $1
; this is used by AI in order to determine whether
; it should use Pokedex Trainer card.
; starts with 5 when Duel starts and counts up by 1 every turn.
; only when it's higher than 5 is AI allowed to use Pokedex,
; in which case it sets the counter to 0.
; this stops the AI from using Pokedex right after using another one
; while still drawing cards that were ordered.
wAIPokedexCounter:: ; cda6
ds $1
; variable to keep track of Mewtwo1's Barrier usage during Player' turn.
; AI_MEWTWO_MILL set means Player is running Mewtwo1 mill deck.
; - when flag is not set, this counts how many turns in a row
; Player used Mewtwo1's Barrier attack;
; - when flag is set, this counts how many turns in a row
; Player has NOT used Barrier attack.
wAIBarrierFlagCounter:: ; cda7
ds $1
; pointer to $00-terminated list of card IDs
; to avoid being placed as prize cards
; when setting up AI duelist's cards at duel start.
; (see SetUpBossStartingHandAndDeck)
wAICardListAvoidPrize:: ; cda8
ds $2
; pointer to $00-terminated list of card IDs
; sorted by priority of AI placing in the Arena
; at duel start (see TrySetUpBossStartingPlayArea)
wAICardListArenaPriority:: ; cdaa
ds $2
; pointer to $00-terminated list of card IDs
; sorted by priority of AI placing in the Bench
; at duel start (see TrySetUpBossStartingPlayArea)
wAICardListBenchPriority:: ; cdac
ds $2
; pointer to $00-terminated list of card IDs
; sorted by priority of AI playing it from Hand
; to the Bench (see AIDecidePlayPokemonCard)
wAICardListPlayFromHandPriority:: ; cdae
ds $2
; pointer to $00-terminated list of card IDs and AI scores.
; these are for giving certain cards more or less
; likelihood of being picked by AI to switch to.
; (see AIDecideBenchPokemonToSwitchTo)
wAICardListRetreatBonus:: ; cdb0
ds $2
; pointer to $00-terminated list of card IDs,
; number of energy cards and AI score.
; these are for giving certain cards more or less
; likelihood of being picked for AI to attach energy.
; also has the maximum number of energy cards that
; the AI is willing to provide for it.
; (see AIProcessEnergyCards)
wAICardListEnergyBonus:: ; cdb2
ds $2
; used by the AI to track how viable
; retreating the current Active card is
wAIRetreatScore:: ; cdb4
ds $1
wAIDuelVarsEnd::
; information about various properties of
; loaded attack for AI calculations
wTempLoadedAttackEnergyCost:: ; cdb5
ds $1
wTempLoadedAttackEnergyNeededType:: ; cdb6
ds $1
wTempLoadedAttackEnergyNeededAmount:: ; cdb7
ds $1
; used for the AI to store various
; details about a given card
wTempCardRetreatCost:: ; cdb8
ds $1
wTempCardID:: ; cdb9
ds $1
wTempCardType:: ; cdba
ds $1
ds $3
; used for AI to score decisions for actions
wAIScore:: ; cdbe
ds $1
UNION
; used for AI decisions that involve
; each card in the Play Area.
wPlayAreaAIScore:: ; cdbf
ds MAX_PLAY_AREA_POKEMON
NEXTU
; stores the score determined by AI for first attack
wFirstAttackAIScore:: ; cdbf
ds $1
ENDU
ds $a
; information about the defending Pokémon and
; the prize card count on both sides for AI:
; player's active Pokémon color
wAIPlayerColor:: ; cdcf
ds $1
; player's active Pokémon weakness
wAIPlayerWeakness:: ; cdd0
ds $1
; player's active Pokémon resistance
wAIPlayerResistance:: ; cdd1
ds $1
; player's prize count
wAIPlayerPrizeCount:: ; cdd2
ds $1
; opponent's prize count
wAIOpponentPrizeCount:: ; cdd3
ds $1
; AI stores the card ID to look for here
wTempCardIDToLook:: ; cdd4
ds $1
; when AI decides which Bench Pokemon to switch to
; it stores it Play Area location here.
wAIPlayAreaCardToSwitch:: ; cdd5
ds $1
; the index of attack chosen by AI
; to use with Pluspower.
wAIPluspowerAttack:: ; cdd6
ds $1
; whether AI is allowed to play an energy card
; from the hand in order to retreat arena card
; $00 = not allowed
; $01 = allowed
wAIPlayEnergyCardForRetreat:: ; cdd7
ds $1
; flags defined by AI_ENERGY_FLAG_* constants
; used as input for AIProcessEnergyCards
; to determine what to check in the routine.
wAIEnergyAttachLogicFlags:: ; cdd8
ds $1
; used as input to AIProcessAttacks.
; if 0, execute the attack chosen by the AI.
; if not 0, return without executing attack.
wAIExecuteProcessedAttack:: ; cdd9
ds $1
wcdda:: ; cdda
ds $1
wAITriedAttack:: ; cddb
ds $1
wcddc:: ; cddc
ds $1
; used to temporarily backup wPlayAreaAIScore values.
wTempPlayAreaAIScore:: ; cddd
ds MAX_PLAY_AREA_POKEMON
wTempAIScore:: ; cde3
ds $1
; used for AI decisions that involve
; each card in the Play Area involving
; attaching Energy cards.
wPlayAreaEnergyAIScore:: ; cde4
ds MAX_PLAY_AREA_POKEMON
wcdea:: ; cdea
ds MAX_PLAY_AREA_POKEMON
; whether AI cannot inflict damage on player's active Pokémon
; (due to No Damage or Effect substatus).
; $00 = can damage
; $01 = can't damage
wAICannotDamage:: ; cdf0
ds $1
; used by AI to store variable information
wTempAI:: ; cdf1
ds $1
; used for AI to store whether this card can use any attack
; $00 = can't attack
; $01 = can attack
wCurCardCanAttack:: ; cdf2
ds $1
; used to temporarily store the card deck index
; while AI is deciding whether to evolve Pokémon
; or deciding whether to play Pokémon card from hand
wTempAIPokemonCard:: ; cdf3
ds $1
; used for AI to store whether this card can KO defending Pokémon
; $00 = can't KO
; $01 = can KO
wCurCardCanKO:: ; cdf4
ds $1
ds $4
wcdf9:: ; cdf9
ds $1
wcdfa:: ; cdfa
ds MAX_PLAY_AREA_POKEMON
wAIFirstAttackDamage:: ; ce00
ds $1
wAISecondAttackDamage:: ; ce01
ds $1
; whether AI's attack is damaging or not
; (attacks that only damages bench are treated as non-damaging)
; $00 = is a damaging attack
; $01 = is a non damaging attack
wAIAttackIsNonDamaging:: ; ce02
ds $1
; whether AI already retreated this turn or not.
; - $0 has not retreated;
; - $1 has retreated.
wAIRetreatedThisTurn:: ; ce03
ds $1
; used by AI to store information of Venusaur2
; while handling Energy Trans logic.
wAIVenusaur2DeckIndex:: ; ce04
ds $1
wAIVenusaur2PlayAreaLocation:: ; ce05
ds $1
wce06:: ; ce06
; number of cards to be transferred by AI using Energy Trans.
wAINumberOfEnergyTransCards:: ; ce06
; used for storing weakness of Player's Arena card
; in AI routine dealing with Shift Pkmn Power.
wAIDefendingPokemonWeakness:: ; ce06
; number of Basic Pokemon cards when
; setting up AI Boss deck
wAISetupBasicPokemonCount:: ; ce06
ds $1
wce07:: ; ce07
ds $1
wce08:: ; ce08
; number of Energy cards when
; setting up AI Boss deck
wAISetupEnergyCount:: ; ce08
ds $7
wce0f:: ; ce0f
ds $7
; stores the deck index (0-59) of the Trainer card
; the AI intends to play from hand.
wAITrainerCardToPlay:: ; ce16
ds $1
wce17:: ; ce17
ds $1
wAITrainerCardPhase:: ; ce18
ds $1
; parameters output by AI Trainer card logic routines
; (e.g. what Pokemon in Play Area to use card on, etc)
wAITrainerCardParameter:: ; ce19
ds $1
wce1a:: ; ce1a
ds $1
wce1b:: ; ce1b
ds $1
wce1c:: ; ce1c
ds $1
wce1d:: ; ce1d
ds $1
wce1e:: ; ce1e
ds $1
wce1f:: ; ce1f
ds $1
; used to store previous/current flags of AI actions
; see AI_FLAG_* constants
wPreviousAIFlags:: ; ce20
ds $1
wCurrentAIFlags:: ; ce21
ds $1
; 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.
; possibly used in other contexts too
wEffectFunctionsBank:: ; ce22
ds $1
; LoadCardGfx loads the card's palette here
wCardPalette:: ; ce23
ds CGB_PAL_SIZE
; information about the text being currently processed, including font width,
; the rom bank, and the memory address of the next character to be printed.
; supports up to four nested texts (used with TX_RAM).
wTextHeader1:: ; ce2b
text_header wTextHeader1
wTextHeader2:: ; ce30
text_header wTextHeader2
wTextHeader3:: ; ce35
text_header wTextHeader3
wTextHeader4:: ; ce3a
text_header wTextHeader4
; text id for the first TX_RAM2 of a text
; prints from wDefaultText if $0000
wTxRam2:: ; ce3f
ds $2
; text id for the second TX_RAM2 of a text
wTxRam2_b:: ; ce41
ds $2
; text id for the first TX_RAM3 of a text
; a number between 0 and 65535
wTxRam3:: ; ce43
ds $2
; text id for the second TX_RAM3 of a text
; a number between 0 and 65535
wTxRam3_b:: ; ce45
ds $2
; when printing text, number of frames to wait between each text tile
wTextSpeed:: ; ce47
ds $1
; a number between 0 and 3 to select a wTextHeader to use for the current text
wWhichTextHeader:: ; ce48
ds $1
; selects wTxRam2 or wTxRam2_b
wWhichTxRam2:: ; ce49
ds $1
; selects wTxRam3 or wTxRam3_b
wWhichTxRam3:: ; ce4a
ds $1
wIsTextBoxLabeled:: ; ce4b
ds $1
; text id of a text box's label
wTextBoxLabel:: ; ce4c
ds $2
wCoinTossScreenTextID:: ; ce4e
ds $2
; set to PLAYER_TURN in the "Your Play Area" screen
; set to OPPONENT_TURN in the "Opp Play Area" screen
; alternates when drawing the "In Play Area" screen
wCheckMenuPlayAreaWhichDuelist:: ; ce50
ds $1
; apparently complements wCheckMenuPlayAreaWhichDuelist to be able to combine
; the usual player or opponent layout with the opposite duelist information
; appears not to be relevant in the "In Play Area" screen
wCheckMenuPlayAreaWhichLayout:: ; ce51
ds $1
; the position of cursor in the "In Play Area" screen
wInPlayAreaCurPosition:: ; ce52
; holds the position of the cursor when selecting
; in the "Your Play Area" or "Opp Play Area" screens
wYourOrOppPlayAreaCurPosition:: ; ce52
ds $1
; pointer to the table which contains information for each key-press.
wMenuInputTablePointer:: ; ce53
; pointer to transition table data
wTransitionTablePtr:: ; ce53
ds $2
; same as wDuelInitialPrizes but with upper 2 bits set
wDuelInitialPrizesUpperBitsSet:: ; ce55
ds $1
; if TRUE, SwapTurn is called
; after some operations are concluded
wIsSwapTurnPending:: ; ce56
ds $1
; it's used for restore the position of cursor
; when going into another view, and returning to
; the previous view.
wInPlayAreaPreservedPosition:: ; ce57
ds $1
; it's used for checking if the player changed
; the cursor in the play area view.
wInPlayAreaTemporaryPosition:: ; ce58
ds $1
; number of prize cards still to be
; picked by the player
wNumberOfPrizeCardsToSelect:: ; ce59
ds $1
; pointer to a $ff-terminated list
; of the prize cards selected by the player
wSelectedPrizeCardListPtr:: ; ce5a
ds $2
wce5c:: ; ce5c
ds $1
; stores whether there are Pokemon in play area
; player arena Pokemon sets bit 0
; opponent arena Pokemon sets bit 1
wArenaCardsInPlayArea:: ; ce5d
ds $1
wce5e:: ; ce5e
ds $1
; this is used to store last cursor position
; in the "Your Play Area" and the "Opp. Play Area" screens
wYourOrOppPlayAreaLastCursorPosition:: ; ce5f
ds $1
; $00 when the "In Play Area" screen has been opened from the Check menu
; $01 when the "In Play Area" screen has been opened by pressing the select button
wInPlayAreaFromSelectButton:: ; ce60
ds $1
; it's used only in one function,
; which means that it's a kind of local variable, but defined in wram.
wPrizeCardCursorTemporaryPosition:: ; ce61
ds $1
wGlossaryPageNo:: ; ce62
ds $1
wce63:: ; ce63
ds $1
wce64:: ; ce64
ds $1
wce65:: ; ce65
ds $1
wce66:: ; ce66
ds $1
wce67:: ; ce67
ds $1
wce68:: ; ce68
ds $1
wce69:: ; ce69
ds $1
; pointer to memory of data to send
; in the data packet to the printer
wPrinterPacketDataPtr:: ; ce6a
ds $2
wce6c:: ; ce6c
ds $1
wce6d:: ; ce6d
ds $1
wce6e:: ; ce6e
ds $1
wPrinterStatus:: ; ce6f
ds $1
; pointer to packet data that is
; being transmitted through serial
wSerialDataPtr:: ; ce70
ds $2
wce72:: ; ce72
ds $1
; card index and its attack index chosen
; to be used by Metronome.
wMetronomeSelectedAttack:: ; ce73
ds $2
; stores the amount of cards that are being ordered.
wNumberOfCardsToOrder:: ; ce75
ds $1
wce76:: ; ce76
ds MAX_PLAY_AREA_POKEMON
; used in CountPokemonIDInPlayArea
wTempPokemonID_ce7c:: ; ce7c
ds $1
ds $1
wce7e:: ; ce7e
ds $1
wce7f:: ; ce7f
ds $2
wce81:: ; ce81
ds $1
wce82:: ; ce82
ds $1
wce83:: ; ce83
ds $1
wce84:: ; ce84
ds $1
; buffer to store data that will be sent/received through IR
wIRDataBuffer:: ; ce85
ds $8
wVBlankFunctionTrampolineBackup:: ; ce8d
ds $2
wce8f:: ; ce8f
ds $1
wPrinterHorizontalOffset:: ; ce90
ds $1
; the count of some card ID in the deck to be printed
wPrinterCardCount:: ; ce91
ds $1
; total card count of list to be printed
wPrinterTotalCardCount:: ; ce92
ds $2
wCurPrinterCardType:: ; ce94
ds $1
; total card count of the current card type
; in list to be printed
wPrinterCurCardTypeCount:: ; ce95
ds $2
wPrinterNumCardTypes:: ; ce97
ds $1
; related to printer functions
; only written to but never read
wce98:: ; ce98
ds $1
wPrinterContrastLevel:: ; ce99
ds $1
wPrizeCardSelectionFrameCounter:: ; ce9a
ds $1
; related to printer serial stuff
wce9b:: ; ce9b
ds $1
wPrintOnlyStarRarity:: ; ce9c
ds $1
; only used in unreferenced function Func_1a14b
; otherwise unused
wce9d:: ; ce9d
ds $1
wPrinterInitAttempts:: ; ce9e
ds $1
wce9f:: ; ce9f
ds $1
; which song to play when obtaining the card from Card Pop!
; the card's rarity determines which song to play
wCardPopCardObtainSong:: ; cea0
ds $1
; first index in the current card list that is visible
; used to calculate which element to get based
; on the cursor position
wCardListVisibleOffset:: ; cea1
ds $1
ds $1
; it's used when the player enters check menu, and its sub-menus.
; increases from 0x00 to 0xff. the game makes its blinking cursor by this.
; note that the check menu also contains the pokemon glossary.
wCheckMenuCursorBlinkCounter:: ; cea3
ds $1
; used to temporarily store wCurCardTypeFilter
; to check whether a new filter is to be applied
wTempCardTypeFilter:: ; cea4
wCardListCursorPos:: ; cea4
wNamingScreenCursorY:: ; cea4
ds $1
wCardListCursorXPos:: ; cea5
ds $1
wCardListCursorYPos:: ; cea6
ds $1
wCardListYSpacing:: ; cea7
ds $1
wCardListXSpacing:: ; cea8
ds $1
wCardListNumCursorPositions:: ; cea9
wNamingScreenKeyboardHeight:: ; cea9
ds $1
; tile to draw when cursor is blinking
wVisibleCursorTile:: ; ceaa
ds $1
; tile to draw when cursor is visible
wInvisibleCursorTile:: ; ceab
ds $1
; unknown handler function run in HandleDeckCardSelectionList
; is always NULL
wCardListHandlerFunction:: ; ceac
ds $2
; number of cards that are listed
; in the current filtered list
wNumEntriesInCurFilter:: ; ceae
ds $1
wCheckMenuCursorXPosition:: ; ceaf
ds $1
wCheckMenuCursorYPosition:: ; ceb0
ds $1
; deck selected by the player in the Decks screen
wCurDeck:: ; ceb1
ds $1
; each of these are a boolean to
; represent whether a given deck
; that the player has is a valid deck
wDecksValid::
wDeck1Valid:: ds $1 ; ceb2
wDeck2Valid:: ds $1 ; ceb3
wDeck3Valid:: ds $1 ; ceb4
wDeck4Valid:: ds $1 ; ceb5
; used to store the tens digit and
; ones digit of a value for printing
; the ones digit is added $20
; ceb6 = ones digit (+ $20)
; ceb7 = tens digit
wOnesAndTensPlace:: ; ceb6
ds $2
ds $3
; each of these stores the card count
; of each filter in the deck building screen
; the order follows CardTypeFilters
wCardFilterCounts:: ; cebb
ds NUM_FILTERS
UNION
; buffer used to show which card IDs
; are visible in a given list
wVisibleListCardIDs:: ; cec4
ds NUM_DECK_CONFIRMATION_VISIBLE_CARDS
NEXTU
; whether a given Card Set is unavailable in the Card Album screen
; used only for CARD_SET_PROMOTIONAL, in which case
; if it's unavailable, will print "----------" as the Card Set name
wUnavailableAlbumCardSets:: ; cec4
ds NUM_CARD_SETS
ENDU
; number of visible entries
; when showing a list of cards
wNumVisibleCardListEntries:: ; cecb
ds $1
wTotalCardCount:: ; cecc
ds $1
; is TRUE if list cannot be scrolled down
; past the last visible entry
wUnableToScrollDown:: ; cecd
ds $1
; pointer to a function that should be called
; to update the card list being shown
wCardListUpdateFunction:: ; cece
ds $2
; holds y and x coordinates (in that order)
; of start of card list (top-left corner)
wCardListCoords:: ; ced0
ds $2
wced2:: ; ced2
ds $1
; the current filter being used
; from the CardTypeFilters list
wCurCardTypeFilter:: ; ced3
ds $1
; temporarily stores wCardListNumCursorPositions value
wTempCardListCursorPos:: ; ced4
ds $1
wTempFilteredCardListNumCursorPositions:: ; ced5
ds $1
wced6:: ; ced6
ds $1
; maybe unused, is written to but never read
wced7:: ; ced7
ds $1
wCardListVisibleOffsetBackup:: ; ced8
ds $1
; stores how many different cards there are in a deck
wNumUniqueCards:: ; ced9
ds $1
; stores the list of all card IDs that filtered by its card type
; (Fire, Water, ..., Energy card, Trainer card)
wFilteredCardList:: ; ceda
; stores AI temporary hand card list
wHandTempList:: ; ceda
ds DECK_SIZE
; terminator for wceda
wcf16:: ; cf16
ds $1
; holds cards for the current deck
wCurDeckCards:: ; cf17
ds DECK_CONFIG_BUFFER_SIZE
wCurDeckCardsTerminator:: ; cf67
ds $1
wCurDeckCardsEnd::
; list of all the different cards in a deck configuration
wUniqueDeckCardList:: ; cf68
; stores the count number of cards owned
; can be 0 in the case that a card is not available
; i.e. already inside a built deck
wOwnedCardsCountList:: ; cf68
; used by _AIProcessHandTrainerCards, AI related
wTempHandCardList:: ; cf68
ds DECK_SIZE
ds $15
; name of the selected deck
wCurDeckName:: ; cfb9
ds DECK_NAME_SIZE
; max number of cards that are allowed
; to include when building a deck configuration
wMaxNumCardsAllowed:: ; cfd1
ds $1
; max number of cards with same name that are allowed
; to be included when building a deck configuration
wSameNameCardsLimit:: ; cfd2
ds $1
; whether to include the cards in the selected deck
; to appear in the filtered lists
; is TRUE when building a deck (since the cards should be shown for removal)
; is FALSE when choosing a deck configuration to send through Gift Center
; (can't select cards that are included in already built decks)
wIncludeCardsInDeck:: ; cfd3
ds $1
; pointer to a function that handles the menu
; when building a deck configuration
wDeckConfigurationMenuHandlerFunction:: ; cfd4
ds $2
; pointer to a transition table for the
; function in wDeckConfigurationMenuHandlerFunction
wDeckConfigurationMenuTransitionTable:: ; cfd6
ds $2
; pointer to a list of cards that
; is currently being shown/manipulated
wCurCardListPtr:: ; cfd8
ds $2
; text ID to print in the card confirmation screen text box
wCardConfirmationText:: ; cfda
ds $2
ds $2
; the tile to draw in place of the cursor, in case
; the cursor is not to be drawn
wCursorAlternateTile:: ; cfde
ds $1
; temporarily stores value of wCardListNumCursorPositions
wTempCardListNumCursorPositions:: ; cfdf
ds $1
; which Card Set selected by the player to view
wSelectedCardSet:: ; cfe0
ds $1
; number of cards the player owns from the given Card Set
wNumOwnedCardsInSet:: ; cfe1
ds $1
; flags that corresponds to each Phantom Card owned by the player
; see src/constants/menu_constants.asm
wOwnedPhantomCardFlags:: ; cfe2
ds $1
; a flag indicating whether sfx should be played.
wPlaysSfx:: ; cfe3
ds $1
wSelectedPrinterMenuItem:: ; cfe4
ds $1
; collection index of the first owned card
wFirstOwnedCardIndex:: ; cfe5
ds $1
wNumCardListEntries:: ; cfe6
ds $1
; a name buffer in the naming screen.
wNamingScreenBuffer:: ; cfe7
ds NAMING_SCREEN_BUFFER_LENGTH
; current name length in the naming screen.
wNamingScreenBufferLength:: ; cfff
ds $1
SECTION "WRAM1", WRAMX
wNamingScreenDestPointer:: ; d000
ds $2
wNamingScreenQuestionPointer:: ; d002
ds $2
; max length of name buffer.
; it's given for limiting the player's input.
wNamingScreenBufferMaxLength:: ; d004
ds $1
wNamingScreenNumColumns:: ; d005
ds $1
wNamingScreenCursorX:: ; d006
ds $1
; the position to display the input on.
wNamingScreenNamePosition:: ; d007
ds $2
wd009:: ; d009
ds $4
; pointers to all decks of current deck machine
wMachineDeckPtrs:: ; d00d
ds 2 * NUM_DECK_SAVE_MACHINE_SLOTS
wNumSavedDecks:: ; d085
ds $1
; temporarily holds value of wCardListCursorPos
wTempDeckMachineCursorPos:: ; d086
ds $1
; temporarily holds value of wCardListVisibleOffset
wTempCardListVisibleOffset:: ; d087
ds $1
; which list entry was selected in the Deck Machine screen
wSelectedDeckMachineEntry:: ; d088
ds $1
wDismantledDeckName:: ; d089
ds DECK_NAME_SIZE
; which deck slot to be used to
; build a new deck
wDeckSlotForNewDeck:: ; d0a1
ds $1
wDeckMachineTitleText:: ; d0a2
ds $2
wTempBankSRAM:: ; d0a4
ds $1
wNumDeckMachineEntries:: ; d0a5
ds $1
; DECK_* flags to be dismantled to build a given deck
wDecksToBeDismantled:: ; d0a6
ds $1
; text ID to print in the text box when
; inside the Deck Machine menu
wDeckMachineText:: ; d0a7
ds $2
; which deck machine is being used
wCurAutoDeckMachine:: ; d0a9
ds $1
; text IDs for each deck descriptions of the
; Auto Deck Machine currently being shown
wAutoDeckMachineTextDescriptions:: ; d0aa
ds 2 * NUM_DECK_MACHINE_SLOTS
; if bit 4 is set, transition to another map via a warp
; if bit 6 is set, transition to a special screen
; (duel, challenge machine, battle center, gift center, credits)
; bit 7 may also be used for some unknown purpose
wOverworldTransition:: ; d0b4
ds $1
; a GAME_EVENT_* constant corresponding to an entry in GameEventPointerTable
; overworld, duel, credits...
wGameEvent:: ; d0b5
ds $1
wSCX:: ; d0b6
ds $1
wSCY:: ; d0b7
ds $1
wSelectedPauseMenuItem:: ; d0b8
ds $1
wSelectedPCMenuItem:: ; d0b9
ds $1
wSelectedGiftCenterMenuItem:: ; d0ba
ds $1
wTempMap:: ; d0bb
ds $1
wTempPlayerXCoord:: ; d0bc
ds $1
wTempPlayerYCoord:: ; d0bd
ds $1
wTempPlayerDirection:: ; d0be
ds $1
; See constants/misc_constants.asm for OWMODE's
wOverworldMode:: ; d0bf
ds $1
wOverworldModeBackup:: ; d0c0
ds $1
; overworld npc flag options
; bit 0; auto-close textbox when finished talking to npc
; bit 1; restore npc facing direction when finished talking to npc
; bit 7; hide all npc sprites (for screens like pause menu, opening boosters, entering deck machine, etc.)
wOverworldNPCFlags:: ; d0c1
ds $1
; only used with GAME_EVENT_DUEL, GAME_EVENT_BATTLE_CENTER, and GAME_EVENT_GIFT_CENTER
wActiveGameEvent:: ; d0c2
ds $1
; stores the player's result in a duel (0: win, 1: loss, 2: ???, -1: transmission error?)
; to be read by the overworld caller
wDuelResult:: ; d0c3
ds $1
wNPCDuelist:: ; d0c4
ds $1
wNPCDuelistDirection:: ; d0c5
ds $1
; used to store the location of an overworld script, which is jumped to later
wNextScript:: ; d0c6
ds $2
wCurrentNPCNameTx:: ; d0c8
ds $2
wDefaultObjectText:: ; d0ca
ds $2
wObjectPalettesCGBBackup:: ; d0cc
ds 8 palettes
wOBP0Backup:: ; d10c
ds $1
wOBP1Backup:: ; d10d
ds $1
wd10e:: ; d10e
ds $1
wReloadOverworldCallbackPtr:: ; d10f
ds $2
wDefaultSong:: ; d111
ds $1
wSongOverride:: ; d112
ds $1
wMatchStartTheme:: ; d113
ds $1
wMedalScreenYOffset:: ; d114
ds $1
wWhichMedal:: ; d115
ds $1
wMedalDisplayTimer:: ; d116
ds $1
; if FALSE, first booster being given
; if TRUE, additional booster being given
; used to control the text that is displayed when booster is opened
wAnotherBoosterPack:: ; d117
ds $1
wConfigMessageSpeedCursorPos:: ; d118
ds $1
wConfigDuelAnimationCursorPos:: ; d119
ds $1
wConfigExitSettingsCursorPos:: ; d11a
ds $1
wConfigCursorYPos:: ; d11b
ds $1
; cursor is invisible if bit 4 is set (every $10 ticks)
wCursorBlinkTimer:: ; d11c
ds $1
wPCPackSelection:: ; d11d
ds $1
; 7th bit of each pack corresponds to whether or not it's been read
wPCPacks:: ; d11e
ds NUM_PC_PACKS
wPCLastDirectionPressed:: ; d12d
ds $1
wSelectedPCPack:: ; d12e
ds $1
wBGMapWidth:: ; d12f
ds $1
wBGMapHeight:: ; d130
ds $1
; current tilemap to load
; TILEMAP_* constant
wCurTilemap:: ; d131
ds $1
wCurMapSGBPals:: ; d132
ds $1
UNION
; when opening a booster pack, list of cards available in the booster pack of a specific rarity
wBoosterViableCardList:: ; d133
ds $100
NEXTU
; permission map of the current room with impassable objects (walls, NPCs, etc).
; $00: passable (floor)
; $10: text/menu box tile
; $40: impassable and talkable (NPC or talkable wall)
; $80: impassable and untalkable (wall)
wPermissionMap:: ; d133
ds $100
ENDU
wd233:: ; d233
ds $1
wd234:: ; d234
ds $1
wSCXBuffer:: ; d235
ds $1
wSCYBuffer:: ; d236
ds $1
wd237:: ; d237
ds $1
wd238:: ; d238
ds $1
; current tileset to load to VRAM
; TILESET_* constant
wCurTileset:: ; d239
ds $1
; pointer to compressed data
; of the current map's permission map
wBGMapPermissionDataPtr:: ; d23a
ds $2
; whether the BG Map is in CGB mode
; this means half of the width is for
; VRAM0 and the other half is for VRAM1
wBGMapCGBMode:: ; d23c
ds $1
wd23d:: ; d23d
ds $1
UNION
; palette loaded from Palette* data
wLoadedPalData:: ; d23e
ds $50
NEXTU
; where BG map data or other compressed data is decompressed
wDecompressionBuffer:: ; d23e
ds $40
ENDU
wDecompressionRowWidth:: ; d28e
ds $1
wCurMapInitialPalette:: ; d28f
ds $1
wCurMapPalette:: ; d290
ds $1
wd291:: ; d291
ds $1
; determines where to copy BG Map data
; $0 = copies to VRAM
; $1 = copies to SRAM
wWriteBGMapToSRAM:: ; d292
ds $1
wd293:: ; d293
ds $1
wTempBGP:: ; d294
ds $1
wTempOBP0:: ; d295
ds $1
wTempOBP1:: ; d296
ds $1
; temporarily holds the palettes from
; wBackgroundPalettesCGB
wTempBackgroundPalettesCGB:: ; d297
ds NUM_BACKGROUND_PALETTES palettes
; temporarily holds the palettes from
; wObjectPalettesCGB
wTempObjectPalettesCGB:: ; d2d7
ds NUM_OBJECT_PALETTES palettes
wd317:: ; d317
ds $1
; pointer to the data of current map OW frameset
wCurMapOWFrameset:: ; d318
ds $2
; stored data for each OW frameset subgroup
; has frame data offset and duration
wOWFramesetSubgroups:: ; d31a
ds NUM_OW_FRAMESET_SUBGROUPS * $2
; address offset of current OW frame
; relative to wCurMapOWFrameset
wCurOWFrameDataOffset:: ; d320
ds $1
; duration of the current map OW frame
wCurOWFrameDuration:: ; d321
ds $1
; number of valid subgroups
; that are currently loaded in wOWFramesetSubgroups
wNumLoadedFramesetSubgroups:: ; d322
ds $1
; holds the current state of each event
; each corresponding to a MAP_EVENT_* constant
; if $0, doors are closed / deck machines are deactivated
; if $1, doors are open / deck machines are activated
wOWMapEvents:: ; d323
ds NUM_MAP_EVENTS
; the OWMAP_* value for the current overworld map selection
wOverworldMapSelection:: ; d32e
ds $1
wCurMap:: ; d32f
ds $1
wPlayerXCoord:: ; d330
ds $1
wPlayerYCoord:: ; d331
ds $1
wPlayerXCoordPixels:: ; d332
ds $1
wPlayerYCoordPixels:: ; d333
ds $1
wPlayerDirection:: ; d334
ds $1
; seems to be 1 if moving 0 otherwise
wPlayerCurrentlyMoving:: ; d335
ds $1
wPlayerSpriteIndex:: ; d336
ds $1
wPlayerSpriteBaseAnimation:: ; d337
ds $1
wd338:: ; d338
ds $1
wd339:: ; d339
ds $1
wd33a:: ; d33a
ds $1
wOverworldMapCursorSprite:: ; d33b
ds $1
wOverworldMapCursorAnimation:: ; d33c
ds $1
wOverworldMapStartingPosition:: ; d33d
ds $1
; 0: selection not made, controlling cursor
; 1: selection made, animating player across map
; 2: player arrived at new map
wOverworldMapPlayerAnimationState:: ; d33e
ds $1
wOverworldMapPlayerMovementPtr:: ; d33f
ds $2
wOverworldMapPlayerMovementCounter:: ; d341
ds $1
ds $1
; during setup, this holds a signed 16-bit integer
; representing the total horizontal distance between
; the current point and the next point
; afterward, this holds a signed fixed-point fractional number
; where the high byte represents the number of pixels
; to travel per frame and the low byte represents the
; fraction of a pixel to travel per frame
wOverworldMapPlayerPathHorizontalMovement:: ; d343
ds $2
; works the same as above, but for vertical distance
wOverworldMapPlayerPathVerticalMovement:: ; d345
ds $2
wOverworldMapPlayerHorizontalSubPixelPosition:: ; d347
ds $1
wOverworldMapPlayerVerticalSubPixelPosition:: ; d348
ds $1
; total number of NPCs that are currently loaded
wNumLoadedNPCs:: ; d349
ds $1
wLoadedNPCs:: ; d34a
loaded_npc_struct wLoadedNPC1
loaded_npc_struct wLoadedNPC2
loaded_npc_struct wLoadedNPC3
loaded_npc_struct wLoadedNPC4
loaded_npc_struct wLoadedNPC5
loaded_npc_struct wLoadedNPC6
loaded_npc_struct wLoadedNPC7
loaded_npc_struct wLoadedNPC8
wLoadedNPCTempIndex:: ; d3aa
ds $1
wTempNPC:: ; d3ab
ds $1
wLoadNPCXPos:: ; d3ac
ds $1
wLoadNPCYPos:: ; d3ad
ds $1
wLoadNPCDirection:: ; d3ae
ds $1
wLoadNPCFunction:: ; d3af
ds $2
wNPCAnim:: ; d3b1
ds $1
wNPCAnimFlags:: ; d3b2
ds $1
; sprite ID of the NPC to load
wNPCSpriteID:: ; d3b3
ds $1
ds $2
; ID of the NPC being interacted with in Script
wScriptNPC:: ; d3b6
ds $1
; bit 6 will be set if an NPC is currently moving
wIsAnNPCMoving:: ; d3b7
ds $1
; whether Ronald is in the current map
; is used to load his theme whenever he is present
wRonaldIsInMap:: ; d3b8
ds $1
wd3b9:: ; d3b9
ds $2
wMastersBeatenList:: ; d3bb
ds $a
wGeneralSaveDataCheckSum:: ; d3c5
ds $2
wNumSRAMValidationErrors:: ; d3c7
ds $1
; play time hours and minutes
; byte 0: minutes
; byte 1: hours (lower byte)
; byte 2: hours (higher byte)
wPlayTimeHourMinutes:: ; d3c8
ds $3
wCurOverworldMap:: ; d3cb
ds $1
wMedalCount:: ; d3cc
ds $1
; total number of cards the player has collected
wTotalNumCardsCollected:: ; d3cd
ds $1
; total number of cards to be collected
; doesn't count the Phantom cards (Venusaur1 and Mew2)
; unless they have already been collected
wTotalNumCardsToCollect:: ; d3ce
ds $1
wCardToAddToCollection:: ; d3cf
ds $1
wd3d0:: ; d3d0
ds $1
; the bits relevant to the currently worked on event, obtained from EventVarMasks
wLoadedEventBits:: ; d3d1
ds $1
wEventVars:: ; d3d2
ds $40
; 0 keeps looping, other values break the loop in RST20
wBreakScriptLoop:: ; d412
ds $1
wScriptPointer:: ; d413
ds $2
; generally set to ff when an event check passes, 0 otherwise
wScriptControlByte:: ; d415
ds $1
wd416:: ; d416
ds $1
wd417:: ; d417
ds $1
wDebugMenuSelection:: ; d418
ds $1
wDebugSGBBorder:: ; d419
ds $1
wDebugBoosterSelection:: ; d41a
ds $1
; used in unreferenced function Func_1c890
; otherwise unused
wd41b:: ; d41b
ds $1
; used in unreferenced function Func_1c890
; otherwise unused
; is read like a sprite index
wd41c:: ; d41c
ds $1
wd41d:: ; d41d
ds $1
wd41e:: ; d41e
ds $1
wd41f:: ; d41f
ds $1
wd420:: ; d420
ds $1
; store settings for animation enabled/disabled
; 0 means enabled, 1 means disabled
wAnimationsDisabled:: ; d421
ds $1
; holds an animation to play
wTempAnimation:: ; d422
ds $1
; holds a list of animations to play
; as long as any of the slot isn't $ff, there's something to play
; it may actually not be a queue
wAnimationQueue:: ; d423
ds ANIMATION_QUEUE_LENGTH
wd42a:: ; d42a
ds $1
wAnimFlags:: ; d42b
ds $1
wDuelAnimBuffer:: ; d42c
duel_anim_struct wDuelAnim1
duel_anim_struct wDuelAnim2
duel_anim_struct wDuelAnim3
duel_anim_struct wDuelAnim4
duel_anim_struct wDuelAnim5
duel_anim_struct wDuelAnim6
duel_anim_struct wDuelAnim7
duel_anim_struct wDuelAnim8
duel_anim_struct wDuelAnim9
duel_anim_struct wDuelAnim10
duel_anim_struct wDuelAnim11
duel_anim_struct wDuelAnim12
duel_anim_struct wDuelAnim13
duel_anim_struct wDuelAnim14
duel_anim_struct wDuelAnim15
duel_anim_struct wDuelAnim16
wDuelAnimBufferCurPos:: ; d4ac
ds $1
wDuelAnimBufferSize:: ; d4ad
ds $1
; used to know what coordinate offsets to use to place animations
; for use in GetAnimCoordsAndFlags
; DUEL_ANIM_SCREEN_MAIN_SCENE = main scene
; DUEL_ANIM_SCREEN_PLAYER_PLAY_AREA = Player's Play Area screen
; DUEL_ANIM_SCREEN_OPP_PLAY_AREA = Opponent's Play Area screen
wDuelAnimationScreen:: ; d4ae
ds $1
; which side to play animation
; uses PLAYER_TURN and OPPONENT_TURN constants
wDuelAnimDuelistSide:: ; d4af
ds $1
; used in GetAnimCoordsAndFlags to determine
; what coordinates to draw the animation in.
; e.g. used to know what Play Area card
; to draw a hit animation in the Play Area screen.
wDuelAnimLocationParam:: ; d4b0
ds $1
; damage value to display with animation
wDuelAnimDamage:: ; d4b1
ds $2
wd4b3:: ; d4b3
ds $1
; stores the character symbols of some
; value that was converted to decimal
; through ConvertWordToNumericalDigits
wDecimalChars:: ; d4b4
ds $3
wd4b7:: ; d4b7
ds $1
wd4b8:: ; d4b8
ds $1
; pointer to a function to update
; the current screen animation
wScreenAnimUpdatePtr:: ; d4b9
ds $2
; duration of the current screen animation
wScreenAnimDuration:: ; d4bb
ds $1
wd4bc:: ; d4bc
ds $2
; bank number to return to after processing animation
wDuelAnimReturnBank:: ; d4be
ds $1
wd4bf:: ; d4bf
ds $1
wd4c0:: ; d4c0
ds $1
ds $1
; pointer to address in VRAM
wVRAMPointer:: ; d4c2
ds $2
; these next 3 seem to be an address (bank @ end) for copying bg data
wTempPointer:: ; d4c4
ds $2
wTempPointerBank:: ; d4c6
ds $1
; stores number of bytes per tile for current sprite
wCurSpriteTileSize:: ; d4c7
ds $1
; stores number of tiles that current sprite/tileset has
wTotalNumTiles:: ; d4c8
; checksum?
wGeneralSaveDataByteCount:: ; d4c8
ds $2
; stores tile offset in VRAM
wVRAMTileOffset:: ; d4ca
wd4ca:: ; d4ca
ds $1
; bottom bit stores which VRAM bank to draw certain gfx
; $0 = VRAM0, $1 = VRAM1
wd4cb:: ; d4cb
ds $1
ds $3
; used as an index to manipulate a sprite from wSpriteAnimBuffer
wWhichSprite:: ; d4cf
ds $1
; 16-byte data for up to 16 sprites
wSpriteAnimBuffer:: ; d4d0
sprite_anim_struct wSprite1
sprite_anim_struct wSprite2
sprite_anim_struct wSprite3
sprite_anim_struct wSprite4
sprite_anim_struct wSprite5
sprite_anim_struct wSprite6
sprite_anim_struct wSprite7
sprite_anim_struct wSprite8
sprite_anim_struct wSprite9
sprite_anim_struct wSprite10
sprite_anim_struct wSprite11
sprite_anim_struct wSprite12
sprite_anim_struct wSprite13
sprite_anim_struct wSprite14
sprite_anim_struct wSprite15
sprite_anim_struct wSprite16
wCurrSpriteAttributes:: ; d5d0
ds $1
wCurrSpriteXPos:: ; d5d1
ds $1
wCurrSpriteYPos:: ; d5d2
ds $1
wCurrSpriteTileID:: ; d5d3
ds $1
wCurrSpriteRightEdgeCheck:: ; d5d4
ds $1
wCurrSpriteBottomEdgeCheck:: ; d5d5
ds $1
wd5d6:: ; d5d6
ds $1
wd5d7:: ; d5d7
ds $1
wSpriteVRAMBuffer:: ; d5d8
sprite_vram_struct wSpriteVRAM1
sprite_vram_struct wSpriteVRAM2
sprite_vram_struct wSpriteVRAM3
sprite_vram_struct wSpriteVRAM4
sprite_vram_struct wSpriteVRAM5
sprite_vram_struct wSpriteVRAM6
sprite_vram_struct wSpriteVRAM7
sprite_vram_struct wSpriteVRAM8
sprite_vram_struct wSpriteVRAM9
sprite_vram_struct wSpriteVRAM10
sprite_vram_struct wSpriteVRAM11
sprite_vram_struct wSpriteVRAM12
sprite_vram_struct wSpriteVRAM13
sprite_vram_struct wSpriteVRAM14
sprite_vram_struct wSpriteVRAM15
sprite_vram_struct wSpriteVRAM16
; seems to be the amount of entries in wSpriteVRAMBuffer
wSpriteVRAMBufferSize:: ; d618
ds $1
wSceneSprite:: ; d619
ds $1
wSceneSpriteAnimation:: ; d61a
ds $1
wSceneSpriteIndex:: ; d61b
ds $1
; base X position in pixels of loaded scene
wSceneBaseX:: ; d61c
ds $1
; base Y position in pixels of loaded scene
wSceneBaseY:: ; d61d
ds $1
wd61e:: ; d61e
ds $1
wd61f:: ; d61f
ds $1
wSceneSGBPacketPtr:: ; d620
ds $2
wSceneSGBRoutinePtr:: ; d622
ds $2
; whether there exists valid save data
wHasSaveData:: ; d624
ds $1
; whether has valid duel save data
wHasDuelSaveData:: ; d625
ds $1
; keep track of which Start Menu item
; is currently highlighted
wCurHighlightedStartMenuItem:: ; d626
; used to keep track of the time
; in which the Title Screen ignores
; the player's input
wTitleScreenIgnoreInputCounter:: ; d626
ds $1
wLastSelectedStartMenuItem:: ; d627
ds $1
; START_MENU_* constant chosen
; by the player in the Start Menu
wStartMenuChoice:: ; d628
ds $1
; list of sprites used in the Title Screen
wTitleScreenSprites:: ; d629
ds $7
ds $1
; pointer to commands used by opening and credits sequence
; (see IntroSequence and CreditsSequence)
wSequenceCmdPtr:: ; d631
ds $2
; when non-zero, is decremented and only
; executes the next sequence command when it's 0
; when it's $ff, it is interpreted as end of sequence
wSequenceDelay:: ; d633
ds $1
wIntroSequencePalsNeedUpdate:: ; d634
ds $1
wd635:: ; d635
ds $1
; has parameters used for the Start Menu
; check SetStartMenuParams for what parameters are set
wStartMenuParams:: ; d636
ds $11
wd647:: ; d647
ds $1
wd648:: ; d648
ds $1
wd649:: ; d649
ds $1
wd64a:: ; d64a
ds $1
; wd64b to wd665 used by Func_3e44
wd64b:: ; d64b
ds $6
wd651:: ; d651
ds $6
wd657:: ; d657
ds $1
wd658:: ; d658
ds $1
wd659:: ; d659
ds $6
wd65f:: ; d65f
ds $6
wd665:: ; d665
ds $1
; used by GetNextBackgroundScroll
wBGScrollMod:: ; d666
ds $1
; used by ApplyBackgroundScroll
wApplyBGScroll:: ; d667
ds $1
; used by ApplyBackgroundScroll
wNextScrollLY:: ; d668
ds $1
; which BoosterPack_* corresponds to the booster pack that the player is opening
wBoosterPackID:: ; d669
ds $1
; card being currently processed by the booster pack engine functions
wBoosterCurrentCard:: ; d66a
ds $1
; BOOSTER_CARD_TYPE_* of the card that has just been drawn from the pack
wBoosterJustDrawnCardType:: ; d66b
ds $1
; rarity of the cards being currently generated (non-energy cards are generated ordered by rarity)
wBoosterCurrentRarity:: ; d66c
ds $1
; the averaged value of all values in wBoosterData_TypeChances
; used to recalculate the chances of a booster card type when a card of said type is drawn from the pack
wBoosterAveragedTypeChances:: ; d66d
ds $1
; data of the booster pack copied from the corresponding BoosterSetRarityAmountsTable entry
wBoosterData_CommonAmount:: ; d66e
ds $1
wBoosterData_UncommonAmount:: ; d66f
ds $1
wBoosterData_RareAmount:: ; d670
ds $1
; how many cards of each type are available of a certain rarity in the booster pack's set
wBoosterAmountOfCardTypeTable:: ; d671
ds NUM_BOOSTER_CARD_TYPES
; holds information similar to wBoosterData_TypeChances, except that it contains 00 on any type
; of which there are no cards remaining in the set for the current rarity
wBoosterTempTypeChancesTable:: ; d67a
ds NUM_BOOSTER_CARD_TYPES
; properties of the card being currently processed by the booster pack engine functions
wBoosterCurrentCardType:: ; d683
ds $1
wBoosterCurrentCardRarity:: ; d684
ds $1
wBoosterCurrentCardSet:: ; d685
ds $1
; data of the booster pack copied from the corresponding BoosterPack_* structure.
; wBoosterData_TypeChances is updated after each card is drawn, to re-balance the type chances.
wBoosterData_Set:: ; d686
ds $1
wBoosterData_EnergyFunctionPointer:: ; d687
ds $2
wBoosterData_TypeChances:: ; d689
ds NUM_BOOSTER_CARD_TYPES
; index into ChallengeMachine_OpponentDeckIDs
; not the typical NPC duelist ID
wChallengeMachineOpponent:: ; d692
ds $1
wStarterDeckChoice:: ; d693
ds $1
wMultichoiceTextboxResult_Sam:: ; d694
ds $1
wMultichoiceTextboxResult_ChooseDeckToDuelAgainst:: ; d695
ds $1
wChallengeHallNPC:: ; d696
ds $1
wCardReceived:: ; d697
ds $1
wd698:: ; d698
ds $4
ds $6e4
SECTION "WRAM1 Audio", WRAMX
; bit 7 is set once the song has been started
wCurSongID:: ; dd80
ds $1
wCurSongBank:: ; dd81
ds $1
; bit 7 is set once the sfx has been started
wCurSfxID:: ; dd82
ds $1
; priority value of current sfx (0 if nothing is playing)
wSfxPriority:: ; dd83
ds $1
; 8-bit output enable mask for left/right output for each channel
wMusicStereoPanning:: ; dd84
ds $1
wdd85:: ; dd85
ds $1
wMusicDuty1:: ; dd86
ds $1
wMusicDuty2:: ; dd87
ds $1
ds $2
wMusicWave:: ; dd8a
ds $1
wMusicWaveChange:: ; dd8b
ds $1
wdd8c:: ; dd8c
ds $1
wMusicIsPlaying:: ; dd8d
ds $4
wMusicTie:: ; dd91
ds $4
; 4 pointers to the current music commands being executed
wMusicChannelPointers:: ; dd95
ds $8
; 4 pointers to the addresses of the beginning of the main loop for each channel
wMusicMainLoopStart:: ; dd9d
ds $8
wMusicCh1CurPitch:: ; dda5
ds $1
wMusicCh1CurOctave:: ; dda6
ds $1
wMusicCh2CurPitch:: ; dda7
ds $1
wMusicCh2CurOctave:: ; dda8
ds $1
wMusicCh3CurPitch:: ; dda9
ds $1
wMusicCh3CurOctave:: ; ddaa
ds $1
wddab:: ; ddab
ds $1
wddac:: ; ddac
ds $1
ds $2
wMusicOctave:: ; ddaf
ds $4
wddb3:: ; ddb3
ds $4
wddb7:: ; ddb7
ds $1
wddb8:: ; ddb8
ds $1
wddb9:: ; ddb9
ds $1
wddba:: ; ddba
ds $1
wddbb:: ; ddbb
ds $4
; the delay (1-8) before a note is cut off early (0 is disabled)
wMusicCutoff:: ; ddbf
ds $4
wddc3:: ; ddc3
ds $4
; the volume to apply after a cutoff
wMusicEcho:: ; ddc7
ds $4
; the pitch offset to apply to each note (see Music1_Pitches)
wMusicPitchOffset:: ; ddcb
ds $4
wMusicSpeed:: ; ddcf
ds $4
wMusicVibratoType:: ; ddd3
ds $4
wMusicVibratoType2:: ; ddd7
ds $4
wdddb:: ; dddb
ds $4
wMusicVibratoDelay:: ; dddf
ds $4
wdde3:: ; dde3
ds $4
wMusicVolume:: ; dde7
ds $3
; the frequency offset to apply to each note
wMusicFrequencyOffset:: ; ddea
ds $3
wdded:: ; dded
ds $2
wddef:: ; ddef
ds $1
wddf0:: ; ddf0
ds $1
wMusicPanning:: ; ddf1
ds $1
wddf2:: ; ddf2
ds $1
; 4 pointers to the positions on the stack for each channel
wMusicChannelStackPointers:: ; ddf3
ds $8
; these stacks contain the address of the command to return to at the end of a sub branch (2 bytes)
; and also contain the address of the command to return to at the end of a loop (2 bytes for address and
; 1 byte for loop count)
wMusicCh1Stack:: ; ddfb
ds $c
wMusicCh2Stack:: ; de07
ds $c
wMusicCh3Stack:: ; de13
ds $c
wMusicCh4Stack:: ; de1f
ds $c
wde2b:: ; de2b
ds $3
wde2e:: ; de2e
ds $1
wde2f:: ; de2f
ds $3
wde32:: ; de32
ds $1
wde33:: ; de33
ds $4
wde37:: ; de37
ds $6
wde3d:: ; de3d
ds $2
wde3f:: ; de3f
ds $4
wde43:: ; de43
ds $8
wde4b:: ; de4b
ds $8
wde53:: ; de53
ds $1
wde54:: ; de54
ds $1
wCurSongIDBackup:: ; de55
ds $1
wCurSongBankBackup:: ; de56
ds $1
wMusicStereoPanningBackup:: ; de57
ds $1
wMusicDuty1Backup:: ; de58
ds $4
wMusicWaveBackup:: ; de5c
ds $1
wMusicWaveChangeBackup:: ; de5d
ds $1
wMusicIsPlayingBackup:: ; de5e
ds $4
wMusicTieBackup:: ; de62
ds $4
wMusicChannelPointersBackup:: ; de66
ds $8
wMusicMainLoopStartBackup:: ; de6e
ds $8
wde76:: ; de76
ds $1
wde77:: ; de77
ds $1
wMusicOctaveBackup:: ; de78
ds $4
wde7c:: ; de7c
ds $4
wde80:: ; de80
ds $4
wde84:: ; de84
ds $4
wMusicCutoffBackup:: ; de88
ds $4
wde8c:: ; de8c
ds $4
wMusicEchoBackup:: ; de90
ds $4
wMusicPitchOffsetBackup:: ; de94
ds $4
wMusicSpeedBackup:: ; de98
ds $4
wMusicVibratoType2Backup:: ; de9c
ds $4
wMusicVibratoDelayBackup:: ; dea0
ds $4
wMusicVolumeBackup:: ; dea4
ds $3
wMusicFrequencyOffsetBackup:: ; dea7
ds $3
wdeaa:: ; deaa
ds $2
wdeac:: ; deac
ds $1
wMusicChannelStackPointersBackup:: ; dead
ds $8
wMusicCh1StackBackup:: ; deb5
ds $c * 4
INCLUDE "sram.asm"
|