-
Notifications
You must be signed in to change notification settings - Fork 10
/
memory.s
229 lines (195 loc) · 6.79 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
include macros.s
; Constants that affect the memory map
MAX_SPR = 24
MAX_ACT = 22
MAX_COMPLEXACT = 7
MAX_CACHESPRITES = 64
MAX_CHUNKFILES = 32
MAX_MAPROWS = 128
MAX_BLK = 192
MAX_LVLDATAACT = 80 ;Defined actors per level, on/off persistency
MAX_LVLACT = 96 ;Allow extra 16 global or temporary persistent actors
MAX_GLOBALACT = MAX_LVLACT-MAX_LVLDATAACT
MAX_SAVEACT = 24 ;Amount of persistent actors saved in save optimize mode
MAX_LVLOBJ = 96
MAX_PLOTBITS = 16
MAX_SAVES = 5
MAX_PERSISTENTNPCS = 3
MAX_CODES = 8
ACTI_PLAYER = 0
ACTI_FIRSTNPC = 1
ACTI_LASTNPC = 6
ACTI_FIRSTITEM = 7
ACTI_LASTITEM = 11
ACTI_FIRSTPLRBULLET = 12
ACTI_LASTPLRBULLET = 16
ACTI_FIRSTNPCBULLET = 17
ACTI_LASTNPCBULLET = 21
ACTI_FIRSTEFFECT = ACTI_LASTPLRBULLET
ACTI_LASTEFFECT = ACTI_FIRSTNPCBULLET+1
MAX_PERSISTENTACT = ACTI_LASTITEM+1 ;Player + complex actors + items
MAX_BULLETS = ACTI_LASTNPCBULLET-ACTI_FIRSTPLRBULLET+1
SAVEDESCSIZE = 20
SCRIPTAREASIZE = 8*256
SCROLLROWS = 22
STACKSTART = $7f
; Zeropage variables
varbase $02
var loadTempReg ;Loader variables
var fileOpen
var zpLenLo ;Exomizer 2 depackroutine variables
var zpSrcLo
var zpSrcHi
var zpBitsLo
var zpBitsHi
var zpBitBuf
var zpDestLo
var zpDestHi
var temp1 ;Temp variables
var temp2
var temp3
var temp4
var temp5
var temp6
var temp7
var temp8
var freeMemLo ;Memory allocator variables
var freeMemHi
var joystick ;Joystick/keyboard variables
var prevJoy
var keyPress
var keyType
var screen ;Scrolling/map/zone variables
var scrollX
var scrollY
var scrollSX
var scrollSY
var scrollCSX
var scrollCSY
var scrCounter
var scrAdd
var scrollWorkFlag
var shakeScreen
var blockX
var blockY
var mapX
var mapY
var mapSizeX
var zoneNum
var zoneLo
var zoneHi
var limitL
var limitR
var limitU
var limitD
var sprIndex ;Spritefile access variables
var sprFileNum
var sprFileLo
var sprFileHi
var frameLo
var frameHi
var textLo ;Panel text printing variables
var textHi
var textTime
var textDelay
var textLeftMargin
var panelUpdateFlags
var menuMode ;Menu system variables
var menuCounter
var menuMoveDelay
var actIndex ;Actor variables
var actLo
var actHi
var tgtActIndex
var numTargets
var numSpawned
var lvlObjNum ;Level object variables
var autoDeactObjNum
var autoDeactObjCounter
var wpnLo ;Weapon variables
var wpnHi
var wpnBits
var displayedItemName ;Misc. game variables
var displayedHealth
var displayedBattery
var armorMsgTime
var healTimer
var difficulty ;Game options
var musicMode
var soundMode
var levelNum ;Player ZP state
var itemIndex
var lastItemIndex
var levelActorIndex
var scriptF
var scriptEP
var upgrade
var reload
var toxinDelay
playerStateZPStart = levelNum
playerStateZPEnd = toxinDelay+1
palFlag = freeMemLo
varrange sprOrder,MAX_SPR+1
varrange sprY,MAX_SPR+1
checkvarbase $90
varbase $c0
varrange sprXL,MAX_SPR+1
varrange sprXH,MAX_SPR+1
var firstSortSpr ;Frame update/raster IRQ variables
var newFrame
var irqSaveA
var irqSaveX
var irqSaveY
var irqSave01
var ntInitSong ;Playroutine
var ntTemp1
var ntTemp2
var ntTrackLo
var ntTrackHi
var ntFiltPos
var ntFiltTime
var ntFiltCutoff
checkvarbase $100
; Memory areas and non-zeropage variables
cacheSprFile = $0180
cacheSprFrame = $0180+MAX_CACHESPRITES
sprF = $0200
sprC = $0200+MAX_SPR
sprAct = $0200+MAX_SPR*2
cacheSprAge = $02a7
targetList = $02a7+MAX_CACHESPRITES
exomizerCodeStart = $0334
loaderCodeStart = $0500
loaderCodeEnd = $0534
videoBank = $c000
spriteCache = $d000
fileAreaEnd = spriteCache
colors = $d800
textChars = $e000
emptySprite = $e300
panelScreen = $e000
mapTblLo = $e000
mapTblHi = $e080
blkTblLo = $e400
loadBuffer = mapTblLo
blkTblHi = $e4c0
depackBuffer = blkTblLo + 1
lvlCodeStart = $e580
charInfo = $e600
charColors = $e700
chars = $e800
introStart = $ec00
screen2 = $f000
screen1 = $f400
charsetLoadProperties = screen2
sortSprD010 = screen2+SCROLLROWS*40
sprIrqLine = screen2+SCROLLROWS*40+MAX_SPR*2
sprOrTbl = screen1+SCROLLROWS*40
sprAndTbl = screen1+SCROLLROWS*40+MAX_SPR*2
lvlDataActX = screen2
lvlDataActY = screen2+MAX_LVLDATAACT
lvlDataActF = screen2+MAX_LVLDATAACT*2
lvlDataActT = screen2+MAX_LVLDATAACT*3
lvlDataActWpn = screen2+MAX_LVLDATAACT*4
introCodeStart = $f400
musicData = $f800