-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsram.asm
443 lines (328 loc) · 9.94 KB
/
sram.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
SECTION "Scratch", SRAM
UNION
sScratch:: ds $60 tiles
NEXTU
sEnemyFrontpicTileCount:: db
sPaddedEnemyFrontpic:: ds 7 * 7 tiles
ENDU
SECTION "Party Mail", SRAM ; 564 bytes.
sPartyMail:: ; 47 x 6 = 282 bytes.
table_width MAIL_STRUCT_LENGTH, sPartyMail
sPartyMon1Mail:: mailmsg sPartyMon1Mail
sPartyMon2Mail:: mailmsg sPartyMon2Mail
sPartyMon3Mail:: mailmsg sPartyMon3Mail
sPartyMon4Mail:: mailmsg sPartyMon4Mail
sPartyMon5Mail:: mailmsg sPartyMon5Mail
sPartyMon6Mail:: mailmsg sPartyMon6Mail
assert_table_length PARTY_LENGTH
sPartyMailBackup:: ; 47 x 6 = 282 bytes.
table_width MAIL_STRUCT_LENGTH, sPartyMailBackup
sPartyMon1MailBackup:: mailmsg sPartyMon1MailBackup
sPartyMon2MailBackup:: mailmsg sPartyMon2MailBackup
sPartyMon3MailBackup:: mailmsg sPartyMon3MailBackup
sPartyMon4MailBackup:: mailmsg sPartyMon4MailBackup
sPartyMon5MailBackup:: mailmsg sPartyMon5MailBackup
sPartyMon6MailBackup:: mailmsg sPartyMon6MailBackup
assert_table_length PARTY_LENGTH
SECTION "Mailbox", SRAM ; 942 bytes.
sMailboxCount:: db
sMailboxes:: ; 47 * 10 = 470 bytes.
table_width MAIL_STRUCT_LENGTH, sMailboxes
sMailbox1:: mailmsg sMailbox1
sMailbox2:: mailmsg sMailbox2
sMailbox3:: mailmsg sMailbox3
sMailbox4:: mailmsg sMailbox4
sMailbox5:: mailmsg sMailbox5
sMailbox6:: mailmsg sMailbox6
sMailbox7:: mailmsg sMailbox7
sMailbox8:: mailmsg sMailbox8
sMailbox9:: mailmsg sMailbox9
sMailbox10:: mailmsg sMailbox10
assert_table_length MAILBOX_CAPACITY
sMailboxCountBackup:: db
sMailboxesBackup:: ; 47 * 10 = 470 bytes.
table_width MAIL_STRUCT_LENGTH, sMailboxesBackup
sMailbox1Backup:: mailmsg sMailbox1Backup
sMailbox2Backup:: mailmsg sMailbox2Backup
sMailbox3Backup:: mailmsg sMailbox3Backup
sMailbox4Backup:: mailmsg sMailbox4Backup
sMailbox5Backup:: mailmsg sMailbox5Backup
sMailbox6Backup:: mailmsg sMailbox6Backup
sMailbox7Backup:: mailmsg sMailbox7Backup
sMailbox8Backup:: mailmsg sMailbox8Backup
sMailbox9Backup:: mailmsg sMailbox9Backup
sMailbox10Backup:: mailmsg sMailbox10Backup
assert_table_length MAILBOX_CAPACITY
SECTION "SRAM Bank 0", SRAM ; 137 bytes.
sMysteryGiftData::
sMysteryGiftItem:: db
sMysteryGiftUnlocked:: db
sBackupMysteryGiftItem:: db
sNumDailyMysteryGiftPartnerIDs:: db
sDailyMysteryGiftPartnerIDs:: ds MAX_MYSTERY_GIFT_PARTNERS * 2 ; 5 * 2 = 10 bytes.
sMysteryGiftDecorationsReceived:: flag_array NUM_NON_TROPHY_DECOS ; 6 bytes?
ds 4
sMysteryGiftTimer:: dw
ds 1
sMysteryGiftTrainerHouseFlag:: db
sMysteryGiftPartnerName:: ds NAME_LENGTH ; 11 bytes.
sMysteryGiftUnusedFlag:: db
sMysteryGiftTrainer:: ds wMysteryGiftTrainerEnd - wMysteryGiftTrainer ; 38 bytes.
sBackupMysteryGiftItemEnd::
ds $30
sRTCStatusFlags:: db
ds 7
sLuckyNumberDay:: db
sLuckyIDNumber:: dw
SECTION "Hospital Box", SRAM
sHospitalBox:: box sHospitalBox
sHospitalBoxBackup:: box sHospitalBoxBackup
SECTION "Backup Save", SRAM
sBackupOptions:: ds wOptionsEnd - wOptions
sBackupCheckValue1:: db ; loaded with SAVE_CHECK_VALUE_1, used to check save corruption
sBackupGameData::
sBackupPlayerData:: ds wPlayerDataEnd - wPlayerData
sBackupCurMapData:: ds wCurMapDataEnd - wCurMapData
sBackupPokemonData:: ds wPokemonDataEnd - wPokemonData
sBackupGameDataEnd::
; ds $185
sBackupChecksum:: dw
sBackupCheckValue2:: db ; loaded with SAVE_CHECK_VALUE_2, used to check save corruption
sStackTop:: dw
if DEF(_DEBUG)
sRTCHaltCheckValue:: dw
sSkipBattle:: db
sDebugTimeCyclesSinceLastCall:: db
sOpenedInvalidSRAM:: db
sIsBugMon:: db
endc
SECTION "Save", SRAM
sOptions:: ds wOptionsEnd - wOptions
sCheckValue1:: db ; loaded with SAVE_CHECK_VALUE_1, used to check save corruption
sGameData::
sPlayerData:: ds wPlayerDataEnd - wPlayerData
sCurMapData:: ds wCurMapDataEnd - wCurMapData
sPokemonData:: ds wPokemonDataEnd - wPokemonData
sGameDataEnd::
; ds $185
sChecksum:: dw
sCheckValue2:: db ; loaded with SAVE_CHECK_VALUE_2, used to check save corruption
SECTION "Active Box", SRAM
sBox:: box sBox
; ds $100
ds 8 ; Added by Damien to add a little padding, but less than the original ds 100.
SECTION "Link Battle Data", SRAM ; 96 bytes.
sLinkBattleStats::
sLinkBattleWins:: dw
sLinkBattleLosses:: dw
sLinkBattleDraws:: dw
sLinkBattleRecord:: ; 18 * 5 = 90 bytes.
table_width LINK_BATTLE_RECORD_LENGTH, sLinkBattleRecord
sLinkBattleRecord1:: link_battle_record sLinkBattleRecord1
sLinkBattleRecord2:: link_battle_record sLinkBattleRecord2
sLinkBattleRecord3:: link_battle_record sLinkBattleRecord3
sLinkBattleRecord4:: link_battle_record sLinkBattleRecord4
sLinkBattleRecord5:: link_battle_record sLinkBattleRecord5
assert_table_length NUM_LINK_BATTLE_RECORDS
sLinkBattleStatsEnd::
SECTION "SRAM Hall of Fame", SRAM
sHallOfFame:: ; 96 * 30 = 2880 bytes. Outch.
table_width HOF_LENGTH, sHallOfFame
sHallOfFame01:: hall_of_fame sHallOfFame01
sHallOfFame02:: hall_of_fame sHallOfFame02
sHallOfFame03:: hall_of_fame sHallOfFame03
sHallOfFame04:: hall_of_fame sHallOfFame04
sHallOfFame05:: hall_of_fame sHallOfFame05
sHallOfFame06:: hall_of_fame sHallOfFame06
sHallOfFame07:: hall_of_fame sHallOfFame07
sHallOfFame08:: hall_of_fame sHallOfFame08
sHallOfFame09:: hall_of_fame sHallOfFame09
sHallOfFame10:: hall_of_fame sHallOfFame10
sHallOfFame11:: hall_of_fame sHallOfFame11
sHallOfFame12:: hall_of_fame sHallOfFame12
sHallOfFame13:: hall_of_fame sHallOfFame13
sHallOfFame14:: hall_of_fame sHallOfFame14
sHallOfFame15:: hall_of_fame sHallOfFame15
sHallOfFame16:: hall_of_fame sHallOfFame16
sHallOfFame17:: hall_of_fame sHallOfFame17
sHallOfFame18:: hall_of_fame sHallOfFame18
sHallOfFame19:: hall_of_fame sHallOfFame19
sHallOfFame20:: hall_of_fame sHallOfFame20
sHallOfFame21:: hall_of_fame sHallOfFame21
sHallOfFame22:: hall_of_fame sHallOfFame22
sHallOfFame23:: hall_of_fame sHallOfFame23
sHallOfFame24:: hall_of_fame sHallOfFame24
sHallOfFame25:: hall_of_fame sHallOfFame25
sHallOfFame26:: hall_of_fame sHallOfFame26
sHallOfFame27:: hall_of_fame sHallOfFame27
sHallOfFame28:: hall_of_fame sHallOfFame28
sHallOfFame29:: hall_of_fame sHallOfFame29
sHallOfFame30:: hall_of_fame sHallOfFame30
assert_table_length NUM_HOF_TEAMS
sHallOfFameEnd::
SECTION "SRAM Crystal Data", SRAM ; 9 bytes lol.
sMobileEventIndex:: db
sCrystalData:: ds wCrystalDataEnd - wCrystalData
sMobileEventIndexBackup:: db
SECTION "SRAM Battle Tower", SRAM ; 12 bytes.
; Battle Tower data must be in SRAM because you can save and leave between battles
sBattleTowerChallengeState::
; 0: normal
; 2: battle tower
db
sNrOfBeatenBattleTowerTrainers:: db
sBTChoiceOfLevelGroup:: db
; Battle Tower trainers are saved here, so nobody appears more than once
sBTTrainers:: ds BATTLETOWER_STREAK_LENGTH ; sbe48 ; 7 bytes.
sBattleTowerSaveFileFlags:: db
sBattleTowerReward:: db
; team of previous trainer
sBTMonOfTrainers::
sBTMonPrevTrainer1:: db
sBTMonPrevTrainer2:: db
sBTMonPrevTrainer3:: db
; team of preprevious trainer
sBTMonPrevPrevTrainer1:: db
sBTMonPrevPrevTrainer2:: db
sBTMonPrevPrevTrainer3:: db
SECTION "Boxes 1-7", SRAM
sBox1:: box sBox1
sBox2:: box sBox2
sBox3:: box sBox3
sBox4:: box sBox4
sBox5:: box sBox5
sBox6:: box sBox6
sBox7:: box sBox7
SECTION "Boxes 8-14", SRAM
sBox8:: box sBox8
sBox9:: box sBox9
sBox10:: box sBox10
sBox11:: box sBox11
sBox12:: box sBox12
sBox13:: box sBox13
sBox14:: box sBox14
SECTION "SRAM Mobile 1", SRAM ; 1031 bytes.
ds $7
s4_a007:: ; struct size $30
ds $c
s4_a013:: ds 36
s4_a037:: ds 4
s4_a03b:: ds 37 * 40
s4_a603:: ds 8
s4_a60b:: db
s4_a60c:: db
s4_a60d:: db
s4_a60e:: dw
ds $1f0
sMobileBattleTimer:: ds 3
ds $7fd
s4_b000:: db
SECTION "SRAM Mobile 2", SRAM
ds 1 ; former location for sMobileEventIndex, moved to 1:BE3C in English
sTrainerRankings::
sTrainerRankingGameTimeHOF:: ds 4
sTrainerRankingStepCountHOF:: ds 4
sTrainerRankingHealingsHOF:: ds 4
sTrainerRankingBattlesHOF:: ds 3
sTrainerRankingStepCount:: ds 4
sTrainerRankingBattleTowerWins:: ds 4
sTrainerRankingTMsHMsTaught:: ds 3
sTrainerRankingBattles:: ds 3
sTrainerRankingWildBattles:: ds 3
sTrainerRankingTrainerBattles:: ds 3
sTrainerRankingUnused1:: ds 3
sTrainerRankingHOFEntries:: ds 3
sTrainerRankingWildMonsCaught:: ds 3
sTrainerRankingHookedEncounters:: ds 3
sTrainerRankingEggsHatched:: ds 3
sTrainerRankingMonsEvolved:: ds 3
sTrainerRankingFruitPicked:: ds 3
sTrainerRankingHealings:: ds 3
sTrainerRankingMysteryGift:: ds 3
sTrainerRankingTrades:: ds 3
sTrainerRankingFly:: ds 3
sTrainerRankingSurf:: ds 3
sTrainerRankingWaterfall:: ds 3
sTrainerRankingWhiteOuts:: ds 3
sTrainerRankingLuckyNumberShow:: ds 3
sTrainerRankingPhoneCalls:: ds 3
sTrainerRankingUnused2:: ds 3
sTrainerRankingLinkBattles:: ds 3
sTrainerRankingSplash:: ds 3
sTrainerRankingTreeEncounters:: ds 3
sTrainerRankingUnused3:: ds 3
sTrainerRankingColosseumWins:: ds 3
sTrainerRankingColosseumLosses:: ds 3
sTrainerRankingColosseumDraws:: ds 3
sTrainerRankingSelfdestruct:: ds 3
sTrainerRankingCurrentSlotsStreak:: ds 2
sTrainerRankingLongestSlotsStreak:: ds 2
sTrainerRankingTotalSlotsPayouts:: ds 4
sTrainerRankingTotalBattlePayouts:: ds 4
sTrainerRankingLongestMagikarp:: ds 2
sTrainerRankingShortestMagikarp:: ds 2
sTrainerRankingBugContestScore:: ds 2
sTrainerRankingsChecksum:: ds 2
sTrainerRankingsEnd::
ds 1 ; Former location for sMobileEventIndexBackup, moved to 1:BE44 in English
sTrainerRankingsBackup:: ds sTrainerRankingsEnd - sTrainerRankings
ds $6fa
s5_a800:: db
ds $24
s5_a825:: db
s5_a826:: db
ds $6d
s5_a894:: ds 6
s5_a89a:: dw
s5_a89c:: ds 22
s5_a8b2:: ds 150
s5_a948:: ds 246
ds $3
s5_aa41:: ds 4
ds $2
s5_aa47:: db
s5_aa48:: db
ds $1
s5_aa4a:: db
sMobileLoginPassword:: ds MOBILE_LOGIN_PASSWORD_LENGTH
ds $1
s5_aa5d:: ds MOBILE_LOGIN_PASSWORD_LENGTH
ds $4
s5_aa72:: db
s5_aa73:: ds 12
s5_aa7f:: ds 12
s5_aa8b:: db
s5_aa8c:: db
s5_aa8d:: db
s5_aa8e:: ds 7 * $cc
ds $1
s5_b023:: ds 105
s5_b08c:: ds 4
s5_b090:: db
s5_b091:: db
s5_b092:: ds 31
ds $100
s5_b1b1:: db
s5_b1b2:: db
s5_b1b3:: db
s5_b1b4:: db
ds $1e
s5_b1d3::
ds $120
s5_b2f3:: db
s5_b2f4:: ds 4
ds $1
s5_b2f9:: db
s5_b2fa:: db
s5_b2fb:: db
ds $b49
s5_be45:: db
s5_be46:: db
ds $1b8
s5_bfff:: db
SECTION "SRAM Mobile 3", SRAM
s6_a000::
SECTION "SRAM Mobile 4", SRAM
s7_a000::
ds $800
s7_a800:: db