summaryrefslogtreecommitdiff
path: root/wram.asm
blob: cd858238ec6f40942508bd3653dc3f08fc0dbac0 (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
INCLUDE "includes.asm"


party_struct: MACRO

\1Species::  db
\1Item::     db

\1Moves::
\1Move1::    db
\1Move2::    db
\1Move3::    db
\1Move4::    db

\1ID::       dw
\1Exp::      ds 3 ; Big endian
\1StatExp::
\1HPExp::    dw
\1AtkExp::   dw
\1DefExp::   dw
\1SpdExp::   dw
\1SpclExp::  dw

\1DVs::
\1AtkDefDV:: db
\1SpdSpcDV:: db

\1PP::
\1PPMove1::  db
\1PPMove2::  db
\1PPMove3::  db
\1PPMove4::  db

\1Happiness::     db
\1PokerusStatus:: db

\1CaughtData::
\1CaughtTime::
\1CaughtLevel::    db
\1CaughtGender::
\1CaughtLocation:: db

\1Level:: db

\1Status::   db
\1Unused::   db

; Stats are big endian.
\1HP::       dw
\1MaxHP::    dw
\1Attack::   dw
\1Defense::  dw
\1Speed::    dw
\1SpclAtk::  dw
\1SpclDef::  dw

ENDM


channel_struct: MACRO
; Addresses are Channel1 ($c101).

\1MusicID:: ; c101
	ds 2
\1MusicBank:: ; c103
	ds 1
\1Flags:: ; c104
; 0: on/off
; 1: subroutine
; 2: 
; 3: 
; 4: noise sampling on/off
; 5: 
; 6: 
; 7: 
	ds 1
\1Flags2:: ; c105
; 0: vibrato on/off
; 1: 
; 2: duty cycle on/off
; 3: 
; 4: 
; 5: 
; 6: 
; 7: 
	ds 1
\1Flags3:: ; c106
; 0: vibrato up/down
; 1: 
; 2: 
; 3: 
; 4: 
; 5: 
; 6: 
; 7: 
	ds 1
\1MusicAddress:: ; c107
	ds 2
\1LastMusicAddress:: ; c109
	ds 2
; could have been meant as a third-level address
	ds 2
\1NoteFlags:: ; c10d
; 0: 
; 1: 
; 2: 
; 3: 
; 4: 
; 5: rest
; 6: 
; 7: 
	ds 1
\1Condition:: ; c10e
; used for conditional jumps
	ds 1
\1DutyCycle:: ; c10f
; uses top 2 bits only
;	0: 12.5%
;	1: 25%
;	2: 50%
;	3: 75%
	ds 1
\1Intensity:: ; c110
;	hi: pressure
;   lo: velocity
	ds 1
\1Frequency::
; 11 bits
\1FrequencyLo:: ; c111
	ds 1
\1FrequencyHi:: ; c112
	ds 1
\1Pitch:: ; c113
; 0: rest
; 1: C
; 2: C#
; 3: D
; 4: D#
; 5: E
; 6: F
; 7: F#
; 8: G
; 9: G#
; a: A
; b: A#
; c: B
	ds 1
\1Octave:: ; c114
; 0: highest
; 7: lowest
	ds 1
\1StartingOctave:: ; c115
; raises existing octaves by this value
; used for repeating phrases in a higher octave to save space
	ds 1
\1NoteDuration:: ; c116
; number of frames remaining in the current note
	ds 1
; c117
	ds 1
; c118
	ds 1
\1LoopCount:: ; c119
	ds 1
\1Tempo:: ; c11a
	ds 2
\1Tracks:: ; c11c
; hi: l
; lo: r
	ds 1
; c11d
	ds 1

\1VibratoDelayCount:: ; c11e
; initialized at the value in VibratoDelay
; decrements each frame
; at 0, vibrato starts
	ds 1
\1VibratoDelay:: ; c11f
; number of frames a note plays until vibrato starts
	ds 1
\1VibratoExtent:: ; c120
; difference in 
	ds 1
\1VibratoRate:: ; c121
; counts down from a max of 15 frames
; over which the pitch is alternated
; hi: init frames
; lo: frame count
	ds 1

; c122
	ds 1
; c123
	ds 1
; c124
	ds 1
; c125
	ds 1
; c126
	ds 1
; c127
	ds 1
\1CryPitch:: ; c128
	ds 1
\1CryEcho:: ; c129
	ds 1
	ds 4
\1NoteLength:: ; c12e
; # frames per 16th note
	ds 1
; c12f
	ds 1
; c130
	ds 1
; c131
	ds 1
; c132
	ds 1
ENDM

SECTION "tiles0",VRAM[$8000],BANK[0]
VTiles0::
SECTION "tiles1",VRAM[$8800],BANK[0]
VTiles1::
SECTION "tiles2",VRAM[$9000],BANK[0]
VTiles2::
SECTION "bgmap0",VRAM[$9800],BANK[0]
VBGMap0::
SECTION "bgmap1",VRAM[$9C00],BANK[0]
VBGMap1::



SECTION "WRAMBank0",WRAM0[$c000]

SECTION "stack",WRAM0[$c0ff]
Stack:: ; c0ff
	ds -$100


SECTION "audio",WRAM0[$c100]
MusicPlaying:: ; c100
; nonzero if playing
	ds 1

Channels::
Channel1:: ; c101
	channel_struct Channel1
Channel2:: ; c133
	channel_struct Channel2
Channel3:: ; c165
	channel_struct Channel3
Channel4:: ; c197
	channel_struct Channel4

SFXChannels::
Channel5:: ; c1c9
	channel_struct Channel5
Channel6:: ; c1fb
	channel_struct Channel6
Channel7:: ; c22d
	channel_struct Channel7
Channel8:: ; c25f
	channel_struct Channel8

; c291
	ds 1
; c292
	ds 1
; c293
	ds 1
; c294
	ds 1
; c295
	ds 1
; c296
	ds 1
; c297
	ds 1

CurMusicByte:: ; c298
	ds 1
CurChannel:: ; c299
	ds 1
Volume:: ; c29a
; corresponds to $ff24
; 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)
	ds 1
SoundOutput:: ; c29b
; corresponds to $ff25
; bit 4-7: ch1-4 so2 on/off
; bit 0-3: ch1-4 so1 on/off
	ds 1
SoundInput:: ; c29c
; corresponds to $ff26
; bit 7: global on/off
; bit 0: ch1 on/off
; bit 1: ch2 on/off
; bit 2: ch3 on/off
; bit 3: ch4 on/off
	ds 1

MusicID::
MusicIDLo:: ; c29d
	ds 1
MusicIDHi:: ; c29e
	ds 1
MusicBank:: ; c29f
	ds 1
NoiseSampleAddress::
NoiseSampleAddressLo:: ; c2a0
	ds 1
NoiseSampleAddressHi:: ; c2a1
	ds 1
; noise delay? ; c2a2
	ds 1
; c2a3
	ds 1
MusicNoiseSampleSet:: ; c2a4
	ds 1
SFXNoiseSampleSet:: ; c2a5
	ds 1
Danger:: ; c2a6
; bit 7: on/off
; bit 4: pitch
; bit 0-3: counter
	ds 1
MusicFade:: ; c2a7
; fades volume over x frames
; bit 7: fade in/out
; bit 0-5: number of frames for each volume level
; $00 = none (default)
	ds 1
