-
Notifications
You must be signed in to change notification settings - Fork 3
/
Variables.asm
555 lines (490 loc) · 27.5 KB
/
Variables.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
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
include "s1.sounddriver.ram.asm"
; sign-extends a 32-bit integer to 64-bit
; all RAM addresses are run through this function to allow them to work in both 16-bit and 32-bit addressing modes
ramaddr function x,(-(x&$80000000)<<1)|x
; RetroKoH/Shobiz S3K Rings Manager
Max_Rings = 511 ; default. maximum number possible is 759
if Max_Rings > 759
fatal "Maximum number of rings possible is 759"
endif
Rings_Space = (Max_Rings+1)*2
; S3K Rings Manager End
; Variables (v) and Flags (f)
phase ramaddr ( $FFFF0000 )
v_ram_start:
if ChunksInROM=0
v_128x128: ds.b $8000 ; 128x128 chunk mappings ($100 chunks * $80 bytes)
v_128x128_end:
else
v_128x128: ds.l 1 ; address location of 128x128 chunk mappings
ds.l $1FFF ; unused ($8000 - 4) bytes
endif
v_lvllayout: ds.b $1000 ; level and background layouts
v_collision1: ds.b $300
v_collision2: ds.b $300
; RetroKoH/Shobiz S3K Rings Manager RAM Variables
v_ringspace:
v_ringpos: ds.b Rings_Space ; $9600 (Ring_status_table) one word per ring = $400 bytes
v_ringposend:
v_ringstart_addr_ROM: ds.l 1 ; $9A00 (Ring_start_addr_ROM) address in the ring layout of the first ring whose X position is >= camera X position - 8
v_ringend_addr_ROM: ds.l 1 ; $9A04 (Ring_end_addr_ROM) address in the ring layout of the first ring whose X position is >= camera X position + 328
v_ringstart_addr_RAM: ds.w 1 ; $9A08 (Ring_start_addr_RAM) address in the ring status table of the first ring whose X position is >= camera X position - 8
v_ringconsumedata: ; $9A0A (Ring_consumption_table) ; stores the addresses of all rings currently being consumed
v_ringconsumecount: ds.w 1 ; the number of rings being consumed currently
v_ringconsumelist: ds.w $3F ; the remaining part of the ring consumption table
v_ringsroutine: ds.b 1 ; $9A8A (Rings_manager_routine)
v_ringspace_end: ; using this to clearRAM seemingly doesn't work correctly.
; S3K Rings Manager End
ds.b 1 ; unused
v_objstate: ds.w $C0 ; object state list (Moved and Expanded -- ProjectFM/MoDule S3K Objects Manager)
v_objstate_end:
v_col_response_list ds.b $70 ; $9C0C
ds.b $B84 ; unused -- $9C7C
v_bgscroll_buffer: ds.b $200 ; $A800 - background scroll buffer
v_ngfx_buffer: ds.b $200 ; Nemesis graphics decompression buffer
v_ngfx_buffer_end:
v_spritequeue: ds.b $400 ; sprite display queue, in order of priority
if BlocksInROM=0
v_16x16: ds.b $1800 ; 16x16 tile mappings
else
v_16x16: ds.l 1 ; address location of 16x16 block mappings
ds.l $5FF ; unused ($1800 - 4) bytes
endif
; Flamewing/MarkeyJester improved DMA Queue
v_vdp_comm_buffer: ds.b $FC ; buffer for DMA Queue replacing the old art buffer.
v_vdp_comm_buffer_slot: ds.b $04 ; stores the address of the next open slot for a queued VDP command
ds.b $200 ; unused (from $20 to $200)
v_tracksonic: ds.b $100 ; position tracking data for Sonic (CB00)
v_hscrolltablebuffer: ds.b $380 ; scrolling table data
v_hscrolltablebuffer_end:
ds.b $80 ; would be unused, but data from v_hscrolltablebuffer can spill into here
v_hscrolltablebuffer_end_padded:
v_objspace: ds.b object_size*$80 ; object variable space ($40 bytes per object)
; Title screen objects
v_sonicteam = v_objspace+object_size*2 ; object variable space for the "SONIC TEAM PRESENTS" text ($40 bytes)
v_titlesonic = v_objspace+object_size*1 ; object variable space for Sonic in the title screen ($40 bytes)
v_pressstart = v_objspace+object_size*2 ; object variable space for the "PRESS START BUTTON" text ($40 bytes)
v_titletm = v_objspace+object_size*3 ; object variable space for the trademark symbol ($40 bytes)
v_ttlsonichide = v_objspace+object_size*4 ; object variable space for hiding part of Sonic ($40 bytes)
; Level objects
v_player = v_objspace+object_size*0 ; ($D000) object variable space for Sonic ($40 bytes)
v_playerdust = v_objspace+object_size*1 ; ($D040) object variable space for effect dust (Replaced the HUD) ($40 bytes)
v_titlecard = v_objspace+object_size*2 ; ($D080) object variable space for the title card ($100 bytes)
v_ttlcardname = v_titlecard+object_size*0 ; ($D080) object variable space for the title card zone name text ($40 bytes)
v_ttlcardzone = v_titlecard+object_size*1 ; ($D0C0) object variable space for the title card "ZONE" text ($40 bytes)
v_ttlcardact = v_titlecard+object_size*2 ; ($D100) object variable space for the title card act text ($40 bytes)
v_ttlcardoval = v_titlecard+object_size*3 ; ($D140) object variable space for the title card oval ($40 bytes)
v_gameovertext1 = v_objspace+object_size*2 ; ($D080) object variable space for the "GAME"/"TIME" in "GAME OVER"/"TIME OVER" text ($40 bytes)
v_gameovertext2 = v_objspace+object_size*3 ; ($D0C0) object variable space for the "OVER" in "GAME OVER"/"TIME OVER" text ($40 bytes)
v_shieldobj = v_objspace+object_size*6 ; ($D180) object variable space for the shield ($40 bytes)
; Use subsprites and free up some v_stars slots
v_starsobj1 = v_objspace+object_size*7 ; ($D1C0) object variable space for the invincibility stars #1 ($40 bytes)
v_starsobj2 = v_objspace+object_size*8 ; ($D200) object variable space for the invincibility stars #2 ($40 bytes)
v_starsobj3 = v_objspace+object_size*9 ; ($D240) object variable space for the invincibility stars #3 ($40 bytes)
v_starsobj4 = v_objspace+object_size*10 ; ($D280) object variable space for the invincibility stars #4 ($40 bytes)
v_splash = v_objspace+object_size*11 ; ($D2C0) object variable space for the water splash ($40 bytes)
v_sonicbubbles = v_objspace+object_size*12 ; ($D300) object variable space for the bubbles that come out of Sonic's mouth/drown countdown ($40 bytes)
v_sparksobj = v_objspace+object_size*13 ; ($D340) object variable space for lightning shield sparks ($100 bytes)
; = v_objspace+object_size*14
; = v_objspace+object_size*15
; = v_objspace+object_size*16
v_trails = v_objspace+object_size*17 ; ($D440) object variable space for after-images ($C0 bytes)
v_followobject = v_objspace+object_size*18
v_trails2 = v_objspace+object_size*19
v_sstarsobj = v_objspace+object_size*20 ; object variable space for super stars
v_gogglesobj = v_objspace+object_size*21 ; object variable space for goggles
v_endcard = v_objspace+object_size*22 ; ($D5C0) object variable space for the level results card ($1C0 bytes)
v_endcardsonic = v_endcard+object_size*0 ; ($D5C0) object variable space for the level results card "SONIC HAS" text ($40 bytes)
v_endcardpassed = v_endcard+object_size*1 ; ($D600) object variable space for the level results card "PASSED" text ($40 bytes)
v_endcardact = v_endcard+object_size*2 ; ($D640) object variable space for the level results card act text ($40 bytes)
v_endcardscore = v_endcard+object_size*3 ; ($D680) object variable space for the level results card score tally ($40 bytes)
v_endcardtime = v_endcard+object_size*4 ; ($D6C0) object variable space for the level results card time bonus tally ($40 bytes)
v_endcardring = v_endcard+object_size*5 ; ($D700) object variable space for the level results card ring bonus tally ($40 bytes)
v_endcardoval = v_endcard+object_size*6 ; ($D740) object variable space for the level results card oval ($40 bytes)
; A final slot is reserved in case we use both Cool and Perfect Bonuses.
v_watersurface1 = v_objspace+object_size*30 ; ($D780) object variable space for the water surface #1 ($40 bytes)
v_watersurface2 = v_objspace+object_size*31 ; ($D7C0) object variable space for the water surface #1 ($40 bytes)
v_lvlobjspace = v_objspace+object_size*32 ; level object variable space ($60 objects, $1800 bytes)
v_lvlobjend = v_lvlobjspace+object_size*96
v_objspace_end = v_lvlobjend
v_rsvobjcount = (v_lvlobjspace-v_objspace)/object_size-1
v_lvlobjcount = (v_lvlobjend-v_lvlobjspace)/object_size-1 ; $5F
v_allobjcount = (v_objspace_end-v_objspace)/object_size-1
; Special Stage objects
v_ssrescard = v_objspace+object_size*23 ; object variable space for the Special Stage results card ($140 bytes)
v_ssrestext = v_ssrescard+object_size*0 ; object variable space for the Special Stage results card text ($40 bytes)
v_ssresscore = v_ssrescard+object_size*1 ; object variable space for the Special Stage results card score tally ($40 bytes)
v_ssresring = v_ssrescard+object_size*2 ; object variable space for the Special Stage results card ring bonus tally ($40 bytes)
v_ssresoval = v_ssrescard+object_size*3 ; object variable space for the Special Stage results card oval ($40 bytes)
if PerfectBonusEnabled
v_ssresperfect = v_ssrescard+object_size*4 ; object variable space for the Special Stage results card PERFECT bonus tally ($40 bytes)
v_ssrescontinue = v_ssrescard+object_size*5 ; object variable space for the Special Stage results card continue icon ($40 bytes)
else
v_ssrescontinue = v_ssrescard+object_size*4 ; object variable space for the Special Stage results card continue icon ($40 bytes)
endif
v_ssresemeralds = v_objspace+object_size*32 ; object variable space for the emeralds in the Special Stage results ($180 bytes)
; Continue screen objects
v_continuetext = v_objspace+object_size*1 ; object variable space for the continue screen text ($40 bytes)
v_continuelight = v_objspace+object_size*2 ; object variable space for the continue screen light spot ($40 bytes)
v_continueicon = v_objspace+object_size*3 ; object variable space for the continue screen icon ($40 bytes)
; Ending objects
v_endemeralds = v_objspace+object_size*16 ; object variable space for the emeralds in the ending ($180 bytes)
v_endemeralds_end = v_objspace+object_size*32
v_endlogo = v_objspace+object_size*16 ; object variable space for the logo in the ending ($40 bytes)
; Credits objects
v_credits = v_objspace+object_size*2 ; object variable space for the credits text ($40 bytes)
v_endeggman = v_objspace+object_size*2 ; object variable space for Eggman after the credits ($40 bytes)
v_tryagain = v_objspace+object_size*3 ; object variable space for the "TRY AGAIN" text ($40 bytes)
v_eggmanchaos = v_objspace+object_size*32 ; object variable space for the emeralds juggled by Eggman ($180 bytes)
v_snddriver_ram: SMPS_RAM ; sound driver state
ds.b $40 ; unused
v_gamemode: ds.b 1 ; game mode (00=Sega; 04=Title; 08=Demo; 0C=Level; 10=SS; 14=Cont; 18=End; 1C=Credit; +8C=PreLevel)
v_lastbgmplayed: ds.b 1 ; last bgm played by PlaySound (Used by RestartMusic)
v_jpadhold2: ds.b 1 ; joypad input - held, duplicate
v_jpadpress2: ds.b 1 ; joypad input - pressed, duplicate
v_jpadhold1: ds.b 1 ; joypad input - held
v_jpadpress1: ds.b 1 ; joypad input - pressed
ds.b 6 ; unused
v_vdp_buffer1: ds.w 1 ; VDP instruction buffer
ds.b 6 ; unused
v_demolength: ds.w 1 ; the length of a demo in frames
v_scrposy_vdp: ds.w 1 ; screen position y (VDP)
v_bgscrposy_vdp: ds.w 1 ; background screen position y (VDP)
v_scrposx_vdp: ds.w 1 ; screen position x (VDP)
v_bgscrposx_vdp: ds.w 1 ; background screen position x (VDP)
v_bg3scrposy_vdp: ds.w 1
v_bg3scrposx_vdp: ds.w 1
ds.b 2 ; unused
v_hbla_hreg: ds.w 1 ; VDP H.interrupt register buffer (8Axx)
v_hbla_line = v_hbla_hreg+1 ; screen line where water starts and palette is changed by HBlank
v_pfade_start: ds.b 1 ; palette fading - start position in bytes
v_pfade_size: ds.b 1 ; palette fading - number of colours
v_misc_variables:
v_vbla_0e_counter: ds.b 1 ; tracks how many times vertical interrupts routine 0E occured (pretty much unused because routine 0E is unused)
ds.b 1 ; unused
v_vbla_routine: ds.b 1 ; VBlank - routine counter
ds.b 1 ; unused
v_spritecount: ds.b 1 ; number of sprites on-screen
ds.b 5 ; unused
v_pcyc_num: ds.w 1 ; palette cycling - current reference number
v_pcyc_time: ds.w 1 ; palette cycling - time until the next change
v_random: ds.l 1 ; pseudo random number buffer
f_pause: ds.b 1 ; flag set to pause the game
ds.b 1 ; unused
v_palette_frame: ds.w 1
v_palette_timer: ds.b 1
f_super_palette: ds.b 1
v_vdp_buffer2: ds.w 1 ; VDP instruction buffer
ds.b 2 ; unused
f_hbla_pal: ds.w 1 ; flag set to change palette during HBlank (0000 = no; 0001 = change)
v_waterpos1: ds.w 1 ; water height, actual
v_waterpos2: ds.w 1 ; water height, ignoring sway
v_waterpos3: ds.w 1 ; water height, next target
f_water: ds.b 1 ; flag set for water
v_wtr_routine: ds.b 1 ; water event - routine counter
f_wtr_state: ds.b 1 ; water palette state when water is above/below the screen (00 = partly/all dry; 01 = all underwater)
f_doupdatesinhblank: ds.b 1 ; defers performing various tasks to the Horizontal Interrupt (H-Blank)
v_pal_buffer: ds.b $30 ; palette data buffer (used for palette cycling)
v_misc_variables_end:
v_plc_buffer: ds.b 6*16 ; pattern load cues buffer (maximum $10 PLCs)
v_plc_buffer_only_end:
v_plc_ptrnemcode: ds.l 1 ; pointer for nemesis decompression code ($1502 or $150C)
v_plc_repeatcount: ds.l 1
v_plc_paletteindex: ds.l 1
v_plc_previousrow: ds.l 1
v_plc_dataword: ds.l 1
v_plc_shiftvalue: ds.l 1
v_plc_patternsleft: ds.w 1
v_plc_framepatternsleft:ds.w 1
ds.b 4 ; unused
v_plc_buffer_end:
v_levelvariables: ; variables that are reset between levels
v_screenposx: ds.l 1 ; screen position x
v_screenposy: ds.l 1 ; screen position y
v_bgscreenposx: ds.l 1 ; background screen position x
v_bgscreenposy: ds.l 1 ; background screen position y
v_bg2screenposx: ds.l 1
v_bg2screenposy: ds.l 1
v_bg3screenposx: ds.l 1
v_bg3screenposy: ds.l 1
v_limitleft1: ds.w 1 ; left level boundary (unused)
v_limitright1: ds.w 1 ; right level boundary (unused)
v_limittop1: ds.w 1 ; top level boundary (unused)
v_limitbtm1: ds.w 1 ; bottom level boundary
v_limitleft2: ds.w 1 ; left level boundary
v_limitright2: ds.w 1 ; right level boundary
v_limittop2: ds.w 1 ; top level boundary
v_limitbtm2: ds.w 1 ; bottom level boundary
v_unused11: ds.w 1 ; unused
v_limitleft3: ds.w 1 ; left level boundary, at the end of an act
v_screenposx_last: ds.w 1 ; ProjectFM S3K Object Manager
v_screenposy_last: ds.w 1 ; ProjectFM S3K Object Manager
ds.b 2 ; unused
v_scrshiftx: ds.w 1 ; x-screen shift (new - last) * $100
v_scrshifty: ds.w 1 ; y-screen shift (new - last) * $100
v_lookshift: ds.w 1 ; screen shift when Sonic looks up/down
ds.b 2 ; unused
v_dle_routine: ds.w 1 ; dynamic level event - routine counter (2 bytes) -- Filter Optimized DLE Manager
f_nobgscroll: ds.b 1 ; flag set to cancel background scrolling
ds.b 1 ; unused
v_unused9: ds.b 1 ; unused
ds.b 1 ; unused
v_unused10: ds.b 1 ; unused
ds.b 1 ; unused
v_fg_xblock: ds.b 1 ; foreground x-block parity (for redraw)
v_fg_yblock: ds.b 1 ; foreground y-block parity (for redraw)
v_bg1_xblock: ds.b 1 ; background x-block parity (for redraw)
v_bg1_yblock: ds.b 1 ; background y-block parity (for redraw)
v_bg2_xblock: ds.b 1 ; secondary background x-block parity (for redraw)
v_bg2_yblock: ds.b 1 ; secondary background y-block parity (unused)
v_bg3_xblock: ds.b 1 ; teritary background x-block parity (for redraw)
v_bg3_yblock: ds.b 1 ; teritary background y-block parity (unused)
ds.b 2 ; unused
v_fg_scroll_flags: ds.w 1 ; screen redraw flags for foreground
v_bg1_scroll_flags: ds.w 1 ; screen redraw flags for background 1
v_bg2_scroll_flags: ds.w 1 ; screen redraw flags for background 2
v_bg3_scroll_flags: ds.w 1 ; screen redraw flags for background 3
f_bgscrollvert: ds.b 1 ; flag for vertical background scrolling
ds.b 3 ; unused
v_sonspeedmax: ds.w 1 ; Sonic's maximum speed
v_sonspeedacc: ds.w 1 ; Sonic's acceleration
v_sonspeeddec: ds.w 1 ; Sonic's deceleration
v_sonframenum: ds.b 1 ; frame to display for Sonic
f_sonframechg: ds.b 1 ; flag set to update Sonic's sprite frame
v_anglebuffer: ds.b 1 ; angle of collision block that Sonic or object is standing on
ds.b 1 ; unused
v_anglebuffer2: ds.b 1 ; other angle of collision block that Sonic or object is standing on
ds.b 1 ; unused
v_opl_routine: ds.b 1 ; ObjPosLoad - routine counter
ds.b 1 ; unused
v_opl_screen: ds.w 1 ; ObjPosLoad - screen variable
v_opl_data: ds.b $10 ; ObjPosLoad - data buffer
v_ssangle: ds.w 1 ; Special Stage angle
v_ssrotate: ds.w 1 ; Special Stage rotation speed
v_ssangleprev: ds.b 1 ; Previous Special Stage angle -- Mercury Dynamic Special Stage Walls
ds.b $9 ; unused
f_levelstarted: ds.b 1 ; level start flag (for drawing non-objects) -- RetroKoH S/3K Rings Manager
v_hudscrollpos ds.b 1 ; Scrolling x-position for the HUD. -- RetroKoH Scrolling HUD Display
v_btnpushtime1: ds.w 1 ; button push duration - in level
v_btnpushtime2: ds.w 1 ; button push duration - in demo
v_palchgspeed: ds.w 1 ; palette fade/transition speed (0 is fastest)
v_collindex: ds.l 1 ; ROM address for collision index of current level
v_palss_num: ds.w 1 ; palette cycling in Special Stage - reference number
v_palss_time: ds.w 1 ; palette cycling in Special Stage - time until next change
v_palss_index: ds.w 1 ; palette cycling in Special Stage - index into palette cycle 2 (unused?)
v_ssbganim: ds.w 1 ; Special Stage background animation
v_camera_pan: ds.w 1 ; Extended Camera - how far the camera/view is panned to the left or right of Sonic (2 bytes)
v_obj31ypos: ds.w 1 ; y-position of object 31 (MZ stomper)
ds.b 1 ; unused
v_bossstatus: ds.b 1 ; status of boss and prison capsule (01 = boss defeated; 02 = prison opened)
v_trackpos: ds.w 1 ; position tracking reference number
v_trackbyte = v_trackpos+1 ; low byte for position tracking
f_lockscreen: ds.b 1 ; flag set to lock screen during bosses
ds.b 5 ; unused
Anim_Counters:
v_lani0_frame: ds.b 1 ; level graphics animation 0 - current frame
v_lani0_time: ds.b 1 ; level graphics animation 0 - time until next frame
v_lani1_frame: ds.b 1 ; level graphics animation 1 - current frame
v_lani1_time: ds.b 1 ; level graphics animation 1 - time until next frame
v_lani2_frame: ds.b 1 ; level graphics animation 2 - current frame
v_lani2_time: ds.b 1 ; level graphics animation 2 - time until next frame
v_lani3_frame: ds.b 1 ; level graphics animation 3 - current frame
v_lani3_time: ds.b 1 ; level graphics animation 3 - time until next frame
v_lani4_frame: ds.b 1 ; level graphics animation 4 - current frame
v_lani4_time: ds.b 1 ; level graphics animation 4 - time until next frame
v_lani5_frame: ds.b 1 ; level graphics animation 5 - current frame
v_lani5_time: ds.b 1 ; level graphics animation 5 - time until next frame
v_lani_updateproc: ds.l 1 ; Update procedure pointer (4 bytes)
f_conveyrev: ds.b 1 ; flag set to reverse conveyor belts in LZ/SBZ
v_obj63: ds.b 6 ; object 63 (LZ/SBZ platforms) variables
f_wtunnelmode: ds.b 1 ; LZ water tunnel mode
f_wtunnelallow: ds.b 1 ; LZ water tunnels (00 = enabled; 01 = disabled)
f_slidemode: ds.b 1 ; LZ water slide mode
v_obj6B: ds.b 1 ; object 6B (SBZ stomper) variable
f_lockctrl: ds.b 1 ; flag set to lock controls during ending sequence
f_bigring: ds.b 1 ; flag set when Sonic collects the giant ring
f_obj56: ds.b 1 ; object 56 flag
v_itembonus: ds.w 1 ; item bonus from broken enemies, blocks etc.
v_timebonus: ds.w 1 ; time bonus at the end of an act
v_ringbonus: ds.w 1 ; ring bonus at the end of an act
v_coolbonus: ds.w 1 ; cool bonus at the end of an act (Only used if Cool Bonus toggle is enabled)
v_perfectbonus: ds.w 1 ; perfect bonus at the end of an act (Only used if Perfect Bonus toggle is enabled)
f_endactbonus: ds.b 1 ; time/ring bonus update flag at the end of an act
v_sonicend: ds.b 1 ; routine counter for Sonic in the ending sequence
v_lz_deform: ds.w 1 ; LZ deformation offset, in units of $80
ds.b 4 ; unused
f_switch: ds.b $10 ; flags set when Sonic stands on a switch
v_scroll_block_1_size: ds.w 1
v_scroll_block_2_size: ds.w 1 ; unused
v_scroll_block_3_size: ds.w 1 ; unused
v_scroll_block_4_size: ds.w 1 ; unused
ds.b 8 ; unused
v_levelvariables_end:
v_spritetablebuffer: ds.b $280 ; sprite table (last $80 bytes are overwritten by v_palette_water_fading)
v_spritetablebuffer_end:
v_palette_water_fading = v_spritetablebuffer_end-$80 ; duplicate underwater palette, used for transitions ($80 bytes)
v_palette_water: ds.b $80 ; main underwater palette
v_palette_water_end:
v_palette: ds.b $80 ; main palette
v_palette_end:
v_palette_fading: ds.b $80 ; duplicate palette, used for transitions
v_palette_fading_end:
ds.b $140 ; stack
v_systemstack:
v_crossresetram: ; RAM beyond this point is only cleared on a cold-boot
ds.b 2 ; unused
v_hitscount: ds.b 1 ; number of cool bonus hits (Decrements with each hit of damage). (Only used if Cool Bonus toggle is enabled)
f_restart: ds.b 1 ; restart level flag (now 1 byte)
v_framecount: ds.w 1 ; frame counter (adds 1 every frame)
v_framebyte = v_framecount+1 ; low byte for frame counter
v_supersonic_frame: ds.b 1 ; frame counter for decrementing rings while Super
v_debugitem: ds.b 1 ; debug item currently selected (NOT the object number of the item)
v_debuguse: ds.w 1 ; debug mode use & routine counter (when Sonic is a ring/item)
v_debugxspeed: ds.b 1 ; debug mode - horizontal speed
v_debugyspeed: ds.b 1 ; debug mode - vertical speed
v_vbla_count: ds.l 1 ; vertical interrupt counter (adds 1 every VBlank)
v_vbla_word = v_vbla_count+2 ; low word for vertical interrupt counter (2 bytes)
v_vbla_byte = v_vbla_word+1 ; low byte for vertical interrupt counter
v_zone: ds.b 1 ; current zone number
v_act: ds.b 1 ; current act number
v_lives: ds.b 1 ; number of lives
ds.b 1 ; unused
v_air: ds.b 1 ; air remaining while underwater
ds.b 1 ; unused
v_lastspecial: ds.b 1 ; last special stage number
ds.b 1 ; unused
v_continues: ds.b 1 ; number of continues
v_carddelay: ds.b 1 ; timer to delay during card art loading (solves certain bugs, namely in LZ)
f_timeover: ds.b 1 ; time over flag
v_lifecount: ds.b 1 ; lives counter value (for actual number, see "v_lives")
f_lifecount: ds.b 1 ; lives counter update flag
f_ringcount: ds.b 1 ; ring counter update flag
f_timecount: ds.b 1 ; time counter update flag
f_scorecount: ds.b 1 ; score counter update flag
v_rings: ds.w 1 ; rings
v_ringbyte = v_rings+1 ; low byte for rings
v_time: ds.l 1 ; time (First byte is unused)
v_timemin = v_time+1 ; time - minutes
v_timesec = v_time+2 ; time - seconds
v_timecent = v_time+3 ; time - centiseconds
v_score: ds.l 1 ; score
ds.b 5 ; unused
v_centstep: ds.b 1 ; value used to increment centiseconds
v_lastlamp: ds.b 2 ; number of the last lamppost you hit
v_lamp_xpos: ds.w 1 ; x-axis for Sonic to respawn at lamppost
v_lamp_ypos: ds.w 1 ; y-axis for Sonic to respawn at lamppost
v_lamp_rings: ds.w 1 ; rings stored at lamppost
v_lamp_time: ds.l 1 ; time stored at lamppost
v_lamp_dle: ds.w 1 ; dynamic level event routine counter at lamppost (2 bytes -- Filter DLE Optimization)
v_lamp_limitbtm: ds.w 1 ; level bottom boundary at lamppost
v_lamp_scrx: ds.w 1 ; x-axis screen at lamppost
v_lamp_scry: ds.w 1 ; y-axis screen at lamppost
v_lamp_bgscrx: ds.w 1 ; x-axis BG screen at lamppost
v_lamp_bgscry: ds.w 1 ; y-axis BG screen at lamppost
v_lamp_bg2scrx: ds.w 1 ; x-axis BG2 screen at lamppost
v_lamp_bg2scry: ds.w 1 ; y-axis BG2 screen at lamppost
v_lamp_bg3scrx: ds.w 1 ; x-axis BG3 screen at lamppost
v_lamp_bg3scry: ds.w 1 ; y-axis BG3 screen at lamppost
v_lamp_wtrpos: ds.w 1 ; water position at lamppost
v_lamp_wtrrout: ds.b 1 ; water routine at lamppost
v_lamp_wtrstat: ds.b 1 ; water state at lamppost
v_lamp_lives: ds.b 1 ; lives counter at lamppost
ds.b 1 ; unused (Placed here to set v_emeralds at an even address
v_emeralds: ds.b 1 ; number of chaos emeralds
v_emldlist: ds.b 1 ; emerald bitfield
v_perfectringsleft: ds.w 1
v_perfectringsflag: ds.w 1
ds.b 2 ; unused
v_oscillate: ds.w 1 ; oscillation bitfield
v_timingandscreenvariables:
v_timingvariables: ds.b $40 ; values which oscillate - for swinging platforms, et al
ds.b $1A ; unused
if SpinDashEnabled=1
v_spindashsfx1: ds.b 1
v_spindashsfx2: ds.b 1
v_spindashsfx3: ds.b 1
v_cameralag: ds.b 1 ; camera lag after launching Spin Dash (1 byte)
v_scrolldelay: ds.b 1 ; scroll delay timer (1 byte)
ds.b 1 ; unused
else
ds.b 6 ; unused
endif
v_ani0_time: ds.b 1 ; synchronised sprite animation 0 - time until next frame (used for synchronised animations)
v_ani0_frame: ds.b 1 ; synchronised sprite animation 0 - current frame
v_ani1_time: ds.b 1 ; synchronised sprite animation 1 - time until next frame
v_ani1_frame: ds.b 1 ; synchronised sprite animation 1 - current frame
v_ani2_time: ds.b 1 ; synchronised sprite animation 2 - time until next frame
v_ani2_frame: ds.b 1 ; synchronised sprite animation 2 - current frame
v_ani3_time: ds.b 1 ; synchronised sprite animation 3 - time until next frame
v_ani3_frame: ds.b 1 ; synchronised sprite animation 3 - current frame
v_ani3_buf: ds.w 1 ; synchronised sprite animation 3 - info buffer
ds.b $26 ; unused
v_limittopdb: ds.w 1 ; level upper boundary, buffered for debug mode
v_limitbtmdb: ds.w 1 ; level bottom boundary, buffered for debug mode
ds.b $C ; unused
v_timingvariables_end:
ds.b $10 ; unused
v_screenposx_dup: ds.l 1 ; screen position x (duplicate)
v_screenposy_dup: ds.l 1 ; screen position y (duplicate)
v_bgscreenposx_dup: ds.l 1 ; background screen position x (duplicate)
v_bgscreenposy_dup: ds.l 1 ; background screen position y (duplicate)
v_bg2screenposx_dup: ds.l 1
v_bg2screenposy_dup: ds.l 1
v_bg3screenposx_dup: ds.l 1
v_bg3screenposy_dup: ds.l 1
v_fg_scroll_flags_dup: ds.w 1
v_bg1_scroll_flags_dup: ds.w 1
v_bg2_scroll_flags_dup: ds.w 1
v_bg3_scroll_flags_dup: ds.w 1
ds.b $48 ; unused
v_timingandscreenvariables_end:
v_levseldelay: ds.w 1 ; level select - time until change when up/down is held
v_levselitem: ds.w 1 ; level select - item selected
v_levselsound: ds.w 1 ; level select - sound selected
; S2 Level Select variables
v_menuanimtimer: ds.b 1 ; could I reuse the above variables for this?
v_menuanimcounter: ds.b 1 ; and this?
v_levselzone: ds.w 1 ; and this? Selected zone and act in level select (2 bytes)
ds.b $36 ; unused
v_scorelife: ds.l 1 ; points required for an extra life
v_top_solid_bit: ds.b 1
v_lrb_solid_bit: ds.b 1
ds.b $1A ; unused
f_levselcheat: ds.b 1 ; level select cheat flag
f_slomocheat: ds.b 1 ; slow motion & frame advance cheat flag
f_debugcheat: ds.b 1 ; debug mode cheat flag
f_creditscheat: ds.b 1 ; hidden credits & press start cheat flag
v_title_dcount: ds.w 1 ; number of times the d-pad is pressed on title screen
v_title_ccount: ds.w 1 ; number of times C is pressed on title screen
f_levsel_active: ds.b 1
ds.b 7 ; unused
f_demo: ds.w 1 ; demo mode flag (0 = no; 1 = yes; $8001 = ending)
v_demonum: ds.w 1 ; demo level number (not the same as the level number)
v_creditsnum: ds.w 1 ; credits index number
ds.b 2 ; unused
v_megadrive: ds.b 1 ; Megadrive machine type
ds.b 1 ; unused
f_debugmode: ds.w 1 ; debug mode flag
v_init: ds.l 1 ; 'init' text string
v_ram_end:
if * > 0 ; Don't declare more space than the RAM can contain!
fatal "The RAM variable declarations are too large by $\{*} bytes."
endif
dephase
; Special stage
v_ssbuffer1 = v_128x128
v_ssblockbuffer = v_ssbuffer1+$1020 ; ($2000 bytes)
v_ssblockbuffer_end = v_ssblockbuffer+$80*$40
v_ssbuffer2 = v_128x128+$4000
v_ssblocktypes = v_ssbuffer2
v_ssitembuffer = v_ssbuffer2+$400 ; ($100 bytes)
v_ssitembuffer_end = v_ssitembuffer+$100
v_ssbuffer3 = v_ssitembuffer_end
v_ssscroll_buffer = v_ngfx_buffer+$100
; Error handler
phase v_objstate
v_regbuffer: ds.b $40 ; stores registers d0-a7 during an error event
v_spbuffer: ds.l 1 ; stores most recent sp address
v_errortype: ds.b 1 ; error type
dephase
!org 0