forked from pret/pokeyellow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wram.asm
executable file
·3592 lines (2748 loc) · 75 KB
/
wram.asm
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
INCLUDE "constants.asm"
flag_array: MACRO
ds ((\1) + 7) / 8
ENDM
box_struct_length EQU 25 + NUM_MOVES * 2
box_struct: MACRO
\1Species:: db
\1HP:: dw
\1BoxLevel:: db
\1Status:: db
\1Type::
\1Type1:: db
\1Type2:: db
\1CatchRate:: db
\1Moves:: ds NUM_MOVES
\1OTID:: dw
\1Exp:: ds 3
\1HPExp:: dw
\1AttackExp:: dw
\1DefenseExp:: dw
\1SpeedExp:: dw
\1SpecialExp:: dw
\1DVs:: ds 2
\1PP:: ds NUM_MOVES
ENDM
party_struct: MACRO
box_struct \1
\1Level:: db
\1Stats::
\1MaxHP:: dw
\1Attack:: dw
\1Defense:: dw
\1Speed:: dw
\1Special:: dw
ENDM
battle_struct: MACRO
\1Species:: db
\1HP:: dw
\1BoxLevel:: db
\1Status:: db
\1Type::
\1Type1:: db
\1Type2:: db
\1CatchRate:: db
\1Moves:: ds NUM_MOVES
\1DVs:: ds 2
\1Level:: db
\1Stats::
\1MaxHP:: dw
\1Attack:: dw
\1Defense:: dw
\1Speed:: dw
\1Special:: dw
\1PP:: ds NUM_MOVES
ENDM
SECTION "WRAM Bank 0", WRAM0
wUnusedC000:: ; c000
ds 1
wSoundID:: ; c001
ds 1
wMuteAudioAndPauseMusic:: ; c002
; bit 7: whether sound has been muted
; all bits: whether the effective is active
; Store 1 to activate effect (any value in the range [1, 127] works).
; All audio is muted and music is paused. Sfx continues playing until it
; ends normally.
; Store 0 to resume music.
ds 1
wDisableChannelOutputWhenSfxEnds:: ; c003
ds 1
wStereoPanning:: ; c004
ds 1
wSavedVolume:: ; c005
ds 1
wChannelCommandPointers:: ; c006
ds 16
wChannelReturnAddresses:: ; c016
ds 16
wChannelSoundIDs:: ; c026
ds 8
wChannelFlags1:: ; c02e
ds 8
wChannelFlags2:: ; c036
ds 8
wChannelDuties:: ; c03e
ds 8
wChannelDutyCycles:: ; c046
ds 8
wChannelVibratoDelayCounters:: ; c04e
; reloaded at the beginning of a note. counts down until the vibrato begins.
ds 8
wChannelVibratoExtents:: ; c056
ds 8
wChannelVibratoRates:: ; c05e
; high nybble is rate (counter reload value) and low nybble is counter.
; time between applications of vibrato.
ds 8
wChannelFrequencyLowBytes:: ; c066
ds 8
wChannelVibratoDelayCounterReloadValues:: ; c06e
; delay of the beginning of the vibrato from the start of the note
ds 8
wChannelPitchBendLengthModifiers:: ; c076
ds 8
wChannelPitchBendFrequencySteps:: ; c07e
ds 8
wChannelPitchBendFrequencyStepsFractionalPart:: ; c086
ds 8
wChannelPitchBendCurrentFrequencyFractionalPart:: ; c08e
ds 8
wChannelPitchBendCurrentFrequencyHighBytes:: ; c096
ds 8
wChannelPitchBendCurrentFrequencyLowBytes:: ; c09e
ds 8
wChannelPitchBendTargetFrequencyHighBytes:: ; c0a6
ds 8
wChannelPitchBendTargetFrequencyLowBytes:: ; c0ae
ds 8
wChannelNoteDelayCounters:: ; c0b6
; Note delays are stored as 16-bit fixed-point numbers where the integer part
; is 8 bits and the fractional part is 8 bits.
ds 8
wChannelLoopCounters:: ; c0be
ds 8
wChannelNoteSpeeds:: ; c0c6
ds 8
wChannelNoteDelayCountersFractionalPart:: ; c0ce
ds 8
wChannelOctaves:: ; c0d6
ds 8
wChannelVolumes:: ; c0de
; also includes fade for hardware channels that support it
ds 8
wMusicWaveInstrument::
ds 1
wSfxWaveInstrument::
ds 1
wMusicTempo:: ; c0e8
ds 2
wSfxTempo:: ; c0ea
ds 2
wSfxHeaderPointer:: ; c0ec
ds 2
wNewSoundID:: ; c0ee
ds 1
wAudioROMBank:: ; c0ef
ds 1
wAudioSavedROMBank:: ; c0f0
ds 1
wFrequencyModifier:: ; c0f1
ds 1
wTempoModifier:: ; c0f2
ds 1
wc0f3:: ds 1
wc0f4:: ds 1
wc0f5:: ds 11
SECTION "Sprite State Data", WRAM0
wSpriteDataStart::
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
spritestatedata1: MACRO
\1PictureID:: db
\1MovementStatus:: db
\1ImageIndex:: db
\1YStepVector:: db
\1YPixels:: db
\1XStepVector:: db
\1XPixels:: db
\1IntraAnimFrameCounter:: db
\1AnimFrameCounter:: db
\1FacingDirection:: db
ds 6
\1End::
endm
wSpritePlayerStateData1:: spritestatedata1 wSpritePlayerStateData1
wSprite01StateData1:: spritestatedata1 wSprite01StateData1
wSprite02StateData1:: spritestatedata1 wSprite02StateData1
wSprite03StateData1:: spritestatedata1 wSprite03StateData1
wSprite04StateData1:: spritestatedata1 wSprite04StateData1
wSprite05StateData1:: spritestatedata1 wSprite05StateData1
wSprite06StateData1:: spritestatedata1 wSprite06StateData1
wSprite07StateData1:: spritestatedata1 wSprite07StateData1
wSprite08StateData1:: spritestatedata1 wSprite08StateData1
wSprite09StateData1:: spritestatedata1 wSprite09StateData1
wSprite10StateData1:: spritestatedata1 wSprite10StateData1
wSprite11StateData1:: spritestatedata1 wSprite11StateData1
wSprite12StateData1:: spritestatedata1 wSprite12StateData1
wSprite13StateData1:: spritestatedata1 wSprite13StateData1
wSprite14StateData1:: spritestatedata1 wSprite14StateData1
wSpritePikachuStateData1:: spritestatedata1 wSpritePikachuStateData1
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
spritestatedata2: MACRO
\1WalkAnimationCounter:: db
ds 1
\1YDisplacement:: db
\1XDisplacement:: db
\1MapY:: db
\1MapX:: db
\1MovementByte1:: db
\1GrassPriority:: db
\1MovementDelay:: db
ds 5
\1ImageBaseOffset:: db
ds 1
\1End::
endm
wSpritePlayerStateData2:: spritestatedata2 wSpritePlayerStateData2
wSprite01StateData2:: spritestatedata2 wSprite01StateData2
wSprite02StateData2:: spritestatedata2 wSprite02StateData2
wSprite03StateData2:: spritestatedata2 wSprite03StateData2
wSprite04StateData2:: spritestatedata2 wSprite04StateData2
wSprite05StateData2:: spritestatedata2 wSprite05StateData2
wSprite06StateData2:: spritestatedata2 wSprite06StateData2
wSprite07StateData2:: spritestatedata2 wSprite07StateData2
wSprite08StateData2:: spritestatedata2 wSprite08StateData2
wSprite09StateData2:: spritestatedata2 wSprite09StateData2
wSprite10StateData2:: spritestatedata2 wSprite10StateData2
wSprite11StateData2:: spritestatedata2 wSprite11StateData2
wSprite12StateData2:: spritestatedata2 wSprite12StateData2
wSprite13StateData2:: spritestatedata2 wSprite13StateData2
wSprite14StateData2:: spritestatedata2 wSprite14StateData2
wSpritePikachuStateData2:: spritestatedata2 wSpritePikachuStateData2
wSpriteDataEnd::
SECTION "OAM Buffer", WRAM0
wOAMBuffer:: ; c300
; buffer for OAM data. Copied to OAM by DMA
ds 4 * 40
wOAMBufferEnd::
wTileMap:: ; c3a0
; buffer for tiles that are visible on screen (20 columns by 18 rows)
ds SCREEN_HEIGHT * SCREEN_WIDTH
wSerialPartyMonsPatchList:: ; c508
; list of indexes to patch with SERIAL_NO_DATA_BYTE after transfer
wTileMapBackup:: ; c508
; buffer for temporarily saving and restoring current screen's tiles
; (e.g. if menus are drawn on top)
; ds 20 * 18
wAnimatedObjectsData::
; Used by functions in BANK 3E
; This looks similar to the address structure for Gen 2 OAM animations.
wAnimatedObjectStartTileOffsets::
ds 10 * 2
wAnimatedObjectDataStructs:: ; c51c
animated_object: macro
\1Index:: db ; 0
\1FramesetID:: db ; 1
\1AnimSeqID:: db ; 2
\1TileID:: db ; 3
\1XCoord:: db ; 4
\1YCoord:: db ; 5
\1XOffset:: db ; 6
\1YOffset:: db ; 7
\1Duration:: db ; 8
\1DurationOffset:: db ; 9
\1FrameIndex:: db ; a
ds 5
\1End::
endm
wAnimatedObject0:: animated_object wAnimatedObject0
wAnimatedObject1:: animated_object wAnimatedObject1
wAnimatedObject2:: animated_object wAnimatedObject2
wAnimatedObject3:: animated_object wAnimatedObject3
wAnimatedObject4:: animated_object wAnimatedObject4
wAnimatedObject5:: animated_object wAnimatedObject5
wAnimatedObject6:: animated_object wAnimatedObject6
wAnimatedObject7:: animated_object wAnimatedObject7
wAnimatedObject8:: animated_object wAnimatedObject8
wAnimatedObject9:: animated_object wAnimatedObject9
wNumLoadedAnimatedObjects:: ; c5bc
ds 1
wCurrentAnimatedObjectOAMBufferOffset:: ; c5bd
ds 3
wAnimatedObjectSpawnStateDataPointer:: ; c5c0
ds 2
wAnimatedObjectFramesDataPointer:: ; c5c2
ds 2
wAnimatedObjectJumptablePointer:: ; c5c4
ds 2
wAnimatedObjectOAMDataPointer:: ; c5c6
ds 2
wCurAnimatedObjectOAMAttributes:: ; c5c8
ds 1
wCurrentAnimatedObjectVTileOffset:: ; c5c9
ds 1
wCurrentAnimatedObjectXCoord:: ; c5ca
ds 1
wCurrentAnimatedObjectYCoord:: ; c5cb
ds 1
wCurrentAnimatedObjectXOffset:: ; c5cc
ds 1
wCurrentAnimatedObjectYOffset:: ; c5cd
ds 1
wAnimatedObjectGlobalYOffset:: ; c5ce
ds 1
wAnimatedObjectGlobalXOffset:: ; c5cf
ds 1
wAnimatedObjectsDataEnd::
wSerialEnemyMonsPatchList:: ; c5d0
; list of indexes to patch with SERIAL_NO_DATA_BYTE after transfer
; Surfing Minigame
wSurfingMinigameData:: ; c5d0
ds 1
wSurfingMinigameRoutineNumber:: ; c5d1
ds 1
wc5d2:: ; c5d2
ds 1
wSurfingMinigameWaveFunctionNumber:: ; c5d3
ds 2
wc5d5:: ; c5d5
ds 1
wSurfingMinigamePikachuHP:: ; c5d6
ds 2 ; little-endian BCD
wc5d8:: ; c5d8 unused?
ds 1
wSurfingMinigameRadnessMeter:: ; c5d9
; number of consecutive tricks
ds 1
wSurfingMinigameRadnessScore:: ; c5da
ds 2 ; little-endian BCD
wSurfingMinigameTotalScore:: ; c5dc
ds 2 ; little-endian BCD
wc5de:: ; c5de
ds 1
wc5df:: ; c5df
ds 1
wc5e0:: ; c5e0
ds 1
wc5e1:: ; c5e1
ds 1
wc5e2:: ; c5e2
ds 1
wSurfingMinigamePikachuSpeed:: ; c5e3
ds 2 ; little-endian
wc5e5:: ; c5e5
ds 3 ; big-endian
wSurfingMinigameWaveHeightBuffer:: ; c5e8
ds 2
wSurfingMinigamePikachuObjectHeight:: ; c5ea
ds 1
wc5eb:: ; c5eb
ds 1
wc5ec:: ; c5ec
ds 1
wc5ed:: ; c5ed
ds 1
wc5ee:: ; c5ee
ds 1
wSurfingMinigameBGMapReadBuffer:: ; c5ef
ds 16
ds 24
wSurfingMinigameSCX:: ; c617
ds 3
wSurfingMinigameWaveHeight:: ; c61a
ds SCREEN_WIDTH
wSurfingMinigameXOffset:: ; c62e
ds 1
wSurfingMinigameTrickFlags:: ; c62f
ds 1
wc630:: ; c630
ds 1
wc631:: ; c631
ds 1
wSurfingMinigameRoutineDelay:: ; c632
ds 1
wSurfingMinigameIntroAnimationFinished:: ; c633
ds 1
wYellowIntroCurrentScene:: ; c634
wc634:: ; c634
ds 1
wYellowIntroSceneTimer:: ; c635
wc635:: ; c635
ds 1
wYellowIntroAnimatedObjectStructPointer:: ; c636
ds 1
wSurfingMinigameDataEnd:: ; c637
ds 177
wTempPic:: ; c6e8
wPrinterData:: ; c6e8
wOverworldMap:: ; c6e8
; ds 1300
wPrinterSendState:: ; c6e8
ds 1
wPrinterRowIndex:: ; c6e9
ds 1
; Printer data header
wPrinterDataHeader:: ; c6ea
wc6ea:: ; c6ea
ds 1
wc6eb:: ; c6eb
ds 1
wc6ec:: ; c6ec
ds 1
wc6ed:: ; c6ed
ds 1
wPrinterChecksum:: ; c6ee
dw
UNION
wPrinterSerialReceived:: ; c6f0
ds 1
wPrinterStatusReceived:: ; c6f1
; 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)
ds 1
wc6f2:: ; c6f2
ds 1
wc6f3:: ; c6f3
ds 13
wLYOverrides:: ; c700
ds $100
wLYOverridesEnd::
wLYOverridesBuffer:: ; c800
ds $100
wLYOverridesBufferEnd:: ; c900
NEXTU
wPrinterSendDataSource1:: ; c6f0
; two 20-tile buffers
ds $140
wPrinterSendDataSource2::
ds $140
ENDU
wPrinterSendDataSource1End:: ; c970
wPrinterHandshake:: ; c970
ds 1
wPrinterStatusFlags:: ; c971
ds 1
wHandshakeFrameDelay:: ; c972
ds 1
wPrinterSerialFrameDelay:: ; c973
ds 1
wPrinterSendByteOffset:: ; c974
dw
wPrinterDataSize:: ; c976
dw
wPrinterTileBuffer:: ; c978
ds SCREEN_HEIGHT * SCREEN_WIDTH
wPrinterStatusIndicator:: ; cae0
ds 2
wcae2:: ; cae2
ds 1
wPrinterSettingsTempCopy:: ; cae3
ds 17
wPrinterQueueLength:: ; caf4
ds 1
wPrinterDataEnd:: ; caf5
wPrinterPokedexEntryTextPointer:: ; caf5
dw
ds 2
wPrinterPokedexMonIsOwned:: ; caf9
ds 227
wcbdc:: ; cbdc
ds 14
wcbea:: ; cbea
ds 2
wcbec:: ; cbec
ds 16
wRedrawRowOrColumnSrcTiles:: ; cbfc
; the tiles of the row or column to be redrawn by RedrawRowOrColumn
ds SCREEN_WIDTH * 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
wPartyAndBillsPCSavedMenuItem:: ; cc2b
; It is mainly used by the party menu to remember the cursor position while the
; menu isn't active.
; It is also used to remember the cursor position of mon lists (for the
; withdraw/deposit/release actions) in Bill's PC so that it doesn't get lost
; when you choose a mon from the list and a sub-menu is shown. It's reset when
; you return to the main Bill's PC menu.
ds 1
wBagSavedMenuItem:: ; cc2c
; It is used by the bag list to remember the cursor position while the menu
; isn't active.
ds 1
wBattleAndStartSavedMenuItem:: ; cc2d
; It is used by the start menu to remember the cursor position while the menu
; isn't active.
; The battle menu uses it so that the cursor position doesn't get lost when
; a sub-menu is shown. It's reset at the start of each battle.
ds 1
wPlayerMoveListIndex:: ; cc2e
ds 1
wPlayerMonNumber:: ; cc2f
; index in party of currently battling mon
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
wMenuItemToSwap:: ; cc35
; id of menu item selected for swapping (counts from 1) (0 means that no menu item has been selected for swapping)
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
wMenuWatchMovingOutOfBounds:: ; cc37
; If non-zero, then when wrapping is disabled and the player tries to go past
; the top or bottom of the menu, return from HandleMenuInput. This is useful for
; menus that have too many items to display at once on the screen because it
; allows the caller to scroll the entire menu up or down when this happens.
ds 1
wTradeCenterPointerTableIndex:: ; cc38
ds 1
ds 1
wTextDestinationTileAddrBuffer:: dw ; cc3a
wDoNotWaitForButtonPressAfterDisplayingText:: ; cc3c
; if non-zero, skip waiting for a button press after displaying text in DisplayTextID
ds 1
wSerialSyncAndExchangeNybbleReceiveData:: ; cc3d
; the final received nybble is stored here by Serial_SyncAndExchangeNybble
wSerialExchangeNybbleTempReceiveData:: ; cc3d
; temporary nybble used by Serial_ExchangeNybble
wLinkMenuSelectionReceiveBuffer:: ; cc3d
; two byte buffer
; the received menu selection is stored twice
ds 1
wSerialExchangeNybbleReceiveData:: ; cc3e
; the final received nybble is stored here by Serial_ExchangeNybble
ds 1
ds 3
wSerialExchangeNybbleSendData:: ; cc42
; this nybble is sent when using Serial_SyncAndExchangeNybble or Serial_ExchangeNybble
wLinkMenuSelectionSendBuffer:: ; cc42
; two byte buffer
; the menu selection byte is stored twice before sending
ds 5
wLinkTimeoutCounter:: ; cc47
; 1 byte
wUnknownSerialCounter:: ; cc47
; 2 bytes
wEnteringCableClub:: ; cc47
ds 2
wWhichTradeMonSelectionMenu:: ; cc49
; $00 = player mons
; $01 = enemy mons
wMonDataLocation:: ; cc49
; 0 = player's party
; 1 = enemy party
; 2 = current box
; 3 = daycare
; 4 = in-battle mon
;
; AddPartyMon uses it slightly differently.
; If the lower nybble is 0, the mon is added to the player's party, else the enemy's.
; If the entire value is 0, then the player is allowed to name the mon.
ds 1
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
wCheckFor180DegreeTurn:: ; cc4b
; whether to check for 180-degree turn (0 = don't, 1 = do)
ds 1
ds 1
wMissableObjectIndex:: ; cc4d
ds 1
wPredefID:: ; cc4e
ds 1
wPredefRegisters:: ; cc4f
ds 6
wTrainerHeaderFlagBit:: ; cc55
ds 1
ds 1
wNPCMovementScriptPointerTableNum:: ; cc57
; which NPC movement script pointer is being used
; 0 if an NPC movement script is not running
ds 1
wNPCMovementScriptBank:: ; cc58
; ROM bank of current NPC movement script
ds 1
ds 2
wUnusedCC5B:: ; cc5b
wVermilionDockTileMapBuffer:: ; cc5b
; 180 bytes
wOaksAideRewardItemName:: ; cc5b
wDexRatingNumMonsSeen:: ; cc5b
wFilteredBagItems:: ; cc5b
; List of bag items that has been filtered to a certain type of items,
; such as drinks or fossils.
wElevatorWarpMaps:: ; cc5b
wMonPartySpritesSavedOAM:: ; cc5b
; Saved copy of OAM for the first frame of the animation to make it easy to
; flip back from the second frame.
; $60 bytes
wTrainerCardBlkPacket:: ; cc5b
; $40 bytes
wSlotMachineSevenAndBarModeChance:: ; cc5b
; If a random number greater than this value is generated, then the player is
; allowed to have three 7 symbols or bar symbols line up.
; So, this value is actually the chance of NOT entering that mode.
; If the slot is lucky, it equals 250, giving a 5/256 (~2%) chance.
; Otherwise, it equals 253, giving a 2/256 (~0.8%) chance.
wHallOfFame:: ; cc5b
wBoostExpByExpAll:: ; cc5b
wAnimationType:: ; cc5b
; values between 0-6. Shake screen horizontally, shake screen vertically, blink Pokemon...
wNPCMovementDirections:: ; cc5b
wPikaPicUsedGFXCount:: ; cc5b
ds 1
wPikaPicUsedGFX:: ; cc5c
wDexRatingNumMonsOwned:: ; cc5c
ds 1
wDexRatingText:: ; cc5d
wTrainerCardBadgeAttributes:: ; cc5d
ds 1
wSlotMachineSavedROMBank:: ; cc5e
; ROM back to return to when the player is done with the slot machine
ds 1
ds 13
wPikaPicUsedGFXEnd:: ; cc6c
ds 13
wAnimPalette:: ; cc79
ds 1
ds 29
wNPCMovementDirections2:: ; cc97
wPikaPicAnimObjectDataBufferSize:: ; cc97
wSwitchPartyMonTempBuffer:: ; cc97
; temporary buffer when swapping party mon data
ds 1
wPikaPicAnimObjectDataBuffer:: ; cc98
; 4 structs each of length 8
; 0: buffer index
; 1: script index
; 2: frame index
; 3: frame timer
; 4: vtile offset
; 5: x offset
; 6: y offset
; 7: unused
ds 9
wNumStepsToTake:: ; cca1
; used in Pallet Town scripted movement
ds 23
wPikaPicAnimObjectDataBufferEnd:: ;ccb8
ds 26
wRLEByteCount:: ; ccd2
ds 1
wAddedToParty:: ; ccd3
; 0 = not added
; 1 = added
wSimulatedJoypadStatesEnd:: ; ccd3
; this is the end of the joypad states
; the list starts above this address and extends downwards in memory until here
; overloaded with below labels
wParentMenuItem:: ; ccd3
wCanEvolveFlags:: ; ccd3
; 1 flag for each party member indicating whether it can evolve
; The purpose of these flags is to track which mons levelled up during the
; current battle at the end of the battle when evolution occurs.
; Other methods of evolution simply set it by calling TryEvolvingMon.
ds 1
wForceEvolution:: ; ccd4
ds 1
; if [ccd5] != 1, the second AI layer is not applied
wAILayer2Encouragement:: ; ccd5
ds 1
ds 1
; current HP of player and enemy substitutes
wPlayerSubstituteHP:: ; ccd7
ds 1
wEnemySubstituteHP:: ; ccd8
ds 1
wTestBattlePlayerSelectedMove:: ; ccd9
; The player's selected move during a test battle.
; InitBattleVariables sets it to the move Pound.
ds 1
ds 1
wMoveMenuType:: ; ccdb
; 0=regular, 1=mimic, 2=above message box (relearn, heal pp..)
ds 1
wPlayerSelectedMove:: ; ccdc
ds 1
wEnemySelectedMove:: ; ccdd
ds 1
wLinkBattleRandomNumberListIndex:: ; ccde
ds 1
wAICount:: ; ccdf
; number of times remaining that AI action can occur
ds 1
ds 2
wEnemyMoveListIndex:: ; cce2
ds 1
wLastSwitchInEnemyMonHP:: ; cce3
; The enemy mon's HP when it was switched in or when the current player mon
; was switched in, which was more recent.
; It's used to determine the message to print when switching out the player mon.
ds 2
wTotalPayDayMoney:: ; cce5
; total amount of money made using Pay Day during the current battle
ds 3
wSafariEscapeFactor:: ; cce8
ds 1
wSafariBaitFactor:: ; cce9
ds 1;
ds 1
wTransformedEnemyMonOriginalDVs:: ; cceb
ds 2
wMonIsDisobedient:: ds 1 ; cced
wPlayerDisabledMoveNumber:: ds 1 ; ccee
wEnemyDisabledMoveNumber:: ds 1 ; ccef
wInHandlePlayerMonFainted:: ; ccf0
; When running in the scope of HandlePlayerMonFainted, it equals 1.
; When running in the scope of HandleEnemyMonFainted, it equals 0.
ds 1
wPlayerUsedMove:: ds 1 ; ccf1
wEnemyUsedMove:: ds 1 ; ccf2
wEnemyMonMinimized:: ds 1 ; ccf3
wMoveDidntMiss:: ds 1 ; ccf4
wPartyFoughtCurrentEnemyFlags:: ; ccf5
; flags that indicate which party members have fought the current enemy mon
flag_array 6
wLowHealthAlarmDisabled:: ; ccf6
; Whether the low health alarm has been disabled due to the player winning the
; battle.
ds 1
wPlayerMonMinimized:: ; ccf7
ds 1
ds 13
wLuckySlotHiddenObjectIndex:: ; cd05
wEnemyNumHits:: ; cd05
; number of hits by enemy in attacks like Double Slap, etc.
wEnemyBideAccumulatedDamage:: ; cd05
; the amount of damage accumulated by the enemy while biding (2 bytes)
ds 10
wInGameTradeGiveMonSpecies:: ; cd0f
wPlayerMonUnmodifiedLevel:: ; cd0f
ds 1
wInGameTradeTextPointerTablePointer:: ; cd10
wPlayerMonUnmodifiedMaxHP:: ; cd10
ds 2
wInGameTradeTextPointerTableIndex:: ; cd12
wPlayerMonUnmodifiedAttack:: ; cd12
ds 1
wInGameTradeGiveMonName:: ; cd13
ds 1
wPlayerMonUnmodifiedDefense:: ; cd14
ds 2
wPlayerMonUnmodifiedSpeed:: ; cd16
ds 2
wPlayerMonUnmodifiedSpecial:: ; cd18
ds 2