Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/ram/hram.asm
1270 views
1
SECTION "HRAM", HRAM
2
3
; Initialized to 16.
4
; Decremented each input iteration if the player
5
; presses the reset sequence (A+B+SEL+START).
6
; Soft reset when 0 is reached.
7
hSoftReset:: db
8
9
UNION
10
hBaseTileID:: ; base tile ID to which offsets are added
11
hDexWeight::
12
hWarpDestinationMap::
13
hOAMTile::
14
hROMBankTemp::
15
hPreviousTileset::
16
hRLEByteValue::
17
db
18
19
hTextID:: ; DisplayTextID's argument
20
hPartyMonIndex::
21
db
22
23
hVRAMSlot::
24
db
25
26
hFourTileSpriteCount::
27
hHalveItemPrices::
28
db
29
30
NEXTU
31
hItemPrice:: ds 3 ; BCD number
32
33
NEXTU
34
hSlideAmount:: db
35
36
; the total number of tiles being shifted each time the pic slides by one tile
37
hSlidingRegionSize:: db
38
39
; -1 = left
40
; 0 = right
41
hSlideDirection:: db
42
43
NEXTU
44
hSpriteInterlaceCounter::
45
hSpriteWidth:: db ; in tiles
46
hSpriteHeight:: db ; in tiles
47
hSpriteOffset:: db
48
49
NEXTU
50
; counters for blinking down arrow
51
hDownArrowBlinkCount1:: db
52
hDownArrowBlinkCount2:: db
53
54
NEXTU
55
hMapStride::
56
hEastWestConnectedMapWidth::
57
hNorthSouthConnectionStripWidth::
58
db
59
hMapWidth::
60
hNorthSouthConnectedMapWidth::
61
db
62
63
NEXTU
64
hSpriteDataOffset:: db
65
hSpriteIndex:: db
66
hSpriteImageIndex::
67
hSpriteFacingDirection::
68
hSpriteMovementByte2::
69
db
70
71
NEXTU
72
ds 2
73
hLoadSpriteTemp1:: db
74
hLoadSpriteTemp2:: db
75
76
NEXTU
77
ds 2
78
hEnemySpeed:: dw
79
ENDU
80
81
UNION
82
hSpriteOffset2:: db
83
hOAMBufferOffset:: db
84
hSpriteScreenX:: db
85
hSpriteScreenY:: db
86
87
NEXTU
88
hCollidingSpriteOffset:: db
89
hCollidingSpriteTempYValue:: db
90
hCollidingSpriteTempXValue:: db
91
hCollidingSpriteAdjustedDistance:: db
92
ENDU
93
94
hTilePlayerStandingOn:: db
95
96
hSpritePriority:: db
97
98
UNION
99
; Multiplication and division variables are meant
100
; to overlap for back-to-back usage. Big endian.
101
UNION
102
ds 1
103
hMultiplicand:: ds 3
104
hMultiplier:: db
105
ds 1
106
hMultiplyBuffer:: ds 4
107
NEXTU
108
hProduct:: ds 4
109
NEXTU
110
hDividend:: ds 4
111
hDivisor:: db
112
hDivideBuffer:: ds 5
113
NEXTU
114
hQuotient:: ds 4
115
hRemainder:: db
116
ENDU
117
118
NEXTU
119
; PrintNumber (big endian).
120
hPastLeadingZeros:: db ; last char printed
121
hNumToPrint:: ds 3
122
hPowerOf10:: ds 3
123
hSavedNumToPrint:: ds 3
124
125
NEXTU
126
hNPCMovementDirections2Index::
127
hNPCSpriteOffset::
128
; distance in steps between NPC and player
129
hNPCPlayerYDistance::
130
db
131
hNPCPlayerXDistance::
132
db
133
hFindPathNumSteps:: db
134
; bit 0: set when the end of the path's Y coordinate matches the target's
135
; bit 1: set when the end of the path's X coordinate matches the target's
136
; When both bits are set, the end of the path is at the target's position
137
; (i.e. the path has been found).
138
hFindPathFlags:: db
139
hFindPathYProgress:: db
140
hFindPathXProgress:: db
141
; 0 = from player to NPC
142
; 1 = from NPC to player
143
hNPCPlayerRelativePosPerspective:: db
144
ds 1
145
; bit 0:
146
; 0 = target is to the south or aligned
147
; 1 = target is to the north
148
; bit 1:
149
; 0 = target is to the east or aligned
150
; 1 = target is to the west
151
hNPCPlayerRelativePosFlags:: db
152
153
NEXTU
154
hSwapItemID:: db
155
hSwapItemQuantity:: db
156
157
NEXTU
158
hSignCoordPointer:: dw
159
160
NEXTU
161
ds 1
162
hMutateWY:: db
163
hMutateWX:: db
164
165
NEXTU
166
; temp value used when swapping bytes or words
167
hSwapTemp:: db
168
hExperience:: ds 3 ; big endian
169
ENDU
170
171
UNION
172
hMoney:: ds 3 ; BCD number
173
NEXTU
174
; some code zeroes this for no reason when writing a coin amount
175
hUnusedCoinsByte:: db
176
hCoins:: dw ; BCD number
177
ENDU
178
179
hDivideBCDDivisor::
180
hDivideBCDQuotient::
181
ds 3 ; BCD number
182
hDivideBCDBuffer::
183
ds 3 ; BCD number
184
185
ds 1
186
187
hSerialReceivedNewData:: db
188
; $01 = using external clock
189
; $02 = using internal clock
190
; $ff = establishing connection
191
hSerialConnectionStatus:: db
192
hSerialIgnoringInitialData:: db
193
hSerialSendData:: db
194
hSerialReceiveData:: db
195
196
; these values are copied to rSCX, rSCY, and rWY during V-blank
197
hSCX:: db
198
hSCY:: db
199
hWY:: db
200
201
hJoyLast:: db
202
hJoyReleased:: db
203
hJoyPressed:: db
204
hJoyHeld:: db
205
hJoy5:: db
206
hJoy6:: db
207
hJoy7:: db
208
209
hLoadedROMBank:: db
210
hSavedROMBank:: db
211
212
; is automatic background transfer during V-blank enabled?
213
; if nonzero, yes
214
; if zero, no
215
hAutoBGTransferEnabled:: db
216
217
; 00 = top third of background
218
; 01 = middle third of background
219
; 02 = bottom third of background
220
hAutoBGTransferPortion:: db
221
222
; the destination address of the automatic background transfer
223
hAutoBGTransferDest:: dw
224
225
hRedrawMapViewRowOffset:: db
226
227
; temporary storage for stack pointer during memory transfers that use pop
228
; to increase speed
229
hSPTemp:: dw
230
231
; source address for VBlankCopyBgMap function
232
; the first byte doubles as the byte that enabled the transfer.
233
; if it is 0, the transfer is disabled
234
; if it is not 0, the transfer is enabled
235
; this means that XX00 is not a valid source address
236
hVBlankCopyBGSource:: dw
237
238
; destination address for VBlankCopyBgMap function
239
hVBlankCopyBGDest:: dw
240
241
; number of rows for VBlankCopyBgMap to copy
242
hVBlankCopyBGNumRows:: db
243
244
; size of VBlankCopy transfer in 16-byte units
245
hVBlankCopySize:: db
246
247
; source address for VBlankCopy function
248
hVBlankCopySource:: dw
249
250
; destination address for VBlankCopy function
251
hVBlankCopyDest:: dw
252
253
; size of source data for VBlankCopyDouble in 8-byte units
254
hVBlankCopyDoubleSize:: db
255
256
; source address for VBlankCopyDouble function
257
hVBlankCopyDoubleSource:: dw
258
259
; destination address for VBlankCopyDouble function
260
hVBlankCopyDoubleDest:: dw
261
262
; controls whether a row or column of 2x2 tile blocks is redrawn in V-blank
263
; 00 = no redraw
264
; 01 = redraw column
265
; 02 = redraw row
266
hRedrawRowOrColumnMode:: db
267
268
hRedrawRowOrColumnDest:: dw
269
270
hRandomAdd:: db
271
hRandomSub:: db
272
273
hFrameCounter:: db ; decremented every V-blank (used for delays)
274
275
; V-blank sets this to 0 each time it runs.
276
; So, by setting it to a nonzero value and waiting for it to become 0 again,
277
; you can detect that the V-blank handler has run since then.
278
hVBlankOccurred:: db
279
280
; Controls which tiles are animated.
281
; 0 = no animations (breaks Surf)
282
; 1 = water tile $14 is animated
283
; 2 = water tile $14 and flower tile $03 are animated
284
hTileAnimations:: db
285
286
hMovingBGTilesCounter1:: db
287
288
ds 1
289
290
hCurrentSpriteOffset:: db ; multiple of $10
291
292
UNION
293
hPlayerFacing:: db
294
hPlayerYCoord:: db
295
hPlayerXCoord:: db
296
297
NEXTU
298
299
; $00 = bag full
300
; $01 = got item
301
; $80 = didn't meet required number of owned mons
302
; $FF = player cancelled
303
hOaksAideResult::
304
hOaksAideRequirement:: ; required number of owned mons
305
db
306
hOaksAideRewardItem:: db
307
hOaksAideNumMonsOwned:: db
308
309
NEXTU
310
hVendingMachineItem:: db
311
hVendingMachinePrice:: ds 3 ; BCD number
312
313
NEXTU
314
hGymGateIndex:: db
315
hGymGateAnswer:: db
316
317
NEXTU
318
hDexRatingNumMonsSeen:: db
319
hDexRatingNumMonsOwned:: db
320
321
NEXTU
322
hItemToRemoveID:: db
323
hItemToRemoveIndex:: db
324
325
NEXTU
326
hItemCounter::
327
hSavedCoordIndex::
328
hMissableObjectIndex::
329
hGymTrashCanRandNumMask::
330
hInteractedWithBookshelf::
331
db
332
ENDU
333
334
ds 1
335
336
hBackupGymGateIndex::
337
hUnlockedSilphCoDoors::
338
db
339
340
; the first tile ID in a sequence of tile IDs that increase by 1 each step
341
hStartTileID:: db
342
343
ds 2
344
345
hNewPartyLength:: db
346
347
UNION
348
hDividend2:: db
349
hDivisor2:: db
350
hQuotient2:: db
351
352
NEXTU
353
hIsHiddenMissableObject:: db
354
ENDU
355
356
hMapROMBank:: db
357
358
hSpriteVRAMSlotAndFacing:: db
359
360
hCoordsInFrontOfPlayerMatch::
361
hSpriteAnimFrameCounter::
362
db
363
364
UNION
365
hSpriteScreenYCoord:: db
366
hSpriteScreenXCoord:: db
367
hSpriteMapYCoord:: db
368
hSpriteMapXCoord:: db
369
370
NEXTU
371
hItemAlreadyFound:: db
372
ds 2
373
hDidntFindAnyHiddenObject:: db
374
375
NEXTU
376
ds 1
377
hSavedMapTextPtr:: dw
378
ds 1
379
ENDU
380
381
ds 4
382
383
hWhoseTurn:: db ; 0 on player's turn, 1 on enemy's turn
384
385
hClearLetterPrintingDelayFlags:: db
386
387
ds 1
388
389
; bit 0: draw HP fraction to the right of bar instead of below (for party menu)
390
; bit 1: menu is double spaced
391
; bit 2: text is single spaced
392
hUILayoutFlags:: db
393
394
hFieldMoveMonMenuTopMenuItemX:: db
395
396
hJoyInput:: db
397
398
hDisableJoypadPolling:: db
399
400
ds 5
401
402
ENDSECTION
403
404