MusicFadeCount:: ; c2a8
	ds 1
MusicFadeID::
MusicFadeIDLo:: ; c2a9
	ds 1
MusicFadeIDHi:: ; c2aa
	ds 1
	ds 5
CryPitch:: ; c2b0
	ds 1
CryEcho:: ; c2b1
	ds 1
CryLength:: ; c2b2
	ds 2
LastVolume:: ; c2b4
	ds 1
	ds 1
SFXPriority:: ; c2b6
; if nonzero, turn off music when playing sfx
	ds 1
	ds 6
CryTracks:: ; c2bd
; plays only in left or right track depending on what side the monster is on
; both tracks active outside of battle
	ds 1
	ds 1
CurSFX:: ; c2bf
; id of sfx currently playing
	ds 1
CurMusic:: ; c2c0
; id of music currently playing
	ds 1

SECTION "auto",WRAM0[$c2c7]
InputType:: ; c2c7
	ds 1
AutoInputAddress:: ; c2c8
	ds 2
AutoInputBank:: ; c2ca
	ds 1
AutoInputLength:: ; c2cb
	ds 1

SECTION "linkbattle",WRAM0[$c2dc]
InLinkBattle:: ; c2dc
; 0 not in link battle
; 1 link battle
; 4 mobile battle
	ds 1

SECTION "scriptengine",WRAM0[$c2dd]
ScriptVar:: ; c2dd
	ds 1


SECTION "tiles",WRAM0[$c2fa]
TileDown:: ; c2fa
	ds 1
TileUp:: ; c2fb
	ds 1
TileLeft:: ; c2fc
	ds 1
TileRight:: ; c2fd
	ds 1

TilePermissions:: ; c2fe
; set if tile behavior prevents
; you from walking in that direction
; bit 3: down
; bit 2: up
; bit 1: left
; bit 0: right
	ds 1

SECTION "icons",WRAM0[$c3b6]

CurIcon:: ; c3b6
	ds 1

SECTION "gfx",WRAM0[$c400]

Sprites:: ; c400
; 4 bytes per sprite
; 40 sprites
; struct:
;	y in pixels
;	x in pixels
;	tile id
;	attributes:
;		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 160
SpritesEnd::

TileMap:: ; c4a0
; 20x18 grid of 8x8 tiles
	ds 360
TileMapEnd::

SECTION "BattleMons",WRAM0[$c608]

EnemyMoveStruct::
EnemyMoveAnimation:: ; c608
	ds 1
EnemyMoveEffect:: ; c609
	ds 1
EnemyMovePower:: ; c60a
	ds 1
EnemyMoveType:: ; c60b
	ds 1
EnemyMoveAccuracy:: ; c60c
	ds 1
EnemyMovePP:: ; c60d
	ds 1
EnemyMoveEffectChance:: ; c60e
	ds 1

PlayerMoveStruct::
PlayerMoveAnimation:: ; c60f
	ds 1
PlayerMoveEffect:: ; c610
	ds 1
PlayerMovePower:: ; c611
	ds 1
PlayerMoveType:: ; c612
	ds 1
PlayerMoveAccuracy:: ; c613
	ds 1
PlayerMovePP:: ; c614
	ds 1
PlayerMoveEffectChance:: ; c615
	ds 1

EnemyMonNick:: ; c616
	ds 11
BattleMonNick:: ; c621
	ds 11


BattleMonSpecies:: ; c62c
	ds 1
BattleMonItem:: ; c62d
	ds 1

BattleMonMoves::
BattleMonMove1:: ; c62e
	ds 1
BattleMonMove2:: ; c62f
	ds 1
BattleMonMove3:: ; c630
	ds 1
BattleMonMove4:: ; c631
	ds 1

BattleMonDVs::
BattleMonAtkDefDV:: ; c632
	ds 1
BattleMonSpdSpclDV:: ; c633
	ds 1

BattleMonPP::
BattleMonPPMove1:: ; c634
	ds 1
BattleMonPPMove2:: ; c635
	ds 1
BattleMonPPMove3:: ; c636
	ds 1
BattleMonPPMove4:: ; c637
	ds 1

BattleMonHappiness:: ; c638
	ds 1
BattleMonLevel:: ; c639
	ds 1

BattleMonStatus:: ; c63a
	ds 2

BattleMonHP:: ; c63c
	ds 2
BattleMonMaxHP:: ; c63e
	ds 2

BattleMonAtk:: ; c640
	ds 2
BattleMonDef:: ; c642
	ds 2
BattleMonSpd:: ; c644
	ds 2
BattleMonSpclAtk:: ; c646
	ds 2
BattleMonSpclDef:: ; c648
	ds 2

BattleMonType1:: ; c64a
	ds 1
BattleMonType2:: ; c64b
	ds 1

	ds 10

OTName:: ; c656
	ds 13

CurOTMon:: ; c663
	ds 1
	
	ds 1

TypeModifier:: ; c665
; >10: super-effective
;  10: normal
; <10: not very effective

; bit 7: stab
	ds 1

CriticalHit:: ; c666
; nonzero for a critical hit
	ds 1
	
AttackMissed:: ; c667
; nonzero for a miss
	ds 1
	
PlayerSubStatus1:: ; c668
; bit
; 7 attract
; 6 encore
; 5 endure
; 4 perish song
; 3 identified
; 2 protect
; 1 curse
; 0 nightmare
	ds 1
PlayerSubStatus2:: ; c669
; bit
; 7
; 6
; 5
; 4
; 3
; 2
; 1
; 0 curled
	ds 1
PlayerSubStatus3:: ; c66a
; bit
; 7 confused
; 6 flying
; 5 underground
; 4 charged
; 3 flinch
; 2
; 1 rollout
; 0 bide
	ds 1
PlayerSubStatus4:: ; c66b
; bit
; 7 leech seed
; 6 rage
; 5 recharge
; 4 substitute
; 3
; 2 focus energy
; 1 mist
; 0 bide: unleashed energy
	ds 1
PlayerSubStatus5:: ; c66c
; bit
; 7 cant run
; 6 destiny bond
; 5 lock-on
; 4
; 3
; 2
; 1
; 0 toxic
	ds 1

EnemySubStatus1:: ; c66d
; see PlayerSubStatus1
	ds 1
EnemySubStatus2:: ; c66e
; see PlayerSubStatus2
	ds 1
EnemySubStatus3:: ; c66f
; see PlayerSubStatus3
	ds 1
EnemySubStatus4:: ; c670
; see PlayerSubStatus4
	ds 1
EnemySubStatus5:: ; c671
; see PlayerSubStatus5
	ds 1

PlayerRolloutCount:: ; c672
	ds 1
PlayerConfuseCount:: ; c673
	ds 1
	ds 1
PlayerDisableCount:: ; c675
	ds 1
PlayerEncoreCount:: ; c676
	ds 1
PlayerPerishCount:: ; c677
	ds 1
PlayerFuryCutterCount:: ; c678
	ds 1
PlayerProtectCount:: ; c679
	ds 1

EnemyRolloutCount:: ; c67a
	ds 1
EnemyConfuseCount:: ; c67b
	ds 1
	ds 1
EnemyDisableCount:: ; c67d
	ds 1
EnemyEncoreCount:: ; c67e
	ds 1
EnemyPerishCount:: ; c67f
	ds 1
EnemyFuryCutterCount:: ; c680
	ds 1
