-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmacroses.inc
1470 lines (1310 loc) · 26.2 KB
/
macroses.inc
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
;-------------C-O-N-S-T-A-N-T-S-----------------
DEBUG EQU 0
OPTIMIZATION EQU 1
BUGFIXES EQU 1
LANG_EN EQU 0
LANG_JP EQU 1
LANR_RU EQU 2
LANGUAGE EQU LANG_EN
;-------------------F-O-N-T---------------------
_0 EQU $00
_1 EQU $01
_2 EQU $02
_3 EQU $03
_4 EQU $04
_5 EQU $05
_6 EQU $06
_7 EQU $07
_8 EQU $08
_9 EQU $09
_exc EQU $0A
_apo EQU $0B
_col EQU $0C
_rar EQU $0E
_que EQU $0F
__ EQU $10
_dot EQU $2C
_ddt EQU $31
_dsh EQU $40
_A EQU $11
_B EQU $12
_C EQU $13
_D EQU $14
_E EQU $15
_F EQU $16
_G EQU $17
_H EQU $18
_I EQU $19
_J EQU $1A
_K EQU $1B
_L EQU $1C
_M EQU $1D
_N EQU $1E
_O EQU $1F
_P EQU $20
_Q EQU $21
_R EQU $22
_S EQU $23
_T EQU $24
_U EQU $25
_V EQU $26
_W EQU $27
_X EQU $28
_Y EQU $29
_Z EQU $2A
_a EQU $36
_b EQU $37
_c EQU $38
_d EQU $39
_e EQU $3A
_f EQU $41
_g EQU $50
_h EQU $42
_i EQU $43
_j EQU $51
_k EQU $44
_l EQU $45
_m EQU $46
_n EQU $47
_o EQU $48
_p EQU $52
_q EQU $53
_r EQU $49
_s EQU $4A
_t EQU $3B
_u EQU $3C
_v EQU $3D
_w EQU $3E
_x EQU $3F
_y EQU $54
_z EQU $4B
_EOL EQU $FE
_WAIT EQU $FD
_RET EQU $FE
_STOP EQU $FF
MAC DICT_REC
{1} SET [[.-_dictionary]>>1]|$80
.WORD {1}_ptr
ENDM
MAC DICT_DATA
{1}_ptr SET .
ENDM
MAC SPR_LIB_IDX
{1}_idx SET [[.-_spr_lib_list]>>1]
.WORD {1}
ENDM
MAC SPR_LIB_START
{1} SET .
SPR_LIB SET .
ENDM
MAC SPR_IDX
{1}_idx SET [[.-SPR_LIB]>>1]
.WORD {1}
ENDM
MAC APU_IDX
{1}_idx SET [[.-_apu_mus_lib]>>1]
.WORD {1}
ENDM
;-----------G-A-M-E--S-P-E-C-I-F-I-C------------
MAC _CMD_IDX
{1}_idx SET [.-_scr_cmd_lib]>>1
.WORD {1}-1
ENDM
; kill current script, stop execution
MAC KILL
#if DEBUG=1
_CNT_KILL SET _CNT_KILL+1
#endif
.BYTE _scr_cmd00_stop_idx
ENDM
; exit current script, return control to the engine
; return back on the next frame
MAC SYNC
#if DEBUG=1
_CNT_SYNC SET _CNT_SYNC+1
#endif
.BYTE _scr_cmd01_sync_idx
ENDM
; set script on hold for {1} frames
MAC SUSPEND
#if DEBUG=1
_CNT_SUSPEND SET _CNT_SUSPEND+1
#endif
.BYTE _scr_cmd02_suspend_idx
.BYTE {1}
ENDM
; execute native code, then exit script, return control to the engine
MAC NJSR_SYNC
#if DEBUG=1
_CNT_NJSR_SYNC SET _CNT_NJSR_SYNC+1
#endif
.BYTE _scr_cmd03_ejsr_sync_idx
.WORD {1}
ENDM
; queue new script and run it, {1} is the obj manager handler mode , {2}
; script pointer. note, all modes except 02 and 06 are the same simple
; script running modes but they differs in the program logic when handling
; collisions
;
; _OBJ_TYPE_AUTO - general purpose global scripts with its own destructors
; _OBJ_TYPE_PLAYER - only PLAYER objects
; _OBJ_TYPE_PBULLET - objects used as projectiles by player
; _OBJ_TYPE_STUNA - special kind anti-player stunning projectiles bouncing from enemy
; _OBJ_TYPE_BALL - special object for basket game
; _OBJ_TYPE_ENEMY - all harmless objects, including projectiles
; _OBJ_TYPE_EBULLET - player damaging projectile
; _OBJ_TYPE_STUNB - player stunning projectile
; _OBJ_TYPE_SOLID - solid sprite objects, jumpable, throwable, harmless to player
; _OBJ_TYPE_TRIGGER - harmless objects for collision test, disappear upon collision
; _OBJ_MODE_HIDE - do not show object's sprite
; _OBJ_MODE_GRABABLE - special flag for counting grabable objects for different ai handlers
; masks
_OBJ_TYPE_MASK EQU $0F
_OBJ_MODE_MASK EQU $F0
; types
_OBJ_TYPE_DISABLED EQU $00
_OBJ_TYPE_AUTO EQU $01
_OBJ_TYPE_PLAYER EQU $02
_OBJ_TYPE_PBULLET EQU $03
_OBJ_TYPE_STUNA EQU $04
_OBJ_TYPE_BALL EQU $05
_OBJ_TYPE_ENEMY EQU $06
_OBJ_TYPE_EBULLET EQU $07
_OBJ_TYPE_STUNB EQU $08
_OBJ_TYPE_SOLID EQU $09
_OBJ_TYPE_TRIGGER EQU $0A
;_OBJ_TYPE0B EQU $0B ; unused
;_OBJ_TYPE0C EQU $0C ; unused
;_OBJ_TYPE0D EQU $0D ; unused
;_OBJ_TYPE0E EQU $0E ; unused
;_OBJ_TYPE0F EQU $0F ; unused
; modes
_OBJ_MODE_HIDE EQU $80
_OBJ_MODE_GRABABLE EQU $40
;_OBJ_MODE20 EQU $20 ; unused
;_OBJ_MODE10 EQU $10 ; unused
MAC SRUN
#if DEBUG=1
_CNT_SRUN SET _CNT_SRUN+1
#endif
.BYTE _scr_cmd04_run_idx
.BYTE {1}
.WORD {2}
ENDM
; execute native code, continue script operation
MAC NJSR
#if DEBUG=1
_CNT_NJSR SET _CNT_NJSR+1
#endif
.BYTE _scr_cmd05_ejsr_idx
.WORD {1}
ENDM
MAC ASSERT_SHORT_OFS
#if DEBUG=1
TMP_CMD_PC SET .
TMP_OFS SET [{1}-TMP_CMD_PC-{2}]
#if TMP_OFS<-128
ECHO "long",{3},"at",TMP_CMD_PC,"jumps to",{1},"distance",TMP_OFS
#endif
#if TMP_OFS>127
ECHO "long",{3},"at",TMP_CMD_PC,"jumps to",{1},"distance",TMP_OFS
#endif
#endif
ENDM
MAC ALERT_SHORT_OFS
#if DEBUG=1
TMP_CMD_PC SET .
TMP_OFS SET [{1}-TMP_CMD_PC-{2}]
#if TMP_OFS>=-128&&TMP_OFS<=127
ECHO "short",{3},"at",TMP_CMD_PC,"jumps to",{1},"distance",TMP_OFS
#endif
#endif
ENDM
; unconditional script branch
MAC SJMP
#if DEBUG=1
_CNT_SJMP SET _CNT_SJMP+1
#endif
ALERT_SHORT_OFS {1},3,"SJMP"
.BYTE _scr_cmd06_jmp_idx
.WORD {1}
ENDM
MAC SJMPS
#if DEBUG=1
_CNT_SJMPS SET _CNT_SJMPS+1
#endif
#if OPTIMIZATION=1
ASSERT_SHORT_OFS {1},2,"SJMPS"
TMP_CMD_PC SET .
.BYTE _scr_cmd4A_jmp_short_idx
.BYTE [{1}-TMP_CMD_PC-2]&$FF
#else
.BYTE _scr_cmd06_jmp_idx
.WORD {1}
#endif
ENDM
; call script subroutine (return with RET)
MAC SJSR
#if DEBUG=1
_CNT_SJSR SET _CNT_SJSR+1
#endif
#if OPTIMIZATION=1
ALERT_SHORT_OFS {1},3,"SJSR"
#endif
.BYTE _scr_cmd07_jsr_idx
.WORD {1}
ENDM
MAC SJSRS
#if DEBUG=1
_CNT_SJSRS SET _CNT_SJSRS+1
#endif
#if OPTIMIZATION=1
ASSERT_SHORT_OFS {1},2,"SJSRS"
TMP_CMD_PC SET .
.BYTE _scr_cmd4B_jsr_short_idx
.BYTE [{1}-TMP_CMD_PC-2]&$FF
#else
.BYTE _scr_cmd07_jsr_idx
.WORD {1}
#endif
ENDM
; return from script subroutine
MAC SRET
#if DEBUG=1
_CNT_SRET SET _CNT_SRET+1
#endif
.BYTE _scr_cmd08_ret_idx
ENDM
; loop to script branch {1} times
MAC LOOP_A
#if DEBUG=1
_CNT_LOOP_A SET _CNT_LOOP_A+1
#endif
#if OPTIMIZATION=1
ASSERT_SHORT_OFS {2},3,"LOOP_A"
TMP_CMD_PC SET .
.BYTE _scr_cmd09_loopA_idx
.BYTE {1}
.BYTE [{2}-TMP_CMD_PC-3]&$FF
#else
.BYTE _scr_cmd09_loopA_idx
.BYTE {1}
.WORD {2}
#endif
ENDM
; second loop operand
MAC LOOP_B
#if DEBUG=1
_CNT_LOOP_B SET _CNT_LOOP_B+1
#endif
#if OPTIMIZATION=1
ASSERT_SHORT_OFS {2},3,"LOOP_B"
TMP_CMD_PC SET .
.BYTE _scr_cmd0A_loopB_idx
.BYTE {1}
.BYTE [{2}-TMP_CMD_PC-3]&$FF
#else
.BYTE _scr_cmd0A_loopB_idx
.BYTE {1}
.WORD {2}
#endif
ENDM
; helper branch macros
MAC SBRANCH
#if {3}=8
ASSERT_SHORT_OFS {1},2,"BRANCH"
TMP_CMD_PC SET .
.BYTE [_scr_cmd44_bne_short_idx+{2}]
.BYTE [{1}-TMP_CMD_PC-2]&$FF
#else
#if OPTIMIZATION=1
ALERT_SHORT_OFS {1},3,"BRANCH"
#endif
.BYTE [_scr_cmd0B_bne_idx+{2}]
.WORD {1}
#endif
ENDM
; set of branches equivalent of 6502 set
; script if EQUAL branch
MAC SBNE
#if DEBUG=1
_CNT_SBNE SET _CNT_SBNE+1
#endif
SBRANCH {1},0,16
ENDM
; script if CARRY=1 branch
MAC SBCC
#if DEBUG=1
_CNT_SBCC SET _CNT_SBCC+1
#endif
SBRANCH {1},1,16
ENDM
; script if NEG=1 branch
MAC SBPL
#if DEBUG=1
_CNT_SBPL SET _CNT_SBPL+1
#endif
SBRANCH {1},2,16
ENDM
; script if NO EQUAL branch
MAC SBEQ
#if DEBUG=1
_CNT_SBEQ SET _CNT_SBEQ+1
#endif
SBRANCH {1},3,16
ENDM
; script if CARRY=0 branch
MAC SBCS
#if DEBUG=1
_CNT_SBCS SET _CNT_SBCS+1
#endif
SBRANCH {1},4,16
ENDM
; script if NEG=0 branch
MAC SBMI
#if DEBUG=1
_CNT_SBMI SET _CNT_SBMI+1
#endif
SBRANCH {1},5,16
ENDM
; set of 8-bit ofs branches
#if OPTIMIZATION=1
MAC SBNES
#if DEBUG=1
_CNT_SBNES SET _CNT_SBNES+1
#endif
SBRANCH {1},0,8
ENDM
MAC SBCCS
#if DEBUG=1
_CNT_SBCCS SET _CNT_SBCCS+1
#endif
SBRANCH {1},1,8
ENDM
MAC SBPLS
#if DEBUG=1
_CNT_SBPLS SET _CNT_SBPLS+1
#endif
SBRANCH {1},2,8
ENDM
MAC SBEQS
#if DEBUG=1
_CNT_SBEQS SET _CNT_SBEQS+1
#endif
SBRANCH {1},3,8
ENDM
MAC SBCSS
#if DEBUG=1
_CNT_SBCSS SET _CNT_SBCSS+1
#endif
SBRANCH {1},4,8
ENDM
MAC SBMIS
#if DEBUG=1
_CNT_SBMIS SET _CNT_SBMIS+1
#endif
SBRANCH {1},5,8
ENDM
#else
MAC SBNES
#if DEBUG=1
_CNT_SBNES SET _CNT_SBNES+1
#endif
SBRANCH {1},0,16
ENDM
MAC SBCCS
#if DEBUG=1
_CNT_SBCCS SET _CNT_SBCCS+1
#endif
SBRANCH {1},1,16
ENDM
MAC SBPLS
#if DEBUG=1
_CNT_SBPLS SET _CNT_SBPLS+1
#endif
SBRANCH {1},2,16
ENDM
MAC SBEQS
#if DEBUG=1
_CNT_SBEQS SET _CNT_SBEQS+1
#endif
SBRANCH {1},3,16
ENDM
MAC SBCSS
#if DEBUG=1
_CNT_SBCSS SET _CNT_SBCSS+1
#endif
SBRANCH {1},4,16
ENDM
MAC SBMIS
#if DEBUG=1
_CNT_SBMIS SET _CNT_SBMIS+1
#endif
SBRANCH {1},5,16
ENDM
#endif
; test pads pad offset {1}, mask {2}, default branch if zero - {3}
_PAD0_HELD EQU $00
_PAD1_HELD EQU $01
; only used option
_PAD0_PRESS EQU $04
_PAD1_PRESS EQU $05
_PAD_A EQU $01
_PAD_B EQU $02
_PAD_SELECT EQU $04
_PAD_START EQU $08
_PAD_UP EQU $10
_PAD_DOWN EQU $20
_PAD_LEFT EQU $40
_PAD_RIGHT EQU $80
_PAD_ANY EQU $FF
MAC PADS_TEST
#if DEBUG=1
_CNT_PADS_TEST SET _CNT_PADS_TEST+1
#endif
.BYTE _scr_cmd11_pads_test_idx
.BYTE {1},{2}
.WORD {3}
ENDM
; switch case construction, {1} index ram variable, first branch default
MAC SSWITCH
#if DEBUG=1
_CNT_SSWITCH SET _CNT_SSWITCH+1
#endif
.BYTE _scr_cmd12_switch_idx
.WORD {1}
ENDM
; lets make it nice
MAC SCASE
.WORD {1}
ENDM
; store operand, put {1} into {2} ram address
MAC STORE
#if DEBUG=1
_CNT_STORE SET _CNT_STORE+1
#endif
.BYTE _scr_cmd13_store_idx
.BYTE {1}
.WORD {2}
ENDM
; {1} chr bank idx, {2} value
MAC CHR_SET
#if DEBUG=1
_CNT_CHR_SET SET _CNT_CHR_SET+1
#endif
.BYTE _scr_cmd14_chr_set_idx
.BYTE {1},{2}
ENDM
; reset loop counter for loop A
MAC LOOP_A_STOP
#if DEBUG=1
_CNT_LOOP_A_STOP SET _CNT_LOOP_A_STOP+1
#endif
.BYTE _scr_cmd15_loopA_reset_idx
ENDM
; same for loop b
MAC LOOP_B_STOP
#if DEBUG=1
_CNT_LOOP_B_STOP SET _CNT_LOOP_B_STOP+1
#endif
.BYTE _scr_cmd16_loopB_reset_idx
ENDM
; play MUS/SE, 00 = mute, 01-21 - music, 22-78 - se (22-74 only exising)
; 79-7F - are special codes
_APU_UNMUTE_idx EQU $79
_APU_MUTE_idx EQU $7A
_APU_MUS_FADE_OUT_idx EQU $7B
_APU_MUS_FADE_IN_idx EQU $7C ; never used, the fade-in routine unreferenced
_APU_MUS_STOP_idx EQU $7D ; never used, the complete stop used instead
_APU_SND_STOP_idx EQU $7E ; never used, the same as previous
_APU_ALL_STOP_idx EQU $7F
MAC APU_SE_SET
#if DEBUG=1
_CNT_APU_SE_SET SET _CNT_APU_SE_SET+1
#endif
.BYTE _scr_cmd17_apu_load_idx
.BYTE {1}_idx
ENDM
; do animation and return to the engine
; sync to the next frame
MAC ANIMATE_HV_SYNC
#if DEBUG=1
_CNT_ANIMATE_HV_SYNC SET _CNT_ANIMATE_HV_SYNC+1
#endif
.BYTE _scr_cmd18_obj_animate_sync_idx
ENDM
; same as previous but continue with the script execution
MAC ANIMATE_HV
#if DEBUG=1
_CNT_ANIMATE_HV SET _CNT_ANIMATE_HV+1
#endif
.BYTE _scr_cmd19_obj_animate_idx
ENDM
; macro command for animating the flight objects locked on
; target (bats level 2, cards of cat boss, etc..)
MAC TARGET_FOLLOW
#if DEBUG=1
_CNT_TARGET_FOLLOW SET _CNT_TARGET_FOLLOW+1
#endif
.BYTE _scr_cmd1A_target_follow_idx
ENDM
; usually set if object is deactivated
MAC SPRITE_ON
#if DEBUG=1
_CNT_SPRITE_ON SET _CNT_SPRITE_ON+1
#endif
.BYTE _scr_cmd1C_obj_show_idx
ENDM
; deactivate
MAC SPRITE_OFF
#if DEBUG=1
_CNT_SPRITE_OFF SET _CNT_SPRITE_OFF+1
#endif
.BYTE _scr_cmd1C_obj_hide_idx
ENDM
; select sprite library for object
MAC SPR_LIB_SET
#if DEBUG=1
_CNT_SPR_LIB_SET SET _CNT_SPR_LIB_SET+1
#endif
.BYTE _scr_cmd1D_spr_lib_select_idx
.BYTE {1}_idx
ENDM
; select current sprite idx as integer value
MAC SPR_IDX_INT_SET
#if DEBUG=1
_CNT_SPR_IDX_INT_SET SET _CNT_SPR_IDX_INT_SET+1
#endif
.BYTE _scr_cmd1E_spr_idx_select_idx
.BYTE {1}
ENDM
; the same using the mnemonic
MAC SPR_IDX_SET
#if DEBUG=1
_CNT_SPR_IDX_SET SET _CNT_SPR_IDX_SET+1
#endif
.BYTE _scr_cmd1E_spr_idx_select_idx
.BYTE {1}_idx
ENDM
; one of hor/vert sprite flipping flags
; flips flags:
_OBJ_FLIP_V EQU $80
_OBJ_FLIP_H EQU $40
_OBJ_UNDER_BG EQU $20
_OBJ_BLINK EQU $10
_OBJ_FLIPS08 EQU $08
_OBJ_FLIPS04 EQU $04
;_OBJ_FLIPS02 EQU $02 ; unused
;_OBJ_FLIPS01 EQU $01 ; unused
MAC FLIP_H_OFF
#if DEBUG=1
_CNT_FLIP_H_OFF SET _CNT_FLIP_H_OFF+1
#endif
.BYTE _scr_cmd1F_hflip_clear_idx
ENDM
; same
MAC FLIP_H_ON
#if DEBUG=1
_CNT_FLIP_H_ON SET _CNT_FLIP_H_ON+1
#endif
.BYTE _scr_cmd1F_hflip_set_idx
ENDM
; same
MAC FLIP_V_OFF
#if DEBUG=1
_CNT_FLIP_V_OFF SET _CNT_FLIP_V_OFF+1
#endif
.BYTE _scr_cmd21_vflip_clear_idx
ENDM
; same
MAC FLIP_V_ON
#if DEBUG=1
_CNT_FLIP_V_ON SET _CNT_FLIP_V_ON+1
#endif
.BYTE _scr_cmd21_vflip_set_idx
ENDM
; similar but toggles
MAC FLIP_H_TOGGLE
#if DEBUG=1
_CNT_FLIP_H_TOGGLE SET _CNT_FLIP_H_TOGGLE+1
#endif
.BYTE _scr_cmd23_hflip_toggle_idx
ENDM
; same
MAC FLIP_V_TOGGLE
#if DEBUG=1
_CNT_FLIP_V_TOGGLE SET _CNT_FLIP_V_TOGGLE+1
#endif
.BYTE _scr_cmd23_vflip_toggle_idx
ENDM
; xpos is always 16-bit for clipping
MAC POS_X_SET
#if DEBUG=1
_CNT_POS_X_SET SET _CNT_POS_X_SET+1
#endif
.BYTE _scr_cmd25_obj_set_x_pos_idx
.BYTE {1},{2}
ENDM
; same for Y
MAC POS_Y_SET
#if DEBUG=1
_CNT_POS_Y_SET SET _CNT_POS_Y_SET+1
#endif
.BYTE _scr_cmd26_obj_set_y_pos_idx
.BYTE {1},{2}
ENDM
; add value to object's X position
MAC POS_X_MOVE
#if DEBUG=1
_CNT_POS_X_MOVE SET _CNT_POS_X_MOVE+1
#endif
.BYTE _scr_cmd27_obj_move_x_pos_idx
.BYTE {1}
ENDM
; same for Y
MAC POS_Y_MOVE
#if DEBUG=1
_CNT_POS_Y_MOVE SET _CNT_POS_Y_MOVE+1
#endif
.BYTE _scr_cmd28_obj_move_y_pos_idx
.BYTE {0}
ENDM
; set constant movement delta for X
MAC DELTA_X_SET
#if DEBUG=1
_CNT_DELTA_X_SET SET _CNT_DELTA_X_SET+1
#endif
.BYTE _scr_cmd29_obj_set_x_delta_idx
.BYTE {0}
ENDM
; same for Y
MAC DELTA_Y_SET
#if DEBUG=1
_CNT_DELTA_Y_SET SET _CNT_DELTA_Y_SET+1
#endif
.BYTE _scr_cmd2A_obj_set_y_delta_idx
.BYTE {0}
ENDM
; does some kind of acceleration, low nibble of delta
; added to x position with carry
MAC DELTA_X_INC
#if DEBUG=1
_CNT_DELTA_X_INC SET _CNT_DELTA_X_INC+1
#endif
.BYTE _scr_cmd2B_obj_inc_x_delta_idx
ENDM
; same for Y
MAC DELTA_Y_INC
#if DEBUG=1
_CNT_DELTA_Y_INC SET _CNT_DELTA_Y_INC+1
#endif
.BYTE _scr_cmd2C_obj_inc_y_delta_idx
ENDM
; same but with decrease
MAC DELTA_X_DEC
#if DEBUG=1
_CNT_DELTA_X_DEC SET _CNT_DELTA_X_DEC+1
#endif
.BYTE _scr_cmd2D_obj_dec_x_delta_idx
ENDM
; same for Y
MAC DELTA_Y_DEC
#if DEBUG=1
_CNT_DELTA_Y_DEC SET _CNT_DELTA_Y_DEC+1
#endif
.BYTE _scr_cmd2E_dec_y_delta_idx
ENDM
; init object lock on target, {1} usually direction of target
MAC TARGET_LOCK
#if DEBUG=1
_CNT_TARGET_LOCK SET _CNT_TARGET_LOCK+1
#endif
.BYTE _scr_cmd2F_target_lock_idx
.BYTE {1}
ENDM
; set speed for traveling to target or some kind...
MAC TIMER_A_SET
#if DEBUG=1
_CNT_TIMER_A_SET SET _CNT_TIMER_A_SET+1
#endif
.BYTE _scr_cmd30_obj_timerAs_set_idx
.BYTE {1}
ENDM
; other direction value for target lock
MAC TIMER_B_SET
#if DEBUG=1
_CNT_TIMER_B_SET SET _CNT_TIMER_B_SET+1
#endif
.BYTE _scr_cmd31_obj_timerBs_set_idx
.BYTE {1}
ENDM
; set object dimensions for collision tests
MAC SIZE_SET
#if DEBUG=1
_CNT_SIZE_SET SET _CNT_SIZE_SET+1
#endif
.BYTE _scr_cmd32_obj_set_size_idx
.BYTE {1},{2}
ENDM
; object damage type set. NOTE, that for cutscene scripts
; this variable utilized differently as one of the tmp
; counters
;
_OBJ_DMG_NONE EQU $00
_OBJ_DMG_KILL EQU $01
_OBJ_DMG_STUN EQU $02
MAC DAMAGE_SET
#if DEBUG=1
_CNT_DAMAGE_SET SET _CNT_DAMAGE_SET+1
#endif
.BYTE _scr_cmd33_damage_set_idx
.BYTE {1}
ENDM
; define object's hitpoints. hp should be set even for undestructable
; objects because they threated as a existence of the object itself
; rather than activeness state flag
; NOTE, this var also used differently for cutscenes
MAC HP_SET
#if DEBUG=1
_CNT_HP_SET SET _CNT_HP_SET+1
#endif
.BYTE _scr_cmd34_obj_set_hp_idx
.BYTE {1}
ENDM
; set the vert/hor flips for object instantly
MAC FLIPS_SET
#if DEBUG=1
_CNT_FLIPS_SET SET _CNT_FLIPS_SET+1
#endif
.BYTE _scr_cmd35_obj_flips_set_idx
.BYTE {1}
ENDM
; unused flag settings
MAC IDXC_SET
#if DEBUG=1
_CNT_IDXC_SET SET _CNT_IDXC_SET+1
#endif
.BYTE _scr_cmd36_idxCs_set_idx
.BYTE {1}
ENDM
; they used MOV operands here for some reasons...
MAC MAIN_SUB_SET
#if DEBUG=1
_CNT_MAIN_SUB_SET SET _CNT_MAIN_SUB_SET+1
#endif
.BYTE _scr_cmd37_main_sub_idx_set_idx
.BYTE {1}
ENDM
; yes, it is parameters are speed and increment value
MAC PAL_FADE_IN
#if DEBUG=1
_CNT_PAL_FADE_IN SET _CNT_PAL_FADE_IN+1
#endif
.BYTE _scr_cmd38_pal_fade_in_idx
.BYTE {1},{2}
ENDM
; same
MAC PAL_FADE_OUT
#if DEBUG=1
_CNT_PAL_FADE_OUT SET _CNT_PAL_FADE_OUT+1
#endif
.BYTE _scr_cmd39_pal_fade_out_idx
.BYTE {1},{2}
ENDM
; never used, always used native handlers instead
MAC TLM_RES_QUEUE
#if DEBUG=1
_CNT_TLM_RES_QUEUE SET _CNT_TLM_RES_QUEUE+1
#endif
.BYTE _scr_cmd3A_tlm_res_queue_idx
.WORD {1}
ENDM
; yes, it is, parameter is an offset to menu data (options position and number)
MAC MENU_CURSOR_DRAW
#if DEBUG=1
_CNT_MENU_CURSOR_DRAW SET _CNT_MENU_CURSOR_DRAW+1
#endif
.BYTE _scr_cmd3B_draw_menu_cursor_idx
.WORD {1}
ENDM
; never used, all menus are vertically oriented
MAC MENU_HOR_INPUT
#if DEBUG=1
_CNT_MENU_HOR_INPUT SET _CNT_MENU_HOR_INPUT+1
#endif
.BYTE _scr_cmd3C_hor_menu_input_idx
.BYTE {1},{2}
ENDM
; same for vert menu, parameters are number of items in menu and default one
MAC MENU_VERT_INPUT
#if DEBUG=1
_CNT_MENU_VERT_INPUT SET _CNT_MENU_VERT_INPUT+1
#endif
.BYTE _scr_cmd3D_vert_menu_input_idx
.BYTE {1},{2}
ENDM
; never used, msg area always the same and hardcoded in msg init routine
MAC MSG_AREA_SET
#if DEBUG=1
_CNT_MSG_AREA_SET SET _CNT_MSG_AREA_SET+1
#endif
.BYTE _scr_cmd3E_msg_area_set_idx
.WORD {1}
.BYTE {2}
ENDM
; displays the message in already defined window, {1} ptr to msg resource
; {2} is the APU SE index to make typing sound for every character
MAC MSG_DISPLAY
#if DEBUG=1
_CNT_MSG_DISPLAY SET _CNT_MSG_DISPLAY+1
#endif
.BYTE _scr_cmd3F_msg_display_idx
.WORD {1}
.BYTE {2}_idx
ENDM
; wait until message is displayed
MAC MSG_WAIT
#if DEBUG=1
_CNT_MSG_WAIT SET _CNT_MSG_WAIT+1
#endif
.BYTE _scr_cmd40_msg_wait_idx
ENDM
; break current subroutine and exit instantly, argument is return address
MAC BREAK
#if DEBUG=1
_CNT_BREAK SET _CNT_BREAK+1
#endif
.BYTE _scr_cmd41_break_idx
.WORD {1}
ENDM
; set default script routine for object when destroyed or collision detected
; called from object manager instantly if collision test passed
;
MAC DESTR_PC_SET