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
|
INCLUDE "constants/wram_constants.asm"
SECTION "WRAM Bank 0", WRAM0
SECTION "Sprite State Data", WRAM0[$c100]
wSpriteStateData1:: ; c100
; data for all sprites on the current map
; holds info for 16 sprites with $10 bytes each
; player sprite is always sprite 0
; C1x0: picture ID (fixed, loaded at map init)
; C1x1: movement status (0: uninitialized, 1: ready, 2: delayed, 3: moving)
; C1x2: sprite image index (changed on update, $ff if off screen, includes facing direction, progress in walking animation and a sprite-specific offset)
; C1x3: Y screen position delta (-1,0 or 1; added to c1x4 on each walking animation update)
; C1x4: Y screen position (in pixels, always 4 pixels above grid which makes sprites appear to be in the center of a tile)
; C1x5: X screen position delta (-1,0 or 1; added to c1x6 on each walking animation update)
; C1x6: X screen position (in pixels, snaps to grid if not currently walking)
; C1x7: intra-animation-frame counter (counting upwards to 4 until c1x8 is incremented)
; C1x8: animation frame counter (increased every 4 updates, hold four states (totalling to 16 walking frames)
; C1x9: facing direction (0: down, 4: up, 8: left, $c: right)
; C1xA
; C1xB
; C1xC
; C1xD
; C1xE
; C1xF
ds $10 * $10
wSpriteStateData2:: ; c200
; more data for all sprites on the current map
; holds info for 16 sprites with $10 bytes each
; player sprite is always sprite 0
; C2x0: walk animation counter (counting from $10 backwards when moving)
; C2x1:
; C2x2: Y displacement (initialized at 8, supposed to keep moving sprites from moving too far, but bugged)
; C2x3: X displacement (initialized at 8, supposed to keep moving sprites from moving too far, but bugged)
; C2x4: Y position (in 2x2 tile grid steps, topmost 2x2 tile has value 4)
; C2x5: X position (in 2x2 tile grid steps, leftmost 2x2 tile has value 4)
; C2x6: movement byte 1 (determines whether a sprite can move, $ff:not moving, $fe:random movements, others unknown)
; C2x7: (?) (set to $80 when in grass, else $0; may be used to draw grass above the sprite)
; C2x8: delay until next movement (counted downwards, status (c1x1) is set to ready if reached 0)
; C2x9
; C2xA
; C2xB
; C2xC
; C2xD
; C2xE: sprite image base offset (in video ram, player always has value 1, used to compute c1x2)
; C2xF
ds $10 * $10
wOAMBuffer:: ; c300
; buffer for OAM data. Copied to OAM by DMA
ds 4 * 40
SECTION "Tile Map", WRAM0[$c3a0]
wTileMap:: ; c3a0
; buffer for tiles that are visible on screen (20 columns by 18 rows)
ds 20 * 18
wTileMapBackup:: ; c508
; buffer for temporarily saving and restoring current screen's tiles
; (e.g. if menus are drawn on top)
ds 20 * 18
; c670
SECTION "Screen Edge Tiles", WRAM0[$cbfc]
wScreenEdgeTiles:: ; cbfc
; the tiles of the row or column to be redrawn by RedrawExposedScreenEdge
ds 20 * 2
; coordinates of the position of the cursor for the top menu item (id 0)
wTopMenuItemY:: ; cc24
ds 1
wTopMenuItemX:: ; cc25
ds 1
wCurrentMenuItem:: ; cc26
; the id of the currently selected menu item
; the top item has id 0, the one below that has id 1, etc.
; note that the "top item" means the top item currently visible on the screen
; add this value to [wListScrollOffset] to get the item's position within the list
ds 1
wTileBehindCursor:: ; cc27
; the tile that was behind the menu cursor's current location
ds 1
wMaxMenuItem:: ; cc28
; id of the bottom menu item
ds 1
wMenuWatchedKeys:: ; cc29
; bit mask of keys that the menu will respond to
ds 1
wLastMenuItem:: ; cc2a
; id of previously selected menu item
ds 1
; cc2b
ds 3
wPlayerMoveListIndex:: ; cc2e
ds 1
wPlayerMonNumber:: ; cc2f
ds 1
wMenuCursorLocation:: ; cc30
; the address of the menu cursor's current location within wTileMap
ds 2
ds 2
wMenuJoypadPollCount:: ; cc34
; how many times should HandleMenuInput poll the joypad state before it returns?
ds 1
ds 1
wListScrollOffset:: ; cc36
; offset of the current top menu item from the beginning of the list
; keeps track of what section of the list is on screen
ds 1
ds 19
wMenuWrappingEnabled:: ; cc4a
; set to 1 if you can go from the bottom to the top or top to bottom of a menu
; set to 0 if you can't go past the top or bottom of the menu
ds 1
ds 10
wTrainerHeaderFlagBit:: ; cc55
ds 1
; cc56
SECTION "RLE", WRAM0[$ccd2]
wRLEByteCount:: ; ccd2
ds 1
ds 4
; current HP of player and enemy substitutes
wPlayerSubstituteHP:: ; ccd7
ds 1
wEnemySubstituteHP:: ; ccd8
ds 1
ds 2
wMoveMenuType:: ; ccdb
; 0=regular, 1=mimic, 2=above message box (relearn, heal pp..)
ds 1
wPlayerSelectedMove:: ; ccdc
ds 1
wEnemySelectedMove:: ; ccdd
ds 1
ds 1
wAICount:: ; ccdf
; number of times remaining that AI action can occur
ds 1
ds 2
wEnemyMoveListIndex:: ; cce2
ds 1
; cce3
SECTION "Stat Modifiers", WRAM0[$cd1a]
; stat modifiers for the player's current pokemon
; value can range from 1 - 13 ($1 to $D)
; 7 is normal
wPlayerMonStatMods::
wPlayerMonAttackMod:: ; cd1a
ds 1
wPlayerMonDefenseMod:: ; cd1b
ds 1
wPlayerMonSpeedMod:: ; cd1c
ds 1
wPlayerMonSpecialMod:: ; cd1d
ds 1
wPlayerMonAccuracyMod:: ; cd1e
ds 1
wPlayerMonEvasionMod:: ; cd1f
ds 1
ds 13
wEngagedTrainerClass:: ; cd2d
ds 1
wEngagedTrainerSet:: ; cd2e
; ds 1
; stat modifiers for the enemy's current pokemon
; value can range from 1 - 13 ($1 to $D)
; 7 is normal
wEnemyMonStatMods::
wEnemyMonAttackMod:: ; cd2e
ds 1
wEnemyMonDefenseMod:: ; cd2f
ds 1
wEnemyMonSpeedMod:: ; cd30
ds 1
wEnemyMonSpecialMod:: ; cd31
ds 1
wEnemyMonAccuracyMod:: ; cd32
ds 1
wEnemyMonEvasionMod:: ; cd33
ds 1
ds 9
wWhichTrade:: ; cd3d
; which entry from TradeMons to select
; ds 1
wTrainerSpriteOffset:: ; cd3d
ds 1
wTrainerEngageDistance:: ; cd3e
ds 1
wTrainerFacingDirection:: ; cd3f
ds 1
wTrainerScreenY:: ; cd40
ds 1
wTrainerScreenX:: ; cd41
ds 1
ds 30
wFlags_0xcd60:: ; cd60
; bit 0: is player engaged by trainer (to avoid being engaged by multiple trainers simultaniously)
ds 1
ds 10
wJoypadForbiddenButtonsMask:: ; cd6b
; bit 1 means button presses will be ignored for that button
ds 1
ds 21
wTileMapBackup2:: ; cd81
; second buffer for temporarily saving and restoring current screen's tiles (e.g. if menus are drawn on top)
ds 20 * 18
wBuffer:: ; cee9
; used for temporary things
wHPBarMaxHP:: ; cee9
ds 2
wHPBarOldHP:: ; ceeb
ds 2
wHPBarNewHP:: ; ceed
ds 2
wHPBarDelta:: ; ceef
ds 1
ds 13
wHPBarHPDifference:: ; cefd
ds 1
ds 9
wAnimSoundID:: ; cf07
; sound ID during battle animations
ds 1
ds 12
wCurSpriteMovement2:: ; cf14
; movement byte 2 of current sprite
ds 1
ds 74
wGymCityName:: ; cf5f
wStringBuffer1:: ; cf5f
ds 16 + 1
wGymLeaderName:: ; cf70
wStringBuffer2:: ; cf70
ds 16 + 1
wStringBuffer3:: ; cf81
ds 16 + 1
wWhichPokemon:: ; cf92
; which pokemon you selected
ds 1
ds 1
wListMenuID:: ; cf94
; ID used by DisplayListMenuID
ds 1
ds 48
wWalkCounter:: ; cfc5
; walk animation counter
ds 1
ds 1
wMusicHeaderPointer:: ; cfc7
; (the current music channel address - $4000) / 3
ds 1
ds 4
W_ENEMYMOVENUM:: ; cfcc
ds 1
W_ENEMYMOVEEFFECT:: ; cfcd
ds 1
W_ENEMYMOVEPOWER:: ; cfce
ds 1
W_ENEMYMOVETYPE:: ; cfcf
ds 1
W_ENEMYMOVEACCURACY:: ; cfd0
ds 1
W_ENEMYMOVEMAXPP:: ; cfd1
ds 1
W_PLAYERMOVENUM:: ; cfd2
ds 1
W_PLAYERMOVEEFFECT:: ; cfd3
ds 1
W_PLAYERMOVEPOWER:: ; cfd4
ds 1
W_PLAYERMOVETYPE:: ; cfd5
ds 1
W_PLAYERMOVEACCURACY:: ; cfd6
ds 1
W_PLAYERMOVEMAXPP:: ; cfd7
ds 1
W_ENEMYMONID:: ; cfd8
ds 1
ds 1
W_ENEMYMONNAME:: ; cfda
ds 11
ds 1
W_ENEMYMONCURHP:: ; cfe6
; active opponent's hp (16 bits)
ds 2
W_ENEMYMONNUMBER:: ; cfe8
; active opponent's position in team (0 to 5)
ds 1
W_ENEMYMONSTATUS:: ; cfe9
; active opponent's status condition
ds 1
W_ENEMYMONTYPES:: ; cfea
W_ENEMYMONTYPE1:: ; cfea
ds 1
W_ENEMYMONTYPE2:: ; cfeb
ds 1
ds 1
W_ENEMYMONMOVES:: ; cfed
ds 4
W_ENEMYMONATKDEFIV:: ; cff1
ds 1
W_ENEMYMONSPDSPCIV:: ; cff2
ds 1
W_ENEMYMONLEVEL:: ; cff3
ds 1
W_ENEMYMONMAXHP:: ; cff4
ds 2
W_ENEMYMONATTACK:: ; cff6
ds 2
W_ENEMYMONDEFENSE:: ; cff8
ds 2
W_ENEMYMONSPEED:: ; cffa
ds 2
W_ENEMYMONSPECIAL:: ; cffc
ds 2
W_ENEMYMONPP:: ; cffe
; four moves (extends past $cfff)
ds 2
SECTION "WRAM Bank 1", WRAMX, BANK[1]
ds 2 ; W_ENEMYMONPP
ds 7
W_PLAYERMONNAME:: ; d009
ds 11
W_PLAYERMONID:: ; d014
ds 1
W_PLAYERMONCURHP:: ; d015
ds 2
ds 1
W_PLAYERMONSTATUS:: ; d018
; the status of the player’s current monster
ds 1
W_PLAYERMONTYPES:: ; d019
W_PLAYERMONTYPE1:: ; d019
ds 1
W_PLAYERMONTYPE2:: ; d01a
ds 1
ds 1
W_PLAYERMONMOVES:: ; d01c
ds 4
W_PLAYERMONIVS:: ; d020
; 4x 4 bit: atk, def, spd, spc
ds 2
W_PLAYERMONLEVEL:: ; d022
ds 1
W_PLAYERMONMAXHP:: ; d023
ds 2
W_PLAYERMONATK:: ; d025
ds 2
W_PLAYERMONDEF:: ; d027
ds 2
W_PLAYERMONSPEED:: ; d029
ds 2
W_PLAYERMONSPECIAL:: ; d02b
ds 2
W_PLAYERMONPP:: ; d02d
ds 4
W_TRAINERCLASS:: ; d031
ds 1
ds 24
W_TRAINERNAME:: ; d04a
; 13 bytes for the letters of the opposing trainer
; the name is terminated with $50 with possible
; unused trailing letters
ds 13
W_ISINBATTLE:: ; d057
; no battle, this is 0
; wild battle, this is 1
; trainer battle, this is 2
ds 1
W_PLAYERMONSALIVEFLAGS:: ; d058
; 6 bit array, 1 if player mon is alive
ds 1
W_CUROPPONENT:: ; d059
; in a wild battle, this is the species of pokemon
; in a trainer battle, this is the trainer class + $C8
ds 1
W_BATTLETYPE:: ; d05a
; in normal battle, this is 0
; in old man battle, this is 1
; in safari battle, this is 2
ds 1
ds 1
W_LONEATTACKNO:: ; d05c
; which entry in LoneAttacks to use
W_GYMLEADERNO:: ; d05c
; it's actually the same thing as ^
ds 1
W_TRAINERNO:: ; d05d
; which instance of [youngster, lass, etc] is this?
ds 1
ds 1
W_MOVEMISSED:: ; d05f
ds 1
ds 2
W_PLAYERBATTSTATUS1:: ; d062
; bit 0 - bide
; bit 1 - thrash / petal dance
; bit 2 - attacking multiple times (e.g. double kick)
; bit 3 - flinch
; bit 4 - charging up for attack
; bit 5 - using multi-turn move (e.g. wrap)
; bit 6 - invulnerable to normal attack (using fly/dig)
; bit 7 - confusion
ds 1
W_PLAYERBATTSTATUS2:: ; d063
; bit 0 - X Accuracy effect
; bit 1 - protected by "mist"
; bit 2 - focus energy effect
; bit 4 - has a substitute
; bit 5 - need to recharge
; bit 6 - rage
; bit 7 - leech seeded
ds 1
W_PLAYERBATTSTATUS3:: ; d064
; bit 0 - toxic
; bit 1 - light screen
; bit 2 - reflect
; bit 3 - tranformed
ds 1
ds 2
W_ENEMYBATTSTATUS1:: ; d067
ds 1
W_ENEMYBATTSTATUS2:: ; d068
ds 1
W_ENEMYBATTSTATUS3:: ; d069
ds 1
ds 2
W_PLAYERTOXICCOUNTER:: ; d06c
ds 1
W_PLAYERDISABLEDMOVE:: ; d06d
ds 1
ds 3
W_ENEMYTOXICCOUNTER:: ; d071
ds 1
W_ENEMYDISABLEDMOVE:: ; d072
ds 1
ds 1
W_NUMHITS:: ; d074
; number of hits in attacks like Doubleslap, etc.
ds 1
ds 7
W_ANIMATIONID:: ; d07c
; ID number of the current battle animation
ds 1
ds 4
; base coordinates of frame block
W_BASECOORDX:: ; d081
ds 1
W_BASECOORDY:: ; d082
ds 1
ds 1
W_FBTILECOUNTER:: ; d084
; counts how many tiles of the current frame block have been drawn
ds 1
ds 1
W_SUBANIMFRAMEDELAY:: ; d086
; duration of each frame of the current subanimation in terms of screen refreshes
ds 1
W_SUBANIMCOUNTER:: ; d087
; counts the number of subentries left in the current subanimation
ds 1
ds 1
W_NUMFBTILES:: ; d089
; number of tiles in current battle animation frame block
ds 1
ds 1
W_SUBANIMTRANSFORM:: ; d08b
; controls what transformations are applied to the subanimation
; 01: flip horizontally and vertically
; 02: flip horizontally and translate downwards 40 pixels
; 03: translate base coordinates of frame blocks, but don't change their internal coordinates or flip their tiles
; 04: reverse the subanimation
ds 1
W_PBSTOREDREGISTERH:: ; d08c
ds 1
W_PBSTOREDREGISTERL:: ; d08d
ds 1
W_PBSTOREDREGISTERD:: ; d08e
ds 1
W_PBSTOREDREGISTERE:: ; d08f
ds 1
ds 2
W_PBSTOREDROMBANK:: ; d092
ds 1
ds 1
W_SUBANIMADDRPTR:: ; d094
; the address _of the address_ of the current subanimation entry
ds 2
W_SUBANIMSUBENTRYADDR:: ; d096
; the address of the current subentry of the current subanimation
ds 2
ds 4
W_FBDESTADDR:: ; d09c
; current destination address in OAM for frame blocks (big endian)
ds 2
W_FBMODE:: ; d09e
; controls how the frame blocks are put together to form frames
; specifically, after finishing drawing the frame block, the frame block's mode determines what happens
; 00: clean OAM buffer and delay
; 02: move onto the next frame block with no delay and no cleaning OAM buffer
; 03: delay, but don't clean OAM buffer
; 04: delay, without cleaning OAM buffer, and do not advance [W_FBDESTADDR], so that the next frame block will overwrite this one
; sprite data is written column by column, each byte contains 8 columns (one for ech bit)
; for 2bpp sprites, pairs of two consecutive bytes (i.e. pairs of consecutive rows of sprite data)
; contain the upper and lower bit of each of the 8 pixels, respectively
ds 1
SECTION "Sprite Buffers", SRAM
S_SPRITEBUFFER0:: ; a000
ds SPRITEBUFFERSIZE
S_SPRITEBUFFER1:: ; a188
ds SPRITEBUFFERSIZE
S_SPRITEBUFFER2:: ; a310
ds SPRITEBUFFERSIZE
SECTION "Sprites", WRAMX[$d0a1], BANK[1]
W_SPRITECURPOSX:: ; d0a1
ds 1
W_SPRITECURPOSY:: ; d0a2
ds 1
W_SPRITEWITDH:: ; d0a3
ds 1
W_SPRITEHEIGHT:: ; d0a4
ds 1
W_SPRITEINPUTCURBYTE:: ; d0a5
; current input byte
ds 1
W_SPRITEINPUTBITCOUNTER:: ; d0a6
; bit offset of last read input bit
ds 1
W_SPRITEOUTPUTBITOFFSET:: ; d0a7; determines where in the output byte the two bits are placed. Each byte contains four columns (2bpp data)
; 3 -> XX000000 1st column
; 2 -> 00XX0000 2nd column
; 1 -> 0000XX00 3rd column
; 0 -> 000000XX 4th column
ds 1
W_SPRITELOADFLAGS:: ; d0a8
; bit 0 determines used buffer (0 -> $a188, 1 -> $a310)
; bit 1 loading last sprite chunk? (there are at most 2 chunks per load operation)
ds 1
W_SPRITEUNPACKMODE:: ; d0a9
ds 1
W_SPRITEFLIPPED:: ; d0aa
ds 1
W_SPRITEINPUTPTR:: ; d0ab
; pointer to next input byte
ds 2
W_SPRITEOUTPUTPTR:: ; d0ad
; pointer to current output byte
ds 2
W_SPRITEOUTPUTPTRCACHED:: ; d0af
; used to revert pointer for different bit offsets
ds 2
W_SPRITEDECODETABLE0PTR:: ; d0b1
; pointer to differential decoding table (assuming initial value 0)
ds 2
W_SPRITEDECODETABLE1PTR:: ; d0b3
; pointer to differential decoding table (assuming initial value 1)
ds 2
ds 1
W_LISTTYPE:: ; d0b6
ds 1
ds 1
W_MONHEADER:: ; d0b8
W_MONHDEXNUM:: ; d0b8
ds 1
W_MONHBASESTATS:: ; d0b9
W_MONHBASEHP:: ; d0b9
ds 1
W_MONHBASEATTACK:: ; d0ba
ds 1
W_MONHBASEDEFENSE:: ; d0bb
ds 1
W_MONHBASESPEED:: ; d0bc
ds 1
W_MONHBASESPECIAL:: ; d0bd
ds 1
W_MONHTYPES:: ; d0be
W_MONHTYPE1:: ; d0be
ds 1
W_MONHTYPE2:: ; d0bf
ds 1
W_MONHCATCHRATE:: ; d0c0
ds 1
W_MONHBASEXP:: ; d0c1
ds 1
W_MONHSPRITEDIM:: ; d0c2
ds 1
W_MONHFRONTSPRITE:: ; d0c3
ds 2
W_MONHBACKSPRITE:: ; d0c5
ds 2
W_MONHMOVES:: ; d0c7
ds 4
W_MONHGROWTHRATE:: ; d0cb
ds 1
W_MONHLEARNSET:: ; d0cc
; bit field
ds 7
ds 4
W_MONHPADDING:: ; d0d7
W_DAMAGE:: ; d0d7
ds 1
ds 79
W_CURENEMYLVL:: ; d127
ds 1
ds 3
W_ISLINKBATTLE:: ; d12b
ds 1
ds 17
W_PRIZE1:: ; d13d
ds 1
W_PRIZE2:: ; d13e
ds 1
W_PRIZE3:: ; d13f
ds 1
ds 24
W_PLAYERNAME:: ; d158
ds 11
W_NUMINPARTY:: ; d163
ds 1
W_PARTYMON1:: ; d164
ds 1
W_PARTYMON2:: ; d165
ds 1
W_PARTYMON3:: ; d166
ds 1
W_PARTYMON4:: ; d167
ds 1
W_PARTYMON5:: ; d168
ds 1
W_PARTYMON6:: ; d169
ds 1
W_PARTYMONEND:: ; d16a
ds 1
W_PARTYMON1DATA:: ; d16b
W_PARTYMON1_NUM:: ; d16b
ds 1
W_PARTYMON1_HP:: ; d16c
ds 2
W_PARTYMON1_BOXLEVEL:: ; d16e
ds 1
W_PARTYMON1_STATUS:: ; d16f
ds 1
W_PARTYMON1_TYPE1:: ; d170
ds 1
W_PARTYMON1_TYPE2:: ; d171
ds 1
W_PARTYMON1_CRATE:: ; d172
ds 1
W_PARTYMON1_MOVE1:: ; d173
ds 1
W_PARTYMON1_MOVE2:: ; d174
ds 1
W_PARTYMON1_MOVE3:: ; d175
ds 1
W_PARTYMON1_MOVE4:: ; d176
ds 1
W_PARTYMON1_OTID:: ; d177
ds 2
W_PARTYMON1_EXP:: ; d179
ds 3
W_PARTYMON1_EVHP:: ; d17c
ds 2
W_PARTYMON1_EVATTACK:: ; d17e
ds 2
W_PARTYMON1_EVDEFENSE:: ; d180
ds 2
W_PARTYMON1_EVSPEED:: ; d182
ds 2
W_PARTYMON1_EVSECIAL:: ; d184
ds 2
W_PARTYMON1_IV:: ; d186
ds 2
W_PARTYMON1_MOVE1PP:: ; d188
ds 1
W_PARTYMON1_MOVE2PP:: ; d189
ds 1
W_PARTYMON1_MOVE3PP:: ; d18a
ds 1
W_PARTYMON1_MOVE4PP:: ; d18b
ds 1
W_PARTYMON1_LEVEL:: ; d18c
ds 1
W_PARTYMON1_MAXHP:: ; d18d
ds 2
W_PARTYMON1_ATACK:: ; d18f
ds 2
W_PARTYMON1_DEFENSE:: ; d191
ds 2
W_PARTYMON1_SPEED:: ; d193
ds 2
W_PARTYMON1_SPECIAL:: ; d195
ds 2
W_PARTYMON2DATA:: ; d197
ds 44
W_PARTYMON3DATA:: ; d1c3
ds 44
W_PARTYMON4DATA:: ; d1ef
ds 44
W_PARTYMON5DATA:: ; d21b
ds 44
W_PARTYMON6DATA:: ; d247
ds 44
W_PARTYMON1OT:: ; d273
ds 11
W_PARTYMON2OT:: ; d27e
ds 11
W_PARTYMON3OT:: ; d289
ds 11
W_PARTYMON4OT:: ; d294
ds 11
W_PARTYMON5OT:: ; d29f
ds 11
W_PARTYMON6OT:: ; d2aa
ds 11
W_PARTYMON1NAME:: ; d2b5
ds 11
W_PARTYMON2NAME:: ; d2c0
ds 11
W_PARTYMON3NAME:: ; d2cb
ds 11
W_PARTYMON4NAME:: ; d2d6
ds 11
W_PARTYMON5NAME:: ; d2e1
ds 11
W_PARTYMON6NAME:: ; d2ec
ds 11
SECTION "Pokedex", WRAMX[$d2f7], BANK[1]
wPokedexOwned:: ; d2f7
ds (150 / 8) + 1
wPokedexOwnedEnd::
wPokedexSeen:: ; d30a
ds (150 / 8) + 1
wPokedexSeenEnd::
wNumBagItems:: ; d31d
ds 1
wBagItems:: ; d31e
; item, quantity
ds 20 * 2
ds 1 ; end
; money is in decimal
wPlayerMoney:: ; d347
ds 3
W_RIVALNAME:: ; d34a
ds 11
W_OPTIONS:: ; d355
; bit 7 = battle animation
; 0: On
; 1: Off
; bit 6 = battle style
; 0: Shift
; 1: Set
; bits 0-3 = text speed (number of frames to delay after printing a letter)
; 1: Fast
; 3: Medium
; 5: Slow
ds 1
W_OBTAINEDBADGES:: ; d356
ds 1
ds 2
wPlayerID:: ; d359
ds 2
ds 3
W_CURMAP:: ; d35e
ds 1
ds 2
W_YCOORD:: ; d361
; player’s position on the current map
ds 1
W_XCOORD:: ; d362
ds 1
W_YBLOCKCOORD:: ; d363
; player's y position (by block)
ds 1
W_XBLOCKCOORD:: ; d364
ds 1
wLastMap:: ; d365
ds 1
ds 1
W_CURMAPTILESET:: ; d367
ds 1
W_CURMAPHEIGHT:: ; d368
; blocks
ds 1
W_CURMAPWIDTH:: ; d369
; blocks
ds 1
W_MAPDATAPTR:: ; d36a
ds 2
W_MAPTEXTPTR:: ; d36c
ds 2
W_MAPSCRIPTPTR:: ; d36e
ds 2
W_MAPCONNECTIONS:: ; d370
; connection byte
ds 1
W_MAPCONN1PTR:: ; d371
ds 2
ds 9
W_MAPCONN2PTR:: ; d37c
ds 2
ds 9
W_MAPCONN3PTR:: ; d387
ds 2
ds 9
W_MAPCONN4PTR:: ; d392
ds 2
ds 9
W_SPRITESET:: ; d39d
; sprite set for the current map (11 sprite picture ID's)
ds 11
W_SPRITESETID:: ; d3a8
; sprite set ID for the current map
ds 1
ds 312
W_NUMSPRITES:: ; d4e1
; number of sprites on the current map
; two bytes per sprite (movement byte 2 , text ID)
ds 3
W_MAPSPRITEDATA:: ; d4e4
; two bytes per sprite (trainer class/item ID , trainer set ID)
ds 32
W_MAPSPRITEEXTRADATA:: ; d504
ds 39
W_TILESETBANK:: ; d52b
ds 1
W_TILESETBLOCKSPTR:: ; d52c
; maps blocks (4x4 tiles) to tiles
ds 2
W_TILESETGFXPTR:: ; d52e
ds 2
W_TILESETCOLLISIONPTR:: ; d530
; list of all walkable tiles
ds 2
W_TILESETTALKINGOVERTILES:: ; d532
ds 3
W_GRASSTILE:: ; d535
ds 1
SECTION "Items", WRAMX[$d53a], BANK[1]
wNumBoxItems:: ; d53a
ds 1
wBoxItems:: ; d53b
; item, quantity
ds 50 * 2
ds 1 ; end
ds 4
; coins are in decimal
wPlayerCoins:: ; d5a4
ds 2
W_MISSABLEOBJECTFLAGS:: ; d5a6
; bit array of missable objects. set = removed
ds 40
W_MISSABLEOBJECTLIST:: ; d5ce
; each entry consists of 2 bytes
; * the sprite ID (depending on the current map)
; * the missable object index (global, used for W_MISSABLEOBJECTFLAGS)
; terminated with $FF
ds 17 * 2
W_GAMEPROGRESSFLAGS:: ; d5f0
; $c8 bytes
ds 0
W_OAKSLABCURSCRIPT:: ; d5f0
ds 1
W_PALLETTOWNCURSCRIPT:: ; d5f1
ds 1
ds 1
W_BLUESHOUSECURSCRIPT:: ; d5f3
ds 1
W_VIRIDIANCITYCURSCRIPT:: ; d5f4
ds 1
ds 2
W_PEWTERCITYCURSCRIPT:: ; d5f7
ds 1
W_ROUTE3CURSCRIPT:: ; d5f8
ds 1
W_ROUTE4CURSCRIPT:: ; d5f9
ds 1
ds 1
W_VIRIDIANGYMCURSCRIPT:: ; d5fb
ds 1
W_PEWTERGYMCURSCRIPT:: ; d5fc
ds 1
W_CERULEANGYMCURSCRIPT:: ; d5fd
ds 1
W_VERMILIONGYMCURSCRIPT:: ; d5fe
ds 1
W_CELADONGYMCURSCRIPT:: ; d5ff
ds 1
W_ROUTE6CURSCRIPT:: ; d600
ds 1
W_ROUTE8CURSCRIPT:: ; d601
ds 1
W_ROUTE24CURSCRIPT:: ; d602
ds 1
W_ROUTE25CURSCRIPT:: ; d603
ds 1
W_ROUTE9CURSCRIPT:: ; d604
ds 1
W_ROUTE10CURSCRIPT:: ; d605
ds 1
W_MTMOON1CURSCRIPT:: ; d606
ds 1
W_MTMOON3CURSCRIPT:: ; d607
ds 1
W_SSANNE8CURSCRIPT:: ; d608
ds 1
W_SSANNE9CURSCRIPT:: ; d609
ds 1
W_ROUTE22CURSCRIPT:: ; d60a
ds 1
ds 1
W_REDSHOUSE2CURSCRIPT:: ; d60c
ds 1
W_VIRIDIANMARKETCURSCRIPT:: ; d60d
ds 1
W_ROUTE22GATECURSCRIPT:: ; d60e
ds 1
W_CERULEANCITYCURSCRIPT:: ; d60f
ds 1
ds 7
W_SSANNE5CURSCRIPT:: ; d617
ds 1
W_VIRIDIANFORESTCURSCRIPT:: ; d618
ds 1
W_MUSEUM1FCURSCRIPT:: ; d619
ds 1
W_ROUTE13CURSCRIPT:: ; d61a
ds 1
W_ROUTE14CURSCRIPT:: ; d61b
ds 1
W_ROUTE17CURSCRIPT:: ; d61c
ds 1
W_ROUTE19CURSCRIPT:: ; d61d
ds 1
W_ROUTE21CURSCRIPT:: ; d61e
ds 1
W_SAFARIZONEENTRANCECURSCRIPT:: ; d61f
ds 1
W_ROCKTUNNEL2CURSCRIPT:: ; d620
ds 1
W_ROCKTUNNEL1CURSCRIPT:: ; d621
ds 1
ds 1
W_ROUTE11CURSCRIPT:: ; d623
ds 1
W_ROUTE12CURSCRIPT:: ; d624
ds 1
W_ROUTE15CURSCRIPT:: ; d625
ds 1
W_ROUTE16CURSCRIPT:: ; d626
ds 1
W_ROUTE18CURSCRIPT:: ; d627
ds 1
W_ROUTE20CURSCRIPT:: ; d628
ds 1
W_SSANNE10CURSCRIPT:: ; d629
ds 1
W_VERMILIONCITYCURSCRIPT:: ; d62a
ds 1
W_POKEMONTOWER2CURSCRIPT:: ; d62b
ds 1
W_POKEMONTOWER3CURSCRIPT:: ; d62c
ds 1
W_POKEMONTOWER4CURSCRIPT:: ; d62d
ds 1
W_POKEMONTOWER5CURSCRIPT:: ; d62e
ds 1
W_POKEMONTOWER6CURSCRIPT:: ; d62f
ds 1
W_POKEMONTOWER7CURSCRIPT:: ; d630
ds 1
W_ROCKETHIDEOUT1CURSCRIPT:: ; d631
ds 1
W_ROCKETHIDEOUT2CURSCRIPT:: ; d632
ds 1
W_ROCKETHIDEOUT3CURSCRIPT:: ; d633
ds 1
W_ROCKETHIDEOUT4CURSCRIPT:: ; d634
ds 2
W_ROUTE6GATECURSCRIPT:: ; d636
ds 1
W_ROUTE8GATECURSCRIPT:: ; d637
ds 2
W_CINNABARISLANDCURSCRIPT:: ; d639
ds 1
W_MANSION1CURSCRIPT:: ; d63a
ds 2
W_MANSION2CURSCRIPT:: ; d63c
ds 1
W_MANSION3CURSCRIPT:: ; d63d
ds 1
W_MANSION4CURSCRIPT:: ; d63e
ds 1
W_VICTORYROAD2CURSCRIPT:: ; d63f
ds 1
W_VICTORYROAD3CURSCRIPT:: ; d640
ds 2
W_FIGHTINGDOJOCURSCRIPT:: ; d642
ds 1
W_SILPHCO2CURSCRIPT:: ; d643
ds 1
W_SILPHCO3CURSCRIPT:: ; d644
ds 1
W_SILPHCO4CURSCRIPT:: ; d645
ds 1
W_SILPHCO5CURSCRIPT:: ; d646
ds 1
W_SILPHCO6CURSCRIPT:: ; d647
ds 1
W_SILPHCO7CURSCRIPT:: ; d648
ds 1
W_SILPHCO8CURSCRIPT:: ; d649
ds 1
W_SILPHCO9CURSCRIPT:: ; d64a
ds 1
W_HALLOFFAMEROOMCURSCRIPT:: ; d64b
ds 1
W_GARYCURSCRIPT:: ; d64c
ds 1
W_LORELEICURSCRIPT:: ; d64d
ds 1
W_BRUNOCURSCRIPT:: ; d64e
ds 1
W_AGATHACURSCRIPT:: ; d64f
ds 1
W_UNKNOWNDUNGEON3CURSCRIPT:: ; d650
ds 1
W_VICTORYROAD1CURSCRIPT:: ; d651
ds 1
ds 1
W_LANCECURSCRIPT:: ; d653
ds 1
ds 4
W_SILPHCO10CURSCRIPT:: ; d658
ds 1
W_SILPHCO11CURSCRIPT:: ; d659
ds 1
ds 1
W_FUCHSIAGYMCURSCRIPT:: ; d65b
ds 1
W_SAFFRONGYMCURSCRIPT:: ; d65c
ds 1
ds 1
W_CINNABARGYMCURSCRIPT:: ; d65e
ds 1
W_CELADONGAMECORNERCURSCRIPT:: ; d65f
ds 1
W_ROUTE16GATECURSCRIPT:: ; d660
ds 1
W_BILLSHOUSECURSCRIPT:: ; d661
ds 1
W_ROUTE5GATECURSCRIPT:: ; d662
ds 1
W_POWERPLANTCURSCRIPT:: ; d663
; overload
ds 0
W_ROUTE7GATECURSCRIPT:: ; d663
; overload
ds 1
ds 1
W_SSANNE2CURSCRIPT:: ; d665
ds 1
W_SEAFOAMISLANDS4CURSCRIPT:: ; d666
ds 1
W_ROUTE23CURSCRIPT:: ; d667
ds 1
W_SEAFOAMISLANDS5CURSCRIPT:: ; d668
ds 1
W_ROUTE18GATECURSCRIPT:: ; d669
ds 1
ds 161
W_TOWNVISITEDFLAG:: ; d70b
; 2 bytes bit array, 1 means visited
ds 2
wSafariSteps:: ; d70d
; starts at 502
ds 2
W_FOSSILITEM:: ; d70f
; item given to cinnabar lab
ds 1
W_FOSSILMON:: ; d710
; mon that will result from the item
ds 1
ds 2
W_ENEMYMONORTRAINERCLASS:: ; d713
; trainer classes start at $c8
ds 1
ds 1
W_RIVALSTARTER:: ; d715
ds 1
ds 1
W_PLAYERSTARTER:: ; d717
ds 1
ds 1
wLastBlackoutMap:: ; d719
ds 1
ds 25
W_FLAGS_D733:: ; d733
; bit 4: use variable [W_CURMAPSCRIPT] instead of the provided index for next frame's map script (used to start battle when talking to trainers)
ds 340
W_GRASSRATE:: ; d887
ds 1
W_GRASSMONS:: ; d888
ds 20
wEnemyPartyCount:: ; d89c
ds 1
wEnemyPartyMons:: ; d89d
ds 6
ds 1 ; end
wEnemyMons::
wEnemyMon1:: ; d8a4
wEnemyMon1Species:: ; d8a4
ds 1
W_ENEMYMON1HP:: ; d8a5
ds 2
ds 7
W_ENEMYMON1MOVE3:: ; d8ae
ds 44
W_ENEMYMON2MOVE3:: ; d8da
ds 44
W_ENEMYMON3MOVE3:: ; d906
ds 44
W_ENEMYMON4MOVE3:: ; d932
ds 44
W_ENEMYMON5MOVE3:: ; d95e
ds 44
W_ENEMYMON6MOVE3:: ; d98a
ds 34
W_ENEMYMON1OT:: ; d9ac
ds 11
W_ENEMYMON2OT:: ; d9b7
ds 11
W_ENEMYMON3OT:: ; d9c2
ds 11
W_ENEMYMON4OT:: ; d9cd
ds 11
W_ENEMYMON5OT:: ; d9d8
ds 11
W_ENEMYMON6OT:: ; d9e3
ds 11
W_ENEMYMON1NAME:: ; d9ee
ds 11
W_ENEMYMON2NAME:: ; d9f9
ds 11
W_ENEMYMON3NAME:: ; da04
ds 11
W_ENEMYMON4NAME:: ; da0f
ds 11
W_ENEMYMON5NAME:: ; da1a
ds 11
W_ENEMYMON6NAME:: ; da25
ds 11
W_TRAINERHEADERPTR:: ; da30
ds 2
ds 7
W_CURMAPSCRIPT:: ; da39
; index of current map script, mostly used as index for function pointer array
; mostly copied from map-specific map script pointer and wirtten back later
ds 1
ds 6
W_PLAYTIMEHOURS:: ; da40
ds 2
W_PLAYTIMEMINUTES:: ; da42
ds 2
W_PLAYTIMESECONDS:: ; da44
ds 1
W_PLAYTIMEFRAMES:: ; da45
ds 1
ds 1
W_NUMSAFARIBALLS:: ; da47
ds 1
W_DAYCARE_IN_USE:: ; da48
; 0 if no pokemon is in the daycare
; 1 if pokemon is in the daycare
ds 1
W_DAYCAREMONNAME:: ; da49
ds 11
W_DAYCAREMONOT:: ; da54
ds 11
W_DAYCAREMONDATA:: ; da5f
ds 33
W_NUMINBOX:: ; da80
; number of mons in current box
ds 22
W_BOXMON1DATA:: ; da96
ds 33
W_BOXMON2DATA:: ; dab7
ds 33 * 19
W_BOXMON1OT:: ; dd2a
ds 11
W_BOXMON2OT:: ; dd35
ds 11 * 19
W_BOXMON1NAME:: ; de06
ds 11
W_BOXMON2NAME:: ; de11
ds 11 * 19
; dee2
|