EnemyProtectCount:: ; c681
	ds 1

PlayerDamageTaken:: ; c682
	ds 2
EnemyDamageTaken:: ; c684
	ds 2

	ds 3
	
	ds 1

BattleScriptBuffer:: ; c68a
	ds 40

BattleScriptBufferLoc:: ; c6b2
	ds 2

	ds 2

PlayerStats:: ; c6b6
	ds 10
	ds 1
EnemyStats:: ; c6c1
	ds 10
	ds 1

PlayerStatLevels:: ; c6cc
; 07 neutral
PlayerAtkLevel:: ; c6cc
	ds 1
PlayerDefLevel:: ; c6cd
	ds 1
PlayerSpdLevel:: ; c6ce
	ds 1
PlayerSAtkLevel:: ; c6cf
	ds 1
PlayerSDefLevel:: ; c6d0
	ds 1
PlayerAccLevel:: ; c6d1
	ds 1
PlayerEvaLevel:: ; c6d2
	ds 1
; c6d3
	ds 1
PlayerStatLevelsEnd::

EnemyStatLevels:: ; c6d4
; 07 neutral
EnemyAtkLevel:: ; c6d4
	ds 1
EnemyDefLevel:: ; c6d5
	ds 1
EnemySpdLevel:: ; c6d6
	ds 1
EnemySAtkLevel:: ; c6d7
	ds 1
EnemySDefLevel:: ; c6d8
	ds 1
EnemyAccLevel:: ; c6d9
	ds 1
EnemyEvaLevel:: ; c6da
	ds 1
; c6db
	ds 1

EnemyTurnsTaken:: ; c6dc
	ds 1
PlayerTurnsTaken:: ; c6dd
	ds 1

	ds 5

CurPlayerMove:: ; c6e3
	ds 1
CurEnemyMove:: ; c6e4
	ds 1

LinkBattleRNCount:: ; c6e5
; how far through the prng stream
	ds 1

	ds 3

CurEnemyMoveNum:: ; c6e9
	ds 1

	ds 10

AlreadyDisobeyed:: ; c6f4
	ds 1

DisabledMove:: ; c6f5
	ds 1
EnemyDisabledMove:: ; c6f6
	ds 1
	ds 1

; exists so you can't counter on switch
LastEnemyCounterMove:: ; c6f8
	ds 1
LastPlayerCounterMove:: ; c6f9
	ds 1

	ds 1

AlreadyFailed:: ; c6fb
	ds 1

	ds 3
	
PlayerScreens:: ; c6ff
; bit
; 4 reflect
; 3 light screen
; 2 safeguard
; 0 spikes
	ds 1

EnemyScreens:: ; c700
; see PlayerScreens
	ds 1

	ds 1

PlayerLightScreenCount:: ; c702
	ds 1
PlayerReflectCount:: ; c703
	ds 1

	ds 2

EnemyLightScreenCount:: ; c706
	ds 1
EnemyReflectCount:: ; c707
	ds 1

	ds 2

Weather:: ; c70a
; 00 normal
; 01 rain
; 02 sun
; 03 sandstorm
; 04 rain stopped
; 05 sunliight faded
; 06 sandstorm subsided
	ds 1

WeatherCount:: ; c70b
; # turns remaining
	ds 1

LoweredStat:: ; c70c
	ds 1
EffectFailed:: ; c70d
	ds 1
FailedMessage:: ; c70e
	ds 1

	ds 3

PlayerUsedMoves:: ; c712
; add a move that has been used once by the player
; added in order of use
	ds 4

	ds 5

LastPlayerMove:: ; c71b
	ds 1
LastEnemyMove:: ; c71c
	ds 1


SECTION "battle",WRAM0[$c734]
BattleEnded:: ; c734
	ds 1


SECTION "overworldmap",WRAM0[$c800]
OverworldMap:: ; c800
	ds 1300
OverworldMapEnd::
	
	ds 12

SECTION "gfx2",WRAM0[$cd20]
CreditsPos::
BGMapBuffer:: ; cd20
	ds 2
CreditsTimer:: ; cd22
	ds 1
	ds 37
	
BGMapPalBuffer:: ; cd48
	ds 40

BGMapBufferPtrs:: ; cd70
; 20 bg map addresses (16x8 tiles)
	ds 40

SGBPredef:: ; cd98
	ds 1
PlayerHPPal:: ; cd99
	ds 1
EnemyHPPal:: ; cd9a
	ds 1
	
	ds 62

AttrMap:: ; cdd9
; 20x18 grid of palettes for 8x8 tiles
; read horizontally from the top row
; bit 3: vram bank
; bit 0-2: palette id
	ds 360

	ds 30
	
MonType:: ; cf5f
	ds 1

CurSpecies:: ; cf60
	ds 1

	ds 6

Requested2bpp:: ; cf67
	ds 1
Requested2bppSource:: ; cf68
	ds 2
Requested2bppDest:: ; cf6a
	ds 2

Requested1bpp:: ; cf6c
	ds 1
Requested1bppSource:: ; cf6d
	ds 2
Requested1bppDest:: ; cf6f
	ds 2

	ds 3

MenuSelection:: ; cf74
	ds 1



SECTION "VBlank",WRAM0[$cfb1]
OverworldDelay:: ; cfb1
	ds 1
TextDelayFrames:: ; cfb2
	ds 1
VBlankOccurred:: ; cfb3
	ds 1

PredefID:: ; cfb4
	ds 1
PredefTemp:: ; cfb5
	ds 2
PredefAddress:: ; cfb7
	ds 2

	ds 3

GameTimerPause:: ; cfbc
; bit 0
	ds 1

SECTION "Engine",WRAM0[$cfc2]
FXAnimID::
FXAnimIDLo:: ; cfc2
	ds 1
FXAnimIDHi:: ; cfc3
	ds 1

	ds 2

TileAnimationTimer:: ; cfc6
	ds 1

	ds 5

Options:: ; cfcc
; 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
	ds 1
	
	ds 1

TextBoxFrame:: ; cfce
; bits 0-2: textbox frame 0-7
	ds 1
	
	ds 1

GBPrinter:: ; cfd0
; bit 0-6: brightness
;   lightest: $00
;   lighter:  $20
;   normal:   $40 (default)
;   darker:   $60
;   darkest:  $7F
	ds 1

Options2:: ; cfd1
; bit 1: menu account off/on
	ds 1

	ds 46
	

SECTION "WRAMBank1",WRAMX[$d000],BANK[1]

	ds 2
	
DefaultFlypoint:: ; d002
	ds 1
; d003
	ds 1
; d004
	ds 1
StartFlypoint:: ; d005
	ds 1
EndFlypoint:: ; d006
	ds 1

MovementBuffer:: ; d007

	ds 55

MenuItemsList::
CurFruitTree::
CurInput::
EngineBuffer1:: ; d03e
	ds 1
CurFruit:: ; d03f
	ds 1

MartPointer:: ; d040
	ds 2

MovementAnimation:: ; d042
	ds 1

WalkingDirection:: ; d043
	ds 1

FacingDirection:: ; d044
	ds 1

WalkingX:: ; d045
	ds 1
WalkingY:: ; d046
	ds 1
WalkingTile:: ; d047
	ds 1

	ds 43

StringBuffer1:: ; d073
	ds 19
StringBuffer2:: ; d086
	ds 19
