-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathwram.s
More file actions
3781 lines (3056 loc) · 90.6 KB
/
wram.s
File metadata and controls
3781 lines (3056 loc) · 90.6 KB
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
; Layout of wram.
;
; When 2 addresses are listed (ie. $c6b9/$c6b5), the first address is for ages, the second
; is for seasons. If only one is listed, assume it's for ages.
;
; The RAMSECTION names are referenced in the linkfiles (linkfile_ages, linkfile_seasons) in order to
; place them at the correct addresses. Their banks and slots are also set in the linkfile.
.RAMSECTION Wram0_c000
wMusicReadFunction: ; $c000
; Function copied to RAM to read a byte from another bank.
dsb $14
wSoundFadeCounter: ; $c014
; When [wSoundFadeCounter]&[wSoundFadeSpeed] == 0, volume is incremented or decremented.
db
wSoundFadeDirection: ; $c015
; $01 for fadeout (volume down), $0a for fadein
db
wSoundFadeSpeed: ; $c016
db
wLoadingSoundBank: ; $c017
; Used within the music playing functions
db
wSoundTmp: ; $c018
; Initially used as the index of the sound to play, then as a channel index. Only used in
; one function.
db
wSoundChannelValue: ; $c019
; This holds the priority of a channel being read, but only in one function.
db
wSoundChannel: ; $c01a
; The sound channel being "operated on" for various functions.
db
wSoundDisabled: ; $c01b
; All sound processing is disabled when this is nonzero
db
wc01c: ; $c01c
db
wSoundCmd: ; $c01d
db
wSoundCmdEnvelope: ; $c01e
; This value goes straight to NR12/NR22
; In some situations it is also used to mark whether to reset / use the counter
; for the channel (NRx4)
db
wSoundFrequencyL: ; $c01f
db
wSoundFrequencyH: ; $c020
db
wWaveformIndex: ; $c021
db
wMusicVolume: ; $c022
; Basically the same as hMusicVolume, except this is only used in the music routines.
db
wc023: ; $c023
; Relates to muting channel 3 when wMusicVolume is set to 0?
db
wSoundVolume: ; $c024
; This value goes straight to NR50.
; Bits 0-2: left speaker, 4-6: right speaker (unless I mixed them up)
db
wc025: ; $c025
dsb 8
wc02d: ; $c02d
; This doesn't apply to channels 6 and 7?
dsb 6
wChannelPitchShift: ; $c033
; An offset for wSoundFrequencyL,H
dsb 6
wc039: ; $c039
; c039 might be related to the "counter" bit (NRx4)
dsb 6
wc03f: ; $c03f
; c03f might be related to sweep
dsb 6
wc045: ; $c045
dsb 6
wChannelVibratos: ; $c04b
dsb 6
wc051: ; $c051
dsb 6
wChannelDutyCycles: ; $c057
dsb 6
wc05d: ; $c05d
dsb 4
wc061: ; $c061
dsb 4
wChannelEnvelopes: ; $c065
dsb 4
wChannelEnvelopes2: ; $c069
dsb 4
wChannelsEnabled: ; $c06d
dsb 8
wChannelWaitCounters: ; $c075
dsb 8
wChannelVolumes: ; $c07d
dsb 8
; $c085-$c09f unused?
.ENDS
; TODO: Make this a ramsection. Currently it creates annoying warnings when made a ramsection due to
; some strange arithmetic done between slots; the warning needs to be muted in wla-dx.
;.RAMSECTION Wram0_c0a0
.ENUM $c0a0
wMusicQueue: ; $c0a0
dsb $10
; Stacks grow down on the gameboy. So the main stack is from $c0b0-$c10f?
wMainStack: dsb $60
wMainStackTop: .db ; $c110
wThread0Stack: dsb $70
wThread0StackTop: .db ; $c180
wThread1Stack: dsb $a0
wThread1StackTop: .db ; $c220
wThread2Stack: dsb $50
wThread2StackTop: .db ; $c270
wThread3Stack: dsb $50
wThread3StackTop: .db ; $c2c0
wc2c0:
dsb $20
wThreadStateBuffer: ; $c2e0
; $20 byte buffer (with a few 2-byte gaps)
dsb $20
.ENDE
.define NUM_THREADS 4
; Used for the intro
.define THREAD_0 <wThreadStateBuffer + 0*8
; Used for main game, file select screen
.define THREAD_1 <wThreadStateBuffer + 1*8
; Used for displaying text
.define THREAD_2 <wThreadStateBuffer + 2*8
; Used for handling palette fadeouts (basically always on?)
.define THREAD_3 <wThreadStateBuffer + 3*8
; Some of the 2-byte gaps in the wThreadStateBuffer are used for other purposes
.define wIntroStage wThreadStateBuffer + $6 ; $c2e6
.define wIntroVar wThreadStateBuffer + $7 ; $c2e7
; Game state.
; 0: Loading a room?
; 1: ?
; 2: Standard (the game is usually in this state)
; 3: Link is falling from the top of the screen (for the start of the game)
.define wGameState wThreadStateBuffer + $e ; $c2ee
; Writing a value here triggers a cutscene.
; (See constants/common/cutsceneIndices.s)
.define wCutsceneIndex wThreadStateBuffer + $f ; $c2ef
; This is the amount to add to each color component to produce the "faded" palettes.
; Increase this enough and they'll be fully white.
.define wPaletteThread_fadeOffset wThreadStateBuffer + $1f ; $c2ff
.RAMSECTION Wram0_c300
wBigBuffer: ; $c300
; General purpose $100 byte buffer. This has several, mutually exclusive uses:
; * Scripts that aren't in bank $C; the "loadscript" command loads $100 bytes into here to
; allow script execution.
; * Screen waves; stores sinewave values used to make the screen wavy, ie. underwater.
; * Stores the layout for the room in d6 with the changing floor
dsb $100
wVBlankFunctionQueue: ; $c400
dsb $80
wKeysPressedLastFrame: ; $c480
db
wKeysPressed: ; $c481
db
wKeysJustPressed: ; $c482
db
wAutoFireKeysPressed: ; $c483
db
wAutoFireCounter: ; $c484
db
wGfxRegs1: ; $c485
; Copied to wGfxRegsFinal prior to vblank.
instanceof GfxRegsStruct
wGfxRegs2: ; $c48b
; Copied to wGfxRegs3 during vblank. Safe to modify from anywhere.
; Note: wGfxRegs2 and wGfxRegs3 can't cross pages (say, c2xx->c3xx)
instanceof GfxRegsStruct
wGfxRegs3: ; $c491
; Used for the "actual game" (these are copied to the real registers during hblank after
; the status bar is drawn).
; Not safe to modify since the LCD interrupt could happen at any time.
instanceof GfxRegsStruct
wGfxRegsFinal: ; $c497
; Copied over during vblank; during normal gameplay this will only affect the status bar?
instanceof GfxRegsStruct
wVBlankChecker: ; $c49d
; Used by vblank wait loop
db
wc49e: ; $c49e
db
wGfxRegs6: ; $c49f
instanceof GfxRegsStruct
wGfxRegs7: ; $c4a5
instanceof GfxRegsStruct
wPaletteThread_mode: ; $c4ab
; Determines what the palette thread does. Generally, the game is inactive when this is
; nonzero.
; Valid values:
; 0: Do nothing
; 1: fadeout to white
; 2: fadein from white
; 3: fadeout to black
; 4: fadein from black
; 5: fadeout to black, stop at a specified amount
; 6: fadein from black, stop at a specified amount
; 7: fadein for a room (has an additional check for dark room)
; 8: fade between two palettes (only BG2-BG7; BG0-BG1 and OBJ palettes don't fade.)
; 9: fadeout to white (using delay from wPaletteThread_counter)
; a: fadein from white (with delay)
; b: fadeout to black (with delay)
; c: fadein from black (with delay)
; d: ages only?
; e: ages only?
db
wPaletteThread_speed: ; $c4ac
; Amount to increase/decrease wPaletteThread_fadeOffset by on each iteration of the
; palette thread
db
wPaletteThread_updateRate: ; $c4ad
; The palette thread only updates once every X frames.
db
wPaletteThread_parameter: ; $c4ae
; For palette modes 5/6, this is where to stop when fading in/out.
; For palette mode 7, this is 1 if the room fading in is dark?
db
wPaletteThread_counter: ; $c4af
; For certain modes, this acts as delay to slow down the palette thread.
db
wPaletteThread_counterRefill: ; $c4b0
; Refills wPaletteThread_counter when it reaches 0.
db
; These are like the corresponding hram variables "hDirtyBgPalettes" etc, but they're not
; immediately checked; they're sometimes "or'd" with those variables?
wDirtyFadeBgPalettes: ; $c4b1
db
wDirtyFadeSprPalettes: ; $c4b2
db
wFadeBgPaletteSources: ; $c4b3
db
wFadeSprPaletteSources: ; $c4b4
db
wLockBG7Color3ToBlack: ; $c4b5
; If set to 1, color 3 of bg palette 7 is always black, regardless of palette fading.
; Used in the intro cutscene.
db
wc4b6: ; $c4b6
; If bit 0 is set, objects don't get drawn.
db
wRamFunction: ; $c4b7
; This is just a jp opcode
dsb 3
wPuddleAnimationPointer: ; $c4ba
; This is a pointer to the oam data for the animation when you stand in a puddle. Updated
; every 16 frames.
dw
; $c4bb-$c4bf unused?
.ENDS
.RAMSECTION Wram0_c4c0
wTerrainEffectsBuffer: ; $c4c0
; This might only be used for drawing objects' shadows, though in theory it could also be
; used to draw puddles and grass as objects walk over them. Each entry is 4 bytes: Y, X,
; and an address in the "Special_Animations" section (bank $14).
dsb $40
wObjectsToDraw: ; $c500
; A buffer keeping track of which objects to draw, in what order (first = highest
; priority). Each entry is 2 bytes, consisting of the address of high byte of the object's
; y-position.
;
; The entries are divided into 4 groups of 16. Each group corresponds to a value for the
; "object.visible" variable (value from 0-3). Lower values have higher draw priority.
;
; Must be aligned to $100 bytes.
dsb $80
; $c580-$c5af unused?
.ENDS
; ==================================================================================================
; Everything from this point ($c5b0) up to $caff goes into the save data ($550 bytes).
; ==================================================================================================
.RAMSECTION Wram0_c5b0
wFileStart: ; $c5b0
; Start of file data (same address as checksum)
.db
wFileChecksum: ; $c5b0
dw
wSavefileString: ; $c5b2
; This string is checked to verify the save data.
; Seasons: "Z11216-0"
; Ages: "Z21216-0"
dsb 8
; $c5ba-$c5bf unused?
.ENDS
.RAMSECTION Wram0_c5c0
wUnappraisedRings: ; $c5c0
; List of unappraised rings. each byte always seems to have bit 6 set, indicating that the
; ring is unappraised. It probably gets unset the moment you appraise it, but only for
; a moment because then it disappears from this list.
dsb $40
wUnappraisedRingsEnd: ; $c600
.db
; ==================================================================================================
; C6xx block: deals largely with inventory, also global flags
; ==================================================================================================
wc600Block: ; $c600
.db
; Addresses $c600-c615 are copied across the link cable when a "game link" is performed.
wGameID: ; $c600
; The unique game ID that is used to make secrets exclusive to a particular set of files.
; If 0, it's considered "not yet decided"?
; Otherwise, it's always between $0001-$7fff?
dw
wLinkName: ; $c602
; 6 bytes, null terminated
dsb 5
wLinkNameNullTerminator:
; This is read by unrelated things (item drop table) as a value which is assumed to always be 0.
db
wc608: ; $c608
; This is always 1. Used as a dummy value in various places?
db
wKidName: ; $c609
dsb 6
wChildStatus: ; $c60f
db
wAnimalCompanion: ; $c610
; $0b for ricky, $0c for dimitri, $0d for moosh (same as the SpecialObject id's for their
; corresponding objects)
db
wWhichGame: ; $c611
; Always 0 for seasons, always 1 for ages.
; Used primarily (only?) for secret generation.
db
wFileIsLinkedGame: ; $c612
; Copied to wIsLinkedGame
db
wFileIsHeroGame: ; $c613
db
wFileIsCompleted: ; $c614
db
wObtainedRingBox: ; $c615
; Remembers whether you've obtained the ring box / friendship ring.
; There's also a global flag for this, so its only purpose may be keeping track of it for
; linked games?
db
; END of $16 byte "file header" that gets copied over from file linking.
wRingsObtained: ; $c616
; Bitset of rings obtained
dsb 8
wDeathCounter: ; $c61e
; 2-byte bcd number
dw
wTotalEnemiesKilled: ; $c620
; Used for the Slayer's ring.
dw
wPlaytimeCounter: ; $c622
dsb 4
wTotalSignsDestroyed: ; $c626
; Used for the sign ring.
db
wTotalRupeesCollected: ; $c627
; Used for the rupee ring. 2 bytes.
dw
wTextSpeed: ; $c629
db
wActiveLanguage: ; $c62a
; Doesn't do anything on the US version
db
wDeathRespawnBuffer: ; $c62b
; $0c bytes
INSTANCEOF DeathRespawnStruct
wLastAnimalMountPointY: ; $c638
; Looks like a component is set to $10 or $70 if the animal enters from
; a particular side. Not sure what it's used for.
db
wLastAnimalMountPointX: ; $c639
db
wMinimapGroup: ; $c63a/$c63a
; Like wActiveGroup, but for the minimap. Not updated in caves.
db
wMinimapRoom: ; $c63b
; Analagous to wMinimapGroup
db
wMinimapDungeonMapPosition: ; $c63c
db
wMinimapDungeonFloor: ; $c63d
db
.ifdef ROM_AGES
wPortalGroup: ; $c63e
; This is set to $ff at the beginning of the game, indicating there's no portal.
db
wPortalRoom: ; $c63f
db
wPortalPos: ; $c640
db
.endif
wMapleKillCounter: ; $c641/$c63e
; Maple appears when this reaches 30 (15 with Maple's ring).
db
wBoughtShopItems1: ; $c642/$c63f
; Bit 0: Bought ring box (ages) or satchel (seasons) upgrade from hidden shop.
; Bit 1: Bought gasha seed 1 from hidden shop.
; Bit 2: Bought gasha seed 2 from hidden shop.
; Bit 3: Bought ring (ages) or treasure map (seasons) from hidden shop.
; Bit 5: Bought gasha seed from normal shop (linked game only).
; Bit 7: Set the first time you talk to the shopkeeper for the chest game.
db
wBoughtShopItems2: ; $c643/$c640
; Bit 0: Bought gasha seed from advance shop.
; Bit 1: Bought gba ring from advance shop.
; Bit 2: Bought random ring from advance shop.
; Bit 3: Set if the flute should be sold instead of hearts (calculated on the fly)
; Bit 4: Set iff link has bombchus (calculated on the fly)
; Bit 5: Set iff link doesn't have bombchus (calculated on the fly)
; Bit 6: Bought heart piece from hidden shop (ages only).
db
wMapleState: ; $c644/$c641
; Bits 0-3: Number of maple encounters?
; Bit 4: Set while touching book is being exchanged (unset at end of encounter)
; Bit 5: Set if the touching book has been exchanged (permanently set)
; Bit 7: Set if maple's heart piece has been obtained
db
wBoughtSubrosianShopItems: ; $c645/$c642
; Bit 0: Bought Ribbon
; Bit 1: Bought piece of heart
; Bit 2: Bought bomb upgrade
; Bit 3: Bought gasha seed
; Bit 4: Bought ring 1
; Bit 5: Bought ring 2
; Bit 6: Bought ring 3
; Bit 7: Bought ring 4
; (Member's Card is considered "bought" if it's in your inventory)
db
wCompanionStates: ; $c646
.db
wRickyState: ; $c646/$c643
; bit 0: set if you've talked to Ricky about getting his gloves
; 5: set if you've returned Ricky's gloves
; 6: set when Ricky leaves you after obtaining island chart
; 7: set if you have Ricky's flute
db
wDimitriState: ; $c647/$c644
; ages:
; bit 0: set if you've seen the initial cutscene of the tokays discussing eating dimitri
; 1: set if you've driven off the tokays harassing Dimitri
; 2:
; 5: set if you've talked to Dimitri after saving him from the tokays
; 6: set if Dimitri should disappear from Tokay Island.
; 7: set if you have Dimitri's flute
; seasons:
; bit 0: 1st bully in Spool/Sunken spoke (signal to 2nd to speak)
; 1: 2nd bully in Spool/Sunken spoke (signal to 3rd to speak)
; 2: 3rd bully in Spool/Sunken spoke (signal to 1st to prompt for payment)
; 3: set when Dimitri is saved from bullies in Spool/Sunken (signal to 2nd to speak)
; 4: after above, set by bully 2 (signal to 3rd to speak) / in Sunken, set by bully 3
; (signal for all 3 to leave)
; 5: after above, set by bully 3 (signal for all 3 to leave) / set in moblin rest house
; (signal for bullies to appear 2 screens left)
; 7: tutorial on Dimitri's usage given
db
wMooshState: ; $c648/$c645
; ages:
; bit 5:
; 6: set if he's left after you finished helping him
; 7: set if you have Moosh's flute
; seasons:
; bit 0: attacked moblin bully
; 1: talked to Moosh after above
; 2: moblins lost and fleed
; 3: left after above, came back, and reinforcements arrived
; 4: ?
; 5: set if you have Moosh's flute
; 6: set if Moosh should disappear from mt. cucco
; 7: set after giving spring bananas to moosh
db
wCompanionTutorialTextShown: ; $c649
; Bits here are used by INTERAC_COMPANION_TUTORIAL to remember which pieces of
; "tutorial" text have been seen.
; Bit 0: Ricky hopping over holes
; Bit 1: Ricky jumping over cliffs
; bit 2: Carrying Dimitri
; Bit 3: Dimitri swimming up waterfalls
; Bit 4: Moosh fluttering
; bit 5: Moosh's buttstomp
db
wc64a: ; $c64a/$c647
db
wc64b: ; $c64b
db
wGashaSpotFlags: ; $c64c/$c649
; Bit 0 is set if you've harvested at least one gasha nut before. The first gasha nut
; always gives you a "class 1" ring (one of the weak, common ones).
; Bit 1 is set if you've obtained the heart piece from one of the gasha spots.
db
wGashaSpotsPlantedBitset: ; $c64d/$c64a
; 2 bytes (1 bit for each spot)
dsb NUM_GASHA_SPOTS/8
wGashaSpotKillCounters: ; $c64f/$c64c
; 16 bytes (1 byte for each spot)
dsb NUM_GASHA_SPOTS
wGashaMaturity: ; $c65f/$c65c
; When this value is 300 or higher, you get the best prizes from gasha trees; otherwise,
; the prizes get progressively worse.
; Many things increase this (digging, getting essence, screen transitions), and it gets
; decreased by 200 when a gasha nut is harvested.
dw
.ifdef ROM_AGES
wc661: ; $c661
db
.else
ws_c65d: ; TODO: figure out what this is
dsb 4
.endif
wDungeonVisitedFloors: ; $c662/$c662
; 1 byte per dungeon ($10 total). Each byte is a bitset of visited floors for a particular dungeon.
dsb NUM_DUNGEONS
wDungeonSmallKeys: ; $c672/$c66e
; 1 byte per dungeon.
dsb NUM_DUNGEONS
wDungeonBossKeys: ; $c682/$c67a
; Bitset of boss keys obtained
dsb NUM_DUNGEONS_DIV_8
wDungeonCompasses: ; $c684/$c67c
; Bitset of compasses obtained
dsb NUM_DUNGEONS_DIV_8
wDungeonMaps: ; $c686/$c67e
; Bitset of maps obtained
dsb NUM_DUNGEONS_DIV_8
wInventoryB: ; $c688/$c680
db
wInventoryA: ; $c689/$c681
db
wInventoryStorage: ; $c68a/$c682
; $10 bytes
dsb INVENTORY_CAPACITY
wObtainedTreasureFlags: ; $c69a/$c692
; Enough memory reserved for $80 treasures (though only about $68 are used)
dsb $10
wLinkHealth: ; $c6aa/$c6a2
db
wLinkMaxHealth: ; $c6ab/$c6a3
db
wNumHeartPieces: ; $c6ac/$c6a4
db
wNumRupees: ; $c6ad/$c6a5
dw
.ifdef ROM_SEASONS
wNumOreChunks: ; $c6a7
dw
.endif
wShieldLevel: ; $c6af/$c6a9
db
wNumBombs: ; $c6b0/$c6aa
db
wMaxBombs: ; $c6b1/$c6ab
db
wSwordLevel: ; $c6b2/$c6ac
db
wNumBombchus: ; $c6b3/$c6ad
db
wSeedSatchelLevel: ; $c6b4/$c6ae
; Determines satchel capacity
db
wFluteIcon: ; $c6b5/$c6af
; Determines icon + song, but not companion
db
.ifdef ROM_AGES
wSwitchHookLevel: ; $c6b6
db
wSelectedHarpSong: ; $c6b7
; 1 = Tune of Echoes;
; 2 = Tune of Currents;
; 3 = Tune of Ages
db
wBraceletLevel: ; $c6b8
db
.else; ROM_SEASONS
wObtainedSeasons: ; $c6b0
db
wBoomerangLevel: ; $c6b1
db
wMagnetGlovePolarity: ; $c6b2
; 0=S, 1=N
db
wSlingshotLevel: ; $c6b3
db
wFeatherLevel: ; $c6b4
db
.endif
wNumEmberSeeds: ; $c6b9/$c6b5
db
wNumScentSeeds: ; $c6ba/$c6b6
db
wNumPegasusSeeds: ; $c6bb/$c6b7
db
wNumGaleSeeds: ; $c6bc/$c6b8
db
wNumMysterySeeds: ; $c6bd/$c6b9
db
wNumGashaSeeds: ; $c6be/$c6ba
db
wEssencesObtained: ; $c6bf/$c6bb
db
wTradeItem: ; $c6c0
db
.ifdef ROM_AGES
wc6c1: ; $c6c1
db
wTuniNutState: ; $c6c2
; 0: broken
; 1: not in inventory (doing patch's game)
; 2: fixed (only within Link's inventory?)
db
wNumSlates: ; $c6c3
; Slates used only in ages dungeon 8
db
.else; ROM_SEASONS
wPirateBellState: ; -/$c6bd
db
.endif
wSatchelSelectedSeeds: ; $c6c4/$c6be
db
wShooterSelectedSeeds: ; $c6c5/$c6bf
; Can also be slingshot selected seeds for seasons
db
wRingBoxContents: ; $c6c6/$c6c0
dsb 5
wActiveRing: ; $c6cb/$c6c5
; When bit 6 is set, the ring is disabled?
db
wRingBoxLevel: ; $c6cc/$c6c6
db
wNumUnappraisedRingsBcd: ; $c6cd
db
wNumRingsAppraised: ; $c6ce
; Once this reaches 100, Vasu gives you the 100th ring.
db
wKilledGoldenEnemies: ; $c6cf/$c6c9
; Bit 0: killed golden octorok
; Bit 1: killed golden moblin
; Bit 2: killed golden darknut
; Bit 3: killed golden lynel
db
wGlobalFlags: ; $c6d0/$c6ca
dsb NUM_GLOBALFLAGS/8
wChildStage: ; $c6e0/$c6da
; Determines the "stage" of child's growth.
db
wNextChildStage: ; $c6e1/$c6db
; The next stage of the child's growth. It will advance to this state after leaving the
; house and coming back a bit later.
db
wc6e2: ; $c6e2/$c6dc
; Bit 0: Baby has been named
; Bit 1: Money has been given for doctor
; Bit 2: Advice has been given about how to get the baby to sleep
; Bit 3: You've told Blossom what kind of child you were
; Bit 4: Stage 6 done (answered a question from the child).
; Bit 5: Stage 8 done (depends on personality type)
db
wChildStage8Response: ; $c6e3/$c6dd
; This is the response to the child's question or request at stage 8.
db
wChildPersonality: ; $c6e4/$c6de
; When [wChildStage] >= 4, he starts developing a personality.
; For stages 4-6:
; 0: Hyperactive
; 1: Shy
; 2: Curious
; For stages 7+:
; 0: Slacker
; 1: Warrior
; 2: Arborist
; 3: Singer
db
wc6e5: ; $c6e5/$c6df ; In seasons, growth of Maku tree
db
.ifdef ROM_SEASONS
ws_c6e0: ; TODO: figure out what this is
db
wInsertedJewels: ; -/$c6e1
; Bitset of jewels inserted into tarm ruins entrance.
db
wNumTimesPlayedSubrosianDance: ; -/$c6e2
db
wNumTimesPlayedStrangeBrothersGame: ; -/$c6e3
db
wTalkedToPirationCaptainState: ; -/$c6e4
; 0: Not yet talked to him after D6 beaten
; 1: Talked to him without a bell
; 2: Talked to him with a bell (either rusty or fixed)
db
.endif
wMakuMapTextPresent: ; $c6e6/$c6e5
; Low byte of text index (05XX) of text to show when selecting maku tree on map
db
.ifdef ROM_AGES
wMakuMapTextPast: ; $c6e7
db
wMakuTreeState: ; $c6e8
; Keeps track of what the Maku Tree says when you talk to her.
; 0: Haven't met yet
; 1: Disappeared from the present
db
wJabuWaterLevel: ; $c6e9
; Bits 4-7: Remembers which buttons are pressed. Corresponds to same bits in wSwitchState.
; Bits 0-3: Actual water level (0 for drained, 2 for full)
db
wWildTokayGameLevel: ; $c6ea
; Goes up to 4. (Level 0 is playing for the scent seedling.)
db
wMakuTreeSeedSatchelXPosition: ; $c6eb
db
wPirateShipRoom: ; $c6ec
; Low room index the pirate ship is in
db
wPirateShipY: ; $c6ed
db
wPirateShipX: ; $c6ee
db
wPirateShipAngle: ; $c6ef
db
wc6f0: ; $c6f0
dsb $b
.endif ; ROM_AGES
wShortSecretIndex: ; $c6fb/$c6e6
; bits 0-3: index of a small secret?
; bits 4-5: indicates the game it's for, and whether it's a return secret or not?
; Also used as a placeholder in the "giveTreasure" function?
db
wc6fc: ; $c6fc
db
wSecretXorCipherIndex: ; $c6fd
; Value from 0-7 which tells the secret generator which xor cipher to use.
db
wSecretType: ; $c6fe
; 0: game transfer secret
; 1: same? (unused?)
; 2: ring secret
; 3: 5-letter secret
db
.ENDS
.define wSeedsAndHarpSongsObtained wObtainedTreasureFlags+TREASURE_EMBER_SEEDS/8
.RAMSECTION Wram0_c700
; In Ages, flags are shared for above water and underwater. In Seasons, groups 1/2/3 are all
; basically the same. So, groups 2 and 3 don't have their own flags.
wGroup0RoomFlags: ; $c700
dsb $100
wGroup1RoomFlags: ; $c800
dsb $100
wGroup4RoomFlags: ; $c900
dsb $100
wGroup5RoomFlags: ; $ca00
dsb $100
.ENDS
; Per-game aliases for room flags
.ifdef ROM_AGES
.define wPresentRoomFlags, wGroup0RoomFlags
.define wPastRoomFlags, wGroup1RoomFlags
; Steal 6 of the past room flags for vine seed positions.
; (Only 5 vines exist, but 6 bytes are used?)
.define wVinePositions, wPastRoomFlags+$f0
.else ;ROM_SEASONS
.define wOverworldRoomFlags, wGroup0RoomFlags
.define wSubrosiaRoomFlags, wGroup1RoomFlags
; Steal 16 of subrosia's room flags for rupee room rupees gotten
.define wD2RupeeRoomRupees, wSubrosiaRoomFlags+$f0
.define wD6RupeeRoomRupees, wSubrosiaRoomFlags+$f8
.endif
; ==================================================================================================
; $cb00: END of data that goes into the save file
; ==================================================================================================
.RAMSECTION Wram0_cb00
wOam: ; $cb00
dsb $a0
wOamEnd: ; $cba0
.db
wTextIsActive: ; $cba0/$cba0
; Nonzero if text is being displayed.
; If $80, text has finished displaying while TEXTBOXFLAG_NONEXITABLE is set.
db
wTextDisplayMode: ; $cba1
; $00: standard text
; $01: selecting an option
; $02: inventory screen / ring menu (instant drawing?)
db
wTextIndex: ; $cba2
; Note that the text index is incremented by $400 before being written here.
; This is due to there being 4 dictionaries. Within text routines, this
; 4-higher value is used.
.dw
wTextIndexL: ; $cba2
db
wTextIndexH: ; $cba3
db
wTextIndexH_backup: ; $cba4
db
wSelectedTextOption: ; $cba5
; Selected option in a textbox, ie. yes/no
; Bit 7 can be set sometimes?
db
wTextGfxColorIndex: ; $cba6
; What color text should be as it's read from the retrieveTextCharacter
; function. Values 0-2 set the text to those respective colors, while a value
; of 3 tells it to read in 2bpp format instead.
db
wTextMapAddress: ; $cba7
; Where the tile map is for the text (always $98?)
db
wTextNumberSubstitution: ; $cba8
; 2-byte BCD number that can be inserted into text.
; The shooting gallery keeps track of score here.
dw