summaryrefslogtreecommitdiff
path: root/hram.asm
blob: ee557050df224420455f26ee9fdd0c5eaf497fe6 (plain)
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
hDMARoutine EQU $FF80

hSoftReset EQU $FF8A
; Initialized to 16.
; Decremented each input iteration if the player
; presses the reset sequence (A+B+SEL+START).
; Soft reset when 0 is reached.

; base tile ID to which offsets are added
hBaseTileID EQU $FF8B

; 3-byte BCD number
hItemPrice EQU $FF8B

hDexWeight EQU $FF8B

hWarpDestinationMap EQU $FF8B

hOAMTile EQU $FF8B

hROMBankTemp EQU $FF8B

hPreviousTileset EQU $FF8B

hEastWestConnectedMapWidth EQU $FF8B

hSlideAmount EQU $FF8B

hRLEByteValue EQU $FF8B

hSpriteWidth            EQU $FF8B ; in tiles
hSpriteInterlaceCounter EQU $FF8B
hSpriteHeight           EQU $FF8C ; in tiles
hSpriteOffset           EQU $FF8D

; counters for blinking down arrow
hDownArrowBlinkCount1 EQU $FF8B
hDownArrowBlinkCount2 EQU $FF8C

hSpriteDataOffset EQU $FF8B
hSpriteIndex      EQU $FF8C

hMapStride EQU $FF8B
hMapWidth  EQU $FF8C

hNorthSouthConnectionStripWidth EQU $FF8B
hNorthSouthConnectedMapWidth    EQU $FF8C

; DisplayTextID's argument
hSpriteIndexOrTextID EQU $FF8C

hPartyMonIndex EQU $FF8C

; the total number of tiles being shifted each time the pic slides by one tile
hSlidingRegionSize EQU $FF8C

; 2 bytes
hEnemySpeed EQU $FF8D

hVRAMSlot EQU $FF8D

hFourTileSpriteCount EQU $FF8E

; -1 = left
;  0 = right
hSlideDirection EQU $FF8D

hSpriteFacingDirection EQU $FF8D

hSpriteMovementByte2 EQU $FF8D

hSpriteImageIndex EQU $FF8D

hLoadSpriteTemp1 EQU $FF8D
hLoadSpriteTemp2 EQU $FF8E

hHalveItemPrices EQU $FF8E

hSpriteOffset2 EQU $FF8F

hOAMBufferOffset EQU $FF90

hSpriteScreenX EQU $FF91
hSpriteScreenY EQU $FF92

hFF8F EQU $FF8F
hFF90 EQU $FF90
hFF91 EQU $FF91
hFF92 EQU $FF92

hTilePlayerStandingOn EQU $FF93

hSpritePriority EQU $FF94

; 2 bytes
hSignCoordPointer EQU $FF95

hNPCMovementDirections2Index EQU $FF95

hSwapItemID       EQU $FF95
hSwapItemQuantity EQU $FF96

; CalcPositionOfPlayerRelativeToNPC
hNPCSpriteOffset EQU $FF95

; temp value used when swapping bytes or words
hSwapTemp EQU $FF95

hExperience EQU $FF96 ; 3 bytes, big endian

hMutateWY EQU $FF96
hMutateWX EQU $FF97

; Multiplication and division variables are meant
; to overlap for back-to-back usage. Big endian.

hMultiplicand EQU $FF96 ; 3 bytes
hMultiplier   EQU $FF99 ; 1 byte
hProduct      EQU $FF95 ; 4 bytes

hDividend     EQU $FF95 ; 4 bytes
hDivisor      EQU $FF99 ; 1 byte
hQuotient     EQU $FF95 ; 4 bytes
hRemainder    EQU $FF99 ; 1 byte

hDivideBuffer EQU $FF9A

hMultiplyBuffer EQU $FF9B