StringBuffer3:: ; d099
	ds 19
StringBuffer4:: ; d0ac
	ds 19
StringBuffer5:: ; d0bf
	ds 19

	ds 2

CurBattleMon:: ; d0d4
	ds 1
CurMoveNum:: ; d0d5
	ds 1

	ds 23

VramState:: ; d0ed
; bit 0: overworld sprite updating on/off
; bit 6: something to do with text
; bit 7: on when surf initiates
;        flickers when climbing waterfall
	ds 1

	ds 2

CurMart:: ; d0f0
	ds 16
CurMartEnd::

	ds 6

CurItem:: ; d106
	ds 1

	ds 1
	
CurPartySpecies:: ; d108
	ds 1

CurPartyMon:: ; d109
; contains which monster in a party
; is being dealt with at the moment
; 0-5
	ds 1

	ds 4

TempMon::
TempMonSpecies:: ; d10e
	ds 1
TempMonItem:: ; d10f
	ds 1
TempMonMoves:: ; d110
TempMonMove1:: ; d110
	ds 1
TempMonMove2:: ; d111
	ds 1
TempMonMove3:: ; d112
	ds 1
TempMonMove4:: ; d113
	ds 1
TempMonID:: ; d114
	ds 2
TempMonExp:: ; d116
	ds 3
TempMonHPExp:: ; d119
	ds 2
TempMonAtkExp:: ; d11b
	ds 2
TempMonDefExp:: ; d11d
	ds 2
TempMonSpdExp:: ; d11f
	ds 2
TempMonSpclExp:: ; d121
	ds 2
TempMonDVs:: ; d123
; hp = %1000 for each dv
	ds 1 ; atk/def
	ds 1 ; spd/spc
TempMonPP:: ; d125
	ds 4
TempMonHappiness:: ; d129
	ds 1
TempMonPokerusStatus:: ; d12a
	ds 1
TempMonCaughtData:: ; d12b
TempMonCaughtTime:: ; d12b
TempMonCaughtLevel:: ; d12b
	ds 1
TempMonCaughtGender:: ; d12c
TempMonCaughtLocation:: ; d12c
	ds 1
TempMonLevel:: ; d12d
	ds 1
TempMonStatus:: ; d12e
	ds 1
; d12f
	ds 1
TempMonHP:: ; d130
	ds 2
TempMonMaxHP:: ; d132
	ds 2
TempMonAtk:: ; d134
	ds 2
TempMonDef:: ; d136
	ds 2
TempMonSpd:: ; d138
	ds 2
TempMonSpclAtk:: ; d13a
	ds 2
TempMonSpclDef:: ; d13c
	ds 2
TempMonEnd:: ; d13e

	ds 3

PartyMenuActionText:: ; d141
	ds 1
	ds 1

CurPartyLevel:: ; d143
	ds 1


SECTION "UsedSprites",WRAMX[$d154],BANK[1]
UsedSprites:: ; d154
	ds 32

SECTION "map",WRAMX[$d19d],BANK[1]

; both are in blocks (2x2 walkable tiles, 4x4 graphics tiles)
MapHeader:: ; d19d
MapBorderBlock:: ; d19d
	ds 1
MapHeight:: ; d19e
	ds 1
MapWidth:: ; d19f
	ds 1
MapBlockDataBank:: ; d1a0
	ds 1
MapBlockDataPointer:: ; d1a1
	ds 2
MapScriptHeaderBank:: ; d1a3
	ds 1
MapScriptHeaderPointer:: ; d1a4
	ds 2
MapEventHeaderPointer:: ; d1a6
	ds 2
; bit set
MapConnections:: ; d1a8
	ds 1
NorthMapConnection:: ; d1a9
NorthConnectedMapGroup:: ; d1a9
	ds 1
NorthConnectedMapNumber:: ; d1aa
	ds 1
NorthConnectionStripPointer:: ; d1ab
	ds 2
NorthConnectionStripLocation:: ; d1ad
	ds 2
NorthConnectionStripLength:: ; d1af
	ds 1
NorthConnectedMapWidth:: ; d1b0
	ds 1
NorthConnectionStripYOffset:: ; d1b1
	ds 1
NorthConnectionStripXOffset:: ; d1b2
	ds 1
NorthConnectionWindow:: ; d1b3
	ds 2

SouthMapConnection:: ; d1b5
SouthConnectedMapGroup:: ; d1b5
	ds 1
SouthConnectedMapNumber:: ; d1b6
	ds 1
SouthConnectionStripPointer:: ; d1b7
	ds 2
SouthConnectionStripLocation:: ; d1b9
	ds 2
SouthConnectionStripLength:: ; d1bb
	ds 1
SouthConnectedMapWidth:: ; d1bc
	ds 1
SouthConnectionStripYOffset:: ; d1bd
	ds 1
SouthConnectionStripXOffset:: ; d1be
	ds 1
SouthConnectionWindow:: ; d1bf
	ds 2

WestMapConnection:: ; d1c1
WestConnectedMapGroup:: ; d1c1
	ds 1
WestConnectedMapNumber:: ; d1c2
	ds 1
WestConnectionStripPointer:: ; d1c3
	ds 2
WestConnectionStripLocation:: ; d1c5
	ds 2
WestConnectionStripLength:: ; d1c7
	ds 1
WestConnectedMapWidth:: ; d1c8
	ds 1
WestConnectionStripYOffset:: ; d1c9
	ds 1
WestConnectionStripXOffset:: ; d1ca
	ds 1
WestConnectionWindow:: ; d1cb
	ds 2

EastMapConnection:: ; d1cd
EastConnectedMapGroup:: ; d1cd
	ds 1
EastConnectedMapNumber:: ; d1ce
	ds 1
EastConnectionStripPointer:: ; d1cf
	ds 2
EastConnectionStripLocation:: ; d1d1
	ds 2
EastConnectionStripLength:: ; d1d3
	ds 1
EastConnectedMapWidth:: ; d1d4
	ds 1
EastConnectionStripYOffset:: ; d1d5
	ds 1
EastConnectionStripXOffset:: ; d1d6
	ds 1
EastConnectionWindow:: ; d1d7
	ds 2


TilesetHeader::
TilesetBank:: ; d1d9
	ds 1
TilesetAddress:: ; d1da
	ds 2
TilesetBlocksBank:: ; d1dc
	ds 1
TilesetBlocksAddress:: ; d1dd
	ds 2
TilesetCollisionBank:: ; d1df
	ds 1
TilesetCollisionAddress:: ; d1e0
	ds 2
TilesetAnim:: ; d1e2
; bank 3f
	ds 2
; unused ; d1e4
	ds 2
TilesetPalettes:: ; d1e6
; bank 3f
	ds 2

EvolvableFlags:: ; d1e8
	ds 1

	ds 1

MagikarpLength::
Buffer1:: ; d1ea
	ds 1
MovementType::
Buffer2:: ; d1eb
	ds 1

SECTION "BattleMons2",WRAMX[$d1fa],BANK[1]
LinkBattleRNs:: ; d1fa
	ds 10

TempEnemyMonSpecies:: ; d204
	ds 1
TempBattleMonSpecies:: ; d205
	ds 1

EnemyMon::
EnemyMonSpecies:: ; d206
	ds 1
EnemyMonItem:: ; d207
	ds 1

EnemyMonMoves::
EnemyMonMove1:: ; d208
	ds 1
