This repository has been archived by the owner on Apr 4, 2023. It is now read-only.
forked from sonicretro/s2disasm
-
Notifications
You must be signed in to change notification settings - Fork 4
/
s2.constants.asm
2249 lines (1994 loc) · 82.3 KB
/
s2.constants.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
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; Equates section - Names for variables.
SRAM = $200001
SRAM_Write = $A130F1
; ---------------------------------------------------------------------------
; size variables - you'll get an informational error if you need to change these...
; they are all in units of bytes
Size_of_Snd_driver_guess = $80E ; approximate post-compressed size of the Z80 sound driver
Debug_Lagometer = 0 ; set to 1 to enable on-screen lagometer. Seems to have an odd habit of breaking Special Stages....
phase 0
save_player_mode ds.b 1
save_player_reserved ds.b 1
save_current_zone ds.b 1 ; FF = Game finished, open level select
save_current_act ds.b 1
save_lives ds.b 1
save_score ds.l 1
save_rings ds.w 1 ; unused for now
save_time ds.b 4 ; unused for now
save_emeralds ds.b 1 ; bitfield
save_emeralds_other ds.b 1 ; bitfield (owo)
save_options ds.b 64
save_size = *
; ---------------------------------------------------------------------------
; Object Status Table offsets (for everything between Object_RAM and Primary_Collision)
; ---------------------------------------------------------------------------
; NAT: By the way, some of these are grossly out of order. I know, I know,
; Bad Natsumi, etc.
; But I did this to help make more sense for the changes I am about to do,
; to make it faster. Sonic 2 is slow as molasses.
; you may also note, objoff_xx will not match with the actual addresses
phase 0
id ds.l 1 ; object ID (if you change this, change insn1op and insn2op in s2.macrosetup.asm, if you still use them)
ds.b 1 ; object's height / 2, often used for determining when object is offscreen (no need to draw sprites)
render_flags ds.b 1 ; bitfield ; bit 7 = onscreen flag, bit 0 = x mirror, bit 1 = y mirror, bit 2 = coordinate system, bit 6 = render subobjects
art_tile ds.w 1 ; start of sprite's art
mappings ds.l 1 ; address of object mappings data
x_pixel = * ; x coordinate for objects using screen-space coordinate system
x_pos ds.l 1 ; object x-position
x_sub = *-2 ; object sub-pixel x-position
;objoff_12 = * ; object sub-pixel x-position
y_pixel = *-2 ; y coordinate for objects using screen-space coordinate system
boss_subtype = *-2 ;
objoff_A = *-2
y_pos ds.l 1 ; object y-position
y_sub = *-2 ; object sub-pixel y-position
objoff_10 = *
x_vel ds.w 1 ; horizontal velocity
y_vel ds.w 1 ; vertical velocity
objoff_14 = * ; objects can use this space for anything
boss_invulnerable_time = * ; BYTE ; the amount of time boss is invulnerable for
inertia ds.w 1 ; Sonic&Tails - directionless representation of speed... not updated in the air
ground_vel = *-2
y_radius ds.b 1 ; object's height / 2, often used for floor/wall collision
x_radius ds.b 1 ; object's width / 2, often used for floor/wall collision
flip_turned = * ; 0 for normal, 1 to invert flipping (it's a 180 degree rotation about the axis of Sonic's spine, so he stays in the same position but looks turned around)
objoff_40 = *
objoff_41 = *
shield_reaction = *
glidemode ds.b 1
double_jump_flag = *
glideflags ds.b 1
boss_sine_count = * ;
mapping_frame ds.b 1 ; the frame the object is currently intending to display
anim_frame ds.b 1 ; offset into animation script. Yes, it has nothing to do with frames as such.
anim ds.b 1 ; animation ID
next_anim ds.b 1 ; animation to be played next. If same as anim, animation will not reset
anim_frame_timer = *
anim_frame_duration ds.b 1 ; how long until next frame of animation must be played
width_pixels ds.b 1 ; object's width / 2, often used for determining when object is offscreen (no need to draw sprites)
invulnerable_time = * ; Sonic&Tails - time remaining until player stops blinking
collision_flags ds.b 1 ; various flags related to enemy collision
collision_property ds.b 1 ; various object collision properties, usually boss hit count
move_lock = * ; Sonic&Tails - horizontal control lock, counts down to 0
respawn_index ds.w 1 ; address where the object's respawn data is stored. Unique for every object in level
status ds.b 1 ; note: exact meaning depends on the object... for sonic/tails: bit 0: leftfacing. bit 1: inair. bit 2: spinning. bit 3: onobject. bit 4: rolljumping. bit 5: pushing. bit 6: underwater.
objoff_28 = * ; overlaps subtype, but a few objects use it for other things anyway
air_left = * ; the amount of air left for the player.
subtype ds.b 1 ; object subtype property
boss_routine = * ;
angle ds.w 1 ; angle about the z axis. There is 256 degrees, as opposed to 360
routine ds.b 1 ; objects routine counter
routine_secondary ds.b 1 ; secondary object routine counter
flip_angle = *-1 ; angle about the x axis (360 degrees = 256) (twist/tumble)
objoff_29 = *-1
vram_art = *
objoff_2A = *
object_control = *
obj_control ds.b 1 ; 0 for normal, 1 for hanging or for resting on a flipper, $81 for going through CNZ/OOZ/MTZ tubes or stopped in CNZ cages or stoppers or flying if Tails
objoff_2B = *
status_secondary ds.b 1 ;
objoff_2C = *
boss_defeated = *
flips_remaining ds.b 1 ; number of flip revolutions remaining
objoff_2D = *
flip_speed ds.b 1 ; number of flip revolutions per frame / 256
objoff_2E = *
objoff_2F = *+1
invincibility_time ds.w 1 ; number of frames until invincibility ends
objoff_30 = *
objoff_31 = *+1
speedshoes_time ds.w 1 ; number of frames until speed shoes end
objoff_32 = *
objoff_33 = *+1
boss_hitcount2 = *
interact ds.w 1 ; Full RAM address of the last object Sonic stood on
objoff_34 = *
top_solid_bit ds.b 1 ; the bit to check for top solidity (either $C or $E)
objoff_35 = *
lrb_solid_bit ds.b 1 ; the bit to check for left/right/bottom solidity (either $D or $F)
objoff_36 = *
next_tilt ds.b 1 ; angle on ground in front of sprite
objoff_37 = *
tilt ds.b 1 ; angle on ground
objoff_38 = *
boss_hurt_sonic = * ; flag set by collision response routine when sonic has just been hurt (by boss?)
stick_to_convex ds.b 1 ; 0 for normal, 1 to make Sonic stick to convex surfaces like the rotating discs in Sonic 1 and 3 (unused in Sonic 2 but fully functional)
objoff_39 = *
pinball_mode = *
spindash_flag ds.b 1 ; 0 for normal, 1 for charging a spindash or forced rolling
restart_countdown = *
objoff_3A = *
objoff_3B = *+1
spindash_counter ds.w 1
objoff_3C = *
objoff_3D = *+1
jumping ds.w 1 ; set when Sonic is jumping... This should REALLY be a byte...
objoff_3E = *
objoff_3F = *+1
double_jump_property = *+1
glideunk = *+1
parent ds.w 1 ; address of object that owns or spawned this one, if applicable
priority ds.w 1 ; address for object's target priority layer. CAN NOT BE INVALID ADDRESS, IF SPRITE IS DISPLAYED!
object_size = * ; the size of an object
next_object = *
; ---------------------------------------------------------------------------
; Special Stage object properties:
ss_dplc_timer = objoff_28
ss_x_pos = objoff_2A
ss_x_sub = objoff_2C
ss_y_pos = objoff_2E
ss_y_sub = objoff_30
ss_init_flip_timer = objoff_32
ss_flip_timer = objoff_33
ss_z_pos = objoff_34
ss_hurt_timer = objoff_36
ss_slide_timer = objoff_37
ss_parent = objoff_38
ss_rings_base = objoff_3C ; word
ss_rings_hundreds = objoff_3C
ss_rings_tens = objoff_3D
ss_rings_units = objoff_3E
ss_last_angle_index = objoff_3F
; ---------------------------------------------------------------------------
; when childsprites are activated (i.e. bit #6 of render_flags set)
mainspr_mapframe = x_pos+3
mainspr_width = y_pos+2
mainspr_childsprites = y_pos+3 ; amount of child sprites
phase x_vel
sub2_x_pos ds.w 1 ; x_vel
sub2_y_pos ds.w 1 ; y_vel
mainspr_height ds.b 1
sub2_mapframe ds.b 1
sub3_x_pos ds.w 1 ; y_radius
sub3_y_pos ds.w 1 ; priority
ds.b 1 ; unused
sub3_mapframe ds.b 1 ; anim_frame
sub4_x_pos ds.w 1 ; anim
sub4_y_pos ds.w 1 ; anim_frame_duration
ds.b 1 ; DO NOT USE, BRIDGES WILL HURT YOU
sub4_mapframe ds.b 1 ; collision_property
sub5_x_pos ds.w 1 ; status
sub5_y_pos ds.w 1 ; routine
ds.b 1 ; unused
sub5_mapframe ds.b 1
sub6_x_pos ds.w 1 ; subtype
sub6_y_pos ds.w 1
ds.b 1 ; unused
sub6_mapframe ds.b 1
sub7_x_pos ds.w 1
sub7_y_pos ds.w 1
ds.b 1 ; unused
sub7_mapframe ds.b 1
sub8_x_pos ds.w 1
sub8_y_pos ds.w 1
ds.b 1 ; unused
sub8_mapframe ds.b 1
sub9_x_pos ds.w 1
sub9_y_pos ds.w 1
ds.b 1 ; unused
sub9_mapframe ds.b 1
next_subspr = 6
; ---------------------------------------------------------------------------
; property of all objects:
; ---------------------------------------------------------------------------
; Bits 3-6 of an object's status after a SolidObject call is a
; bitfield with the following meaning:
p1_standing_bit = 3
p2_standing_bit = p1_standing_bit + 1
p1_standing = 1<<p1_standing_bit
p2_standing = 1<<p2_standing_bit
pushing_bit_delta = 2
p1_pushing_bit = p1_standing_bit + pushing_bit_delta
p2_pushing_bit = p1_pushing_bit + 1
p1_pushing = 1<<p1_pushing_bit
p2_pushing = 1<<p2_pushing_bit
standing_mask = p1_standing|p2_standing
pushing_mask = p1_pushing|p2_pushing
; ---------------------------------------------------------------------------
; The high word of d6 after a SolidObject call is a bitfield
; with the following meaning:
p1_touch_side_bit = 0
p2_touch_side_bit = p1_touch_side_bit + 1
p1_touch_side = 1<<p1_touch_side_bit
p2_touch_side = 1<<p2_touch_side_bit
touch_side_mask = p1_touch_side|p2_touch_side
p1_touch_bottom_bit = p1_touch_side_bit + pushing_bit_delta
p2_touch_bottom_bit = p1_touch_bottom_bit + 1
p1_touch_bottom = 1<<p1_touch_bottom_bit
p2_touch_bottom = 1<<p2_touch_bottom_bit
touch_bottom_mask = p1_touch_bottom|p2_touch_bottom
p1_touch_top_bit = p1_touch_bottom_bit + pushing_bit_delta
p2_touch_top_bit = p1_touch_top_bit + 1
p1_touch_top = 1<<p1_touch_top_bit
p2_touch_top = 1<<p2_touch_top_bit
touch_top_mask = p1_touch_top|p2_touch_top
; ---------------------------------------------------------------------------
; Controller Buttons
;
; Buttons bit numbers
button_Z: EQU 0
button_Y: EQU 1
button_X: EQU 2
button_mode: EQU 3
button_up: EQU 0
button_down: EQU 1
button_left: EQU 2
button_right: EQU 3
button_B: EQU 4
button_C: EQU 5
button_A: EQU 6
button_start: EQU 7
; Buttons masks (1 << x == pow(2, x))
button_Z_mask: EQU 1<<button_Z ; $01
button_Y_mask: EQU 1<<button_Y ; $02
button_X_mask: EQU 1<<button_X ; $04
button_mode_mask: EQU 1<<button_mode ; $08
button_up_mask: EQU 1<<button_up ; $01
button_down_mask: EQU 1<<button_down ; $02
button_left_mask: EQU 1<<button_left ; $04
button_right_mask: EQU 1<<button_right ; $08
button_B_mask: EQU 1<<button_B ; $10
button_C_mask: EQU 1<<button_C ; $20
button_A_mask: EQU 1<<button_A ; $40
button_start_mask: EQU 1<<button_start ; $80
; ---------------------------------------------------------------------------
; Casino night bumpers
bumper_id = 0
bumper_x = 2
bumper_y = 4
next_bumper = 6
prev_bumper_x = bumper_x-next_bumper
Status_Facing: EQU 0
Status_InAir: EQU 1
Status_Roll: EQU 2
Status_OnObj: EQU 3
Status_RollJump: EQU 4
Status_Push: EQU 5
Status_Underwater: EQU 6
Shield_Reaction_Bounce: EQU 3
Shield_Reaction_Fire: EQU 4
Shield_Reaction_Ltng: EQU 5
Shield_Reaction_Bubble: EQU 6
; ---------------------------------------------------------------------------
; status_secondary bitfield variables
;
; status_secondary variable bit numbers
Status_Shield: EQU 0
Status_Invincible: EQU 1
Status_SpeedShoes: EQU 2
Status_FireShield: EQU 4
Status_LtngShield: EQU 5
Status_BublShield: EQU 6
Status_FireShield_mask: EQU 1<<Status_FireShield
Status_LtngShield_mask: EQU 1<<Status_LtngShield
Status_BublShield_mask: EQU 1<<Status_BublShield
status_sec_hasShield: EQU 0
status_sec_isInvincible: EQU 1
status_sec_hasSpeedShoes: EQU 2
status_sec_isSliding: EQU 7
; status_secondary variable masks (1 << x == pow(2, x))
status_sec_hasShield_mask: EQU 1<<status_sec_hasShield ; $01
status_sec_isInvincible_mask: EQU 1<<status_sec_isInvincible ; $02
status_sec_hasSpeedShoes_mask: EQU 1<<status_sec_hasSpeedShoes ; $04
status_sec_isSliding_mask: EQU 1<<status_sec_isSliding ; $80
; ---------------------------------------------------------------------------
; Elemental Shield DPLC variables
LastLoadedDPLC = $34
Art_Address = $38
DPLC_Address = $3C
; ---------------------------------------------------------------------------
; Constants that can be used instead of hard-coded IDs for various things.
; The "id" function allows to remove elements from an array/table without having
; to change the IDs everywhere in the code.
cur_zone_id := 0 ; the zone ID currently being declared
cur_zone_str := "0" ; string representation of the above
; macro to declare a zone ID
; this macro also declares constants of the form zone_id_X, where X is the ID of the zone in stock Sonic 2
; in order to allow level offset tables to be made dynamic
zoneID macro zoneID,{INTLABEL}
__LABEL__ = zoneID
zone_id_{cur_zone_str} = zoneID
cur_zone_id := cur_zone_id+1
cur_zone_str := "\{cur_zone_id}"
endm
; Zone IDs. These MUST be declared in the order in which their IDs are in stock Sonic 2, otherwise zone offset tables will screw up
emerald_hill_zone zoneID $00
zone_1 zoneID $01
wood_zone zoneID $02
zone_3 zoneID $03
metropolis_zone zoneID $04
metropolis_zone_2 zoneID $05
wing_fortress_zone zoneID $06
hill_top_zone zoneID $07
hidden_palace_zone zoneID $08
zone_9 zoneID $09
oil_ocean_zone zoneID $0A
mystic_cave_zone zoneID $0B
casino_night_zone zoneID $0C
chemical_plant_zone zoneID $0D
death_egg_zone zoneID $0E
aquatic_ruin_zone zoneID $0F
sky_chase_zone zoneID $10
; NOTE: If you want to shift IDs around, set useFullWaterTables to 1 in the assembly options
; set the number of zones
no_of_zones = cur_zone_id
; Zone and act IDs
emerald_hill_zone_act_1 = (emerald_hill_zone<<8)|$00
emerald_hill_zone_act_2 = (emerald_hill_zone<<8)|$01
chemical_plant_zone_act_1 = (chemical_plant_zone<<8)|$00
chemical_plant_zone_act_2 = (chemical_plant_zone<<8)|$01
aquatic_ruin_zone_act_1 = (aquatic_ruin_zone<<8)|$00
aquatic_ruin_zone_act_2 = (aquatic_ruin_zone<<8)|$01
casino_night_zone_act_1 = (casino_night_zone<<8)|$00
casino_night_zone_act_2 = (casino_night_zone<<8)|$01
hill_top_zone_act_1 = (hill_top_zone<<8)|$00
hill_top_zone_act_2 = (hill_top_zone<<8)|$01
mystic_cave_zone_act_1 = (mystic_cave_zone<<8)|$00
mystic_cave_zone_act_2 = (mystic_cave_zone<<8)|$01
oil_ocean_zone_act_1 = (oil_ocean_zone<<8)|$00
oil_ocean_zone_act_2 = (oil_ocean_zone<<8)|$01
metropolis_zone_act_1 = (metropolis_zone<<8)|$00
metropolis_zone_act_2 = (metropolis_zone<<8)|$01
metropolis_zone_act_3 = (metropolis_zone_2<<8)|$00
sky_chase_zone_act_1 = (sky_chase_zone<<8)|$00
wing_fortress_zone_act_1 = (wing_fortress_zone<<8)|$00
death_egg_zone_act_1 = (death_egg_zone<<8)|$00
; Prototype zone and act IDs
wood_zone_act_1 = (wood_zone<<8)|$00
wood_zone_act_2 = (wood_zone<<8)|$01
hidden_palace_zone_act_1 = (hidden_palace_zone<<8)|$00
hidden_palace_zone_act_2 = (hidden_palace_zone<<8)|$01
; ---------------------------------------------------------------------------
; some variables and functions to help define those constants (redefined before a new set of IDs)
offset := 0 ; this is the start of the pointer table
ptrsize := 1 ; this is the size of a pointer (should be 1 if the ID is a multiple of the actual size)
idstart := 0 ; value to add to all IDs
; function using these variables
id function ptr,((ptr-offset)/ptrsize+idstart)
; V-Int routines
offset := Vint_SwitchTbl
ptrsize := 1
idstart := 0
VintID_Lag = id(Vint_Lag_ptr) ; 0
VintID_SEGA = id(Vint_SEGA_ptr) ; 2
VintID_Title = id(Vint_Title_ptr) ; 4
VintID_Unused6 = id(Vint_Unused6_ptr) ; 6
VintID_Level = id(Vint_Level_ptr) ; 8
VintID_S2SS = id(Vint_S2SS_ptr) ; A
VintID_TitleCard = id(Vint_TitleCard_ptr) ; C
VintID_UnusedE = id(Vint_UnusedE_ptr) ; E
VintID_Pause = id(Vint_Pause_ptr) ; 10
VintID_Fade = id(Vint_Fade_ptr) ; 12
VintID_PCM = id(Vint_PCM_ptr) ; 14
VintID_Menu = id(Vint_Menu_ptr) ; 16
VintID_Ending = id(Vint_Ending_ptr) ; 18
VintID_CtrlDMA = id(Vint_CtrlDMA_ptr) ; 1A
;VintID_SaveScreen = id(VInt_SaveScreen_ptr) ; 1A
; Game modes
offset := GameModesArray
ptrsize := 1
idstart := 0
GameModeID_SegaScreen = id(GameMode_SegaScreen) ; 0
GameModeID_TitleScreen = id(GameMode_TitleScreen) ; 4
GameModeID_Demo = id(GameMode_Demo) ; 8
GameModeID_Level = id(GameMode_Level) ; C
GameModeID_SpecialStage = id(GameMode_SpecialStage) ; 10
GameModeID_ContinueScreen = id(GameMode_ContinueScreen) ; 14
GameModeID_2PResults = id(GameMode_2PResults) ; 18
GameModeID_2PLevelSelect = id(GameMode_2PLevelSelect) ; 1C
GameModeID_EndingSequence = id(GameMode_EndingSequence) ; 20
GameModeID_OptionsMenu = id(GameMode_OptionsMenu) ; 24
GameModeID_LevelSelect = id(GameMode_LevelSelect) ; 28
GameModeFlag_TitleCard = 7 ; flag bit
GameModeID_TitleCard = 1<<GameModeFlag_TitleCard ; flag mask
; palette IDs
offset := PalPointers
ptrsize := 8
idstart := 0
PalID_SEGA = id(PalPtr_SEGA) ; 0
PalID_Title = id(PalPtr_Title) ; 1
PalID_MenuB = id(PalPtr_MenuB) ; 2
PalID_BGND = id(PalPtr_BGND) ; 3
PalID_EHZ = id(PalPtr_EHZ) ; 4
PalID_EHZ2 = id(PalPtr_EHZ2) ; 5
PalID_WZ = id(PalPtr_WZ) ; 6
PalID_EHZ3 = id(PalPtr_EHZ3) ; 7
PalID_MTZ = id(PalPtr_MTZ) ; 8
PalID_MTZ2 = id(PalPtr_MTZ2) ; 9
PalID_WFZ = id(PalPtr_WFZ) ; A
PalID_HTZ = id(PalPtr_HTZ) ; B
PalID_HPZ = id(PalPtr_HPZ) ; C
PalID_EHZ4 = id(PalPtr_EHZ4) ; D
PalID_OOZ = id(PalPtr_OOZ) ; E
PalID_MCZ = id(PalPtr_MCZ) ; F
PalID_CNZ = id(PalPtr_CNZ) ; 10
PalID_CPZ = id(PalPtr_CPZ) ; 11
PalID_DEZ = id(PalPtr_DEZ) ; 12
PalID_ARZ = id(PalPtr_ARZ) ; 13
PalID_SCZ = id(PalPtr_SCZ) ; 14
PalID_HPZ_U = id(PalPtr_HPZ_U) ; 15
PalID_CPZ_U = id(PalPtr_CPZ_U) ; 16
PalID_ARZ_U = id(PalPtr_ARZ_U) ; 17
PalID_SS = id(PalPtr_SS) ; 18
PalID_MCZ_B = id(PalPtr_MCZ_B) ; 19
PalID_CNZ_B = id(PalPtr_CNZ_B) ; 1A
PalID_SS1 = id(PalPtr_SS1) ; 1B
PalID_SS2 = id(PalPtr_SS2) ; 1C
PalID_SS3 = id(PalPtr_SS3) ; 1D
PalID_SS4 = id(PalPtr_SS4) ; 1E
PalID_SS5 = id(PalPtr_SS5) ; 1F
PalID_SS6 = id(PalPtr_SS6) ; 20
PalID_SS7 = id(PalPtr_SS7) ; 21
PalID_SS1_2p = id(PalPtr_SS1_2p) ; 22
PalID_SS2_2p = id(PalPtr_SS2_2p) ; 23
PalID_SS3_2p = id(PalPtr_SS3_2p) ; 24
PalID_OOZ_B = id(PalPtr_OOZ_B) ; 25
PalID_Menu = id(PalPtr_Menu) ; 26
PalID_Result = id(PalPtr_Result) ; 27
PalID_Knux = id(PalPtr_Knux) ; 28
PalID_CPZ_K_U = id(PalPtr_CPZ_K_U) ; 29
PalID_ARZ_K_U = id(PalPtr_ARZ_K_U) ; 30
PalID_SS_Knux = id(PalPtr_SS_Knux)
; PLC IDs
offset := ArtLoadCues
ptrsize := 2
idstart := 0
PLCID_Std1 = id(PLCptr_Std1) ; 0
PLCID_Std2 = id(PLCptr_Std2) ; 1
PLCID_StdWtr = id(PLCptr_StdWtr) ; 2
PLCID_GameOver = id(PLCptr_GameOver) ; 3
PLCID_Ehz1 = id(PLCptr_Ehz1) ; 4
PLCID_Ehz2 = id(PLCptr_Ehz2) ; 5
PLCID_Miles1up = id(PLCptr_Miles1up) ; 6
PLCID_MilesLife = id(PLCptr_MilesLife) ; 7
PLCID_Tails1up = id(PLCptr_Tails1up) ; 8
PLCID_TailsLife = id(PLCptr_TailsLife) ; 9
PLCID_Unused1 = id(PLCptr_Unused1) ; A
PLCID_Unused2 = id(PLCptr_Unused2) ; B
PLCID_Mtz1 = id(PLCptr_Mtz1) ; C
PLCID_Mtz2 = id(PLCptr_Mtz2) ; D
PLCID_Wfz1 = id(PLCptr_Wfz1) ; 10
PLCID_Wfz2 = id(PLCptr_Wfz2) ; 11
PLCID_Htz1 = id(PLCptr_Htz1) ; 12
PLCID_Htz2 = id(PLCptr_Htz2) ; 13
PLCID_Hpz1 = id(PLCptr_Hpz1) ; 14
PLCID_Hpz2 = id(PLCptr_Hpz2) ; 15
PLCID_Unused3 = id(PLCptr_Unused3) ; 16
PLCID_Unused4 = id(PLCptr_Unused4) ; 17
PLCID_Ooz1 = id(PLCptr_Ooz1) ; 18
PLCID_Ooz2 = id(PLCptr_Ooz2) ; 19
PLCID_Mcz1 = id(PLCptr_Mcz1) ; 1A
PLCID_Mcz2 = id(PLCptr_Mcz2) ; 1B
PLCID_Cnz1 = id(PLCptr_Cnz1) ; 1C
PLCID_Cnz2 = id(PLCptr_Cnz2) ; 1D
PLCID_Cpz1 = id(PLCptr_Cpz1) ; 1E
PLCID_Cpz2 = id(PLCptr_Cpz2) ; 1F
PLCID_Dez1 = id(PLCptr_Dez1) ; 20
PLCID_Dez2 = id(PLCptr_Dez2) ; 21
PLCID_Arz1 = id(PLCptr_Arz1) ; 22
PLCID_Arz2 = id(PLCptr_Arz2) ; 23
PLCID_Scz1 = id(PLCptr_Scz1) ; 24
PLCID_Scz2 = id(PLCptr_Scz2) ; 25
PLCID_Results = id(PLCptr_Results) ; 26
PLCID_Signpost = id(PLCptr_Signpost) ; 27
PLCID_CpzBoss = id(PLCptr_CpzBoss) ; 28
PLCID_EhzBoss = id(PLCptr_EhzBoss) ; 29
PLCID_HtzBoss = id(PLCptr_HtzBoss) ; 2A
PLCID_ArzBoss = id(PLCptr_ArzBoss) ; 2B
PLCID_MczBoss = id(PLCptr_MczBoss) ; 2C
PLCID_CnzBoss = id(PLCptr_CnzBoss) ; 2D
PLCID_MtzBoss = id(PLCptr_MtzBoss) ; 2E
PLCID_OozBoss = id(PLCptr_OozBoss) ; 2F
PLCID_FieryExplosion = id(PLCptr_FieryExplosion) ; 30
PLCID_DezBoss = id(PLCptr_DezBoss) ; 31
PLCID_EhzAnimals = id(PLCptr_EhzAnimals) ; 32
PLCID_MczAnimals = id(PLCptr_MczAnimals) ; 33
PLCID_HtzAnimals = id(PLCptr_HtzAnimals) ; 34
PLCID_MtzAnimals = id(PLCptr_MtzAnimals) ; 34
PLCID_WfzAnimals = id(PLCptr_WfzAnimals) ; 34
PLCID_DezAnimals = id(PLCptr_DezAnimals) ; 35
PLCID_HpzAnimals = id(PLCptr_HpzAnimals) ; 36
PLCID_OozAnimals = id(PLCptr_OozAnimals) ; 37
PLCID_SczAnimals = id(PLCptr_SczAnimals) ; 38
PLCID_CnzAnimals = id(PLCptr_CnzAnimals) ; 39
PLCID_CpzAnimals = id(PLCptr_CpzAnimals) ; 3A
PLCID_ArzAnimals = id(PLCptr_ArzAnimals) ; 3B
PLCID_SpecialStage = id(PLCptr_SpecialStage) ; 3C
PLCID_SpecStageBombs = id(PLCptr_SpecStageBombs) ; 3D
PLCID_WfzBoss = id(PLCptr_WfzBoss) ; 3E
PLCID_Tornado = id(PLCptr_Tornado) ; 3F
PLCID_Capsule = id(PLCptr_Capsule) ; 40
PLCID_Explosion = id(PLCptr_Explosion) ; 41
PLCID_ResultsTails = id(PLCptr_ResultsTails) ; 42
PLCID_KnucklesLife = id(PLCptr_KnucklesLife)
PLCID_Std2Knuckles = id(PLCptr_Std2Knuckles)
PLCID_ResultsKnuckles = id(PLCptr_ResultsKnuckles)
PLCID_SignpostKnuckles = id(PLCptr_SignpostKnuckles)
PLCID_TitleCard = id(PLCptr_TitleCard)
PLCID_SpecialStage_Knux = id(PLCptr_SpecialStage_Knux) ; 3C
PLCID_Std22P = id(PLCptr_Std22P)
; 2P VS results screens
offset := TwoPlayerResultsPointers
ptrsize := 8
idstart := 0
VsRSID_Act = id(VsResultsScreen_Act) ; 0
VsRSID_Zone = id(VsResultsScreen_Zone) ; 1
VsRSID_Game = id(VsResultsScreen_Game) ; 2
VsRSID_SS = id(VsResultsScreen_SS) ; 3
VsRSID_SSZone = id(VsResultsScreen_SSZone) ; 4
; Animation IDs
offset := SonicAniData
ptrsize := 2
idstart := 0
AniIDSonAni_Walk = id(SonAni_Walk_ptr) ; 0 ; 0
AniIDSonAni_Run = id(SonAni_Run_ptr) ; 1 ; 1
AniIDSonAni_Roll = id(SonAni_Roll_ptr) ; 2 ; 2
AniIDSonAni_Roll2 = id(SonAni_Roll2_ptr) ; 3 ; 3
AniIDSonAni_Push = id(SonAni_Push_ptr) ; 4 ; 4
AniIDSonAni_Wait = id(SonAni_Wait_ptr) ; 5 ; 5
AniIDSonAni_Balance = id(SonAni_Balance_ptr) ; 6 ; 6
AniIDSonAni_LookUp = id(SonAni_LookUp_ptr) ; 7 ; 7
AniIDSonAni_Duck = id(SonAni_Duck_ptr) ; 8 ; 8
AniIDSonAni_Spindash = id(SonAni_Spindash_ptr) ; 9 ; 9
AniIDSonAni_Blink = id(SonAni_Blink_ptr) ; 10 ; $A
AniIDSonAni_GetUp = id(SonAni_GetUp_ptr) ; 11 ; $B
AniIDSonAni_Balance2 = id(SonAni_Balance2_ptr) ; 12 ; $C
AniIDSonAni_Stop = id(SonAni_Stop_ptr) ; 13 ; $D
AniIDSonAni_Float = id(SonAni_Float_ptr) ; 14 ; $E
AniIDSonAni_Float2 = id(SonAni_Float2_ptr) ; 15 ; $F
AniIDSonAni_Spring = id(SonAni_Spring_ptr) ; 16 ; $10
AniIDSonAni_Hang = id(SonAni_Hang_ptr) ; 17 ; $11
AniIDSonAni_Dash2 = id(SonAni_Dash2_ptr) ; 18 ; $12
AniIDSonAni_Dash3 = id(SonAni_Dash3_ptr) ; 19 ; $13
AniIDSonAni_Hang2 = id(SonAni_Hang2_ptr) ; 20 ; $14
AniIDSonAni_Bubble = id(SonAni_Bubble_ptr) ; 21 ; $15
AniIDSonAni_DeathBW = id(SonAni_DeathBW_ptr) ; 22 ; $16
AniIDSonAni_Drown = id(SonAni_Drown_ptr) ; 23 ; $17
AniIDSonAni_Death = id(SonAni_Death_ptr) ; 24 ; $18
AniIDSonAni_Hurt = id(SonAni_Hurt_ptr) ; 25 ; $19
AniIDSonAni_Hurt2 = id(SonAni_Hurt2_ptr) ; 26 ; $1A
AniIDSonAni_Slide = id(SonAni_Slide_ptr) ; 27 ; $1B
AniIDSonAni_Blank = id(SonAni_Blank_ptr) ; 28 ; $1C
AniIDSonAni_Balance3 = id(SonAni_Balance3_ptr) ; 29 ; $1D
AniIDSonAni_Balance4 = id(SonAni_Balance4_ptr) ; 30 ; $1E
AniIDSupSonAni_Transform = id(SupSonAni_Transform_ptr) ; 31 ; $1F
AniIDSonAni_Lying = id(SonAni_Lying_ptr) ; 32 ; $20
AniIDSonAni_LieDown = id(SonAni_LieDown_ptr) ; 33 ; $21
AniIDSonAni_PeelOut = id(SonAni_PeelOut_ptr)
AniIDSonAni_DropDash = id(SonAni_DropDash_ptr)
offset := TailsAniData
ptrsize := 2
idstart := 0
AniIDTailsAni_Walk = id(TailsAni_Walk_ptr) ; 0 ; 0
AniIDTailsAni_Run = id(TailsAni_Run_ptr) ; 1 ; 1
AniIDTailsAni_Roll = id(TailsAni_Roll_ptr) ; 2 ; 2
AniIDTailsAni_Roll2 = id(TailsAni_Roll2_ptr) ; 3 ; 3
AniIDTailsAni_Push = id(TailsAni_Push_ptr) ; 4 ; 4
AniIDTailsAni_Wait = id(TailsAni_Wait_ptr) ; 5 ; 5
AniIDTailsAni_Balance = id(TailsAni_Balance_ptr) ; 6 ; 6
AniIDTailsAni_LookUp = id(TailsAni_LookUp_ptr) ; 7 ; 7
AniIDTailsAni_Duck = id(TailsAni_Duck_ptr) ; 8 ; 8
AniIDTailsAni_Spindash = id(TailsAni_Spindash_ptr) ; 9 ; 9
AniIDTailsAni_Dummy1 = id(TailsAni_Dummy1_ptr) ; 10 ; $A
AniIDTailsAni_Dummy2 = id(TailsAni_Dummy2_ptr) ; 11 ; $B
AniIDTailsAni_Dummy3 = id(TailsAni_Dummy3_ptr) ; 12 ; $C
AniIDTailsAni_Stop = id(TailsAni_Stop_ptr) ; 13 ; $D
AniIDTailsAni_Float = id(TailsAni_Float_ptr) ; 14 ; $E
AniIDTailsAni_Float2 = id(TailsAni_Float2_ptr) ; 15 ; $F
AniIDTailsAni_Spring = id(TailsAni_Spring_ptr) ; 16 ; $10
AniIDTailsAni_Hang = id(TailsAni_Hang_ptr) ; 17 ; $11
AniIDTailsAni_Blink = id(TailsAni_Blink_ptr) ; 18 ; $12
AniIDTailsAni_Blink2 = id(TailsAni_Blink2_ptr) ; 19 ; $13
AniIDTailsAni_Hang2 = id(TailsAni_Hang2_ptr) ; 20 ; $14
AniIDTailsAni_Bubble = id(TailsAni_Bubble_ptr) ; 21 ; $15
AniIDTailsAni_DeathBW = id(TailsAni_DeathBW_ptr) ; 22 ; $16
AniIDTailsAni_Drown = id(TailsAni_Drown_ptr) ; 23 ; $17
AniIDTailsAni_Death = id(TailsAni_Death_ptr) ; 24 ; $18
AniIDTailsAni_Hurt = id(TailsAni_Hurt_ptr) ; 25 ; $19
AniIDTailsAni_Hurt2 = id(TailsAni_Hurt2_ptr) ; 26 ; $1A
AniIDTailsAni_Slide = id(TailsAni_Slide_ptr) ; 27 ; $1B
AniIDTailsAni_Blank = id(TailsAni_Blank_ptr) ; 28 ; $1C
AniIDTailsAni_Dummy4 = id(TailsAni_Dummy4_ptr) ; 29 ; $1D
AniIDTailsAni_Dummy5 = id(TailsAni_Dummy5_ptr) ; 30 ; $1E
AniIDTailsAni_HaulAss = id(TailsAni_HaulAss_ptr) ; 31 ; $1F
AniIDTailsAni_Fly = id(TailsAni_Fly_ptr) ; 32 ; $20
AniIDTailsAni_FlyTired = id(TailsAni_FlyTired_ptr)
AniIDTailsAni_FlyCarry = id(TailsAni_FlyCarry_ptr)
AniIDTailsAni_FlyCarryUp = id(TailsAni_FlyCarryUp_ptr)
AniIDTailsAni_FlyCarryTired = id(TailsAni_FlyCarryTired_ptr)
AniIDTailsAni_Swim = id(TailsAni_Swim_ptr)
AniIDTailsAni_SwimFast = id(TailsAni_SwimFast_ptr)
AniIDTailsAni_SwimTired = id(TailsAni_SwimTired_ptr)
AniIDTailsAni_SwimCarry = id(TailsAni_SwimCarry_ptr)
AniIDTailsAni_Transform = id(TailsAni_Transform_ptr)
; Other sizes
palette_line_size = $10*2 ; 16 word entries
; ---------------------------------------------------------------------------
; function for converting priority to proper format
prlayer = $80
prio function x, Sprite_Table_Input+(x*prlayer)
; ---------------------------------------------------------------------------
; I run the main 68k RAM addresses through this function
; to let them work in both 16-bit and 32-bit addressing modes.
ramaddr function x,-(-x)&$FFFFFFFF
; ---------------------------------------------------------------------------
; RAM variables - General
phase ramaddr($FFFF0000) ; Pretend we're in the RAM
RAM_Start:
Chunk_Table: ds.b $8000 ; was "Metablock_Table"
Chunk_Table_End:
Level_Layout: ds.b $1000
Level_Layout_End:
Block_Table: ds.w $C00
Block_Table_End:
TempArray_LayerDef: ds.b $200 ; used by some layer deformation routines
Decomp_Buffer: ds.b $200
Sprite_Table_Input: ds.b prlayer*8 ; in custom format before being converted and stored in Sprite_Table/Sprite_Table_2
Sprite_Table_Input_End:
Object_RAM: ; The various objects in the game are loaded in this area.
; Each game mode uses different objects, so some slots are reused.
; The section below declares labels for the objects used in main gameplay.
; Objects for other game modes are declared further down.
Reserved_Object_RAM:
Player_1:
MainCharacter: ; first object (usually Sonic except in a Tails Alone game)
ds.b object_size
Player_2:
Sidekick: ; second object (Tails in a Sonic and Tails game)
ds.b object_size
TitleCard:
TitleCard_ZoneName: ; level title card: zone name
GameOver_GameText: ; "GAME" from GAME OVER
TimeOver_TimeText: ; "TIME" from TIME OVER
ds.b object_size
TitleCard_Zone: ; level title card: "ZONE"
GameOver_OverText: ; "OVER" from GAME OVER
TimeOver_OverText: ; "OVER" from TIME OVER
ds.b object_size
TitleCard_ActNumber: ; level title card: act number
ds.b object_size
TitleCard_Background: ; level title card: background
ds.b object_size
TitleCard_Bottom: ; level title card: yellow part at the bottom
ds.b object_size
TitleCard_Left: ; level title card: red part on the left
ds.b object_size
; Reserved object RAM, free slots
ds.b object_size
ds.b object_size
ds.b object_size
ds.b object_size
ds.b object_size
CPZPylon: ; Pylon in the foreground in CPZ
ds.b object_size
WaterSurface1: ; First water surface
Oil: ; Oil at the bottom of OOZ
ds.b object_size
WaterSurface2: ; Second water surface
ds.b object_size
Reserved_Object_RAM_End:
Dynamic_Object_RAM: ; Dynamic object RAM
ds.b $23*object_size
Dynamic_Object_RAM_2P_End: ; SingleObjLoad stops searching here in 2P mode
ds.b $48*object_size
Dynamic_Object_RAM_End:
LevelOnly_Object_RAM:
Tails_Tails: ; address of the Tail's Tails object
ds.b object_size
SuperSonicStars:
ds.b object_size
HyperSonicKnux_Trail:
ds.b object_size
Tails_Tails_Trail:
ds.b object_size
Sonic_BreathingBubbles: ; Sonic's breathing bubbles
ds.b object_size
Tails_BreathingBubbles: ; Tails' breathing bubbles
ds.b object_size
Sonic_Dust: ; Sonic's spin dash dust
ds.b object_size
Tails_Dust: ; Tails' spin dash dust
ds.b object_size
Shield:
Sonic_Shield:
ds.b object_size
Tails_Shield:
ds.b object_size
Sonic_InvincibilityStars:
ds.b object_size
ds.b object_size
ds.b object_size
ds.b object_size
Tails_InvincibilityStars:
ds.b object_size
ds.b object_size
ds.b object_size
ds.b object_size
LevelOnly_Object_RAM_End:
Object_RAM_End:
Primary_Collision: ds.b $300
Secondary_Collision: ds.b $300
Sprite_table_buffer:
Sprite_Table_2: ds.b $280 ; Sprite attribute table buffer for the bottom split screen in 2-player mode
ds.b $80 ; unused, but SAT buffer can spill over into this area when there are too many sprites on-screen
DMA_queue:
VDP_Command_Buffer: ds.w 7*$12 ; stores 18 ($12) VDP commands to issue the next time ProcessDMAQueue is called
DMA_queue_slot:
VDP_Command_Buffer_Slot: ds.w 1 ; stores the address of the next open slot for a queued VDP command
ds.w 1 ; Padding, remove me!
H_scroll_buffer:
Horiz_Scroll_Buf: ds.b $400
Horiz_Scroll_Buf_End:
Stat_table:
Sonic_Stat_Record_Buf: ds.b $100
Pos_table:
Sonic_Pos_Record_Buf: ds.b $100
Pos_table_P2:
Tails_Pos_Record_Buf: ds.b $100
CNZ_saucer_data: ds.b $40 ; the number of saucer bumpers in a group which have been destroyed. Used to decide when to give 500 points instead of 10
CNZ_saucer_data_End:
Max_Rings = 511
Ring_Positions: ds.w Max_Rings+1
Ring_Positions_End:
Camera_RAM:
Camera_X_pos: ds.l 1
Camera_Y_pos: ds.l 1
Camera_BG_X_pos: ds.l 1 ; only used sometimes as the layer deformation makes it sort of redundant
Camera_BG_Y_pos: ds.l 1
Camera_BG2_X_pos: ds.l 1 ; used in CPZ
Camera_BG2_Y_pos: ds.l 1 ; used in CPZ
Camera_X_pos_P2: ds.l 1
Camera_Y_pos_P2: ds.l 1
Camera_BG_X_pos_P2: ds.l 1 ; only used sometimes as the layer deformation makes it sort of redundant
Camera_BG_Y_pos_P2: ds.l 1
Camera_BG2_Y_pos_P2: ds.l 1
Horiz_block_crossed_flag: ds.b 1 ; toggles between 0 and $10 when you cross a block boundary horizontally
Verti_block_crossed_flag: ds.b 1 ; toggles between 0 and $10 when you cross a block boundary vertically
Horiz_block_crossed_flag_BG: ds.b 1 ; toggles between 0 and $10 when background camera crosses a block boundary horizontally
Verti_block_crossed_flag_BG: ds.b 1 ; toggles between 0 and $10 when background camera crosses a block boundary vertically
Horiz_block_crossed_flag_BG2: ds.b 1 ; used in CPZ
ds.b 1 ; $FFFFEE45 ; seems unused
Horiz_block_crossed_flag_BG3: ds.b 1
ds.b 1 ; $FFFFEE47 ; seems unused
Horiz_block_crossed_flag_P2: ds.b 1 ; toggles between 0 and $10 when you cross a block boundary horizontally
Verti_block_crossed_flag_P2: ds.b 1 ; toggles between 0 and $10 when you cross a block boundary vertically
Scroll_flags: ds.w 1 ; bitfield ; bit 0 = redraw top row, bit 1 = redraw bottom row, bit 2 = redraw left-most column, bit 3 = redraw right-most column
Scroll_flags_BG: ds.w 1 ; bitfield ; bits 0-3 as above, bit 4 = redraw top row (except leftmost block), bit 5 = redraw bottom row (except leftmost block), bits 6-7 = as bits 0-1
Scroll_flags_BG2: ds.w 1 ; bitfield ; essentially unused; bit 0 = redraw left-most column, bit 1 = redraw right-most column
Scroll_flags_BG3: ds.w 1 ; bitfield ; for CPZ; bits 0-3 as Scroll_flags_BG but using Y-dependent BG camera; bits 4-5 = bits 2-3; bits 6-7 = bits 2-3
Scroll_flags_P2: ds.w 1 ; bitfield ; bit 0 = redraw top row, bit 1 = redraw bottom row, bit 2 = redraw left-most column, bit 3 = redraw right-most column
Scroll_flags_BG_P2: ds.w 1 ; bitfield ; bits 0-3 as above, bit 4 = redraw top row (except leftmost block), bit 5 = redraw bottom row (except leftmost block), bits 6-7 = as bits 0-1
Scroll_flags_BG2_P2: ds.w 1 ; bitfield ; essentially unused; bit 0 = redraw left-most column, bit 1 = redraw right-most column
Scroll_flags_BG3_P2: ds.w 1 ; bitfield ; for CPZ; bits 0-3 as Scroll_flags_BG but using Y-dependent BG camera; bits 4-5 = bits 2-3; bits 6-7 = bits 2-3
Camera_RAM_copy: ds.l 2 ; copied over every V-int
Camera_BG_copy: ds.l 2 ; copied over every V-int
Camera_BG2_copy: ds.l 2 ; copied over every V-int
Camera_BG3_copy: ds.l 2 ; copied over every V-int
Camera_P2_copy: ds.l 8 ; copied over every V-int
Scroll_flags_copy: ds.w 1 ; copied over every V-int
Scroll_flags_BG_copy: ds.w 1 ; copied over every V-int
Scroll_flags_BG2_copy: ds.w 1 ; copied over every V-int
Scroll_flags_BG3_copy: ds.w 1 ; copied over every V-int
Scroll_flags_copy_P2: ds.w 1 ; copied over every V-int
Scroll_flags_BG_copy_P2: ds.w 1 ; copied over every V-int
Scroll_flags_BG2_copy_P2: ds.w 1 ; copied over every V-int
Scroll_flags_BG3_copy_P2: ds.w 1 ; copied over every V-int
Camera_X_pos_diff: ds.w 1 ; (new X pos - old X pos) * 256
Camera_Y_pos_diff: ds.w 1 ; (new Y pos - old Y pos) * 256
Camera_BG_X_pos_diff: ds.w 1 ; Effective camera change used in WFZ ending and HTZ screen shake
Camera_BG_Y_pos_diff: ds.w 1 ; Effective camera change used in WFZ ending and HTZ screen shake
Camera_X_pos_diff_P2: ds.w 1 ; (new X pos - old X pos) * 256
Camera_Y_pos_diff_P2: ds.w 1 ; (new Y pos - old Y pos) * 256
Screen_Shaking_Flag_HTZ: ds.b 1 ; activates screen shaking code in HTZ's layer deformation routine
Screen_Shaking_Flag: ds.b 1 ; activates screen shaking code (if existent) in layer deformation routine
Scroll_lock: ds.b 1 ; set to 1 to stop all scrolling for P1
Scroll_lock_P2: ds.b 1 ; set to 1 to stop all scrolling for P2
unk_EEC4: ds.w 1 ; same as above. The write being a long also overwrites the address below
Camera_Max_Y_pos: ds.w 1
Camera_Min_X_pos: ds.w 1
Camera_Max_X_pos: ds.w 1
Camera_Min_Y_pos: ds.w 1
Camera_Max_Y_pos_now: ds.w 1 ; was "Camera_max_scroll_spd"...
H_scroll_frame_offset:
Horiz_scroll_delay_val: ds.w 1 ; if its value is a, where a != 0, X scrolling will be based on the player's X position a-1 frames ago
Pos_table_index:
Sonic_Pos_Record_Index: ds.w 1 ; into Sonic_Pos_Record_Buf and Sonic_Stat_Record_Buf
Horiz_scroll_delay_val_P2: ds.w 1
Pos_table_index_P2:
Tails_Pos_Record_Index: ds.w 1 ; into Tails_Pos_Record_Buf
Camera_Y_pos_bias: ds.w 1 ; added to y position for lookup/lookdown, $60 is center
Camera_Y_pos_bias_P2: ds.w 1 ; for Tails
Deform_lock: ds.b 1 ; set to 1 to stop all deformation
ds.b 1 ; $FFFFEEDD ; seems unused
Camera_Max_Y_Pos_Changing: ds.b 1
Dynamic_Resize_Routine: ds.b 1
Camera_BG_X_offset: ds.w 1 ; Used to control background scrolling in X in WFZ ending and HTZ screen shake
Camera_BG_Y_offset: ds.w 1 ; Used to control background scrolling in Y in WFZ ending and HTZ screen shake
HTZ_Terrain_Delay: ds.w 1 ; During HTZ screen shake, this is a delay between rising and sinking terrain during which there is no shaking
HTZ_Terrain_Direction: ds.b 1 ; During HTZ screen shake, 0 if terrain/lava is rising, 1 if lowering
ActTransition_Flag: ds.b 1
Vscroll_Factor_P2_HInt: ds.l 1
Camera_X_pos_copy: ds.l 1
Camera_Y_pos_copy: ds.l 1
Tails_Min_X_pos: ds.w 1
Tails_Max_X_pos: ds.w 1
Tails_Min_Y_pos: ds.w 1 ; seems not actually implemented (only written to) (unused)
Tails_Max_Y_pos: ds.w 1
Camera_Pan: ds.w 1
Camera_Pan_2P: ds.w 1
Camera_RAM_End:
Block_cache: ds.b $80
Ring_consumption_table: ds.b $80 ; contains RAM addresses of rings currently being consumed
Ring_consumption_table_End:
Target_water_palette:
Underwater_target_palette: ds.b palette_line_size ; This is used by the screen-fading subroutines.
Underwater_target_palette_line2:ds.b palette_line_size ; While Underwater_palette contains the blacked-out palette caused by the fading,
Underwater_target_palette_line3:ds.b palette_line_size ; Underwater_target_palette will contain the palette the screen will ultimately fade in to.
Underwater_target_palette_line4:ds.b palette_line_size
Water_palette:
Underwater_palette: ds.b palette_line_size ; main palette for underwater parts of the screen
Underwater_palette_line2: ds.b palette_line_size
Underwater_palette_line3: ds.b palette_line_size
Underwater_palette_line4: ds.b palette_line_size
DrvMem: ds.b $4C0 ; memory used by AMPS
Game_Mode: ds.w 1 ; 1 byte ; see GameModesArray (master level trigger, Mstr_Lvl_Trigger)
Ctrl_1_Logical: ; 2 bytes
Ctrl_1_Held_Logical: ds.b 1 ; 1 byte
Ctrl_1_pressed_logical:
Ctrl_1_Press_Logical: ds.b 1 ; 1 byte
Ctrl_1: ; 2 bytes
Ctrl_1_Held: ds.b 1 ; 1 byte ; (pressed and held were switched around before)
Ctrl_1_pressed:
Ctrl_1_Press: ds.b 1 ; 1 byte
Ctrl_2: ; 2 bytes
Ctrl_2_Held: ds.b 1 ; 1 byte
Ctrl_2_pressed:
Ctrl_2_Press: ds.b 1 ; 1 byte
Ctrl_2_Logical: ; 2 bytes
Ctrl_2_Held_Logical: ds.b 1 ; 1 byte
Ctrl_2_Press_Logical: ds.b 1 ; 1 byte
; Extra buttons
Ctrl_6btn_1: ; 2 bytes
Ctrl_6btn_1_Held: ds.b 1 ; 1 byte ; (pressed and held were switched around before)
Ctrl_6btn_1_pressed:
Ctrl_6btn_1_Press: ds.b 1 ; 1 byte
Ctrl_6btn_2: ; 2 bytes
Ctrl_6btn_2_Held: ds.b 1 ; 1 byte
Ctrl_6btn_2_pressed:
Ctrl_6btn_2_Press: ds.b 1 ; 1 byte
Ctrl_6btn_1_Logical: ; 2 bytes
Ctrl_6btn_1_Held_Logical: ds.b 1 ; 1 byte
Ctrl_6btn_1_Press_Logical: ds.b 1 ; 1 byte
Ctrl_6btn_2_Logical: ; 2 bytes
Ctrl_6btn_2_Held_Logical: ds.b 1 ; 1 byte
Ctrl_6btn_2_Press_Logical: ds.b 1 ; 1 byte
Ctrl_Analog_1:
Ctrl_Analog_1_X: ds.b 1
Ctrl_Analog_1_Y: ds.b 1
Ctrl_Analog_2:
Ctrl_Analog_2_X: ds.b 1
Ctrl_Analog_2_Y: ds.b 1
Ctrl_Analog_1_Logical:
Ctrl_Analog_1_X_Logical: ds.b 1
Ctrl_Analog_1_Y_Logical: ds.b 1
Ctrl_Analog_2_Logical:
Ctrl_Analog_2_X_Logical: ds.b 1
Ctrl_Analog_2_Y_Logical: ds.b 1
VDP_reg_1_command:
VDP_Reg1_val: ds.w 1 ; normal value of VDP register #1 when display is disabled