; PrintNumber (big endian).
hPastLeadingZeros EQU $FF95 ; last char printed
hNumToPrint       EQU $FF96 ; 3 bytes
hPowerOf10        EQU $FF99 ; 3 bytes
hSavedNumToPrint  EQU $FF9C ; 3 bytes

; distance in steps between NPC and player
hNPCPlayerYDistance EQU $FF95
hNPCPlayerXDistance EQU $FF96

hFindPathNumSteps EQU $FF97

; bit 0: set when the end of the path's Y coordinate matches the target's
; bit 1: set when the end of the path's X coordinate matches the target's
; When both bits are set, the end of the path is at the target's position
; (i.e. the path has been found).
hFindPathFlags EQU $FF98

hFindPathYProgress EQU $FF99
hFindPathXProgress EQU $FF9A

; 0 = from player to NPC
; 1 = from NPC to player
hNPCPlayerRelativePosPerspective EQU $FF9B

; bit 0:
; 0 = target is to the south or aligned
; 1 = target is to the north
; bit 1:
; 0 = target is to the east or aligned
; 1 = target is to the west
hNPCPlayerRelativePosFlags EQU $FF9D

; some code zeroes this for no reason when writing a coin amount
hUnusedCoinsByte EQU $FF9F

hMoney EQU $FF9F ; 3-byte BCD number
hCoins EQU $FFA0 ; 2-byte BCD number

hDivideBCDDivisor  EQU $FFA2 ; 3-byte BCD number
hDivideBCDQuotient EQU $FFA2 ; 3-byte BCD number
hDivideBCDBuffer   EQU $FFA5 ; 3-byte BCD number

hSerialReceivedNewData EQU $FFA9

; $01 = using external clock
; $02 = using internal clock
; $ff = establishing connection
hSerialConnectionStatus EQU $FFAA

hSerialIgnoringInitialData EQU $FFAB

hSerialSendData EQU $FFAC

hSerialReceiveData EQU $FFAD

; these values are copied to SCX, SCY, and WY during V-blank
hSCX EQU $FFAE
hSCY EQU $FFAF
hWY  EQU $FFB0

hJoyLast     EQU $FFB1
hJoyReleased EQU $FFB2
hJoyPressed  EQU $FFB3
hJoyHeld     EQU $FFB4
hJoy5        EQU $FFB5
hJoy6        EQU $FFB6
hJoy7        EQU $FFB7

hLoadedROMBank EQU $FFB8

hSavedROMBank EQU $FFB9

; is automatic background transfer during V-blank enabled?
; if nonzero, yes
; if zero, no
hAutoBGTransferEnabled EQU $FFBA

TRANSFERTOP    EQU 0
TRANSFERMIDDLE EQU 1
TRANSFERBOTTOM EQU 2

; 00 = top third of background
; 01 = middle third of background
; 02 = bottom third of background
hAutoBGTransferPortion EQU $FFBB

; the destination address of the automatic background transfer
hAutoBGTransferDest EQU $FFBC ; 2 bytes

hRedrawMapViewRowOffset EQU $FFBE

; temporary storage for stack pointer during memory transfers that use pop
; to increase speed
hSPTemp EQU $FFBF ; 2 bytes

; source address for VBlankCopyBgMap function
; the first byte doubles as the byte that enabled the transfer.
; if it is 0, the transfer is disabled
; if it is not 0, the transfer is enabled
; this means that XX00 is not a valid source address
hVBlankCopyBGSource EQU $FFC1 ; 2 bytes

; destination address for VBlankCopyBgMap function
hVBlankCopyBGDest EQU $FFC3 ; 2 bytes

; number of rows for VBlankCopyBgMap to copy
hVBlankCopyBGNumRows EQU $FFC5

; size of VBlankCopy transfer in 16-byte units
hVBlankCopySize EQU $FFC6

; source address for VBlankCopy function
hVBlankCopySource EQU $FFC7

; destination address for VBlankCopy function
hVBlankCopyDest EQU $FFC9

; size of source data for VBlankCopyDouble in 8-byte units
hVBlankCopyDoubleSize EQU $FFCB