EnemyMonMove2:: ; d209
	ds 1
EnemyMonMove3:: ; d20a
	ds 1
EnemyMonMove4:: ; d20b
	ds 1
EnemyMonMovesEnd::

EnemyMonDVs::
EnemyMonAtkDefDV:: ; d20c
	ds 1
EnemyMonSpdSpclDV:: ; d20d
	ds 1
	
EnemyMonPP::
EnemyMonPPMove1:: ; d20e
	ds 1
EnemyMonPPMove2:: ; d20f
	ds 1
EnemyMonPPMove3:: ; d210
	ds 1
EnemyMonPPMove4:: ; d211
	ds 1
	
EnemyMonHappiness:: ; d212
	ds 1
EnemyMonLevel:: ; d213
	ds 1
	
EnemyMonStatus:: ; d214
	ds 2

EnemyMonHP::
EnemyMonHPHi:: ; d216
	ds 1
EnemyMonHPLo:: ; d217
	ds 1

EnemyMonMaxHP::
EnemyMonMaxHPHi:: ; d218
	ds 1
EnemyMonMaxHPLo:: ; d219
	ds 1

EnemyMonStats::
EnemyMonAtk:: ; d21a
	ds 2
EnemyMonDef:: ; d21c
	ds 2
EnemyMonSpd:: ; d21e
	ds 2
EnemyMonSpclAtk:: ; d220
	ds 2
EnemyMonSpclDef:: ; d222
	ds 2
EnemyMonStatsEnd::

EnemyMonType1:: ; d224
	ds 1
EnemyMonType2:: ; d225
	ds 1

EnemyMonBaseStats:: ; d226
	ds 5

EnemyMonCatchRate:: ; d22b
	ds 1
EnemyMonBaseExp:: ; d22c
	ds 1

EnemyMonEnd::


IsInBattle:: ; d22d
; 0: overworld
; 1: wild battle
; 2: trainer battle
	ds 1
	
	ds 1

OtherTrainerClass:: ; d22f
; class (Youngster, Bug Catcher, etc.) of opposing trainer
; 0 if opponent is a wild Pokémon, not a trainer
	ds 1

BattleType:: ; d230
; $00 normal
; $01
; $02
; $03 dude
; $04 fishing
; $05 roaming
; $06
; $07 shiny
; $08 headbutt/rock smash
; $09
; $0a force Item1
; $0b
; $0c suicune
	ds 1

OtherTrainerID:: ; d231
; which trainer of the class that you're fighting
; (Joey, Mikey, Albert, etc.)
	ds 1

	ds 1

TrainerClass:: ; d233
	ds 1

UnownLetter:: ; d234
	ds 1

	ds 1

CurBaseData:: ; d236
BaseDexNo:: ; d236
	ds 1
BaseStats:: ; d237
BaseHP:: ; d237
	ds 1
BaseAttack:: ; d238
	ds 1
BaseDefense:: ; d239
	ds 1
BaseSpeed:: ; d23a
	ds 1
BaseSpecialAttack:: ; d23b
	ds 1
BaseSpecialDefense:: ; d23c
	ds 1
BaseType:: ; d23d
BaseType1:: ; d23d
	ds 1
BaseType2:: ; d23e
	ds 1
BaseCatchRate:: ; d23f
	ds 1
BaseExp:: ; d240
	ds 1
BaseItems:: ; d241
	ds 2
BaseGender:: ; d243
	ds 1
BaseUnknown1:: ; d244
	ds 1
BaseEggSteps:: ; d245
	ds 1
BaseUnknown2:: ; d246
	ds 1
BasePicSize:: ; d247
	ds 1
BasePadding:: ; d248
	ds 4
BaseGrowthRate:: ; d24c
	ds 1
BaseEggGroups:: ; d24d
	ds 1
BaseTMHM:: ; d24e
	ds 8


CurDamage:: ; d256
	ds 2


SECTION "TimeOfDay",WRAMX[$d269],BANK[1]

TimeOfDay:: ; d269
	ds 1

SECTION "OTParty",WRAMX[$d280],BANK[1]

OTPartyCount:: ; d280
	ds 1 ; number of Pokémon in party
OTPartySpecies:: ; d281
	ds 6 ; species of each Pokémon in party
; d287
	ds 1 ; any empty slots including the 7th must be FF
	     ; or the routine will keep going

OTPartyMon1:: ; d288
	party_struct OTPartyMon1
OTPartyMon2:: ; d2b8
	party_struct OTPartyMon2
OTPartyMon3:: ; d2e8
	party_struct OTPartyMon3
OTPartyMon4:: ; d318
	party_struct OTPartyMon4
OTPartyMon5:: ; d348
	party_struct OTPartyMon5
OTPartyMon6:: ; d378
	party_struct OTPartyMon6


OTPartyMonOT::
OTPartyMon1OT:: ; d3a8
	ds 11
OTPartyMon2OT:: ; d3b3
	ds 11
OTPartyMon3OT:: ; d3be
	ds 11
OTPartyMon4OT:: ; d3c9
	ds 11
OTPartyMon5OT:: ; d3d4
	ds 11
OTPartyMon6OT:: ; d3df
	ds 11

OTPartyMonNicknames::
OTPartyMon1Nickname:: ; d3ea
	ds 11
OTPartyMon2Nickname:: ; d3f5
	ds 11
OTPartyMon3Nickname:: ; d400
	ds 11
OTPartyMon4Nickname:: ; d40b
	ds 11
OTPartyMon5Nickname:: ; d416
	ds 11
OTPartyMon6Nickname:: ; d421
	ds 11

SECTION "Map Events", WRAMX[$d432], BANK[1]
MapStatus:: ; d432
	ds 1
MapEventStatus:: ; d433
	ds 1

ScriptFlags:: ; d434
	ds 1
ScriptFlags2:: ; d435
	ds 1
ScriptFlags3:: ; d436
	ds 1

ScriptMode:: ; d437
	ds 1
ScriptRunning:: ; d438
	ds 1
ScriptBank:: ; d439
	ds 1
ScriptPos:: ; d43a
	ds 2

	ds 17

ScriptDelay:: ; d44d
	ds 1

SECTION "Player",WRAMX[$d472],BANK[1]
PlayerGender:: ; d472
; bit 0:
;	0 male
;	1 female
	ds 1
	ds 8
PlayerID:: ; d47b
	ds 2

PlayerName:: ; d47d
	ds 11
MomsName:: ; d488
	ds 11
RivalName:: ; d493
	ds 11
RedsName:: ; d49e
	ds 11
GreensName:: ; d4a9
	ds 11

	ds 2

; init time set at newgame
StartDay:: ; d4b6
	ds 1
StartHour:: ; d4b7
	ds 1
StartMinute:: ; d4b8
	ds 1
StartSecond:: ; d4b9
	ds 1

	ds 9
	
GameTimeCap:: ; d4c3
	ds 1
GameTimeHours:: ; d4c4
	ds 2
GameTimeMinutes:: ; d4c6
	ds 1
GameTimeSeconds:: ; d4c7
	ds 1
GameTimeFrames:: ; d4c8
	ds 1

	ds 2

CurDay:: ; d4cb
	ds 1

	ds 10


ObjectStructs::

PlayerStruct:: ; d4d6
	ds 2
PlayerSprite:: ; d4d8
	ds 1
	ds 3
