-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathmemory.s
294 lines (237 loc) · 8.93 KB
/
memory.s
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
include defines.s
include macros.s
; Zeropage variables
varbase $02
var loadBufferPos ;Loader variables. Note: order is important, used for selfmod optimization code
var loadTempReg
var fileOpen
var ntscFlag
var loaderMode
var fileNumber ;Not needed by loader, but used by main code to remember the file currently accessed
var zpLenLo ;Exomizer 3 depackroutine variables
var zpSrcLo
var zpSrcHi
var zpDestLo
var zpDestHi
var zpBitsLo
var zpBitsHi
var zpBitBuf
zpLenHi = zpBitsLo ;Exomizer 3 doesn't use zpBitsLo, but the engine uses it as an extra pointer / counter
var xLo ;Actor render / spawn coordinates
var yLo
var xHi
var yHi
var cacheFrame ;Sprite render variables
var sprFrameNum
var numSpr
var numBounds
var actColorAnd
var actColorOr
var actYMSB
var actIndex ;Actor variables
var actLo
var actHi
var currFlags
var wpnLo
var wpnHi
var wpnFlags
var loadRes ;Current resource file for load
var freeMemLo ;Memory allocator variables
var freeMemHi
var musicDataLo
var musicDataHi
var zoneBufferLo
var zoneBufferHi
var nextLvlActIndex ;Misc. game vars
varrange actXH,MAX_ACT ;Actor ZP variables
varrange actYH,MAX_ACT
varrange actSX,MAX_ACT
varrange actSY,MAX_ACT
varrange actF1,MAX_ACT
checkvarbase $90
varbase $a6
var joystick ;Input variables
var prevJoy
var keyType
var levelNum ;Zone / level variables
var zoneNum
var mapSizeX
var mapSizeY
var zoneBg1
var zoneBg2
var zoneBg3
var lastNavArea
var animObj ;Levelobject variables. First 3 also used in zone init
var animObjFrame
var animObjTarget
var usableObj
var autoDeactObj
var atObj
checkvarbase $b7
varbase $c0
varrange sprOrder,MAX_SPR+1
var scrollX ;Scrolling variables
var scrollY
var scrollSX
var scrollSY
var scrCounter
var blockX
var blockY
var mapX
var mapY
var textTime ;Text printing variables
var textLeftMargin
var textRightMargin
var textLo
var textHi
var irqSaveA ;IRQ variables
var irqSaveX
var irqSaveY
var frameNumber
var firstSortSpr
var newFrameFlag
var drawScreenFlag
var dsBlockX
var dsBlockY
var dsStartX
var dsEdgeX
var dsTopPtrLo
var dsTopPtrHi
var dsBottomPtrLo
var dsBottomPtrHi
var pattPtrLo ;Playroutine
var pattPtrHi
var trackPtrLo
var trackPtrHi
var masterVol
var sfxTemp
checkvarbase $100
textCursor = loadBufferPos ;Reused during text printing (should never load mid-line!)
dataSizeLo = xHi ;Reused during resource load
dataSizeHi = yHi
zoneCharset = animObj ;Reused during zone init
zoneDataOffsetLo = animObjFrame
zoneDataOffsetHi = animObjTarget
complexSprCount = xHi ;Reused during actor render
complexSprTemp = yHi
oldSprLo = wpnLo
oldSprHi = wpnHi
oldSprHeaderLo = loadBufferPos
oldSprHeaderHi = loadTempReg
cacheAdr = wpnLo
sliceMask = wpnHi
currFireCtrl = xLo ;Reused during actor move / attack
currCtrl = yLo
edgeCtrl = xHi
moveSpeed = yHi
sideOffset = zpBitsLo
topOffset = zpBitsHi
slopeX = zpBitBuf
saveActIndex = actColorAnd
saveHp = actColorOr
blockCtrl = xHi ;Reused during attack
aimDir = zpBitsLo
bulletDir = zpBitsHi
wpnFlagsDisp = loadBufferPos
bounceBrake = yLo ;Reused during bounce physics
bouncePrevX = xHi
bouncePrevY = yHi
signXDist = xLo ;Reused during AI
absXDist = xHi
signYDist = yLo
absYDist = yHi
targetX = zpSrcLo
targetY = zpSrcHi
srcNavArea = zpDestLo
currentDist = zpDestHi
bestDist = zpBitsLo
bestArea = zpBitsHi
aggression = zpLenLo
bboxTop = zpBitsLo ;AI firing dir check
bboxBottom = zpBitsHi
wpnHeight = zpBitBuf
lineX = xLo ;Reused during linecheck
lineY = yLo
lineYCopy = xHi
lineSlope = yHi
lineCount = zpBitsLo
aoEndFrame = xLo ;Object animation
aoTemp = yLo
promptIndex = xLo ;Interaction prompts
promptType = yLo
; Memory areas and non-zeropage variables
depackBuffer = $0100
loadBuffer = $0200
StopIrq = $02a7 ;Kernal load/save preparation: disable IRQs / blank screen if necessary
exomizerCodeStart = $0334
scriptCodeRelocStart = $8000
videoBank = $c000
fileAreaEnd = $d000
spriteCache = $d000
colors = $d800
panelScreen = $e000
panelChars = $e000
blkTL = $e400
blkTR = $e500
blkBL = $e600
blkBR = $e700
chars = $e800
blkInfo = $f000
blkColors = $f100
lvlObjAnimFrames = $f200
charAnimCodeJump = $f2bd
miscVarArea1 = $f2c0
screen = $f800
emptySprite = $fc00
miscVarArea2 = $fc40
varbase panelScreen+24*40-1
varrange sprY,MAX_SPR+1
varrange boundsAct,MAX_BOUNDS
checkvarbase panelScreen+1016
varbase screen+SCROLLROWS*40
varrange sprX,MAX_SPR
varrange sprF,MAX_SPR
varrange sprC,MAX_SPR
varrange sprAct,MAX_SPR
checkvarbase screen+1016
varbase miscVarArea1
; Level objects
varrange lvlObjX,MAX_LVLOBJ
varrange lvlObjY,MAX_LVLOBJ
varrange lvlObjZ,MAX_LVLOBJ
varrange lvlObjFlags,MAX_LVLOBJ
varrange lvlObjSize,MAX_LVLOBJ
varrange lvlObjFrame,MAX_LVLOBJ
varrange lvlObjDL,MAX_LVLOBJ
varrange lvlObjDH,MAX_LVLOBJ
; Leveldata actors
varrange lvlActX,MAX_LVLACT
varrange lvlActY,MAX_LVLACT
varrange lvlActZ,MAX_LVLACT
varrange lvlActT,MAX_LVLACT
varrange lvlActWpn,MAX_LVLACT
varrange lvlActOrg,MAX_LVLACT
varbase miscVarArea2
; Sprite caching & resources
varrange fileNumObjects,MAX_CHUNKFILES
varrange cacheSprAge,MAX_CACHESPRITES
varrange cacheSprFrame,MAX_CACHESPRITES
varrange cacheSprFile,MAX_CACHESPRITES
varrange fileLo,MAX_CHUNKFILES
varrange fileHi,MAX_CHUNKFILES
varrange fileAge,MAX_CHUNKFILES
; Actor bounds
varrange boundsL,MAX_BOUNDS
varrange boundsR,MAX_BOUNDS
varrange boundsU,MAX_BOUNDS
varrange boundsD,MAX_BOUNDS
; Navareas
varrange navAreaType,MAX_NAVAREAS
varrange navAreaL,MAX_NAVAREAS
varrange navAreaR,MAX_NAVAREAS
varrange navAreaU,MAX_NAVAREAS
varrange navAreaD,MAX_NAVAREAS
; Maprowtable
varrange mapTblLo,MAX_MAPROWS
varrange mapTblHi,MAX_MAPROWS
checkvarbase $fffa