; source address for VBlankCopyDouble function
hVBlankCopyDoubleSource EQU $FFCC

; destination address for VBlankCopyDouble function
hVBlankCopyDoubleDest EQU $FFCE

; controls whether a row or column of 2x2 tile blocks is redrawn in V-blank
; 00 = no redraw
; 01 = redraw column
; 02 = redraw row
hRedrawRowOrColumnMode EQU $FFD0

REDRAW_COL EQU 1
REDRAW_ROW EQU 2

hRedrawRowOrColumnDest EQU $FFD1

hRandomAdd EQU $FFD3
hRandomSub EQU $FFD4

hFrameCounter EQU $FFD5 ; decremented every V-blank (used for delays)

; V-blank sets this to 0 each time it runs.
; So, by setting it to a nonzero value and waiting for it to become 0 again,
; you can detect that the V-blank handler has run since then.
hVBlankOccurred EQU $FFD6

; 00 = indoor
; 01 = cave
; 02 = outdoor
; this is often set to 00 in order to turn off water and flower BG tile animations
hTilesetType EQU $FFD7

hMovingBGTilesCounter1 EQU $FFD8

hCurrentSpriteOffset EQU $FFDA ; multiple of $10

hItemCounter EQU $FFDB

hGymGateIndex  EQU $FFDB
hGymGateAnswer EQU $FFDC

hGymTrashCanRandNumMask EQU $FFDB

hDexRatingNumMonsSeen  EQU $FFDB
hDexRatingNumMonsOwned EQU $FFDC

; $00 = bag full
; $01 = got item
; $80 = didn't meet required number of owned mons
; $FF = player cancelled
hOaksAideResult       EQU $FFDB

hSavedCoordIndex      EQU $FFDB

hOaksAideRequirement  EQU $FFDB ; required number of owned mons
hOaksAideRewardItem   EQU $FFDC
hOaksAideNumMonsOwned EQU $FFDD

hPlayerFacing EQU $FFDB
hPlayerYCoord EQU $FFDC
hPlayerXCoord EQU $FFDD

hMissableObjectIndex EQU $FFDB

hItemToRemoveID    EQU $FFDB
hItemToRemoveIndex EQU $FFDC

hVendingMachineItem  EQU $FFDB
hVendingMachinePrice EQU $FFDC ; 3-byte BCD number

hFFDB EQU $FFDB
hFFDC EQU $FFDC

hBackupGymGateIndex EQU $FFE0

hUnlockedSilphCoDoors EQU $FFE0

; the first tile ID in a sequence of tile IDs that increase by 1 each step
hStartTileID EQU $FFE1

hNewPartyLength EQU $FFE4

hIsHiddenMissableObject EQU $FFE5

hDividend2 EQU $FFE5
hDivisor2  EQU $FFE6
hQuotient2 EQU $FFE7

hMapROMBank EQU $FFE8

hSpriteVRAMSlotAndFacing EQU $FFE9

hCoordsInFrontOfPlayerMatch EQU $FFEA

hSpriteAnimFrameCounter EQU $FFEA

hSpriteScreenYCoord EQU $FFEB
hSpriteScreenXCoord EQU $FFEC
hSpriteMapYCoord    EQU $FFED
hSpriteMapXCoord    EQU $FFEE

hItemAlreadyFound         EQU $FFEB
hDidntFindAnyHiddenObject EQU $FFEE

hSavedMapTextPtr EQU $FFEC

hWhoseTurn EQU $FFF3 ; 0 on player’s turn, 1 on enemy’s turn

hClearLetterPrintingDelayFlags EQU $FFF4

; bit 0: draw HP fraction to the right of bar instead of below (for party menu)
; bit 1: menu is double spaced
hFlagsFFF6 EQU $FFF6

hFieldMoveMonMenuTopMenuItemX EQU $FFF7

hDisableJoypadPolling EQU $FFF9

hJoyInput EQU $FFF8