PlayerPalette:: ; d4dc
	ds 1
	ds 1
PlayerDirection:: ; d4de
; uses bits 2 and 3 / $0c / %00001100
; %00 down
; %01 up
; %10 left
; $11 right
	ds 1
	ds 2
PlayerAction:: ; d4e1
; 1 standing
; 2 walking
; 4 spinning
; 6 fishing
	ds 1
	ds 1
PlayerFacing:: ; d4e3
	ds 1
StandingTile:: ; d4e4
	ds 1
StandingTile2:: ; d4e5
	ds 1
; relative to the map struct including borders
MapX:: ; d4e6
	ds 1
MapY:: ; d4e7
	ds 1
MapX2:: ; d4e8
	ds 1
MapY2:: ; d4e9
	ds 1
	ds 3
; relative to the bg map, in px
PlayerSpriteX:: ; d4ed
	ds 1
PlayerSpriteY:: ; d4ee
	ds 1
	ds 15

ObjectStruct1:: ; d4fe
	ds 40
ObjectStruct2:: ; d526
	ds 40
ObjectStruct3:: ; d54e
	ds 40
ObjectStruct4:: ; d576
	ds 40
ObjectStruct5:: ; d59e
	ds 40
ObjectStruct6:: ; d5c6
	ds 40
ObjectStruct7:: ; d5ee
	ds 40
ObjectStruct8:: ; d616
	ds 40
ObjectStruct9:: ; d63e
	ds 40
ObjectStruct10:: ; d666
	ds 40
ObjectStruct11:: ; d68e
	ds 40
ObjectStruct12:: ; d6b6
	ds 40
; d6de

SECTION "Objects",WRAMX[$d71e],BANK[1]
MapObjects:: ; d71e
	ds OBJECT_LENGTH * NUM_OBJECTS


SECTION "VariableSprites",WRAMX[$d82e],BANK[1]
VariableSprites:: ; d82e
	ds $10


SECTION "Status",WRAMX[$d841],BANK[1]
TimeOfDayPal:: ; d841
	ds 1
	ds 4
; d846
	ds 1
	ds 1
CurTimeOfDay:: ; d848
	ds 1
	
	ds 3

StatusFlags:: ; d84c
	ds 1
StatusFlags2:: ; d84d
	ds 1

Money:: ; d84e
	ds 3

	ds 4

Coins:: ; d855
	ds 2
	
Badges::
JohtoBadges:: ; d857
	ds 1
KantoBadges:: ; d858
	ds 1
	
SECTION "Items",WRAMX[$d859],BANK[1]
TMsHMs:: ; d859
	ds 57
TMsHMsEnd::

NumItems:: ; d892
	ds 1
Items:: ; d893
	ds 41
ItemsEnd::

NumKeyItems:: ; d8bc
	ds 1
KeyItems:: ; d8bd
	ds 26
KeyItemsEnd::

NumBalls:: ; d8d7
	ds 1
Balls:: ; d8d8
	ds 25
BallsEnd::

PCItems:: ; d8f1
	ds 101
PCItemsEnd::


SECTION "overworld",WRAMX[$d95b],BANK[1]
WhichRegisteredItem:: ; d95b
	ds 1
RegisteredItem:: ; d95c
	ds 1

PlayerState:: ; d95d
	ds 1

SECTION "scriptram",WRAMX[$d962],BANK[1]
MooMooBerries:: ; d962
	ds 1 ; how many berries fed to MooMoo
UndergroundSwitchPositions:: ; d963
	ds 1 ; which positions the switches are in
FarfetchdPosition:: ; d964
	ds 1 ; which position the ilex farfetch'd is in

SECTION "Map Triggers", WRAMX[$d972], BANK[1]

wPokecenter2FTrigger::                       ds 1 ; d972
wTradeCenterTrigger::                        ds 1 ; d973
wColosseumTrigger::                          ds 1 ; d974
wTimeCapsuleTrigger::                        ds 1 ; d975
wPowerPlantTrigger::                         ds 1 ; d976
wCeruleanGymTrigger::                        ds 1 ; d977
wRoute25Trigger::                            ds 1 ; d978
wTrainerHouseB1FTrigger::                    ds 1 ; d979
wVictoryRoadGateTrigger::                    ds 1 ; d97a
wSaffronTrainStationTrigger::                ds 1 ; d97b
wRoute16GateTrigger::                        ds 1 ; d97c
wRoute1718GateTrigger::                      ds 1 ; d97d
wIndigoPlateauPokecenter1FTrigger::          ds 1 ; d97e
wWillsRoomTrigger::                          ds 1 ; d97f
wKogasRoomTrigger::                          ds 1 ; d980
wBrunosRoomTrigger::                         ds 1 ; d981
wKarensRoomTrigger::                         ds 1 ; d982
wLancesRoomTrigger::                         ds 1 ; d983
wHallOfFameTrigger::                         ds 1 ; d984
wRoute27Trigger::                            ds 1 ; d985
wNewBarkTownTrigger::                        ds 1 ; d986
wElmsLabTrigger::                            ds 1 ; d987
wKrissHouse1FTrigger::                       ds 1 ; d988
wRoute29Trigger::                            ds 1 ; d989
wCherrygroveCityTrigger::                    ds 1 ; d98a
wMrPokemonsHouseTrigger::                    ds 1 ; d98b
wRoute32Trigger::                            ds 1 ; d98c
wRoute35NationalParkGateTrigger::            ds 1 ; d98d
wRoute36Trigger::                            ds 1 ; d98e
wRoute36NationalParkGateTrigger::            ds 1 ; d98f
wAzaleaTownTrigger::                         ds 1 ; d990
wGoldenrodGymTrigger::                       ds 1 ; d991
wGoldenrodMagnetTrainStationTrigger::        ds 1 ; d992
wGoldenrodPokecenter1FTrigger::              ds 1 ; d993
wOlivineCityTrigger::                        ds 1 ; d994
wRoute34Trigger::                            ds 1 ; d995
wRoute34IlexForestGateTrigger::              ds 1 ; d996
wEcruteakHouseTrigger::                      ds 1 ; d997
wWiseTriosRoomTrigger::                      ds 1 ; d998
wEcruteakPokecenter1FTrigger::               ds 1 ; d999
wEcruteakGymTrigger::                        ds 1 ; d99a
wMahoganyTownTrigger::                       ds 1 ; d99b
wRoute42Trigger::                            ds 1 ; d99c
wCianwoodCityTrigger::                       ds 1 ; d99d
wBattleTower1FTrigger::                      ds 1 ; d99e
wBattleTowerBattleRoomTrigger::              ds 1 ; d99f
wBattleTowerElevatorTrigger::                ds 1 ; d9a0
wBattleTowerHallwayTrigger::                 ds 1 ; d9a1
wBattleTowerOutsideTrigger::                 ds 1 ; d9a2
wRoute43GateTrigger::                        ds 1 ; d9a3
wMountMoonTrigger::                          ds 1 ; d9a4
wSproutTower3FTrigger::                      ds 1 ; d9a5
wTinTower1FTrigger::                         ds 1 ; d9a6
wBurnedTower1FTrigger::                      ds 1 ; d9a7
wBurnedTowerB1FTrigger::                     ds 1 ; d9a8
wRadioTower5FTrigger::                       ds 1 ; d9a9
wRuinsOfAlphOutsideTrigger::                 ds 1 ; d9aa
wRuinsOfAlphResearchCenterTrigger::          ds 1 ; d9ab
wRuinsOfAlphHoOhChamberTrigger::             ds 1 ; d9ac
wRuinsOfAlphKabutoChamberTrigger::           ds 1 ; d9ad
wRuinsOfAlphOmanyteChamberTrigger::          ds 1 ; d9ae
wRuinsOfAlphAerodactylChamberTrigger::       ds 1 ; d9af
wRuinsOfAlphInnerChamberTrigger::            ds 1 ; d9b0
wMahoganyMart1FTrigger::                     ds 1 ; d9b1
wTeamRocketBaseB1FTrigger::                  ds 1 ; d9b2
wTeamRocketBaseB2FTrigger::                  ds 1 ; d9b3
wTeamRocketBaseB3FTrigger::                  ds 1 ; d9b4
wUndergroundPathSwitchRoomEntrancesTrigger:: ds 1 ; d9b5
wSilverCaveRoom3Trigger::                    ds 1 ; d9b6
wVictoryRoadTrigger::                        ds 1 ; d9b7
wDragonsDenB1FTrigger::                      ds 1 ; d9b8
wDragonShrineTrigger::                       ds 1 ; d9b9
wOlivinePortTrigger::                        ds 1 ; d9ba
wVermilionPortTrigger::                      ds 1 ; d9bb
wFastShip1FTrigger::                         ds 1 ; d9bc
wFastShipB1FTrigger::                        ds 1 ; d9bd
wMountMoonSquareTrigger::                    ds 1 ; d9be
wMobileTradeRoomMobileTrigger::              ds 1 ; d9bf
wMobileBattleRoomTrigger::                   ds 1 ; d9c0


