summaryrefslogtreecommitdiff
path: root/wram.asm
blob: cb3ed62d2e1e891b8cea72eae69e722b1bcbb253 (plain)
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
INCLUDE "constants.asm"

INCLUDE "macros/wram.asm"

INCLUDE "vram.asm"


SECTION "Audio RAM", WRAM0

wMusic::

; nonzero if playing
wMusicPlaying:: db ; c000

wChannels::
wChannel1:: channel_struct wChannel1 ; c001
wChannel2:: channel_struct wChannel2 ; c033
wChannel3:: channel_struct wChannel3 ; c065
wChannel4:: channel_struct wChannel4 ; c097

wSFXChannels::
wChannel5:: channel_struct wChannel5 ; c0c9
wChannel6:: channel_struct wChannel6 ; c0fb
wChannel7:: channel_struct wChannel7 ; c12d
wChannel8:: channel_struct wChannel8 ; c15f

	ds 1 ; c191

wCurTrackDuty:: db
wCurTrackVolumeEnvelope:: db
wCurTrackFrequency:: dw
wUnusedBCDNumber:: db ; BCD value, dummied out
wCurNoteDuration:: db ; used in MusicE0 and LoadNote

wCurMusicByte:: db ; c198
wCurChannel:: db ; c199
wVolume:: ; c19a
; corresponds to rNR50
; Channel control / ON-OFF / Volume (R/W)
;   bit 7 - Vin->SO2 ON/OFF
;   bit 6-4 - SO2 output level (volume) (# 0-7)
;   bit 3 - Vin->SO1 ON/OFF
;   bit 2-0 - SO1 output level (volume) (# 0-7)
	db
wSoundOutput:: ; c19b
; corresponds to rNR51
; bit 4-7: ch1-4 so2 on/off
; bit 0-3: ch1-4 so1 on/off
	db
wPitchSweep:: ; c19c
; corresponds to rNR10
; bit 7:   unused
; bit 4-6: sweep time
; bit 3:   sweep direction
; but 0-2: sweep shift
	db

wMusicID:: dw ; c19d
wMusicBank:: db ; c19f
wNoiseSampleAddress:: dw ; c1a0
wNoiseSampleDelay:: db ; c1a2
	ds 1 ; c1a3
wMusicNoiseSampleSet:: db ; c1a4
wSFXNoiseSampleSet:: db ; c1a5

wLowHealthAlarm:: ; c1a6
; bit 7: on/off
; bit 4: pitch
; bit 0-3: counter
	db

wMusicFade:: ; c1a7
; fades volume over x frames
; bit 7: fade in/out
; bit 0-5: number of frames for each volume level
; $00 = none (default)
	db
wMusicFadeCount:: db ; c1a8
wMusicFadeID:: dw ; c1a9

	ds 5

wCryPitch:: dw ; c1b0
wCryLength:: dw ; c1b2

wLastVolume:: db ; c1b4
wUnusedMusicF9Flag:: db ; c1b5

wSFXPriority:: ; c1b6
; if nonzero, turn off music when playing sfx
	db

	ds 1

wChannel1JumpCondition:: db
wChannel2JumpCondition:: db
wChannel3JumpCondition:: db
wChannel4JumpCondition:: db

wStereoPanningMask:: db ; c1bc

wCryTracks:: ; c1bd
; plays only in left or right track depending on what side the monster is on
; both tracks active outside of battle
	db

wSFXDuration:: db
wCurSFX:: ; c1bf
; id of sfx currently playing
	db
wChannelsEnd::

wMapMusic:: db ; c1c0

wDontPlayMapMusicOnReload:: db
wMusicEnd::


SECTION "WRAM", WRAM0

wLZAddress:: dw ; c1c2
wLZBank::    db ; c1c4

	ds 1

wInputType::        db ; c1c6
wAutoInputAddress:: dw ; c1c7
wAutoInputBank::    db ; c1c9
wAutoInputLength::  db ; c1ca

wDebugFlags:: db
wGameLogicPaused:: db ; c1cc
wSpriteUpdatesEnabled:: db

wUnusedScriptByteBuffer:: db

wMapTimeOfDay:: db

	ds 3

wPrinterConnectionOpen:: db
wPrinterOpcode:: db
wPrevDexEntry:: db
wDisableTextAcceleration:: db
wPCItemsCursor:: db
wPCItemsScrollPosition:: db

	ds 39


SECTION "GBC Palettes", WRAM0

; eight 4-color palettes each
wBGPals1:: ds 8 palettes ; c200
wOBPals1:: ds 8 palettes ; c240
wBGPals2:: ds 8 palettes ; c280
wOBPals2:: ds 8 palettes ; c2c0


SECTION "Sprites", WRAM0

wVirtualOAM:: ; c300
wVirtualOAMSprite00:: sprite_oam_struct wVirtualOAMSprite00
wVirtualOAMSprite01:: sprite_oam_struct wVirtualOAMSprite01
wVirtualOAMSprite02:: sprite_oam_struct wVirtualOAMSprite02
wVirtualOAMSprite03:: sprite_oam_struct wVirtualOAMSprite03
wVirtualOAMSprite04:: sprite_oam_struct wVirtualOAMSprite04
wVirtualOAMSprite05:: sprite_oam_struct wVirtualOAMSprite05
wVirtualOAMSprite06:: sprite_oam_struct wVirtualOAMSprite06
wVirtualOAMSprite07:: sprite_oam_struct wVirtualOAMSprite07
wVirtualOAMSprite08:: sprite_oam_struct wVirtualOAMSprite08
wVirtualOAMSprite09:: sprite_oam_struct wVirtualOAMSprite09
wVirtualOAMSprite10:: sprite_oam_struct wVirtualOAMSprite10
wVirtualOAMSprite11:: sprite_oam_struct wVirtualOAMSprite11
wVirtualOAMSprite12:: sprite_oam_struct wVirtualOAMSprite12
wVirtualOAMSprite13:: sprite_oam_struct wVirtualOAMSprite13
wVirtualOAMSprite14:: sprite_oam_struct wVirtualOAMSprite14
wVirtualOAMSprite15:: sprite_oam_struct wVirtualOAMSprite15
wVirtualOAMSprite16:: sprite_oam_struct wVirtualOAMSprite16
wVirtualOAMSprite17:: sprite_oam_struct wVirtualOAMSprite17
wVirtualOAMSprite18:: sprite_oam_struct wVirtualOAMSprite18
wVirtualOAMSprite19:: sprite_oam_struct wVirtualOAMSprite19
wVirtualOAMSprite20:: sprite_oam_struct wVirtualOAMSprite20
wVirtualOAMSprite21:: sprite_oam_struct wVirtualOAMSprite21
wVirtualOAMSprite22:: sprite_oam_struct wVirtualOAMSprite22
wVirtualOAMSprite23:: sprite_oam_struct wVirtualOAMSprite23
wVirtualOAMSprite24:: sprite_oam_struct wVirtualOAMSprite24
wVirtualOAMSprite25:: sprite_oam_struct wVirtualOAMSprite25
wVirtualOAMSprite26:: sprite_oam_struct wVirtualOAMSprite26
wVirtualOAMSprite27:: sprite_oam_struct wVirtualOAMSprite27
wVirtualOAMSprite28:: sprite_oam_struct wVirtualOAMSprite28
wVirtualOAMSprite29:: sprite_oam_struct wVirtualOAMSprite29
wVirtualOAMSprite30:: sprite_oam_struct wVirtualOAMSprite30
wVirtualOAMSprite31:: sprite_oam_struct wVirtualOAMSprite31
wVirtualOAMSprite32:: sprite_oam_struct wVirtualOAMSprite32
wVirtualOAMSprite33:: sprite_oam_struct wVirtualOAMSprite33
wVirtualOAMSprite34:: sprite_oam_struct wVirtualOAMSprite34
wVirtualOAMSprite35:: sprite_oam_struct wVirtualOAMSprite35
wVirtualOAMSprite36:: sprite_oam_struct wVirtualOAMSprite36
wVirtualOAMSprite37:: sprite_oam_struct wVirtualOAMSprite37
wVirtualOAMSprite38:: sprite_oam_struct wVirtualOAMSprite38
wVirtualOAMSprite39:: sprite_oam_struct wVirtualOAMSprite39
wVirtualOAMEnd::


SECTION "Tilemap", WRAM0

wTilemap:: ; c3a0
; 20x18 grid of 8x8 tiles
	ds SCREEN_WIDTH * SCREEN_HEIGHT
wTilemapEnd::


SECTION "Miscellaneous", WRAM0

; This union spans 480 bytes from c508 to c6e8.
UNION ; c508
; surrounding tiles
; This buffer determines the size for the rest of the union;
; it uses exactly 480 bytes.
wSurroundingTiles:: ds SURROUNDING_WIDTH * SURROUNDING_HEIGHT

NEXTU ; c508
; box save buffer
; SaveBoxAddress uses this buffer in three steps because it
; needs more space than the buffer can hold.
wBoxPartialData:: ds 480
wBoxPartialDataEnd::

NEXTU ; c508
; 20x18 grid of 8x8 tiles
wTempTilemap::
	ds SCREEN_WIDTH * SCREEN_HEIGHT ; $168 = 360

NEXTU ; c508

; This union spans 200 bytes from c508 to c5d0.
UNION ; c508
; wSpriteAnimDict is a 10x2 dictionary
; keys: taken from third column of SpriteAnimSeqData
; values: vTiles
wSpriteAnimDict:: ds 10 * 2

wSpriteAnimationStructs::
; field  0:   index
; fields 1-3: loaded from SpriteAnimSeqData
wSpriteAnim1::  sprite_anim_struct wSpriteAnim1
wSpriteAnim2::  sprite_anim_struct wSpriteAnim2
wSpriteAnim3::  sprite_anim_struct wSpriteAnim3
wSpriteAnim4::  sprite_anim_struct wSpriteAnim4
wSpriteAnim5::  sprite_anim_struct wSpriteAnim5
wSpriteAnim6::  sprite_anim_struct wSpriteAnim6
wSpriteAnim7::  sprite_anim_struct wSpriteAnim7
wSpriteAnim8::  sprite_anim_struct wSpriteAnim8
wSpriteAnim9::  sprite_anim_struct wSpriteAnim9
wSpriteAnim10:: sprite_anim_struct wSpriteAnim10
wSpriteAnimationStructsEnd::

wSpriteAnimCount:: db
wCurSpriteOAMAddr:: db

wCurIcon:: db ; c5be

wCurIconTile:: db
wSpriteAnimAddrBackup::
wSpriteAnimIDBuffer::
wCurSpriteOAMFlags::
	dw
wCurAnimVTile:: db
wCurAnimXCoord:: db
wCurAnimYCoord:: db
wCurAnimXOffset:: db
wCurAnimYOffset:: db
wGlobalAnimYOffset:: db
wGlobalAnimXOffset:: db
wSpriteAnimsEnd::
	ds 7

NEXTU ; c508
; timeset temp storage
wTimeSetBuffer::
	ds 20
wInitHourBuffer:: db ; c51c
	ds 9
wInitMinuteBuffer:: db ; c526
	ds 19
wTimeSetBufferEnd::

NEXTU ; c508
; hall of fame temp struct
wHallOfFameTemp:: hall_of_fame wHallOfFameTemp

NEXTU ; c508
; link engine data
wLink_c508:: ds 10
wc512:: ds 10

NEXTU ; c508
; unused (engine/menus/debug.asm)
wc508:: ds 13
ENDU ; c5d0

; This union spans 280 bytes from c5d0 to c6e8.
UNION ; c5d0
; pokedex
wPokedexDataStart:: ; c5d0
wPokedexOrder:: ds $100 ; >= NUM_POKEMON
wPokedexOrderEnd::
wDexListingScrollOffset:: db ; offset of the first displayed entry from the start
wDexListingCursor:: db ; Dex cursor
wDexListingEnd:: db ; Last mon to display
wDexListingHeight:: db ; number of entries displayed at once in the dex listing
wCurDexMode:: db ; Pokedex Mode
wDexSearchMonType1:: db ; first type to search
wDexSearchMonType2:: db ; second type to search
wDexSearchResultCount:: db
wDexArrowCursorPosIndex:: db
wDexArrowCursorDelayCounter:: db
wDexArrowCursorBlinkCounter:: db
wDexSearchSlowpokeFrame:: db
wUnlockedUnownMode:: db
wDexCurUnownIndex:: db
wDexUnownCount:: db
wDexConvertedMonType:: db ; mon type converted from dex search mon type
wDexListingScrollOffsetBackup:: db
wDexListingCursorBackup:: db
wBackupDexListingCursor:: db
wBackupDexListingPage:: db
wDexCurLocation:: db
wPokedexDataEnd::
	ds 3

NEXTU ; c5d0
; pokegear
wPokegearPhoneLoadNameBuffer:: db ; c5d0
wPokegearPhoneCursorPosition:: db ; c5d1
wPokegearPhoneScrollPosition:: db ; c5d2
wPokegearPhoneSelectedPerson:: db ; cd3
wPokegearPhoneSubmenuCursor:: db ; c5d4
wPokegearMapCursorObjectPointer:: dw ; c5d5
wPokegearMapCursorLandmark:: db ; c5d7
wPokegearMapPlayerIconLandmark:: db ; c5d8
wPokegearRadioChannelBank:: db ; c5d9
wPokegearRadioChannelAddr:: dw ; c5da
wPokegearRadioMusicPlaying:: db ; c5dc

NEXTU ; c5d0
; trade
wTrademons:: ; c5d0
wPlayerTrademon:: trademon wPlayerTrademon
wOTTrademon::     trademon wOTTrademon
wTrademonsEnd::
wTradeAnimAddress:: dw
wLinkPlayer1Name:: ds NAME_LENGTH
wLinkPlayer2Name:: ds NAME_LENGTH
wLinkTradeSendmonSpecies:: db
wLinkTradeGetmonSpecies::  db

NEXTU
; naming screen
wNamingScreenDestinationPointer:: dw ; c5d0
wNamingScreenCurNameLength:: db ; c5d2
wNamingScreenMaxNameLength:: db ; c5d3
wNamingScreenType:: db ; c5d4
wNamingScreenCursorObjectPointer:: dw ; c5d5
wNamingScreenLastCharacter:: db ; c5d7
wNamingScreenStringEntryCoord:: dw ; c5d8

NEXTU ; c5d0
; slot machine
wSlots:: ; c5d0
wReel1:: slot_reel wReel1
wReel2:: slot_reel wReel2
wReel3:: slot_reel wReel3
; c600
wReel1Stopped:: ds 3
wReel2Stopped:: ds 3
wReel3Stopped:: ds 3
wSlotBias:: db
wSlotBet:: db
wFirstTwoReelsMatching:: db
wFirstTwoReelsMatchingSevens:: db
wSlotMatched:: db
wCurReelStopped:: ds 3
wPayout:: dw
wCurReelXCoord:: db
wCurReelYCoord:: db
	ds 2
wSlotBuildingMatch:: db
wSlotsDataEnd::
	ds 28
wSlotsEnd::

NEXTU ; c5d0
; unused (engine/gfx/color.asm)
	ds 50

wc602:: db ; c602
	ds 2

wc605:: db ; c605
wc606:: db ; c606
wc607:: db ; c607
ENDU ; c6e8

ENDU ; c6e8

; This was a buffer for map-related pointers in the 1997 G/S prototype.
; See wMapBuffer in pokegold-spaceworld's wram.asm.
wUnusedMapBuffer:: ds 24
wUnusedMapBufferEnd::


SECTION "Overworld Map", WRAM0

UNION ; c700
; overworld map blocks
wOverworldMapBlocks:: ds 1300 ; c700
wOverworldMapBlocksEnd::

NEXTU ; c700
; GB Printer screen RAM
wGameboyPrinterRAM::
wGameboyPrinterScreen:: ds SCREEN_HEIGHT * SCREEN_WIDTH ; c700
wGameboyPrinterScreenEnd:: ; c868

NEXTU ; c700
; GB Printer data
wGameboyPrinter2bppSource:: ds 40 tiles
wGameboyPrinter2bppSourceEnd::
wc980:: db
wPrinterRowIndex:: db

; Printer data
wPrinterData:: ds 4
wPrinterChecksum:: dw ; c986
wPrinterHandshake:: db
wPrinterStatusFlags::
; bit 7: set if error 1 (battery low)
; bit 6: set if error 4 (too hot or cold)
; bit 5: set if error 3 (paper jammed or empty)
; if this and the previous byte are both $ff: error 2 (connection error)
	db

wHandshakeFrameDelay:: db
wPrinterSerialFrameDelay:: db
wPrinterSendByteOffset:: dw
wPrinterSendByteCounter:: dw

; tilemap backup?
wPrinterTilemapBuffer:: ds SCREEN_HEIGHT * SCREEN_WIDTH ; c990
wPrinterTilemapBufferEnd::
wPrinterStatus:: db ; caf8
	ds 1
; High nibble is for margin before the image, low nibble is for after.
wPrinterMargins:: db ; cafa
wPrinterExposureTime:: db ; cafb
	ds 16
wGameboyPrinterRAMEnd::

NEXTU ; c700
; Hall of Fame data
wHallOfFamePokemonList:: hall_of_fame wHallOfFamePokemonList

NEXTU ; c700
; raw link data
wLinkData:: ds $514
wLinkDataEnd::

NEXTU ; c700
; link data members
wLinkPlayerName:: ds NAME_LENGTH
wLinkPartyCount:: db
wLinkPartySpecies:: ds PARTY_LENGTH
wLinkPartyEnd:: db ; older code doesn't check PartyCount

UNION ; c713
; time capsule party data
wTimeCapsulePlayerData::
wTimeCapsulePartyMon1:: red_party_struct wTimeCapsulePartyMon1
wTimeCapsulePartyMon2:: red_party_struct wTimeCapsulePartyMon2
wTimeCapsulePartyMon3:: red_party_struct wTimeCapsulePartyMon3
wTimeCapsulePartyMon4:: red_party_struct wTimeCapsulePartyMon4
wTimeCapsulePartyMon5:: red_party_struct wTimeCapsulePartyMon5
wTimeCapsulePartyMon6:: red_party_struct wTimeCapsulePartyMon6
wTimeCapsulePartyMonOTNames:: ds PARTY_LENGTH * NAME_LENGTH
wTimeCapsulePartyMonNicks:: ds PARTY_LENGTH * MON_NAME_LENGTH
wTimeCapsulePlayerDataEnd::

NEXTU ; c713
; link player data
wLinkPlayerData::
wLinkPlayerPartyMon1:: party_struct wLinkPlayerPartyMon1
wLinkPlayerPartyMon2:: party_struct wLinkPlayerPartyMon2
wLinkPlayerPartyMon3:: party_struct wLinkPlayerPartyMon3
wLinkPlayerPartyMon4:: party_struct wLinkPlayerPartyMon4
wLinkPlayerPartyMon5:: party_struct wLinkPlayerPartyMon5
wLinkPlayerPartyMon6:: party_struct wLinkPlayerPartyMon6
wLinkPlayerPartyMonOTNames:: ds PARTY_LENGTH * NAME_LENGTH
wLinkPlayerPartyMonNicks:: ds PARTY_LENGTH * MON_NAME_LENGTH
wLinkPlayerDataEnd::
ENDU

NEXTU ; c700
; mystery gift data
wMysteryGiftPartyTemp:: ; ds PARTY_LENGTH * (1 + 1 + NUM_MOVES)
wMysteryGiftStaging::
wc700:: ds 80

wMysteryGiftTrainerData:: ds (1 + 1 + NUM_MOVES) * PARTY_LENGTH + 2
wMysteryGiftTrainerDataEnd::

	ds 138

wMysteryGiftPartnerData::
wc800:: db
wMysteryGiftPartnerID:: dw
wMysteryGiftPartnerName:: ds NAME_LENGTH
wMysteryGiftPartnerDexCaught:: db
wc80f::
wMysteryGiftPartnerSentDeco:: db
wMysteryGiftPartnerWhichItem:: db
wMysteryGiftPartnerWhichDeco:: db
wMysteryGiftPartnerBackupItem:: db
	ds 1
wMysteryGiftPartnerDataEnd::

	ds 60

wMysteryGiftPlayerData::
	ds 1
wMysteryGiftPlayerID:: dw
wMysteryGiftPlayerName:: ds NAME_LENGTH
wMysteryGiftPlayerDexCaught:: db
wMysteryGiftPlayerSentDeco:: db
wMysteryGiftPlayerWhichItem:: db
wMysteryGiftPlayerWhichDeco:: db
wMysteryGiftPlayerBackupItem:: db
	ds 1
wMysteryGiftPlayerDataEnd::

	ds 144

wc8f4:: ds 5
wc8f9:: ds 7

NEXTU ; c700
; LCD expects wLYOverrides to have an alignment of $100
wLYOverrides:: ds SCREEN_HEIGHT_PX
wLYOverridesEnd:: ds 112

wLYOverridesBackup:: ds SCREEN_HEIGHT_PX
wLYOverridesBackupEnd:: ds 112

UNION ; c900
; blank credits tile buffer
wCreditsBlankFrame2bpp:: ds 4 * 4 tiles
wCreditsBlankFrame2bppEnd::

NEXTU ; c900
; mystery gift data
wc900:: db
wc901:: db
wc902:: db

NEXTU ; c900
; link
	ds 191
wc9bf:: ds 79
wca0e:: ds 5
wca13:: ds 113
wca84:: ds 100
wcae8:: dw
wLinkOTPartyMonTypes:: ds 2 * PARTY_LENGTH ; caea
	ds 84
wcb4a:: ds 84
wcb9e:: ds 130

NEXTU ; c900
; battle
wBattleAnimTileDict:: ds 10

wActiveAnimObjects:: ; c90a
wAnimObject01:: battle_anim_struct wAnimObject01
wAnimObject02:: battle_anim_struct wAnimObject02
wAnimObject03:: battle_anim_struct wAnimObject03
wAnimObject04:: battle_anim_struct wAnimObject04
wAnimObject05:: battle_anim_struct wAnimObject05
wAnimObject06:: battle_anim_struct wAnimObject06
wAnimObject07:: battle_anim_struct wAnimObject07
wAnimObject08:: battle_anim_struct wAnimObject08
wAnimObject09:: battle_anim_struct wAnimObject09
wAnimObject10:: battle_anim_struct wAnimObject10
wActiveAnimObjectsEnd::

wActiveBGEffects:: ; c9fa
wBGEffect1:: battle_bg_effect wBGEffect1
wBGEffect2:: battle_bg_effect wBGEffect2
wBGEffect3:: battle_bg_effect wBGEffect3
wBGEffect4:: battle_bg_effect wBGEffect4
wBGEffect5:: battle_bg_effect wBGEffect5
wActiveBGEffectsEnd::

wLastAnimObjectIndex:: db ; ca0e

wBattleAnimFlags:: db ; ca0f
wBattleAnimAddress:: dw ; ca10
wBattleAnimDelay:: db ; ca12
wBattleAnimParent:: dw ; ca13
wBattleAnimLoops:: db ; ca15
wBattleAnimVar:: db ; ca16
wBattleAnimByte:: db ; ca17
wBattleAnimOAMPointerLo:: db ; ca18

	ds 207

wBattle:: ; cae8
wEnemyMoveStruct:: move_struct wEnemyMoveStruct
wPlayerMoveStruct:: move_struct wPlayerMoveStruct

wEnemyMonNick:: ds MON_NAME_LENGTH ; caf6
wBattleMonNick:: ds MON_NAME_LENGTH ; cb01

wBattleMon:: battle_struct wBattleMon ; cb0c

wcb2c:: ds 1 ; cb2c
wcb2d:: ds 1 ; cb2d
wEnemyTrainerItem1:: db ; cb2e
wEnemyTrainerItem2:: db ; cb2f
wEnemyTrainerBaseReward:: db ; cb30
wcb31:: ds 1 ; cb31
wcb32:: ds 1 ; cb32
wcb33:: ds 1 ; cb33

wOTClassName:: ds TRAINER_CLASS_NAME_LENGTH ; cb34

wCurOTMon:: db ; cb41

wBattleParticipantsNotFainted::
; Bit array.  Bits 0 - 5 correspond to party members 1 - 6.
; Bit set if the mon appears in battle.
; Bit cleared if the mon faints.
; Backed up if the enemy switches.
; All bits cleared if the enemy faints.
	db

wTypeModifier:: ; cb43
; >10: super-effective
;  10: normal
; <10: not very effective
; bit 7: stab
	db

wCriticalHit:: ; cb44
; 0 if not critical
; 1 for a critical hit
; 2 for a OHKO
	db

wAttackMissed:: ; cb45
; nonzero for a miss
	db

wPlayerSubStatus1:: ; cb46
; bit
; 7 in love
; 6 rollout
; 5 endure
; 4 perish song
; 3 identified
; 2 protect
; 1 curse
; 0 nightmare
	db
wPlayerSubStatus2:: ; cb47
; bit
; 7
; 6
; 5
; 4
; 3
; 2
; 1
; 0 curled
	db
wPlayerSubStatus3:: ; cb48
; bit
; 7 confused
; 6 flying
; 5 underground
; 4 charged
; 3 flinched
; 2 in loop
; 1 rampage
; 0 bide
	db
wPlayerSubStatus4:: ; cb49
; bit
; 7 leech seed
; 6 rage
; 5 recharge
; 4 substitute
; 3
; 2 focus energy
; 1 mist
; 0 x accuracy
	db
wPlayerSubStatus5:: ; cb4a
; bit
; 7 can't run
; 6 destiny bond
; 5 lock-on
; 4 encored
; 3 transformed
; 2
; 1
; 0 toxic
	db

wEnemySubStatus1:: ; cb4b
; see wPlayerSubStatus1
	db
wEnemySubStatus2:: ; cb4c
; see wPlayerSubStatus2
	db
wEnemySubStatus3:: ; cb4d
; see wPlayerSubStatus3
	db
wEnemySubStatus4:: ; cb4e
; see wPlayerSubStatus4
	db
wEnemySubStatus5:: ; cb4f
; see wPlayerSubStatus5
	db

wPlayerRolloutCount:: db ; cb50
wPlayerConfuseCount:: db ; cb51
wPlayerToxicCount:: db ; cb52
wPlayerDisableCount:: db ; cb53
wPlayerEncoreCount:: db ; cb54
wPlayerPerishCount:: db ; cb55
wPlayerFuryCutterCount:: db ; cb56
wPlayerProtectCount:: db ; cb57

wEnemyRolloutCount:: db ; cb58
wEnemyConfuseCount:: db ; cb59
wEnemyToxicCount:: db ; cb5a
wEnemyDisableCount:: db ; cb5b
wEnemyEncoreCount:: db ; cb5c
wEnemyPerishCount:: db ; cb5d
wEnemyFuryCutterCount:: db ; cb5e
wEnemyProtectCount:: db ; cb5f

wPlayerDamageTaken:: dw ; cb60
wEnemyDamageTaken:: dw ; cb62

wBattleReward:: ds 3 ; cb64
wBattleAnimParam::
wKickCounter::
wPresentPower::
	db ; cb67
wBattleScriptBuffer:: ds 40 ; cb68

wBattleScriptBufferAddress:: dw ; cb90
wTurnEnded:: db ; cb92

	ds 1

wPlayerStats:: ; cb94
wPlayerAttack:: dw
wPlayerDefense:: dw
wPlayerSpeed:: dw
wPlayerSpAtk:: dw
wPlayerSpDef:: dw
	ds 1

wEnemyStats:: ; cb9f
wEnemyAttack:: dw
wEnemyDefense:: dw
wEnemySpeed:: dw
wEnemySpAtk:: dw
wEnemySpDef:: dw
	ds 1

wPlayerStatLevels:: ; cbaa
; 07 neutral
wPlayerAtkLevel:: db ; cbaa
wPlayerDefLevel:: db ; cbab
wPlayerSpdLevel:: db ; cbac
wPlayerSAtkLevel:: db ; cbad
wPlayerSDefLevel:: db ; cbae
wPlayerAccLevel:: db ; cbaf
wPlayerEvaLevel:: db ; cbb0
	ds 1
wPlayerStatLevelsEnd::

wEnemyStatLevels:: ; cbb2
; 07 neutral
wEnemyAtkLevel:: db ; cbb2
wEnemyDefLevel:: db ; cbb3
wEnemySpdLevel:: db ; cbb4
wEnemySAtkLevel:: db ; cbb5
wEnemySDefLevel:: db ; cbb6
wEnemyAccLevel:: db ; cbb7
wEnemyEvaLevel:: db ; cbb8
	ds 1

wEnemyTurnsTaken:: db ; cbba
wPlayerTurnsTaken:: db ; cbbb
	ds 1

wPlayerSubstituteHP:: db ; cbbd
wEnemySubstituteHP:: db ; cbbe

wUnusedPlayerLockedMove:: db ; cbbf
	ds 1

wCurPlayerMove:: db ; cbc1
wCurEnemyMove:: db ; cbc2

wLinkBattleRNCount:: ; cbc3
; how far through the prng stream
	db

wEnemyItemState:: db ; cbc4
	ds 2
wCurEnemyMoveNum:: db ; cbc7

wEnemyHPAtTimeOfPlayerSwitch:: dw ; cbc8
wPayDayMoney:: ds 3 ; cbca

wSafariMonAngerCount:: db ; cbcd
wSafariMonEating:: db ; cbce
	ds 1
wEnemyBackupDVs:: dw ; cbd0 ; used when enemy is transformed
wAlreadyDisobeyed:: db ; cbd2

wDisabledMove:: db ; cbd3
wEnemyDisabledMove:: db ; cbd4
wWhichMonFaintedFirst:: db ; cbd5

; exists so you can't counter on switch
wLastPlayerCounterMove:: db ; cbd6
wLastEnemyCounterMove:: db ; cbd7

wEnemyMinimized:: db ; cbd8

wAlreadyFailed:: db ; cbd9

wBattleParticipantsIncludingFainted:: db ; cbda
wBattleLowHealthAlarm:: db ; cbdb
wPlayerMinimized:: db ; cbdc
wPlayerScreens:: ; cbdd
; bit
; 7
; 6
; 5
; 4 reflect
; 3 light screen
; 2 safeguard
; 1
; 0 spikes
	db

wEnemyScreens:: ; cbde
; see wPlayerScreens
	db

wPlayerSafeguardCount:: db ; cbdf
wPlayerLightScreenCount:: db ; cbe0
wPlayerReflectCount:: db ; cbe1
	ds 1

wEnemySafeguardCount:: db ; cbe3
wEnemyLightScreenCount:: db ; cbe4
wEnemyReflectCount:: db ; cbe5
	ds 2

wBattleWeather:: ; cbe8
; 00 normal
; 01 rain
; 02 sun
; 03 sandstorm
; 04 rain stopped
; 05 sunliight faded
; 06 sandstorm subsided
	db

wWeatherCount:: ; cbe9
; # turns remaining
	db

wLoweredStat:: db ; cbea
wEffectFailed:: db ; cbeb
wFailedMessage:: db ; cbec
wEnemyGoesFirst:: db ; cbed

wPlayerIsSwitching:: db ; cbee
wEnemyIsSwitching:: db ; cbef

wPlayerUsedMoves:: ; cbf0
; add a move that has been used once by the player
; added in order of use
	ds NUM_MOVES

wEnemyAISwitchScore:: db ; cbf4
wEnemySwitchMonParam:: db ; cbf5
wEnemySwitchMonIndex:: db ; cbf6
wTempLevel:: db ; cbf7
wLastPlayerMon:: db ; cbf8
wLastPlayerMove:: db ; cbf9
wLastEnemyMove:: db ; cbfa

wPlayerFutureSightCount:: db ; cbfb
wEnemyFutureSightCount:: db ; cbfc

wGivingExperienceToExpShareHolders:: db ; cbfd

wBackupEnemyMonBaseStats:: ds 5 ; cbfe
wBackupEnemyMonCatchRate:: db ; cc03
wBackupEnemyMonBaseExp:: db ; cc04

wPlayerFutureSightDamage:: dw ; cc05
wEnemyFutureSightDamage:: dw ; cc07
wPlayerRageCounter:: db ; cc09
wEnemyRageCounter:: db ; cc0a

wBeatUpHitAtLeastOnce:: db ; cc0b

wPlayerTrappingMove:: db ; cc0c
wEnemyTrappingMove:: db ; cc0d
wPlayerWrapCount:: db ; cc0e
wEnemyWrapCount:: db ; cc0f
wPlayerCharging:: db ; cc10
wEnemyCharging:: db ; cc11

wBattleEnded:: db ; cc12

wWildMonMoves:: ds NUM_MOVES ; cc13
wWildMonPP:: ds NUM_MOVES ; cc17

wAmuletCoin:: db ; cc1b

wSomeoneIsRampaging:: db ; cc1c

wPlayerJustGotFrozen:: db ; cc1d
wEnemyJustGotFrozen:: db ; cc1e
wBattleEnd::

	ds 1

ENDU

ENDU ; cc20


SECTION "Video", WRAM0

; wBGMapBuffer
wBGMapBuffer::     ds 40 ; cc20
wBGMapPalBuffer::  ds 40 ; cc48
wBGMapBufferPtrs:: ds 40 ; cc70 ; 20 bg map addresses (16x8 tiles)
wBGMapBufferEnd::

wSGBPredef:: db ; cc98

wPlayerHPPal:: db ; cc99
wEnemyHPPal:: db ; cc9a

wHPPals:: ds PARTY_LENGTH
wCurHPPal:: db

	ds 7

wSGBPals:: ds 48 ; cca9

wAttrmap:: ; ccd9
; 20x18 grid of bg tile attributes for 8x8 tiles
; read horizontally from the top row
;		bit 7: priority
;		bit 6: y flip
;		bit 5: x flip
;		bit 4: pal # (non-cgb)
;		bit 3: vram bank (cgb only)
;		bit 2-0: pal # (cgb only)
	ds SCREEN_WIDTH * SCREEN_HEIGHT
wAttrmapEnd::

wTileAnimBuffer:: ds 1 tiles ; ce41

wOtherPlayerLinkMode:: db ; ce51
wOtherPlayerLinkAction:: ; ce52
wBattleAction:: db
	ds 3
wPlayerLinkAction:: db ; ce56
wce57:: db
	ds 3
wLinkTimeoutFrames:: dw ; ce5b
wce5d:: dw

wMonType:: db ; ce5f

wCurSpecies:: db ; ce60

wNamedObjectTypeBuffer:: db

	ds 1

wJumptableIndex:: db

UNION ; ce64
; unidentified
wce64:: db
wce65:: db
wce66:: db

NEXTU ; ce64
; intro and title data
wIntroSceneFrameCounter:: db
UNION ; ce65
wIntroSceneTimer:: db
NEXTU ; ce65
wTitleScreenTimer:: dw
ENDU

NEXTU ; ce64
; credits data
wCreditsBorderFrame:: db
wCreditsBorderMon:: db
wCreditsLYOverride:: db

NEXTU ; ce64
; pokedex
wPrevDexEntryJumptableIndex:: db
wPrevDexEntryBackup::
wPokedexStatus:: db

NEXTU ; ce64
; pokegear
wPokegearCard:: db
wPokegearMapRegion:: db
wPokegearCE66:: db

NEXTU ; ce64
; pack
wPackJumptableIndex:: db
wCurPocket:: db
wPackUsedItem:: db

NEXTU ; ce64
; trainer card badges
wTrainerCardBadgeFrameCounter:: db
wTrainerCardBadgeTileID:: db
wTrainerCardBadgeAttributes:: db

NEXTU ; ce64
; magnet train
wMagnetTrainOffset:: db
wMagnetTrainPosition:: db
wMagnetTrainWaitCounter:: db

NEXTU ; ce64
; miscellaneous
wFrameCounter::
wMomBankDigitCursorPosition::
wNamingScreenLetterCase::
wHallOfFameMonCounter::
wSlotsDelay::
	db
wPrinterQueueLength:: db
wSlotsCE66::
wPokedexCE66::
	db
ENDU ; ce67

wRequested2bpp::
wRequested2bppSize:: db ; ce67
wRequested2bppSource:: dw ; ce68
wRequested2bppDest:: dw ; ce6a

wRequested1bpp::
wRequested1bppSize:: db ; ce6c
wRequested1bppSource:: dw ; ce6d
wRequested1bppDest:: dw ; ce6f

wSecondsSince:: db ; ce71
wMinutesSince:: db ; ce72
wHoursSince:: db ; ce73
wDaysSince:: db ; ce74

wce75:: ds 1 ; ce75
wce76:: ds 1 ; ce76
wce77:: ds 1 ; ce77
wce78:: ds 1 ; ce78
wce79:: ds 1 ; ce79
wce7a:: ds 1 ; ce7a
wce7b:: ds 1 ; ce7b
wce7c:: ds 1 ; ce7c
wce7d:: ds 1 ; ce7d
wce7e:: ds 1 ; ce7e
wce7f:: ds 1 ; ce7f
wce80:: ds 1 ; ce80

wPlayerBGMapOffsetX:: db ; used in FollowNotExact; unit is pixels
wPlayerBGMapOffsetY:: db ; used in FollowNotExact; unit is pixels

wPlayerStepVectorX:: db ; ce83
wPlayerStepVectorY:: db ; ce84
wPlayerStepFlags:: db ; ce85
wPlayerStepDirection:: db ; ce86

wPlayerNextMovement:: db ; ce87
wPlayerMovement:: db ; ce88
wce89:: ds 1 ; ce89
wce8a:: ds 1 ; ce8a
wMovementObject:: db ; ce8b
wMovementDataBank:: db ; ce8c
wMovementDataAddress:: dw ; ce8d
wce8f:: ds 1 ; ce8f
wce90:: ds 1 ; ce90
wce91:: ds 1 ; ce91
wce92:: ds 1 ; ce92
wMovementByteWasControlSwitch:: db ; ce93
wMovementPointer:: dw ; ce94

	ds 3

wTempObjectCopyMapObjectIndex:: db ; ce99
wTempObjectCopySprite:: db ; ce9a
wTempObjectCopySpriteVTile:: db ; ce9b
wTempObjectCopyPalette:: db ; ce9c
wTempObjectCopyMovement:: db ; ce9d
wTempObjectCopyRange:: db ; ce9e
wTempObjectCopyX:: db ; ce9f
wTempObjectCopyY:: db ; cea0
wTempObjectCopyRadius:: db ; cea1

	ds 1

wTileDown::  db ; cea3
wTileUp::    db ; cea4
wTileLeft::  db ; cea5
wTileRight:: db ; cea6

wTilePermissions:: db ; cea7

wWindowStackPointer:: dw ; cea8
wMenuJoypad:: db ; ceaa
wMenuSelection:: db ; ceab
wMenuSelectionQuantity:: db ; ceac
wWhichIndexSet:: db ; cead
wScrollingMenuCursorPosition:: db ; ceae
wWindowStackSize:: db ; ceaf

	ds 8

; menu header
wMenuHeader:: ; ceb8
wMenuFlags:: db
wMenuBorderTopCoord:: db
wMenuBorderLeftCoord:: db
wMenuBorderBottomCoord:: db
wMenuBorderRightCoord:: db
wMenuDataPointer:: dw
wMenuCursorBuffer:: dw
	ds 7
wMenuHeaderEnd::

wMenuData::
wMenuDataFlags:: db ; cec8

UNION ; cec9
; Vertical Menu/DoNthMenu/SetUpMenu
wMenuDataItems:: db ; cec9
wMenuDataIndicesPointer:: dw ; ceca
wMenuDataDisplayFunctionPointer:: dw ; cecc
wMenuDataPointerTableAddr:: dw ; cece

NEXTU ; cec9
; 2D Menu
wMenuData_2DMenuDimensions:: db ; cec9
wMenuData_2DMenuSpacing:: db ; ceca
wMenuData_2DMenuItemStringsBank:: db ; cecb
wMenuData_2DMenuItemStringsAddr:: dw ; cecc
wMenuData_2DMenuFunctionBank:: db ; cece
wMenuData_2DMenuFunctionAddr:: dw ; cecf

NEXTU ; cec9
; Scrolling Menu
wMenuData_ScrollingMenuHeight:: db ; cec9
wMenuData_ScrollingMenuWidth:: db ; ceca
wMenuData_ScrollingMenuItemFormat:: db ; cecb
wMenuData_ItemsPointerBank:: db ; cecc
wMenuData_ItemsPointerAddr:: dw ; cecd
wMenuData_ScrollingMenuFunction1:: ds 3 ; cecf
wMenuData_ScrollingMenuFunction2:: ds 3 ; ced2
wMenuData_ScrollingMenuFunction3:: ds 3 ; ced5
ENDU ; ced8
wMenuDataEnd::

w2DMenuData::
w2DMenuCursorInitY:: db ; ced8
w2DMenuCursorInitX:: db ; ced9
w2DMenuNumRows:: db ; ceda
w2DMenuNumCols:: db ; cedb
w2DMenuFlags1:: ; cedc
; bit 7: Disable checking of wMenuJoypadFilter
; bit 6: Enable sprite animations
; bit 5: Wrap around vertically
; bit 4: Wrap around horizontally
; bit 3: Set bit 7 in w2DMenuFlags2 and exit the loop if bit 5 is disabled and we tried to go too far down
; bit 2: Set bit 7 in w2DMenuFlags2 and exit the loop if bit 5 is disabled and we tried to go too far up
; bit 1: Set bit 7 in w2DMenuFlags2 and exit the loop if bit 4 is disabled and we tried to go too far left
; bit 0: Set bit 7 in w2DMenuFlags2 and exit the loop if bit 4 is disabled and we tried to go too far right
	db
w2DMenuFlags2:: db ; cedd
w2DMenuCursorOffsets:: db ; cede
wMenuJoypadFilter:: db ; cedf
w2DMenuDataEnd::
wMenuCursorY:: db ; cee0
wMenuCursorX:: db ; cee1
wCursorOffCharacter:: db ; cee2
wCursorCurrentTile:: dw ; cee3

	ds 3

wOverworldDelay:: db ; cee8
wTextDelayFrames:: db ; cee9
wVBlankOccurred:: db ; ceea

wceeb:: db
wDefaultSpawnpoint:: db

UNION ; ceed
; mail temp storage
wTempMail:: mailmsg wTempMail

NEXTU ; ceed
; magnet train
wMagnetTrain:: ; used only for BANK(wMagnetTrain)
wMagnetTrainDirection:: db
wMagnetTrainInitPosition:: db
wMagnetTrainHoldPosition:: db
wMagnetTrainFinalPosition:: db
wMagnetTrainPlayerSpriteInitX:: db

NEXTU ; ceed
; credits
wCreditsPos:: dw
wCreditsTimer:: db

NEXTU ; ceed
; mon buffer
wBufferMonNick:: ds MON_NAME_LENGTH ; ceed
wBufferMonOT:: ds NAME_LENGTH ; cef8
wBufferMon:: party_struct wBufferMon ; cf03
	ds 8

NEXTU ; ceed
; bug-catching contest
wBugContestResults::
	bugcontestwinner wBugContestFirstPlace
	bugcontestwinner wBugContestSecondPlace
	bugcontestwinner wBugContestThirdPlace
wBugContestWinnersEnd::
	bugcontestwinner wBugContestTemp
	ds 4
wBugContestWinnerName:: ds NAME_LENGTH

NEXTU ; ceed
; mart items
wMartItem1BCD:: ds 3
wMartItem2BCD:: ds 3
wMartItem3BCD:: ds 3
wMartItem4BCD:: ds 3
wMartItem5BCD:: ds 3
wMartItem6BCD:: ds 3
wMartItem7BCD:: ds 3
wMartItem8BCD:: ds 3
wMartItem9BCD:: ds 3
wMartItem10BCD:: ds 3

NEXTU ; ceed
; town map data
wTownMapPlayerIconLandmark:: db
UNION
wTownMapCursorLandmark:: db
wTownMapCursorObjectPointer:: dw
NEXTU
wTownMapCursorCoordinates:: dw
ENDU

NEXTU ; ceed
; phone call data
wPhoneScriptBank:: db
wPhoneCaller:: dw

NEXTU ; ceed
; radio data
wCurRadioLine:: db
wNextRadioLine:: db
wRadioTextDelay:: db
wNumRadioLinesPrinted:: db
wOaksPKMNTalkSegmentCounter:: db
	ds 5
wRadioText:: ds 2 * SCREEN_WIDTH
wRadioTextEnd::

NEXTU ; ceed
; lucky number show
wLuckyNumberDigitsBuffer:: ds 5

NEXTU ; ceed
; movement buffer data
wMovementBufferCount:: db
wMovementBufferObject:: db
wUnusedMovementBufferBank:: db
wUnusedMovementBufferPointer:: dw
wMovementBuffer:: ds 55

NEXTU ; ceed
; box printing
wWhichBoxMonToPrint:: db
wFinishedPrintingBox:: db
wAddrOfBoxToPrint:: dw
wBankOfBoxToPrint:: db
wWhichBoxToPrint:: db

NEXTU ; ceed
; trainer HUD data
	ds 1
wPlaceBallsDirection:: db
wTrainerHUDTiles:: ds 4

NEXTU ; ceed
; earthquake data buffer
wEarthquakeMovementDataBuffer:: ds 5

NEXTU ; ceed
; miscellaneous
wTempDayOfWeek::
wKeepSevenBiasChance:: ; used in the slots to handle the favoring of 7 symbol streaks
	db
	ds 2
wStartFlypoint:: db
wEndFlypoint:: db

NEXTU ; ceed
; unidentified
wceed:: db
wceee:: db
wceef:: db

	ds 1
wcef1:: ds 2
wcef3:: ds 2
	ds 2
wcef7:: ds 1
wcef8:: ds 1
	ds 1
wcefa:: ds 1
wcefb:: ds 1
wcefc:: ds 1
wcefd:: ds 1
wcefe:: ds 1
wceff:: ds 2
	ds 1
wcf02:: ds 1
wcf03:: ds 1
wcf04:: ds 1
	ds 19
wcf18:: ds 1
wcf19:: ds 1
wcf1a:: ds 1
wcf1b:: ds 1
wcf1c:: ds 1
wcf1d:: ds 1
wcf1e:: ds 1
wcf1f:: ds 2
wcf21:: ds 2
	ds 6

UNION ; cf29
; trainer data
wSeenTrainerBank:: db
wSeenTrainerDistance:: db
wSeenTrainerDirection:: db
wTempTrainer::
wTempTrainerEventFlag:: dw
wTempTrainerClass:: db
wTempTrainerID:: db
wSeenTextPointer:: dw
wWinTextPointer:: dw
wLossTextPointer:: dw
wScriptAfterPointer:: dw
wRunningTrainerBattleScript:: db
wTempTrainerEnd::

NEXTU ; cf29
; menu items list
wMenuItemsList:: ds 16
wMenuItemsListEnd::

NEXTU ; cf29
; fruit tree data
wCurFruitTree:: db
wCurFruit:: db

NEXTU ; cf29
; item ball data
wItemBallData::
wItemBallItemID:: db
wItemBallQuantity:: db
wItemBallDataEnd::

NEXTU ; cf29
; hidden item data
wHiddenItemData::
wHiddenItemEvent:: dw
wHiddenItemID:: db
wHiddenItemDataEnd::

NEXTU ; cf29
; elevator data
wElevatorData::
wElevatorPointerBank:: db
wElevatorPointer:: dw
wElevatorOriginFloor:: db
wElevatorDataEnd::

NEXTU ; cf29
; coord event data
wCurCoordEvent::
wCurCoordEventSceneID:: db
wCurCoordEventMapY:: db
wCurCoordEventMapX:: db
	ds 1
wCurCoordEventScriptAddr:: dw

NEXTU ; cf29
; BG event data
wCurBGEvent::
wCurBGEventYCoord:: db
wCurBGEventXCoord:: db
wCurBGEventType:: db
wCurBGEventScriptAddr:: dw

NEXTU ; cf29
; mart data
wMartType:: db
wMartPointerBank:: db
wMartPointer:: dw
wMartJumptableIndex:: db
wBargainShopFlags:: db

NEXTU ; cf29
; player movement data
wCurInput::
wFacingTileID:: db
wWalkingIntoNPC:: db
wWalkingIntoLand:: db
wWalkingIntoEdgeWarp:: db
wMovementAnimation:: db
wWalkingDirection:: db
wFacingDirection:: db
wWalkingX:: db
wWalkingY:: db
wWalkingTile:: db
	ds 6
wPlayerTurningDirection:: db

NEXTU ; cf29
; std script buffer
	ds 1
wJumpStdScriptBuffer:: ds 3

NEXTU ; cf29
; phone script data
wCheckedTime:: db
wPhoneListIndex:: db
wNumAvailableCallers:: db
wAvailableCallers:: ds CONTACT_LIST_SIZE

NEXTU ; cf29
; phone caller contact
	ds 1
wCallerContact:: ds PHONE_CONTACT_SIZE

NEXTU ; cf29
; backup menu data
	ds 7
wMenuCursorBufferBackup:: db
wMenuScrollPositionBackup:: db

NEXTU ; cf29
; poison step data
wPoisonStepData::
wPoisonStepFlagSum:: db
wPoisonStepPartyFlags:: ds PARTY_LENGTH
wPoisonStepDataEnd::
ENDU ; cf3a

	ds 1

wBoxAlignment:: db
wUnusedBufferCF3C:: dw
wFXAnimID:: dw
ENDU ; cf40

wPlaceBallsX:: db ; cf40
wPlaceBallsY:: db ; cf41
wTileAnimationTimer:: db ; cf42

; palette backups?
wBGP:: db
wOBP0:: db
wOBP1:: db

wNumHits:: db ; cf46

	ds 1

wMonOrItemNameBuffer:: ds 22 ; cf48
wTMHMMoveNameBackup:: ds MOVE_NAME_LENGTH ; cf5e

wStringBuffer1:: ds 19 ; cf6b
wStringBuffer2:: ds 19 ; cf7e
wStringBuffer3:: ds 19 ; cf91
wStringBuffer4:: ds 19 ; cfa4
wStringBuffer5:: ds 13 ; cfb7

wBattleMenuCursorBuffer:: dw ; cfc4
wCurBattleMon:: db ; cfc6
wCurMoveNum:: db; cfc7
wLastPocket:: db ; cfc8

wPartyMenuCursor:: db ; cfc9
wItemsPocketCursor:: db ; cfca
wKeyItemsPocketCursor:: db ; cfcb
wBallsPocketCursor:: db ; cfcc
wTMHMPocketCursor:: db ; cfcd

	ds 1

wItemsPocketScrollPosition:: db ; cfcf
wKeyItemsPocketScrollPosition:: db; cfd0
wBallsPocketScrollPosition:: db ; cfd1
wTMHMPocketScrollPosition:: db ; cfd2

wSwitchMon::
wSwitchItem::
wMoveSwapBuffer::
wcfd3::
	db

wMenuScrollPosition:: ds 4

wQueuedScriptBank:: db
wQueuedScriptAddr:: dw

wPredefID:: db ; cfdb
wPredefTemp:: dw ; cfdc
wPredefAddress:: dw ; cfde
wFarCallBCBuffer:: dw ; cfe0
	ds 1

wNumMoves:: db

wFieldMoveSucceeded::
wItemEffectSucceeded::
wBattlePlayerAction::
; 0 - use move
; 1 - use item
; 2 - switch
wSolvedUnownPuzzle::
	db ; cfe4

wVramState:: ; cfe5
; bit 0: overworld sprite updating on/off
; bit 6: something to do with text
; bit 7: on when surf initiates
;        flickers when climbing waterfall
	db

	ds 3

wBattleResult:: ; cfe9
; WIN, LOSE, or DRAW
; bit 7: box full
	db
wcfea:: ds 1 ; cfea
wUsingItemWithSelect:: db ; cfeb

UNION ; cfec
; mart data
wCurMart:: ds 16
wCurMartEnd::

NEXTU ; cfec
; elevator data
wCurElevator:: db
wCurElevatorFloors:: db

NEXTU ; cfec
; mailbox data
wCurMessageScrollPosition:: db
wCurMessageIndex:: db
wMailboxCount:: db
wMailboxItems:: ds MAILBOX_CAPACITY
wMailboxEnd::
ENDU ; cffc

wListPointer:: dw ; cffc
wUnusedCFFE:: dw ; cffe


SECTION "WRAM 1", WRAMX

wItemAttributesPtr:: dw ; d000

wCurItem:: db ; d002
wCurItemQuantity:: ; d003
wMartItemID::
	db

wCurPartySpecies:: db ; d004

wCurPartyMon:: ; d005
; contains which monster in a party
; is being dealt with at the moment
; 0-5
	db

wd006:: ds 1 ; d006

wWhichHPBar:: ; d007
; 0: Enemy
; 1: Player
; 2: Party Menu
	db

wPokemonWithdrawDepositParameter:: ; d008
; 0: Take from PC
; 1: Put into PC
; 2: Take from Day-Care
; 3: Put into Day-Care
	db

wItemQuantityChangeBuffer:: db ; d009
wItemQuantityBuffer:: db ; d00a

wTempMon:: party_struct wTempMon ; d00b

wSpriteFlags:: db ; d03b

wHandlePlayerStep:: db ; d03c

	ds 1

wPartyMenuActionText:: db ; d03e

wItemAttributeParamBuffer:: db ; d03f

wCurPartyLevel:: db ; d040
wScrollingMenuListSize:: db ; d041

wLinkMode:: db ; d042
; 0 not in link battle
; 1 link battle

; used when following a map warp
wNextWarp:: db ; d043
wNextMapGroup:: db ; d044
wNextMapNumber:: db ; d045
wPrevWarp:: db ; d046
wPrevMapGroup:: db ; d047
wPrevMapNumber:: db ; d048

wd049:: ds 1 ; d049
wd04a:: ds 1 ; d04a
wd04b:: ds 1 ; d04b
wd04c:: ds 1 ; d04c
wd04d:: ds 1 ; d04d
wd04e:: ds 1 ; d04e
wd04f:: ds 1 ; d04f
wd050:: ds 1 ; d050
wd051:: ds 1 ; d051
wd052:: ds 1 ; d052
wd053:: ds 1 ; d053
wd054:: ds 1 ; d054
wd055:: ds 1 ; d055
wd056:: ds 1 ; d056
wd057:: ds 1 ; d057
wd058:: ds 1 ; d058
wd059:: ds 1 ; d059
wUnusedD05A:: db

wBGMapAnchor:: dw ; d05b

wUsedSprites:: ds SPRITE_GFX_LIST_CAPACITY * 2
wUsedSpritesEnd::
	ds 8

wOverworldMapAnchor:: dw ; d07d
wMetatileStandingY:: db ; d07f
wMetatileStandingX:: db ; d080

wMapPartial::
wMapAttributesBank:: db ; d081
wMapTileset:: db ; d082
wEnvironment:: db ; d083
wMapAttributesPointer:: dw ; d084
wMapPartialEnd::

wMapAttributes:: ; d086
wMapBorderBlock:: db ; d086
; width/height are in blocks (2x2 walkable tiles, 4x4 graphics tiles)
wMapHeight:: db ; d087
wMapWidth:: db ; d088
wMapBlocksBank:: db; d089
wMapBlocksPointer:: dw ; d08a
wMapScriptsBank:: db ; d08c
wMapScriptsPointer:: dw ; d08d
wMapEventsPointer:: dw ; d08f
; bit set
wMapConnections:: db ; d091
wMapAttributesEnd::

wNorthMapConnection:: map_connection_struct wNorth ; d092
wSouthMapConnection:: map_connection_struct wSouth ; d09e
wWestMapConnection::  map_connection_struct wWest ; d0aa
wEastMapConnection::  map_connection_struct wEast ; d0b6

wTileset::
wTilesetBank:: db ; d0c2
wTilesetAddress:: dw ; d0c3
wTilesetBlocksBank:: db ; d0c5
wTilesetBlocksAddress:: dw ; d0c6
wTilesetCollisionBank:: db ; d0c8
wTilesetCollisionAddress:: dw ; d0c9
wTilesetAnim:: dw ; bank 3f ; d0cb
	ds 2 ; unused ; d0cd
wTilesetPalettes:: dw ; bank 3f ; d0cf
wTilesetEnd::

wEvolvableFlags:: flag_array PARTY_LENGTH ; d0d1

wForceEvolution:: db ; d0d2

UNION ; d0d3
; general-purpose buffers
wBuffer1:: db ; d0d3
wBuffer2:: db ; d0d4
wBuffer3:: db ; d0d5
wBuffer4:: db ; d0d6
wBuffer5:: db ; d0d7
wBuffer6:: db ; d0d8

NEXTU ; d0d3
; HP bar animations
wCurHPAnimMaxHP::   dw ; d0d3
wCurHPAnimOldHP::   dw ; d0d5
wCurHPAnimNewHP::   dw ; d0d7
wCurHPAnimPal::     db ; d0d9
wCurHPBarPixels::   db ; d0da
wNewHPBarPixels::   db ; d0db
wCurHPAnimDeltaHP:: dw ; d0dc
wCurHPAnimLowHP::   db ; d0de
wCurHPAnimHighHP::  db ; d0df

NEXTU ; d0d3
; evolution data
wEvolutionOldSpecies:: db ; d0d3
wEvolutionNewSpecies:: db ; d0d4
wEvolutionPicOffset:: db ; d0d5
wEvolutionCanceled:: db ; d0d6

NEXTU

wd0d3:: ds 1
wd0d4:: ds 1
wd0d5:: ds 1
wd0d6:: ds 1
wd0d7:: ds 1
wd0d8:: ds 1
wd0d9:: ds 1
wd0da:: ds 1
wd0db:: ds 1
wd0dc:: ds 1

NEXTU ; d0d3
; miscellaneous
wMagikarpLength:: dw
wSelectedDecoration:: db
wOtherDecoration::    db
	ds 3
wCurEnemyItem:: db
ENDU ; d0e0

	ds 3

wLinkBattleRNs:: ds 10 ; d0e3

wTempEnemyMonSpecies:: db ; d0ed
wTempBattleMonSpecies:: db ; d0ee

wEnemyMon:: battle_struct wEnemyMon ; d0ef
wEnemyMonBaseStats:: ds 5 ; d10f
wEnemyMonCatchRate:: db ; d114
wEnemyMonBaseExp::   db ; d115
wEnemyMonEnd::

wBattleMode:: ; d116
; 0: overworld
; 1: wild battle
; 2: trainer battle
	db

wTempWildMonSpecies:: db

wOtherTrainerClass:: ; d118
; class (Youngster, Bug Catcher, etc.) of opposing trainer
; 0 if opponent is a wild Pokémon, not a trainer
	db

; BATTLETYPE_* values
wBattleType:: db ; d119
wd11a:: ds 1 ; d11a

wOtherTrainerID:: ; d11b
; which trainer of the class that you're fighting
; (Joey, Mikey, Albert, etc.)
	db

wForcedSwitch:: db

wTrainerClass:: db ; d11d

wUnownLetter:: db ; d11e

wMoveSelectionMenuType:: db ; d11f

; corresponds to the data/pokemon/base_stats/*.asm contents
wCurBaseData:: ; d120
wBaseDexNo:: db ; d120
wBaseStats:: ; d121
wBaseHP:: db ; d121
wBaseAttack:: db ; d122
wBaseDefense:: db ; d123
wBaseSpeed:: db ; d124
wBaseSpecialAttack:: db ; d125
wBaseSpecialDefense:: db ; d126
wBaseType:: ; d127
wBaseType1:: db ; d127
wBaseType2:: db ; d128
wBaseCatchRate:: db ; d129
wBaseExp:: db ; d12a
wBaseItems:: ; d12b
wBaseItem1:: db ; d12b
wBaseItem2:: db ; d12c
wBaseGender:: db ; d12d
wBaseUnknown1:: db ; d12e
wBaseEggSteps:: db ; d12f
wBaseUnknown2:: db ; d130
wBasePicSize:: db ; d131
wBaseUnusedFrontpic:: dw ; d132
wBaseUnusedBackpic:: dw ; d134
wBaseGrowthRate:: db ; d136
wBaseEggGroups:: db ; d137
wBaseTMHM:: flag_array NUM_TMS + NUM_HMS ; d138
wCurBaseDataEnd::

wd140:: ds 1 ; d140
wCurDamage:: dw ; d141
wd143:: ds 1 ; d143
wd144:: ds 1 ; d144
wMornEncounterRate::  db ; d145
wDayEncounterRate::   db ; d146
wNiteEncounterRate::  db ; d147
wWaterEncounterRate:: db ; d148
wListMoves_MoveIndicesBuffer:: ds NUM_MOVES
wPutativeTMHMMove:: db ; d14d
wInitListType:: db ; d14e
wWildMon:: db ; d14f
wBattleHasJustStarted:: db ; d150

; d151 has many different short-term uses
wNamedObjectIndexBuffer::
wDeciramBuffer::
wTempByteValue::
wNumSetBits::
wTypeMatchup::
wCurType::
wTempSpecies::
wTempIconSpecies::
wTempTMHM::
wTempPP::
wNextBoxOrPartyIndex::
wChosenCableClubRoom::
wBreedingCompatibility::
wMoveGrammar::
wApplyStatLevelMultipliersToEnemy::
wUsePPUp::
wd151::
	db ; d151

wFailedToFlee:: db ; d152
wNumFleeAttempts:: db ; d153
wMonTriedToEvolve:: db ; d154

wROMBankBackup:: db ; d155
wFarByte::
wTempBank:: db ; d156

wTimeOfDay:: db ; d157
wd158:: ds 1 ; d158

wMapStatus:: db ; d159
wMapEventStatus:: db ; d15a

wScriptFlags:: ; d15b
; bit 3: priority jump
	db
wScriptFlags2:: ; d15c
	db
wScriptFlags3:: ; d15d
; bit 0: count steps
; bit 1: coord events
; bit 2: warps and connections
; bit 4: wild encounters
; bit 5: unknown
	db

wScriptMode:: db ; d15e
wScriptRunning:: db ; d15f
wScriptBank:: db ; d160
wScriptPos:: dw ; d161

wScriptStackSize:: db
wScriptStack:: ds 3 * 5
wScriptVar:: db ; d173
wScriptDelay:: db ; d174

wPriorityScriptBank::
wScriptTextBank::
	db ; d175
wPriorityScriptAddr::
wScriptTextAddr::
	dw ; d176
wd178:: ds 1 ; d178
wWildEncounterCooldown:: db ; d179
wXYComparePointer:: dw ; d17a
wd17c:: ds 1 ; d17c
wd17d:: ds 1 ; d17d
wd17e:: ds 1 ; d17e
wd17f:: ds 1 ; d17f
wBattleScriptFlags:: dw ; d180
wPlayerSpriteSetupFlags:: ; d182
	db
wMapReentryScriptQueueFlag:: db ; d183
wMapReentryScriptBank:: db
wMapReentryScriptAddress:: dw ; d185
wd187:: ds 1 ; d187
wd188:: ds 1 ; d188
wd189:: ds 1 ; d189
wd18a:: ds 1 ; d18a
wTimeCyclesSinceLastCall:: db ; d18b
wReceiveCallDelay_MinsRemaining:: db ; d18c
wReceiveCallDelay_StartTime:: ds 3 ; d18d
wd190:: ds 1 ; d190
wd191:: ds 1 ; d191
wd192:: ds 1 ; d192
wBugContestMinsRemaining:: db ; d193
wBugContestSecsRemaining:: db ; d194
wd195:: ds 1 ; d195
wd196:: ds 1 ; d196
wMapStatusEnd::
wd197:: ds 1 ; d197
wd198:: ds 1 ; d198

wOptions:: ; d199
; bit 0-2: number of frames to delay when printing text
;   fast 1; mid 3; slow 5
; bit 3: ?
; bit 4: no text delay
; bit 5: stereo off/on
; bit 6: battle style shift/set
; bit 7: battle scene off/on
	db

wSaveFileExists:: db ; d19a
wTextboxFrame:: ; d19b
; bits 0-2: textbox frame 0-7
	db

wTextboxFlags:: ; d19c
; bit 0: 1-frame text delay
; bit 1: when unset, no text delay
	db
wGBPrinterBrightness:: ; d19d
; bit 0-6: brightness
;   lightest: $00
;   lighter:  $20
;   normal:   $40 (default)
;   darker:   $60
;   darkest:  $7F
	db
wOptions2:: ; d19e
; bit 0: menu account off/on
	db

	ds 2

wOptionsEnd::


SECTION "Game Data", WRAMX

wGameData::
wPlayerData::
wPlayerData1::
wPlayerID:: dw ; d1a1

wPlayerName:: ds NAME_LENGTH ; d1a3
wMomsName:: ds NAME_LENGTH ; d1ae
wRivalName:: ds NAME_LENGTH ; d1b9
wRedsName:: ds NAME_LENGTH ; d1c4
wGreensName:: ds NAME_LENGTH ; d1cf

wSavedAtLeastOnce:: db ; d1da
wSpawnAfterChampion:: db ; d1db
wStartDay:: db ; d1dc
wStartHour:: db ; d1dd
wStartMinute:: db ; d1de
wStartSecond:: db ; d1df
wRTC:: ds 4 ; d1e0

wDSTBackupDay:: db ; d1e4
wDSTBackupHours:: db ; d1e5
wDSTBackupMinutes:: db ; d1e6
wDSTBackupSeconds:: db ; d1e7

wDST:: ; d1e8
; bit 7: dst
	db

	ds 1

wGameTimeCap::     db ; d1ea
wGameTimeHours::   dw ; d1eb
wGameTimeMinutes:: db ; d1ed
wGameTimeSeconds:: db ; d1ee
wGameTimeFrames::  db ; d1ef

	ds 2

wCurDay:: db ; d1f2

	ds 1

wObjectFollow_Leader:: db ; d1f4
wObjectFollow_Follower:: db ; d1f5
wCenteredObject:: db ; d1f6
wFollowerMovementQueueLength:: db ; d1f7
wFollowMovementQueue:: ds 5 ; d1f8

wObjectStructs:: ; d1fd
wPlayerStruct::   object_struct wPlayer
wObject1Struct::  object_struct wObject1
wObject2Struct::  object_struct wObject2
wObject3Struct::  object_struct wObject3
wObject4Struct::  object_struct wObject4
wObject5Struct::  object_struct wObject5
wObject6Struct::  object_struct wObject6
wObject7Struct::  object_struct wObject7
wObject8Struct::  object_struct wObject8
wObject9Struct::  object_struct wObject9
wObject10Struct:: object_struct wObject10
UNION
	ds 18
wPlayerData1End::
wPlayerData2::
NEXTU
wObject11Struct:: object_struct wObject11
wObject12Struct:: object_struct wObject12
wObjectStructsEnd::
ENDU

wCmdQueue:: ds CMDQUEUE_CAPACITY * CMDQUEUE_ENTRY_SIZE ; d405
; d41d

	ds 40

wMapObjects:: ; d445
wPlayerObject:: map_object wPlayer  ; d445
wMap1Object::   map_object wMap1    ; d455
wMap2Object::   map_object wMap2    ; d465
wMap3Object::   map_object wMap3    ; d475
wMap4Object::   map_object wMap4    ; d485
wMap5Object::   map_object wMap5    ; d495
wMap6Object::   map_object wMap6    ; d4a5
wMap7Object::   map_object wMap7    ; d4b5
wMap8Object::   map_object wMap8    ; d4c5
wMap9Object::   map_object wMap9    ; d4d5
wMap10Object::  map_object wMap10   ; d4e5
wMap11Object::  map_object wMap11   ; d4f5
wMap12Object::  map_object wMap12   ; d505
wMap13Object::  map_object wMap13   ; d515
wMap14Object::  map_object wMap14   ; d525
wMap15Object::  map_object wMap15   ; d535
wMapObjectsEnd:: ; d545

wObjectMasks:: ds NUM_OBJECTS ; d545

wVariableSprites:: ds $100 - SPRITE_VARS ; d555

wEnteredMapFromContinue:: db ; d565
	ds 2
wTimeOfDayPal:: db
	ds 4
wTimeOfDayPalFlags:: db ; d56d
wTimeOfDayPalset:: db ; d56e
wCurTimeOfDay:: db ; d56f

	ds 1

wPlayerData2End::
wPlayerData3::
wStatusFlags::
	db ; d571
wStatusFlags2:: db ; d572

wMoney:: ds 3 ; d573
wMomsMoney:: ds 3 ; d576

wMomSavingMoney:: ; d579
; bit 0: saving some money
; bit 1: saving half money (unused)
; bit 2: saving all money (unused)
; bit 7: active
	db

wCoins:: dw ; d57a

wBadges::
wJohtoBadges:: flag_array NUM_JOHTO_BADGES ; d57c
wKantoBadges:: flag_array NUM_KANTO_BADGES ; d57d

wTMsHMs:: ds NUM_TMS + NUM_HMS ; d57e
wTMsHMsEnd::

wNumItems:: db ; d5b7
wItems:: ds MAX_ITEMS * 2 + 1 ; d5b8
wItemsEnd::

wNumKeyItems:: db ; d5e1
wKeyItems:: ds MAX_KEY_ITEMS + 1 ; d5e2
wKeyItemsEnd::

wNumBalls:: db ; d5fc
wBalls:: ds MAX_BALLS * 2 + 1 ; d5fd
wBallsEnd::

wNumPCItems:: db
wPCItems:: ds MAX_PC_ITEMS * 2 + 1 ; d616
wPCItemsEnd::

wPokegearFlags::
; bit 0: map
; bit 1: radio
; bit 2: phone
; bit 3: expn
; bit 7: on/off
	db
wRadioTuningKnob:: db ; d67d
wLastDexMode:: db ; d67e
	ds 1
wWhichRegisteredItem:: db ; d680
wRegisteredItem:: db ; d681

wPlayerState:: db ; d682

wHallOfFameCount:: dw
wTradeFlags:: flag_array NUM_NPC_TRADES ; d685
wd686:: ds 1 ; d686
wd687:: ds 1 ; d687
wd688:: ds 1 ; d688
wd689:: ds 1 ; d689
wd68a:: ds 1 ; d68a
wd68b:: ds 1 ; d68b
wd68c:: ds 1 ; d68c
wd68d:: ds 1 ; d68d
wd68e:: ds 1 ; d68e
wd68f:: ds 1 ; d68f
wd690:: ds 1 ; d690
wd691:: ds 1 ; d691
wd692:: ds 1 ; d692
wd693:: ds 1 ; d693
wd694:: ds 1 ; d694
wd695:: ds 1 ; d695
wd696:: ds 1 ; d696
wd697:: ds 1 ; d697
wd698:: ds 1 ; d698
wd699:: ds 1 ; d699
wd69a:: ds 1 ; d69a
wd69b:: ds 1 ; d69b
wd69c:: ds 1 ; d69c
wd69d:: ds 1 ; d69d
wd69e:: ds 1 ; d69e
wd69f:: ds 1 ; d69f
wd6a0:: ds 1 ; d6a0
wd6a1:: ds 1 ; d6a1
wd6a2:: ds 1 ; d6a2
wd6a3:: ds 1 ; d6a3
wd6a4:: ds 1 ; d6a4
wd6a5:: ds 1 ; d6a5
wd6a6:: ds 1 ; d6a6
wMooMooBerries:: db ; d6a7
wUndergroundSwitchPositions:: db ; d6a8
wd6a9:: ds 1 ; d6a9
wd6aa:: ds 1 ; d6aa
wd6ab:: ds 1 ; d6ab
wd6ac:: ds 1 ; d6ac
wd6ad:: ds 1 ; d6ad
wd6ae:: ds 1 ; d6ae
wd6af:: ds 1 ; d6af
wd6b0:: ds 1 ; d6b0
wd6b1:: ds 1 ; d6b1
wd6b2:: ds 1 ; d6b2
wd6b3:: ds 1 ; d6b3
wd6b4:: ds 1 ; d6b4
wd6b5:: ds 1 ; d6b5
wd6b6:: ds 1 ; d6b6

wPokecenter2FSceneID::                            db ; d6b7
wTradeCenterSceneID::                             db ; d6b8
wColosseumSceneID::                               db ; d6b9
wTimeCapsuleSceneID::                             db ; d6ba
wPowerPlantSceneID::                              db ; d6bb
wCeruleanGymSceneID::                             db ; d6bc
wRoute25SceneID::                                 db ; d6bd
wTrainerHouseB1FSceneID::                         db ; d6be
wVictoryRoadGateSceneID::                         db ; d6bf
wSaffronMagnetTrainStationSceneID::               db ; d6c0
wRoute16GateSceneID::                             db ; d6c1
wRoute17Route18GateSceneID::                      db ; d6c2
wIndigoPlateauPokecenter1FSceneID::               db ; d6c3
wWillsRoomSceneID::                               db ; d6c4
wKogasRoomSceneID::                               db ; d6c5
wBrunosRoomSceneID::                              db ; d6c6
wKarensRoomSceneID::                              db ; d6c7
wLancesRoomSceneID::                              db ; d6c8
wHallOfFameSceneID::                              db ; d6c9
wRoute27SceneID::                                 db ; d6ca
wNewBarkTownSceneID::                             db ; d6cb
wElmsLabSceneID::                                 db ; d6cc
wPlayersHouse1FSceneID::                          db ; d6cd
wRoute29SceneID::                                 db ; d6ce
wCherrygroveCitySceneID::                         db ; d6cf
wMrPokemonsHouseSceneID::                         db ; d6d0
wRoute32SceneID::                                 db ; d6d1
wRoute35NationalParkGateSceneID::                 db ; d6d2
wRoute36NationalParkGateSceneID::                 db ; d6d3
wAzaleaTownSceneID::                              db ; d6d4
wGoldenrodGymSceneID::                            db ; d6d5
wGoldenrodMagnetTrainStationSceneID::             db ; d6d6
wOlivineCitySceneID::                             db ; d6d7
wRoute34SceneID::                                 db ; d6d8
wEcruteakTinTowerEntranceSceneID::                db ; d6d9
wEcruteakPokecenter1FSceneID::                    db ; d6da
wMahoganyTownSceneID::                            db ; d6db
wRoute43GateSceneID::                             db ; d6dc
wMountMoonSceneID::                               db ; d6dd
wSproutTower3FSceneID::                           db ; d6de
wBurnedTower1FSceneID::                           db ; d6df
wBurnedTowerB1FSceneID::                          db ; d6e0
wRadioTower5FSceneID::                            db ; d6e1
wRuinsOfAlphOutsideSceneID::                      db ; d6e2
wRuinsOfAlphResearchCenterSceneID::               db ; d6e3
wRuinsOfAlphInnerChamberSceneID::                 db ; d6e4
wMahoganyMart1FSceneID::                          db ; d6e5
wTeamRocketBaseB1FSceneID::                       db ; d6e6
wTeamRocketBaseB2FSceneID::                       db ; d6e7
wTeamRocketBaseB3FSceneID::                       db ; d6e8
wGoldenrodUndergroundSwitchRoomEntrancesSceneID:: db ; d6e9
wSilverCaveRoom3SceneID::                         db ; d6ea
wVictoryRoadSceneID::                             db ; d6eb
wDragonsDenB1FSceneID::                           db ; d6ec
wOlivinePortSceneID::                             db ; d6ed
wVermilionPortSceneID::                           db ; d6ee
wFastShip1FSceneID::                              db ; d6ef
wFastShipB1FSceneID::                             db ; d6f0
wMountMoonSquareSceneID::                         db ; d6f1

wd6f2:: ds 1 ; d6f2
wd6f3:: ds 1 ; d6f3
wd6f4:: ds 1 ; d6f4
wd6f5:: ds 1 ; d6f5
wd6f6:: ds 1 ; d6f6
wd6f7:: ds 1 ; d6f7
wd6f8:: ds 1 ; d6f8
wd6f9:: ds 1 ; d6f9
wd6fa:: ds 1 ; d6fa
wd6fb:: ds 1 ; d6fb
wd6fc:: ds 1 ; d6fc
wd6fd:: ds 1 ; d6fd
wd6fe:: ds 1 ; d6fe
wd6ff:: ds 1 ; d6ff
wd700:: ds 1 ; d700
wd701:: ds 1 ; d701
wd702:: ds 1 ; d702
wd703:: ds 1 ; d703
wd704:: ds 1 ; d704
wd705:: ds 1 ; d705
wd706:: ds 1 ; d706
wd707:: ds 1 ; d707
wd708:: ds 1 ; d708
wd709:: ds 1 ; d709
wd70a:: ds 1 ; d70a
wd70b:: ds 1 ; d70b
wd70c:: ds 1 ; d70c
wd70d:: ds 1 ; d70d
wd70e:: ds 1 ; d70e
wd70f:: ds 1 ; d70f
wd710:: ds 1 ; d710
wd711:: ds 1 ; d711
wd712:: ds 1 ; d712
wd713:: ds 1 ; d713
wd714:: ds 1 ; d714
wd715:: ds 1 ; d715
wd716:: ds 1 ; d716
wd717:: ds 1 ; d717
wd718:: ds 1 ; d718
wd719:: ds 1 ; d719
wd71a:: ds 1 ; d71a
wd71b:: ds 1 ; d71b
wd71c:: ds 1 ; d71c
wd71d:: ds 1 ; d71d
wd71e:: ds 1 ; d71e
wd71f:: ds 1 ; d71f
wd720:: ds 1 ; d720
wd721:: ds 1 ; d721
wd722:: ds 1 ; d722
wd723:: ds 1 ; d723
wd724:: ds 1 ; d724
wd725:: ds 1 ; d725
wd726:: ds 1 ; d726
wd727:: ds 1 ; d727
wd728:: ds 1 ; d728
wd729:: ds 1 ; d729
wd72a:: ds 1 ; d72a
wd72b:: ds 1 ; d72b
wd72c:: ds 1 ; d72c
wd72d:: ds 1 ; d72d
wd72e:: ds 1 ; d72e
wd72f:: ds 1 ; d72f
wd730:: ds 1 ; d730
wd731:: ds 1 ; d731
wd732:: ds 1 ; d732
wd733:: ds 1 ; d733
wd734:: ds 1 ; d734
wd735:: ds 1 ; d735
wd736:: ds 1 ; d736
wd737:: ds 1 ; d737
wd738:: ds 1 ; d738
wd739:: ds 1 ; d739
wd73a:: ds 1 ; d73a
wd73b:: ds 1 ; d73b
wd73c:: ds 1 ; d73c
wd73d:: ds 1 ; d73d
wd73e:: ds 1 ; d73e
wd73f:: ds 1 ; d73f
wd740:: ds 1 ; d740
wd741:: ds 1 ; d741
wd742:: ds 1 ; d742
wd743:: ds 1 ; d743
wd744:: ds 1 ; d744
wd745:: ds 1 ; d745
wd746:: ds 1 ; d746
wd747:: ds 1 ; d747
wd748:: ds 1 ; d748
wd749:: ds 1 ; d749
wd74a:: ds 1 ; d74a
wd74b:: ds 1 ; d74b
wd74c:: ds 1 ; d74c
wd74d:: ds 1 ; d74d
wd74e:: ds 1 ; d74e
wd74f:: ds 1 ; d74f
wd750:: ds 1 ; d750
wd751:: ds 1 ; d751
wd752:: ds 1 ; d752
wd753:: ds 1 ; d753
wd754:: ds 1 ; d754
wd755:: ds 1 ; d755
wd756:: ds 1 ; d756
wd757:: ds 1 ; d757
wd758:: ds 1 ; d758
wd759:: ds 1 ; d759
wd75a:: ds 1 ; d75a
wd75b:: ds 1 ; d75b
wd75c:: ds 1 ; d75c
wd75d:: ds 1 ; d75d
wd75e:: ds 1 ; d75e
wd75f:: ds 1 ; d75f
wd760:: ds 1 ; d760
wd761:: ds 1 ; d761
wd762:: ds 1 ; d762
wd763:: ds 1 ; d763
wd764:: ds 1 ; d764
wd765:: ds 1 ; d765
wd766:: ds 1 ; d766
wd767:: ds 1 ; d767
wd768:: ds 1 ; d768
wd769:: ds 1 ; d769
wd76a:: ds 1 ; d76a
wd76b:: ds 1 ; d76b
wd76c:: ds 1 ; d76c
wd76d:: ds 1 ; d76d
wd76e:: ds 1 ; d76e
wd76f:: ds 1 ; d76f
wd770:: ds 1 ; d770
wd771:: ds 1 ; d771
wd772:: ds 1 ; d772
wd773:: ds 1 ; d773
wd774:: ds 1 ; d774
wd775:: ds 1 ; d775
wd776:: ds 1 ; d776
wd777:: ds 1 ; d777
wd778:: ds 1 ; d778
wd779:: ds 1 ; d779
wd77a:: ds 1 ; d77a
wd77b:: ds 1 ; d77b
wd77c:: ds 1 ; d77c
wd77d:: ds 1 ; d77d
wd77e:: ds 1 ; d77e
wd77f:: ds 1 ; d77f
wd780:: ds 1 ; d780
wd781:: ds 1 ; d781
wd782:: ds 1 ; d782
wd783:: ds 1 ; d783
wd784:: ds 1 ; d784
wd785:: ds 1 ; d785
wd786:: ds 1 ; d786
wd787:: ds 1 ; d787
wd788:: ds 1 ; d788
wd789:: ds 1 ; d789
wd78a:: ds 1 ; d78a
wd78b:: ds 1 ; d78b
wd78c:: ds 1 ; d78c
wd78d:: ds 1 ; d78d
wd78e:: ds 1 ; d78e
wd78f:: ds 1 ; d78f
wd790:: ds 1 ; d790
wd791:: ds 1 ; d791
wd792:: ds 1 ; d792
wd793:: ds 1 ; d793
wd794:: ds 1 ; d794
wd795:: ds 1 ; d795
wd796:: ds 1 ; d796
wd797:: ds 1 ; d797
wd798:: ds 1 ; d798
wd799:: ds 1 ; d799
wd79a:: ds 1 ; d79a
wd79b:: ds 1 ; d79b
wd79c:: ds 1 ; d79c
wd79d:: ds 1 ; d79d
wd79e:: ds 1 ; d79e
wd79f:: ds 1 ; d79f
wd7a0:: ds 1 ; d7a0
wd7a1:: ds 1 ; d7a1
wd7a2:: ds 1 ; d7a2
wd7a3:: ds 1 ; d7a3
wd7a4:: ds 1 ; d7a4
wd7a5:: ds 1 ; d7a5
wd7a6:: ds 1 ; d7a6
wd7a7:: ds 1 ; d7a7
wd7a8:: ds 1 ; d7a8
wd7a9:: ds 1 ; d7a9
wd7aa:: ds 1 ; d7aa
wd7ab:: ds 1 ; d7ab
wd7ac:: ds 1 ; d7ac
wd7ad:: ds 1 ; d7ad
wd7ae:: ds 1 ; d7ae
wd7af:: ds 1 ; d7af
wd7b0:: ds 1 ; d7b0
wd7b1:: ds 1 ; d7b1
wd7b2:: ds 1 ; d7b2
wd7b3:: ds 1 ; d7b3
wd7b4:: ds 1 ; d7b4
wd7b5:: ds 1 ; d7b5
wd7b6:: ds 1 ; d7b6

wEventFlags:: flag_array NUM_EVENTS ; d7b7

wd8b1:: ds 1 ; d8b1
wd8b2:: ds 1 ; d8b2
wd8b3:: ds 1 ; d8b3
wd8b4:: ds 1 ; d8b4
wd8b5:: ds 1 ; d8b5
wd8b6:: ds 1 ; d8b6
wd8b7:: ds 1 ; d8b7
wGameTimerPause:: db ; d8b8
wd8b9:: ds 1 ; d8b9
wd8ba:: ; d8ba
; bits 4, 6, or 7 can be used to disable joypad input
; bit 4
; bit 6: mon fainted?
; bit 7: SGB flag?
	db
wd8bb:: ds 1 ; d8bb
wCurBox:: db ; d8bc

	ds 2

; 8 chars + $50
wBoxNames:: ds BOX_NAME_LENGTH * NUM_BOXES ; d8bf

wd93d:: ds 1 ; d93d
wd93e:: ds 1 ; d93e
wBikeFlags:: db ; d93f
wd940:: ds 1 ; d940

wCurMapSceneScriptPointer:: dw ; d941

wCurCaller:: dw ; d943
wCurMapWarpCount:: db ; d945
wCurMapWarpsPointer:: dw ; d946
wCurMapCoordEventCount:: db ; d948
wCurMapCoordEventsPointer:: dw ; d949
wCurMapBGEventCount:: db ; d94b
wCurMapBGEventsPointer:: dw ; d94c
wCurMapObjectEventCount:: db ; d94e
wCurMapObjectEventsPointer:: dw ; d94f
wCurMapSceneScriptCount:: db ; d951
wCurMapSceneScriptsPointer:: dw ; d952
wCurMapCallbackCount:: db ; d954
wCurMapCallbacksPointer:: dw ; d955

	ds 2

; Sprite id of each decoration
wDecoBed::           db ; d959
wDecoCarpet::        db ; d95a
wDecoPlant::         db ; d95b
wDecoPoster::        db ; d95c
wDecoConsole::       db ; d95d
wDecoLeftOrnament::  db ; d95e
wDecoRightOrnament:: db ; d95f
wDecoBigDoll::       db ; d960

; Items bought from Mom
wWhichMomItem:: db ; d961
wWhichMomItemSet:: db ; d962
wMomItemTriggerBalance:: ds 3 ; d963

wDailyResetTimer:: dw ; d966
wDailyFlags1:: db ; d968
wDailyFlags2:: db ; d969
	ds 3
wTimerEventStartDay:: db
	ds 3

wFruitTreeFlags:: flag_array NUM_FRUIT_TREES ; d971

	ds 2

wLuckyNumberDayBuffer:: dw ; d977
wd979:: ds 1 ; d979
wd97a:: ds 1 ; d97a
wSpecialPhoneCallID:: db ; d97b
wd97c:: ds 1 ; d97c
wd97d:: ds 1 ; d97d
wd97e:: ds 1 ; d97e
wBugContestStartTime:: ds 4 ; day, hour, min, sec ; d97f
wUnusedTwoDayTimerOn:: db ; d983
wUnusedTwoDayTimer:: db
wUnusedTwoDayTimerStartDate:: db
wd986:: ds 1 ; d986
wd987:: ds 1 ; d987
wd988:: ds 1 ; d988
wd989:: ds 1 ; d989
wd98a:: ds 1 ; d98a
wd98b:: ds 1 ; d98b
wd98c:: ds 1 ; d98c
wd98d:: ds 1 ; d98d
wd98e:: ds 1 ; d98e
wd98f:: ds 1 ; d98f
wd990:: ds 1 ; d990
wd991:: ds 1 ; d991
wd992:: ds 1 ; d992
wd993:: ds 1 ; d993
wd994:: ds 1 ; d994
wd995:: ds 1 ; d995
wd996:: ds 1 ; d996
wd997:: ds 1 ; d997
wd998:: ds 1 ; d998
wd999:: ds 1 ; d999
wd99a:: ds 1 ; d99a
wd99b:: ds 1 ; d99b
wd99c:: ds 1 ; d99c
wd99d:: ds 1 ; d99d
wd99e:: ds 1 ; d99e
wd99f:: ds 1 ; d99f
wd9a0:: ds 1 ; d9a0
wd9a1:: ds 1 ; d9a1
wd9a2:: ds 1 ; d9a2
wd9a3:: ds 1 ; d9a3
wd9a4:: ds 1 ; d9a4
wd9a5:: ds 1 ; d9a5
wd9a6:: ds 1 ; d9a6
wd9a7:: ds 1 ; d9a7
wd9a8:: ds 1 ; d9a8
wd9a9:: ds 1 ; d9a9
wd9aa:: ds 1 ; d9aa
wd9ab:: ds 1 ; d9ab
wd9ac:: ds 1 ; d9ac
wd9ad:: ds 1 ; d9ad
wd9ae:: ds 1 ; d9ae
wd9af:: ds 1 ; d9af
wd9b0:: ds 1 ; d9b0
wd9b1:: ds 1 ; d9b1
wd9b2:: ds 1 ; d9b2
wd9b3:: ds 1 ; d9b3
wd9b4:: ds 1 ; d9b4
wd9b5:: ds 1 ; d9b5
wd9b6:: ds 1 ; d9b6
wd9b7:: ds 1 ; d9b7
wd9b8:: ds 1 ; d9b8
wd9b9:: ds 1 ; d9b9
wd9ba:: ds 1 ; d9ba
wd9bb:: ds 1 ; d9bb
wd9bc:: ds 1 ; d9bc

wStepCount:: db ; d9bd
wPoisonStepCount:: db ; d9be
	ds 2
wHappinessStepCount:: db
	ds 1

wParkBallsRemaining::
wSafariBallsRemaining:: db ; d9c3
wSafariTimeRemaining:: dw ; d9c4

wPhoneList:: ds CONTACT_LIST_SIZE ; d9c6
; d9d0
	ds 23

wLuckyNumberShowFlag:: db ; d9e7
	ds 1
wLuckyIDNumber:: dw ; d9e9

wRepelEffect:: db ; If a Repel is in use, it contains the nr of steps it's still active
wBikeStep:: dw

wPlayerData3End::
wPlayerDataEnd::

wCurMapData::

wVisitedSpawns:: flag_array NUM_SPAWNS ; d9ee

wDigWarpNumber:: db ; d9f2
wDigMapGroup::   db ; d9f3
wDigMapNumber::  db ; d9f4

; used on maps like second floor pokécenter, which are reused, so we know which
; map to return to
wBackupWarpNumber:: db ; d9f5
wBackupMapGroup::   db ; d9f6
wBackupMapNumber::  db ; d9f7

	ds 3

wLastSpawnMapGroup:: db
wLastSpawnMapNumber:: db

wd9fd:: ds 1 ; d9fd
wd9fe:: ds 1 ; d9fe
wWarpNumber:: db ; d9ff
wMapGroup:: db ; da00
wMapNumber:: db ; da01
wYCoord:: db ; da02
wXCoord:: db ; da03
wScreenSave:: ds SCREEN_META_WIDTH * SCREEN_META_HEIGHT

wCurMapDataEnd::


SECTION "Party", WRAMX

wPokemonData::
wPartyCount::   db ; da22
wPartySpecies:: ds PARTY_LENGTH ; da23
wPartyEnd::     db ; da29 ; older code doesn't check wPartyCount

wPartyMons::
wPartyMon1:: party_struct wPartyMon1 ; da2a
wPartyMon2:: party_struct wPartyMon2 ; da5a
wPartyMon3:: party_struct wPartyMon3 ; da8a
wPartyMon4:: party_struct wPartyMon4 ; daba
wPartyMon5:: party_struct wPartyMon5 ; daea
wPartyMon6:: party_struct wPartyMon6 ; db1a

wPartyMonOT:: ds NAME_LENGTH * PARTY_LENGTH ; db4a

wPartyMonNicknames:: ds MON_NAME_LENGTH * PARTY_LENGTH ; db8c
wPartyMonNicknamesEnd::

	ds 22 ; equivalent to NAME_LENGTH + MON_NAME_LENGTH, possibly a reference to 7 pokemon?

wPokedexCaught:: flag_array NUM_POKEMON ; dbe4
wEndPokedexCaught::

wPokedexSeen:: flag_array NUM_POKEMON ; dc04
wEndPokedexSeen::

wUnownDex:: ds NUM_UNOWN ; dc24
wUnlockedUnowns:: db ; dc3e
wFirstUnownSeen:: db ; dc3f

wDayCareMan:: ; dc40
; bit 7: active
; bit 6: egg ready
; bit 5: monsters are compatible
; bit 0: monster 1 in day-care
	db

wBreedMon1::
wBreedMon1Nick::  ds MON_NAME_LENGTH ; dc41
wBreedMon1OT::    ds NAME_LENGTH ; dc4c
wBreedMon1Stats:: box_struct wBreedMon1 ; dc57

wDayCareLady:: ; dc77
; bit 7: active
; bit 0: monster 2 in day-care
	db

wStepsToEgg:: ; dc78
	db
wBreedMotherOrNonDitto:: ; dc79
;  z: yes
; nz: no
	db

wBreedMon2::
wBreedMon2Nick::  ds MON_NAME_LENGTH ; dc7a
wBreedMon2OT::    ds NAME_LENGTH ; dc85
wBreedMon2Stats:: box_struct wBreedMon2 ; dc90

wEggNick:: ds MON_NAME_LENGTH ; dcb0
wEggOT::   ds NAME_LENGTH ; dcbb
wEggMon::  box_struct wEggMon ; dcc6

wBugContestSecondPartySpecies:: db ; dce6
wContestMon:: party_struct wContestMon ; dce7

wSwarmMapGroup:: db ; dd17
wSwarmMapNumber:: db ; dd18
wFishingSwarmFlag:: db ; dd19

wRoamMon1:: roam_struct wRoamMon1 ; dd1a
wRoamMon2:: roam_struct wRoamMon2 ; dd21
wRoamMon3:: roam_struct wRoamMon3 ; dd28

wRoamMons_CurMapNumber:: db
wRoamMons_CurMapGroup:: db
wRoamMons_LastMapNumber:: db
wRoamMons_LastMapGroup:: db

wBestMagikarpLengthFeet:: db
wBestMagikarpLengthInches:: db
wMagikarpRecordHoldersName:: ds NAME_LENGTH

UNION ; dd40
wPokedexShowPointerAddr:: dw
wPokedexShowPointerBank:: db
	ds 3

NEXTU ; dd40
wUnusedEggHatchFlag:: db

NEXTU ; dd40
; enemy party
wOTPlayerName:: ds NAME_LENGTH ; dd40
wOTPlayerID:: dw ; dd4b
	ds 8
wOTPartyCount::   db ; dd55
wOTPartySpecies:: ds PARTY_LENGTH ; dd56
wOTPartyEnd::     db ; older code doesn't check PartyCount
ENDU ; dd5d

UNION ; dd5d
; catch tutorial dude pack
wDudeBag::
wDudeNumItems:: db
wDudeItems:: ds 2 * 4
wDudeItemsEnd:: db

wDudeNumKeyItems:: db ; dd67
wDudeKeyItems:: ds 18
wDudeKeyItemsEnd:: db

wDudeNumBalls:: db ; dd7b
wDudeBalls:: ds 2 * 4 ; dd7c
wDudeBallsEnd:: db ; dd84
wDudeBagEnd::

NEXTU ; dd5d
; ot party mons
wOTPartyMons::
wOTPartyMon1:: party_struct wOTPartyMon1 ; dd5d
wOTPartyMon2:: party_struct wOTPartyMon2 ; dd8d
wOTPartyMon3:: party_struct wOTPartyMon3 ; ddbd
wOTPartyMon4:: party_struct wOTPartyMon4 ; dded
wOTPartyMon5:: party_struct wOTPartyMon5 ; de1d
wOTPartyMon6:: party_struct wOTPartyMon6 ; de4d
wOTPartyMonsEnd::

wOTPartyMonOT:: ds NAME_LENGTH * PARTY_LENGTH ; de7d
wOTPartyMonNicknames:: ds MON_NAME_LENGTH * PARTY_LENGTH ; debf
wOTPartyDataEnd::
ENDU ; df01

wPokemonDataEnd::
wGameDataEnd::


SECTION "Stack", WRAMX

wStackTop::


INCLUDE "sram.asm"

INCLUDE "hram.asm"