SECTION "Events",WRAMX[$da72],BANK[1]

EventFlags:: ; da72
;RoomDecorations:: ; dac6
;TeamRocketAzaleaTownAttackEvent:: ; db51
;PoliceAtElmsLabEvent:: ; db52
;SalesmanMahoganyTownEvent:: ; db5c
;RedGyaradosEvent:: ; db5c
	ds 250
; db6c

SECTION "Boxes",WRAMX[$db72],BANK[1]

wCurBox:: ; db72
	ds 1

	ds 2

; 8 chars + $50
Box1Name:: ; db75
	ds 9
Box2Name:: ; db7e
	ds 9
Box3Name:: ; db87
	ds 9
Box4Name:: ; db90
	ds 9
Box5Name:: ; db99
	ds 9
Box6Name:: ; dba2
	ds 9
Box7Name:: ; dbab
	ds 9
Box8Name:: ; dbb4
	ds 9
Box9Name:: ; dbbd
	ds 9
Box10Name:: ; dbc6
	ds 9
Box11Name:: ; dbcf
	ds 9
Box12Name:: ; dbd8
	ds 9
Box13Name:: ; dbe1
	ds 9
Box14Name:: ; dbea
	ds 9

SECTION "bike", WRAMX[$dbf5],BANK[1]
BikeFlags:: ; dbf5
; bit 1: always on bike
; bit 2: downhill
	ds 1

SECTION "decorations", WRAMX[$dc0f],BANK[1]
; Sprite id of each decoration
Bed:: ; dc0f
	ds 1
Carpet:: ; dc10
	ds 1
Plant:: ; dc11
	ds 1
Poster:: ; dc12
	ds 1
Console:: ; dc13
	ds 1
LeftOrnament:: ; dc14
	ds 1
RightOrnament:: ; dc15
	ds 1
BigDoll:: ; dc16
	ds 1

SECTION "fruittrees", WRAMX[$dc27],BANK[1]
FruitTreeFlags:: ; dc27
	ds 1

SECTION "steps", WRAMX[$dc73],BANK[1]
StepCount:: ; dc73
	ds 1
PoisonStepCount:: ; dc74
	ds 1

SECTION "Visited Spawn Points", WRAMX[$dca5],BANK[1]
VisitedSpawns:: ; dca5
	ds 4

SECTION "BackupMapInfo", WRAMX[$dcad],BANK[1]

; used on maps like second floor pokécenter, which are reused, so we know which
; map to return to
BackupMapGroup:: ; dcad
	ds 1
BackupMapNumber:: ; dcae
	ds 1

SECTION "PlayerMapInfo", WRAMX[$dcb4],BANK[1]

WarpNumber:: ; dcb4
	ds 1
MapGroup:: ; dcb5
	ds 1 ; map group of current map
MapNumber:: ; dcb6
	ds 1 ; map number of current map
YCoord:: ; dcb7
	ds 1 ; current y coordinate relative to top-left corner of current map
XCoord:: ; dcb8
	ds 1 ; current x coordinate relative to top-left corner of current map

SECTION "PlayerParty",WRAMX[$dcd7],BANK[1]

PartyCount:: ; dcd7
	ds 1 ; number of Pokémon in party
PartySpecies:: ; dcd8
	ds 6 ; species of each Pokémon in party
PartyEnd:: ; dcde
	ds 1 ; legacy functions don't check PartyCount
		 
PartyMons::
PartyMon1:: ; dcdf
	party_struct PartyMon1
PartyMon2:: ; dd0f
	party_struct PartyMon2
PartyMon3:: ; dd3f
	party_struct PartyMon3
PartyMon4:: ; dd6f
	party_struct PartyMon4
PartyMon5:: ; dd9f
	party_struct PartyMon5
PartyMon6:: ; ddcf
	party_struct PartyMon6

PartyMonOT::
PartyMon1OT:: ; ddff
	ds 11
PartyMon2OT:: ; de0a
	ds 11
PartyMon3OT:: ; de15
	ds 11
PartyMon4OT:: ; de20
	ds 11
PartyMon5OT:: ; de2b
	ds 11
PartyMon6OT:: ; de36
	ds 11

PartyMonNicknames::
PartyMon1Nickname:: ; de41
	ds 11
PartyMon2Nickname:: ; de4c
	ds 11
PartyMon3Nickname:: ; de57
	ds 11
PartyMon4Nickname:: ; de62
	ds 11
PartyMon5Nickname:: ; de6d
	ds 11
PartyMon6Nickname:: ; de78
	ds 11
PartyMonNicknamesEnd::

SECTION "Pokedex",WRAMX[$de99],BANK[1]
PokedexCaught:: ; de99
	ds 32
EndPokedexCaught::
PokedexSeen:: ; deb9
	ds 32
EndPokedexSeen::
UnownDex:: ; ded9
	ds 26
UnlockedUnowns:: ; def3
	ds 1

SECTION "Breeding",WRAMX[$def5],BANK[1]
DaycareMan:: ; def5
; bit 7: active
; bit 6: monsters are compatible
; bit 5: egg ready
; bit 0: monster 1 in daycare
	ds 1

BreedMon1::
BreedMon1Nick:: ; def6
	ds 11
BreedMon1OT:: ; df01
	ds 11
BreedMon1Stats::
BreedMon1Species:: ; df0c
	ds 1
	ds 31

DaycareLady:: ; df2c
; bit 7: active
; bit 0: monster 2 in daycare
	ds 1

StepsToEgg:: ; df2d
	ds 1
DittoInDaycare:: ; df2e
;  z: yes
; nz: no
	ds 1

BreedMon2::
BreedMon2Nick:: ; df2f
	ds 11
BreedMon2OT:: ; df3a
	ds 11
BreedMon2Stats::
BreedMon2Species:: ; df45
	ds 1
	ds 31

EggNick:: ; df65
; EGG@
	ds 11
EggOT:: ; df70
	ds 11
EggStats::
EggSpecies:: ; df7b
	ds 1
	ds 31

	ds 1

wContestMon:: ; df9c
	party_struct wContestMon

	ds 3

RoamMon1Species:: ; dfcf
	ds 1
RoamMon1Level:: ; dfd0
	ds 1
RoamMon1MapGroup:: ; dfd1
	ds 1
RoamMon1MapNumber:: ; dfd2
	ds 1
RoamMon1HP:: ; dfd3
	ds 1
RoamMon1DVs:: ; dfd4
	ds 2

RoamMon2Species:: ; dfd6
	ds 1
RoamMon2Level:: ; dfd7
	ds 1
RoamMon2MapGroup:: ; dfd8
	ds 1
RoamMon2MapNumber:: ; dfd9
	ds 1
RoamMon2HP:: ; dfda
	ds 1
RoamMon2DVs:: ; dfdb
	ds 2

RoamMon3Species:: ; dfdd
	ds 1
RoamMon3Level:: ; dfde
	ds 1
RoamMon3MapGroup:: ; dfdf
	ds 1
RoamMon3MapNumber:: ; dfe0
	ds 1
RoamMon3HP:: ; dfe1
	ds 1
RoamMon3DVs:: ; dfe2
	ds 2



SECTION "WRAMBank5",WRAMX[$d000],BANK[5]

; 8 4-color palettes
Unkn1Pals:: ; d000
	ds $40
Unkn2Pals:: ; d040
	ds $40
BGPals:: ; d080
	ds $40
OBPals:: ; d0c0
	ds $40

LYOverrides:: ; d100
	ds 144
LYOverridesEnd::

	ds 112

LYOverridesBackup:: ; d200
	ds 144
LYOverridesBackupEnd::


SECTION "Battle Animations", WRAMX[$d30a], BANK[5]

ActiveAnimObjects:: ; d30a
	ds 4 * 40

	ds 80

ActiveBGEffects:: ; d3fa
	ds 4 * 5

	ds 1

BattleAnimFlags:: ; d40f
	ds 1
BattleAnimAddress:: ; d410
	ds 2
BattleAnimDuration:: ; d412
	ds 1
BattleAnimParent:: ; d413
	ds 2
BattleAnimLoops:: ; d415
	ds 1
BattleAnimVar:: ; d416
	ds 1
BattleAnimByte:: ; d417
	ds 1
	ds 1
BattleAnimTemps:: ; d419
	ds 8


SECTION "SRAMBank1",SRAM,BANK[1]

SECTION "BoxMons",SRAM[$ad10],BANK[1]
BoxCount:: ; ad10
	ds 1
BoxSpecies:: ; ad11
	ds 20
	ds 1
BoxMons::
BoxMon1::
BoxMon1Species:: ; ad26
	ds 1
BoxMon1Item:: ; ad27
	ds 1
BoxMon1Moves:: ; ad28
	ds 4
BoxMon1ID:: ; ad2c
	ds 2
BoxMon1Exp:: ; ad2e
	ds 3
BoxMon1HPExp:: ; ad31
	ds 2
BoxMon1AtkExp:: ; ad33
	ds 2
BoxMon1DefExp:: ; ad35
	ds 2
BoxMon1SpdExp:: ; ad37
	ds 2
BoxMon1SpcExp:: ; ad39
	ds 2
BoxMon1DVs:: ; ad3b
	ds 2
BoxMon1PP:: ; ad3d
	ds 4
BoxMon1Happiness:: ; ad41
	ds 1
BoxMon1PokerusStatus:: ; ad42
	ds 1
BoxMon1CaughtData::
BoxMon1CaughtTime::
BoxMon1CaughtLevel:: ; ad43
	ds 1
BoxMon1CaughtGender::
BoxMon1CaughtLocation:: ; ad44
	ds 1
BoxMon1Level:: ; ad45
	ds 1

BoxMon2:: ; ad46
	ds 32
BoxMon3:: ; ad66
	ds 32
BoxMon4:: ; ad86
	ds 32
BoxMon5:: ; ada6
	ds 32
BoxMon6:: ; adc6
	ds 32
BoxMon7:: ; ade6
	ds 32
BoxMon8:: ; ae06
	ds 32
BoxMon9:: ; ae26
	ds 32
BoxMon10:: ; ae46
	ds 32
BoxMon11:: ; ae66
	ds 32
BoxMon12:: ; ae86
	ds 32
BoxMon13:: ; aea6
	ds 32
BoxMon14:: ; aec6
	ds 32
BoxMon15:: ; aee6
	ds 32
BoxMon16:: ; af06
	ds 32
BoxMon17:: ; af26
	ds 32
BoxMon18:: ; af46
	ds 32
BoxMon19:: ; af66
	ds 32
BoxMon20:: ; af86
	ds 32

BoxMonOT::
BoxMon1OT:: ; afa6
	ds 11
BoxMon2OT:: ; afb1
	ds 11
BoxMon3OT:: ; afbc
	ds 11
BoxMon4OT:: ; afc7
	ds 11
BoxMon5OT:: ; afd2
	ds 11
BoxMon6OT:: ; afdd
	ds 11
BoxMon7OT:: ; afe8
	ds 11
BoxMon8OT:: ; aff3
	ds 11
BoxMon9OT:: ; affe
	ds 11
BoxMon10OT:: ; b009
	ds 11
BoxMon11OT:: ; b014
	ds 11
BoxMon12OT:: ; b01f
	ds 11
BoxMon13OT:: ; b02a
	ds 11
BoxMon14OT:: ; b035
	ds 11
BoxMon15OT:: ; b040
	ds 11
BoxMon16OT:: ; b04b
	ds 11
BoxMon17OT:: ; b056
	ds 11
BoxMon18OT:: ; b061
	ds 11
BoxMon19OT:: ; b06c
	ds 11
BoxMon20OT:: ; b077
	ds 11

BoxMonNicknames::
BoxMon1Nickname:: ; b082
	ds 11
BoxMon2Nickname:: ; b08d
	ds 11
BoxMon3Nickname:: ; b098
	ds 11
BoxMon4Nickname:: ; b0a3
	ds 11
BoxMon5Nickname:: ; b0ae
	ds 11
BoxMon6Nickname:: ; b0b9
	ds 11
BoxMon7Nickname:: ; b0c4
	ds 11
BoxMon8Nickname:: ; b0cf
	ds 11
BoxMon9Nickname:: ; b0da
	ds 11
BoxMon10Nickname:: ; b0e5
	ds 11
BoxMon11Nickname:: ; b0f0
	ds 11
BoxMon12Nickname:: ; b0fb
	ds 11
BoxMon13Nickname:: ; b106
	ds 11
BoxMon14Nickname:: ; b111
	ds 11
BoxMon15Nickname:: ; b11c
	ds 11
BoxMon16Nickname:: ; b127
	ds 11
BoxMon17Nickname:: ; b132
	ds 11
BoxMon18Nickname:: ; b13d
	ds 11
BoxMon19Nickname:: ; b148
	ds 11
BoxMon20Nickname:: ; b153
	ds 11
BoxMonNicknamesEnd::