-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
2698 lines (2390 loc) · 135 KB
/
Copy pathMakefile
File metadata and controls
2698 lines (2390 loc) · 135 KB
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
# ============================================================================
# Virtua Racing Deluxe (32X) - Reassembly Build System
# ============================================================================
# Tools
ASM = tools/vasmm68k_mot
SH2_AS = sh-elf-as
SH2_OBJCOPY = sh-elf-objcopy
SH2_ASFLAGS = --isa=sh2
PYTHON = python3
# Directories
BUILD_DIR = build
DISASM_DIR = disasm
TOOLS_DIR = tools
ORIGINAL_ROM = Virtua Racing Deluxe (USA).32x
OUTPUT_ROM = $(BUILD_DIR)/vr_rebuild.32x
# Assembly flags
# -Fbin = binary output
# -m68000 = target CPU
# -no-opt = no optimization (preserve original code)
# -o = output file
ASMFLAGS = -Fbin -m68000 -no-opt -spaces -quiet
# Source files
M68K_SRC = $(DISASM_DIR)/vrd.asm
.PHONY: all clean disasm tools test profile-frame profile-pc
# ============================================================================
# Main targets
# ============================================================================
all: dirs sh2-assembly $(OUTPUT_ROM)
dirs:
@mkdir -p $(BUILD_DIR)
# Build the ROM from original sections/
# Depends on SH2 assembly to ensure generated includes exist
$(OUTPUT_ROM): $(M68K_SRC) $(SH2_FUNC000_INC) $(SH2_FUNC022_INC) $(SH2_FUNC017_INC) $(SH2_FUNC018_INC) $(SH2_FUNC019_INC) $(SH2_FUNC020_INC) $(SH2_FUNC021_ORIG_INC) $(SH2_FUNC023_INC) $(SH2_FUNC040_INC) $(SH2_FUNC032_INC) $(SH2_FUNC011_INC) $(SH2_FUNC012_INC) $(SH2_FUNC013_INC) $(SH2_FUNC014_015_INC) $(SH2_FUNC024_INC) $(SH2_FUNC025_INC) $(SH2_FUNC026_INC) $(SH2_FUNC001_INC) $(SH2_FUNC002_INC) $(SH2_FUNC003_004_INC) $(SH2_FUNC029_030_031_INC) $(SH2_FUNC033_INC) $(SH2_FUNC034_INC) $(SH2_FUNC036_INC) $(SH2_FUNC037_038_039_INC) $(SH2_FUNC005_INC) $(SH2_FUNC007_INC) $(SH2_FUNC006_INC) $(SH2_FUNC008_INC) $(SH2_FUNC016_INC) $(SH2_FUNC065_INC) $(SH2_FUNC066_INC) $(SH2_FUNC021_OPT_INC) $(SH2_BATCH_COPY_INC) $(SH2_CMD27_DRAIN_INC) $(SH2_SLAVE_WRAPPER_V2_INC) $(SH2_HANDLER_FRAME_SYNC_INC) $(SH2_MASTER_DISPATCH_HOOK_INC) $(SH2_SLAVE_TEST_FUNC_INC) $(SH2_SHADOW_PATH_WRAPPER_INC) $(SH2_CMDINT_HANDLER_INC) $(SH2_QUEUE_PROCESSOR_INC) $(SH2_GEN_DRAIN_INC)
@echo "==> Assembling 68000 code (from sections/)..."
$(ASM) $(ASMFLAGS) -o $@ $<
@echo "==> Build complete: $@"
@ls -lh $@
# ============================================================================
# Disassembly targets
# ============================================================================
disasm: disasm-m68k disasm-sh2
disasm-m68k:
@echo "==> Disassembling 68000 code..."
$(PYTHON) $(TOOLS_DIR)/m68k_disasm.py "$(ORIGINAL_ROM)" 0x0 100
disasm-sh2:
@echo "==> Disassembling SH2 code..."
$(PYTHON) $(TOOLS_DIR)/sh2_disasm.py "$(ORIGINAL_ROM)" 0x245E4 100
# ============================================================================
# Analysis targets
# ============================================================================
analyze:
@echo "==> Analyzing ROM structure..."
$(PYTHON) $(TOOLS_DIR)/analyze_rom.py
find-sections:
@echo "==> Finding code sections..."
$(PYTHON) $(TOOLS_DIR)/find_code_sections.py
# ============================================================================
# Tool building
# ============================================================================
tools: tools/vasmm68k_mot
tools/vasmm68k_mot:
@echo "==> Building vasm assembler..."
@mkdir -p tools/vasm
@cd tools/vasm && \
wget -q http://sun.hasenbraten.de/vasm/release/vasm.tar.gz && \
tar -xzf vasm.tar.gz && \
cd vasm && \
make CPU=m68k SYNTAX=mot
@cp tools/vasm/vasm/vasmm68k_mot tools/
@echo "✓ vasm built successfully"
# ============================================================================
# SH2 Assembly
# ============================================================================
# SH2 source directories
SH2_SRC_DIR = $(DISASM_DIR)/sh2
SH2_GEN_DIR = $(SH2_SRC_DIR)/generated
SH2_3D_DIR = $(SH2_SRC_DIR)/3d_engine
SH2_LD = sh-elf-ld
# SH2 source files (Priority 1: simplest functions first)
SH2_FUNC000_SRC = $(SH2_3D_DIR)/data_copy.asm
SH2_FUNC000_LDS = $(SH2_3D_DIR)/data_copy.lds
SH2_FUNC000_BIN = $(BUILD_DIR)/sh2/data_copy.bin
SH2_FUNC000_INC = $(SH2_GEN_DIR)/data_copy.inc
SH2_FUNC022_SRC = $(SH2_3D_DIR)/wait_ready.asm
SH2_FUNC022_LDS = $(SH2_3D_DIR)/wait_ready.lds
SH2_FUNC022_BIN = $(BUILD_DIR)/sh2/wait_ready.bin
SH2_FUNC022_INC = $(SH2_GEN_DIR)/wait_ready.inc
SH2_FUNC017_SRC = $(SH2_3D_DIR)/quad_helper.asm
SH2_FUNC017_LDS = $(SH2_3D_DIR)/quad_helper.lds
SH2_FUNC017_BIN = $(BUILD_DIR)/sh2/quad_helper.bin
SH2_FUNC017_INC = $(SH2_GEN_DIR)/quad_helper.inc
SH2_FUNC032_SRC = $(SH2_3D_DIR)/scanline_setup.asm
SH2_FUNC032_LDS = $(SH2_3D_DIR)/scanline_setup.lds
SH2_FUNC032_BIN = $(BUILD_DIR)/sh2/scanline_setup.bin
SH2_FUNC032_INC = $(SH2_GEN_DIR)/scanline_setup.inc
SH2_FUNC011_SRC = $(SH2_3D_DIR)/display_list_loop.asm
SH2_FUNC011_LDS = $(SH2_3D_DIR)/display_list_loop.lds
SH2_FUNC011_BIN = $(BUILD_DIR)/sh2/display_list_loop.bin
SH2_FUNC011_INC = $(SH2_GEN_DIR)/display_list_loop.inc
SH2_FUNC012_SRC = $(SH2_3D_DIR)/display_entry.asm
SH2_FUNC012_LDS = $(SH2_3D_DIR)/display_entry.lds
SH2_FUNC012_BIN = $(BUILD_DIR)/sh2/display_entry.bin
SH2_FUNC012_INC = $(SH2_GEN_DIR)/display_entry.inc
SH2_FUNC013_SRC = $(SH2_3D_DIR)/vdp_init_short.asm
SH2_FUNC013_LDS = $(SH2_3D_DIR)/vdp_init_short.lds
SH2_FUNC013_BIN = $(BUILD_DIR)/sh2/vdp_init_short.bin
SH2_FUNC013_INC = $(SH2_GEN_DIR)/vdp_init_short.inc
SH2_FUNC014_015_SRC = $(SH2_3D_DIR)/vdp_copy_short.asm
SH2_FUNC014_015_LDS = $(SH2_3D_DIR)/vdp_copy_short.lds
SH2_FUNC014_015_BIN = $(BUILD_DIR)/sh2/vdp_copy_short.bin
SH2_FUNC014_015_INC = $(SH2_GEN_DIR)/vdp_copy_short.inc
SH2_FUNC025_SRC = $(SH2_3D_DIR)/coord_offset_short.asm
SH2_FUNC025_LDS = $(SH2_3D_DIR)/coord_offset_short.lds
SH2_FUNC025_BIN = $(BUILD_DIR)/sh2/coord_offset_short.bin
SH2_FUNC025_INC = $(SH2_GEN_DIR)/coord_offset_short.inc
SH2_FUNC024_SRC = $(SH2_3D_DIR)/screen_coords_short.asm
SH2_FUNC024_LDS = $(SH2_3D_DIR)/screen_coords_short.lds
SH2_FUNC024_BIN = $(BUILD_DIR)/sh2/screen_coords_short.bin
SH2_FUNC024_INC = $(SH2_GEN_DIR)/screen_coords_short.inc
SH2_FUNC026_SRC = $(SH2_3D_DIR)/bounds_compare_short.asm
SH2_FUNC026_LDS = $(SH2_3D_DIR)/bounds_compare_short.lds
SH2_FUNC026_BIN = $(BUILD_DIR)/sh2/bounds_compare_short.bin
SH2_FUNC026_INC = $(SH2_GEN_DIR)/bounds_compare_short.inc
SH2_FUNC001_SRC = $(SH2_3D_DIR)/main_coordinator_short.asm
SH2_FUNC001_LDS = $(SH2_3D_DIR)/main_coordinator_short.lds
SH2_FUNC001_BIN = $(BUILD_DIR)/sh2/main_coordinator_short.bin
SH2_FUNC001_INC = $(SH2_GEN_DIR)/main_coordinator_short.inc
SH2_FUNC002_SRC = $(SH2_3D_DIR)/case_handlers_short.asm
SH2_FUNC002_LDS = $(SH2_3D_DIR)/case_handlers_short.lds
SH2_FUNC002_BIN = $(BUILD_DIR)/sh2/case_handlers_short.bin
SH2_FUNC002_INC = $(SH2_GEN_DIR)/case_handlers_short.inc
SH2_FUNC003_004_SRC = $(SH2_3D_DIR)/offset_copy_short.asm
SH2_FUNC003_004_LDS = $(SH2_3D_DIR)/offset_copy_short.lds
SH2_FUNC003_004_BIN = $(BUILD_DIR)/sh2/offset_copy_short.bin
SH2_FUNC003_004_INC = $(SH2_GEN_DIR)/offset_copy_short.inc
SH2_FUNC029_030_031_SRC = $(SH2_3D_DIR)/visibility_short.asm
SH2_FUNC029_030_031_LDS = $(SH2_3D_DIR)/visibility_short.lds
SH2_FUNC029_030_031_BIN = $(BUILD_DIR)/sh2/visibility_short.bin
SH2_FUNC029_030_031_INC = $(SH2_GEN_DIR)/visibility_short.inc
SH2_FUNC033_SRC = $(SH2_3D_DIR)/render_quad_short.asm
SH2_FUNC033_LDS = $(SH2_3D_DIR)/render_quad_short.lds
SH2_FUNC033_BIN = $(BUILD_DIR)/sh2/render_quad_short.bin
SH2_FUNC033_INC = $(SH2_GEN_DIR)/render_quad_short.inc
SH2_FUNC034_SRC = $(SH2_3D_DIR)/span_filler_short.asm
SH2_FUNC034_LDS = $(SH2_3D_DIR)/span_filler_short.lds
SH2_FUNC034_BIN = $(BUILD_DIR)/sh2/span_filler_short.bin
SH2_FUNC034_INC = $(SH2_GEN_DIR)/span_filler_short.inc
SH2_FUNC036_SRC = $(SH2_3D_DIR)/render_dispatch_short.asm
SH2_FUNC036_LDS = $(SH2_3D_DIR)/render_dispatch_short.lds
SH2_FUNC036_BIN = $(BUILD_DIR)/sh2/render_dispatch_short.bin
SH2_FUNC036_INC = $(SH2_GEN_DIR)/render_dispatch_short.inc
SH2_FUNC037_038_039_SRC = $(SH2_3D_DIR)/helpers_short.asm
SH2_FUNC037_038_039_LDS = $(SH2_3D_DIR)/helpers_short.lds
SH2_FUNC037_038_039_BIN = $(BUILD_DIR)/sh2/helpers_short.bin
SH2_FUNC037_038_039_INC = $(SH2_GEN_DIR)/helpers_short.inc
SH2_FUNC018_SRC = $(SH2_3D_DIR)/quad_batch_short.asm
SH2_FUNC018_LDS = $(SH2_3D_DIR)/quad_batch_short.lds
SH2_FUNC018_BIN = $(BUILD_DIR)/sh2/quad_batch_short.bin
SH2_FUNC018_INC = $(SH2_GEN_DIR)/quad_batch_short.inc
SH2_FUNC019_SRC = $(SH2_3D_DIR)/quad_batch_alt_short.asm
SH2_FUNC019_LDS = $(SH2_3D_DIR)/quad_batch_alt_short.lds
SH2_FUNC019_BIN = $(BUILD_DIR)/sh2/quad_batch_alt_short.bin
SH2_FUNC019_INC = $(SH2_GEN_DIR)/quad_batch_alt_short.inc
SH2_FUNC020_SRC = $(SH2_3D_DIR)/vertex_helper_short.asm
SH2_FUNC020_LDS = $(SH2_3D_DIR)/vertex_helper_short.lds
SH2_FUNC020_BIN = $(BUILD_DIR)/sh2/vertex_helper_short.bin
SH2_FUNC020_INC = $(SH2_GEN_DIR)/vertex_helper_short.inc
SH2_FUNC021_ORIG_SRC = $(SH2_3D_DIR)/vertex_transform_orig.asm
SH2_FUNC021_ORIG_LDS = $(SH2_3D_DIR)/vertex_transform.lds
SH2_FUNC021_ORIG_BIN = $(BUILD_DIR)/sh2/vertex_transform_orig.bin
SH2_FUNC021_ORIG_INC = $(SH2_GEN_DIR)/vertex_transform_orig.inc
SH2_FUNC023_SRC = $(SH2_3D_DIR)/frustum_cull_short.asm
SH2_FUNC023_LDS = $(SH2_3D_DIR)/frustum_cull_short.lds
SH2_FUNC023_BIN = $(BUILD_DIR)/sh2/frustum_cull_short.bin
SH2_FUNC023_INC = $(SH2_GEN_DIR)/frustum_cull_short.inc
SH2_FUNC040_SRC = $(SH2_3D_DIR)/display_list_short.asm
SH2_FUNC040_LDS = $(SH2_3D_DIR)/display_list_short.lds
SH2_FUNC040_BIN = $(BUILD_DIR)/sh2/display_list_short.bin
SH2_FUNC040_INC = $(SH2_GEN_DIR)/display_list_short.inc
SH2_FUNC040_CASES_SRC = $(SH2_3D_DIR)/display_cases_short.asm
SH2_FUNC040_CASES_LDS = $(SH2_3D_DIR)/display_cases_short.lds
SH2_FUNC040_CASES_BIN = $(BUILD_DIR)/sh2/display_cases_short.bin
SH2_FUNC040_CASES_INC = $(SH2_GEN_DIR)/display_cases_short.inc
SH2_FUNC040_UTIL_SRC = $(SH2_3D_DIR)/display_utility_short.asm
SH2_FUNC040_UTIL_LDS = $(SH2_3D_DIR)/display_utility_short.lds
SH2_FUNC040_UTIL_BIN = $(BUILD_DIR)/sh2/display_utility_short.bin
SH2_FUNC040_UTIL_INC = $(SH2_GEN_DIR)/display_utility_short.inc
SH2_FUNC041_SRC = $(SH2_3D_DIR)/render_coord_short.asm
SH2_FUNC041_LDS = $(SH2_3D_DIR)/render_coord_short.lds
SH2_FUNC041_BIN = $(BUILD_DIR)/sh2/render_coord_short.bin
SH2_FUNC041_INC = $(SH2_GEN_DIR)/render_coord_short.inc
SH2_FUNC042_SRC = $(SH2_3D_DIR)/data_copy_util_short.asm
SH2_FUNC042_LDS = $(SH2_3D_DIR)/data_copy_util_short.lds
SH2_FUNC042_BIN = $(BUILD_DIR)/sh2/data_copy_util_short.bin
SH2_FUNC042_INC = $(SH2_GEN_DIR)/data_copy_util_short.inc
SH2_FUNC043_SRC = $(SH2_3D_DIR)/polygon_batch_short.asm
SH2_FUNC043_LDS = $(SH2_3D_DIR)/polygon_batch_short.lds
SH2_FUNC043_BIN = $(BUILD_DIR)/sh2/polygon_batch_short.bin
SH2_FUNC043_INC = $(SH2_GEN_DIR)/polygon_batch_short.inc
SH2_FUNC044_SRC = $(SH2_3D_DIR)/edge_scan_short.asm
SH2_FUNC044_LDS = $(SH2_3D_DIR)/edge_scan_short.lds
SH2_FUNC044_BIN = $(BUILD_DIR)/sh2/edge_scan_short.bin
SH2_FUNC044_INC = $(SH2_GEN_DIR)/edge_scan_short.inc
SH2_FUNC045_SRC = $(SH2_3D_DIR)/dispatch_loop_short.asm
SH2_FUNC045_LDS = $(SH2_3D_DIR)/dispatch_loop_short.lds
SH2_FUNC045_BIN = $(BUILD_DIR)/sh2/dispatch_loop_short.bin
SH2_FUNC045_INC = $(SH2_GEN_DIR)/dispatch_loop_short.inc
SH2_FUNC046_SRC = $(SH2_3D_DIR)/array_copy_short.asm
SH2_FUNC046_LDS = $(SH2_3D_DIR)/array_copy_short.lds
SH2_FUNC046_BIN = $(BUILD_DIR)/sh2/array_copy_short.bin
SH2_FUNC046_INC = $(SH2_GEN_DIR)/array_copy_short.inc
SH2_FUNC047_SRC = $(SH2_3D_DIR)/bounds_check_short.asm
SH2_FUNC047_LDS = $(SH2_3D_DIR)/bounds_check_short.lds
SH2_FUNC047_BIN = $(BUILD_DIR)/sh2/bounds_check_short.bin
SH2_FUNC047_INC = $(SH2_GEN_DIR)/bounds_check_short.inc
SH2_FUNC048_SRC = $(SH2_3D_DIR)/bounds_handler_short.asm
SH2_FUNC048_LDS = $(SH2_3D_DIR)/bounds_handler_short.lds
SH2_FUNC048_BIN = $(BUILD_DIR)/sh2/bounds_handler_short.bin
SH2_FUNC048_INC = $(SH2_GEN_DIR)/bounds_handler_short.inc
SH2_FUNC049_SRC = $(SH2_3D_DIR)/bounds_entry_short.asm
SH2_FUNC049_LDS = $(SH2_3D_DIR)/bounds_entry_short.lds
SH2_FUNC049_BIN = $(BUILD_DIR)/sh2/bounds_entry_short.bin
SH2_FUNC049_INC = $(SH2_GEN_DIR)/bounds_entry_short.inc
SH2_FUNC050_SRC = $(SH2_3D_DIR)/multi_bsr_short.asm
SH2_FUNC050_LDS = $(SH2_3D_DIR)/multi_bsr_short.lds
SH2_FUNC050_BIN = $(BUILD_DIR)/sh2/multi_bsr_short.bin
SH2_FUNC050_INC = $(SH2_GEN_DIR)/multi_bsr_short.inc
SH2_FUNC051_SRC = $(SH2_3D_DIR)/offset_bsr_short.asm
SH2_FUNC051_LDS = $(SH2_3D_DIR)/offset_bsr_short.lds
SH2_FUNC051_BIN = $(BUILD_DIR)/sh2/offset_bsr_short.bin
SH2_FUNC051_INC = $(SH2_GEN_DIR)/offset_bsr_short.inc
SH2_FUNC052_SRC = $(SH2_3D_DIR)/small_bsr_short.asm
SH2_FUNC052_LDS = $(SH2_3D_DIR)/small_bsr_short.lds
SH2_FUNC052_BIN = $(BUILD_DIR)/sh2/small_bsr_short.bin
SH2_FUNC052_INC = $(SH2_GEN_DIR)/small_bsr_short.inc
SH2_FUNC053_SRC = $(SH2_3D_DIR)/offset_small_short.asm
SH2_FUNC053_LDS = $(SH2_3D_DIR)/offset_small_short.lds
SH2_FUNC053_BIN = $(BUILD_DIR)/sh2/offset_small_short.bin
SH2_FUNC053_INC = $(SH2_GEN_DIR)/offset_small_short.inc
SH2_FUNC054_SRC = $(SH2_3D_DIR)/conditional_bsr_short.asm
SH2_FUNC054_LDS = $(SH2_3D_DIR)/conditional_bsr_short.lds
SH2_FUNC054_BIN = $(BUILD_DIR)/sh2/conditional_bsr_short.bin
SH2_FUNC054_INC = $(SH2_GEN_DIR)/conditional_bsr_short.inc
SH2_FUNC055_SRC = $(SH2_3D_DIR)/unrolled_copy_short.asm
SH2_FUNC055_LDS = $(SH2_3D_DIR)/unrolled_copy_short.lds
SH2_FUNC055_BIN = $(BUILD_DIR)/sh2/unrolled_copy_short.bin
SH2_FUNC055_INC = $(SH2_GEN_DIR)/unrolled_copy_short.inc
# NOTE: func_056 removed - code at $023F2E is already covered by unrolled_data_copy
SH2_FUNC067_SRC = $(SH2_3D_DIR)/rle_entry_alt1_short.asm
SH2_FUNC067_LDS = $(SH2_3D_DIR)/rle_entry_alt1_short.lds
SH2_FUNC067_BIN = $(BUILD_DIR)/sh2/rle_entry_alt1_short.bin
SH2_FUNC067_INC = $(SH2_GEN_DIR)/rle_entry_alt1_short.inc
SH2_FUNC068_SRC = $(SH2_3D_DIR)/rle_entry_alt2_short.asm
SH2_FUNC068_LDS = $(SH2_3D_DIR)/rle_entry_alt2_short.lds
SH2_FUNC068_BIN = $(BUILD_DIR)/sh2/rle_entry_alt2_short.bin
SH2_FUNC068_INC = $(SH2_GEN_DIR)/rle_entry_alt2_short.inc
SH2_FUNC069_SRC = $(SH2_3D_DIR)/block_copy_stride_short.asm
SH2_FUNC069_LDS = $(SH2_3D_DIR)/block_copy_stride_short.lds
SH2_FUNC069_BIN = $(BUILD_DIR)/sh2/block_copy_stride_short.bin
SH2_FUNC069_INC = $(SH2_GEN_DIR)/block_copy_stride_short.inc
SH2_FUNC070_SRC = $(SH2_3D_DIR)/loop_dispatcher_short.asm
SH2_FUNC070_LDS = $(SH2_3D_DIR)/loop_dispatcher_short.lds
SH2_FUNC070_BIN = $(BUILD_DIR)/sh2/loop_dispatcher_short.bin
SH2_FUNC070_INC = $(SH2_GEN_DIR)/loop_dispatcher_short.inc
SH2_FUNC071_SRC = $(SH2_3D_DIR)/context_setup_short.asm
SH2_FUNC071_LDS = $(SH2_3D_DIR)/context_setup_short.lds
SH2_FUNC071_BIN = $(BUILD_DIR)/sh2/context_setup_short.bin
SH2_FUNC071_INC = $(SH2_GEN_DIR)/context_setup_short.inc
SH2_FUNC072_SRC = $(SH2_3D_DIR)/element_processor_short.asm
SH2_FUNC072_LDS = $(SH2_3D_DIR)/element_processor_short.lds
SH2_FUNC072_BIN = $(BUILD_DIR)/sh2/element_processor_short.bin
SH2_FUNC072_INC = $(SH2_GEN_DIR)/element_processor_short.inc
SH2_FUNC073_SRC = $(SH2_3D_DIR)/negative_handler_short.asm
SH2_FUNC073_LDS = $(SH2_3D_DIR)/negative_handler_short.lds
SH2_FUNC073_BIN = $(BUILD_DIR)/sh2/negative_handler_short.bin
SH2_FUNC073_INC = $(SH2_GEN_DIR)/negative_handler_short.inc
SH2_FUNC074_SRC = $(SH2_3D_DIR)/block_copy_14_short.asm
SH2_FUNC074_LDS = $(SH2_3D_DIR)/block_copy_14_short.lds
SH2_FUNC074_BIN = $(BUILD_DIR)/sh2/block_copy_14_short.bin
SH2_FUNC074_INC = $(SH2_GEN_DIR)/block_copy_14_short.inc
SH2_FUNC075_SRC = $(SH2_3D_DIR)/block_iterator_short.asm
SH2_FUNC075_LDS = $(SH2_3D_DIR)/block_iterator_short.lds
SH2_FUNC075_BIN = $(BUILD_DIR)/sh2/block_iterator_short.bin
SH2_FUNC075_INC = $(SH2_GEN_DIR)/block_iterator_short.inc
SH2_FUNC076_SRC = $(SH2_3D_DIR)/vdp_pixel_write_short.asm
SH2_FUNC076_LDS = $(SH2_3D_DIR)/vdp_pixel_write_short.lds
SH2_FUNC076_BIN = $(BUILD_DIR)/sh2/vdp_pixel_write_short.bin
SH2_FUNC076_INC = $(SH2_GEN_DIR)/vdp_pixel_write_short.inc
SH2_FUNC077_SRC = $(SH2_3D_DIR)/value_dispatch_short.asm
SH2_FUNC077_LDS = $(SH2_3D_DIR)/value_dispatch_short.lds
SH2_FUNC077_BIN = $(BUILD_DIR)/sh2/value_dispatch_short.bin
SH2_FUNC077_INC = $(SH2_GEN_DIR)/value_dispatch_short.inc
SH2_FUNC078_SRC = $(SH2_3D_DIR)/negative_fill_short.asm
SH2_FUNC078_LDS = $(SH2_3D_DIR)/negative_fill_short.lds
SH2_FUNC078_BIN = $(BUILD_DIR)/sh2/negative_fill_short.bin
SH2_FUNC078_INC = $(SH2_GEN_DIR)/negative_fill_short.inc
SH2_FUNC079_SRC = $(SH2_3D_DIR)/fill_decrement_short.asm
SH2_FUNC079_LDS = $(SH2_3D_DIR)/fill_decrement_short.lds
SH2_FUNC079_BIN = $(BUILD_DIR)/sh2/fill_decrement_short.bin
SH2_FUNC079_INC = $(SH2_GEN_DIR)/fill_decrement_short.inc
SH2_FUNC080_SRC = $(SH2_3D_DIR)/memory_clear_short.asm
SH2_FUNC080_LDS = $(SH2_3D_DIR)/memory_clear_short.lds
SH2_FUNC080_BIN = $(BUILD_DIR)/sh2/memory_clear_short.bin
SH2_FUNC080_INC = $(SH2_GEN_DIR)/memory_clear_short.inc
SH2_FUNC081_SRC = $(SH2_3D_DIR)/multi_jsr_short.asm
SH2_FUNC081_LDS = $(SH2_3D_DIR)/multi_jsr_short.lds
SH2_FUNC081_BIN = $(BUILD_DIR)/sh2/multi_jsr_short.bin
SH2_FUNC081_INC = $(SH2_GEN_DIR)/multi_jsr_short.inc
SH2_FUNC082_SRC = $(SH2_3D_DIR)/multi_jsr_alt_short.asm
SH2_FUNC082_LDS = $(SH2_3D_DIR)/multi_jsr_alt_short.lds
SH2_FUNC082_BIN = $(BUILD_DIR)/sh2/multi_jsr_alt_short.bin
SH2_FUNC082_INC = $(SH2_GEN_DIR)/multi_jsr_alt_short.inc
SH2_FUNC083_SRC = $(SH2_3D_DIR)/poll_wait_short.asm
SH2_FUNC083_LDS = $(SH2_3D_DIR)/poll_wait_short.lds
SH2_FUNC083_BIN = $(BUILD_DIR)/sh2/poll_wait_short.bin
SH2_FUNC083_INC = $(SH2_GEN_DIR)/poll_wait_short.inc
SH2_FUNC084_SRC = $(SH2_3D_DIR)/hw_init_short.asm
SH2_FUNC084_LDS = $(SH2_3D_DIR)/hw_init_short.lds
SH2_FUNC084_BIN = $(BUILD_DIR)/sh2/hw_init_short.bin
SH2_FUNC084_INC = $(SH2_GEN_DIR)/hw_init_short.inc
SH2_FUNC085_SRC = $(SH2_3D_DIR)/poll_zero_short.asm
SH2_FUNC085_LDS = $(SH2_3D_DIR)/poll_zero_short.lds
SH2_FUNC085_BIN = $(BUILD_DIR)/sh2/poll_zero_short.bin
SH2_FUNC085_INC = $(SH2_GEN_DIR)/poll_zero_short.inc
SH2_FUNC086_SRC = $(SH2_3D_DIR)/clear_reg_short.asm
SH2_FUNC086_LDS = $(SH2_3D_DIR)/clear_reg_short.lds
SH2_FUNC086_BIN = $(BUILD_DIR)/sh2/clear_reg_short.bin
SH2_FUNC086_INC = $(SH2_GEN_DIR)/clear_reg_short.inc
SH2_FUNC087_SRC = $(SH2_3D_DIR)/poll_zero_alt_short.asm
SH2_FUNC087_LDS = $(SH2_3D_DIR)/poll_zero_alt_short.lds
SH2_FUNC087_BIN = $(BUILD_DIR)/sh2/poll_zero_alt_short.bin
SH2_FUNC087_INC = $(SH2_GEN_DIR)/poll_zero_alt_short.inc
SH2_FUNC088_SRC = $(SH2_3D_DIR)/struct_init_short.asm
SH2_FUNC088_LDS = $(SH2_3D_DIR)/struct_init_short.lds
SH2_FUNC088_BIN = $(BUILD_DIR)/sh2/struct_init_short.bin
SH2_FUNC088_INC = $(SH2_GEN_DIR)/struct_init_short.inc
SH2_FUNC089_SRC = $(SH2_3D_DIR)/poll_branch_short.asm
SH2_FUNC089_LDS = $(SH2_3D_DIR)/poll_branch_short.lds
SH2_FUNC089_BIN = $(BUILD_DIR)/sh2/poll_branch_short.bin
SH2_FUNC089_INC = $(SH2_GEN_DIR)/poll_branch_short.inc
SH2_FUNC090_SRC = $(SH2_3D_DIR)/poll_wait_2_short.asm
SH2_FUNC090_LDS = $(SH2_3D_DIR)/poll_wait_2_short.lds
SH2_FUNC090_BIN = $(BUILD_DIR)/sh2/poll_wait_2_short.bin
SH2_FUNC090_INC = $(SH2_GEN_DIR)/poll_wait_2_short.inc
SH2_FUNC091_SRC = $(SH2_3D_DIR)/poll_copy_short.asm
SH2_FUNC091_LDS = $(SH2_3D_DIR)/poll_copy_short.lds
SH2_FUNC091_BIN = $(BUILD_DIR)/sh2/poll_copy_short.bin
SH2_FUNC091_INC = $(SH2_GEN_DIR)/poll_copy_short.inc
SH2_FUNC005_SRC = $(SH2_3D_DIR)/transform_loop.asm
SH2_FUNC005_LDS = $(SH2_3D_DIR)/transform_loop.lds
SH2_FUNC005_BIN = $(BUILD_DIR)/sh2/transform_loop.bin
SH2_FUNC005_INC = $(SH2_GEN_DIR)/transform_loop.inc
SH2_FUNC007_SRC = $(SH2_3D_DIR)/alt_transform_loop.asm
SH2_FUNC007_LDS = $(SH2_3D_DIR)/alt_transform_loop.lds
SH2_FUNC007_BIN = $(BUILD_DIR)/sh2/alt_transform_loop.bin
SH2_FUNC007_INC = $(SH2_GEN_DIR)/alt_transform_loop.inc
SH2_FUNC006_SRC = $(SH2_3D_DIR)/matrix_multiply.asm
SH2_FUNC006_BIN = $(BUILD_DIR)/sh2/matrix_multiply.bin
SH2_FUNC006_INC = $(SH2_GEN_DIR)/matrix_multiply.inc
SH2_FUNC008_SRC = $(SH2_3D_DIR)/alt_matrix_multiply.asm
SH2_FUNC008_BIN = $(BUILD_DIR)/sh2/alt_matrix_multiply.bin
SH2_FUNC008_INC = $(SH2_GEN_DIR)/alt_matrix_multiply.inc
SH2_FUNC016_SRC = $(SH2_3D_DIR)/coord_transform.asm
SH2_FUNC016_BIN = $(BUILD_DIR)/sh2/coord_transform.bin
SH2_FUNC016_INC = $(SH2_GEN_DIR)/coord_transform.inc
SH2_FUNC009_SRC = $(SH2_3D_DIR)/display_list_4elem.asm
SH2_FUNC009_BIN = $(BUILD_DIR)/sh2/display_list_4elem.bin
SH2_FUNC009_INC = $(SH2_GEN_DIR)/display_list_4elem.inc
SH2_FUNC010_SRC = $(SH2_3D_DIR)/display_list_3elem.asm
SH2_FUNC010_BIN = $(BUILD_DIR)/sh2/display_list_3elem.bin
SH2_FUNC010_INC = $(SH2_GEN_DIR)/display_list_3elem.inc
SH2_FUNC065_SRC = $(SH2_3D_DIR)/unrolled_data_copy.asm
SH2_FUNC065_BIN = $(BUILD_DIR)/sh2/unrolled_data_copy.bin
SH2_FUNC065_INC = $(SH2_GEN_DIR)/unrolled_data_copy.inc
SH2_FUNC066_SRC = $(SH2_3D_DIR)/rle_decoder.asm
SH2_FUNC066_BIN = $(BUILD_DIR)/sh2/rle_decoder.bin
SH2_FUNC066_INC = $(SH2_GEN_DIR)/rle_decoder.inc
# Expansion ROM functions (for Slave offloading)
SH2_EXP_DIR = $(SH2_SRC_DIR)/expansion
SH2_FUNC021_OPT_SRC = $(SH2_EXP_DIR)/vertex_transform_optimized.asm
SH2_FUNC021_OPT_BIN = $(BUILD_DIR)/sh2/vertex_transform_optimized.bin
SH2_FUNC021_OPT_INC = $(SH2_GEN_DIR)/vertex_transform_optimized.inc
# Batch copy handler (optimization for cmd $26)
SH2_BATCH_COPY_SRC = $(SH2_SRC_DIR)/batch_copy_handler.asm
SH2_BATCH_COPY_BIN = $(BUILD_DIR)/sh2/batch_copy_handler.bin
SH2_BATCH_COPY_INC = $(SH2_GEN_DIR)/batch_copy_handler.inc
# cmd27 queue drain (async queue processor)
SH2_CMD27_DRAIN_SRC = $(SH2_EXP_DIR)/cmd27_queue_drain.asm
SH2_CMD27_DRAIN_BIN = $(BUILD_DIR)/sh2/cmd27_queue_drain.bin
SH2_CMD27_DRAIN_INC = $(SH2_GEN_DIR)/cmd27_queue_drain.inc
# slave_work_wrapper_v2 (with queue support)
SH2_SLAVE_WRAPPER_V2_SRC = $(SH2_EXP_DIR)/slave_work_wrapper_v2.asm
SH2_SLAVE_WRAPPER_V2_BIN = $(BUILD_DIR)/sh2/slave_work_wrapper_v2.bin
SH2_SLAVE_WRAPPER_V2_INC = $(SH2_GEN_DIR)/slave_work_wrapper_v2.inc
# handler_frame_sync (expansion ROM frame sync handler)
SH2_HANDLER_FRAME_SYNC_SRC = $(SH2_EXP_DIR)/handler_frame_sync.asm
SH2_HANDLER_FRAME_SYNC_LDS = $(SH2_EXP_DIR)/handler_frame_sync.lds
SH2_HANDLER_FRAME_SYNC_BIN = $(BUILD_DIR)/sh2/handler_frame_sync.bin
SH2_HANDLER_FRAME_SYNC_INC = $(SH2_GEN_DIR)/handler_frame_sync.inc
# master_dispatch_hook (expansion ROM command dispatcher)
SH2_MASTER_DISPATCH_HOOK_SRC = $(SH2_EXP_DIR)/master_dispatch_hook.asm
SH2_MASTER_DISPATCH_HOOK_LDS = $(SH2_EXP_DIR)/master_dispatch_hook.lds
SH2_MASTER_DISPATCH_HOOK_BIN = $(BUILD_DIR)/sh2/master_dispatch_hook.bin
SH2_MASTER_DISPATCH_HOOK_INC = $(SH2_GEN_DIR)/master_dispatch_hook.inc
# slave_test_func (expansion ROM parameter loader)
SH2_SLAVE_TEST_FUNC_SRC = $(SH2_EXP_DIR)/slave_test_func.asm
SH2_SLAVE_TEST_FUNC_LDS = $(SH2_EXP_DIR)/slave_test_func.lds
SH2_SLAVE_TEST_FUNC_BIN = $(BUILD_DIR)/sh2/slave_test_func.bin
SH2_SLAVE_TEST_FUNC_INC = $(SH2_GEN_DIR)/slave_test_func.inc
# shadow_path_wrapper (expansion ROM instrumentation wrapper)
SH2_SHADOW_PATH_WRAPPER_SRC = $(SH2_EXP_DIR)/shadow_path_wrapper.asm
SH2_SHADOW_PATH_WRAPPER_LDS = $(SH2_EXP_DIR)/shadow_path_wrapper.lds
SH2_SHADOW_PATH_WRAPPER_BIN = $(BUILD_DIR)/sh2/shadow_path_wrapper.bin
SH2_SHADOW_PATH_WRAPPER_INC = $(SH2_GEN_DIR)/shadow_path_wrapper.inc
# cmdint_handler (Phase 1 - CMDINT interrupt handler)
SH2_CMDINT_HANDLER_SRC = $(SH2_EXP_DIR)/cmdint_handler.asm
SH2_CMDINT_HANDLER_LDS = $(SH2_EXP_DIR)/cmdint_handler.lds
SH2_CMDINT_HANDLER_BIN = $(BUILD_DIR)/sh2/cmdint_handler.bin
SH2_CMDINT_HANDLER_INC = $(SH2_GEN_DIR)/cmdint_handler.inc
# queue_processor (Phase 1 - Ring buffer command processor)
SH2_QUEUE_PROCESSOR_SRC = $(SH2_EXP_DIR)/queue_processor.asm
SH2_QUEUE_PROCESSOR_LDS = $(SH2_EXP_DIR)/queue_processor.lds
SH2_QUEUE_PROCESSOR_BIN = $(BUILD_DIR)/sh2/queue_processor.bin
SH2_QUEUE_PROCESSOR_INC = $(SH2_GEN_DIR)/queue_processor.inc
# general_queue_drain (Phase 3 - General command async queue processor)
SH2_GEN_DRAIN_SRC = $(SH2_EXP_DIR)/general_queue_drain.asm
SH2_GEN_DRAIN_BIN = $(BUILD_DIR)/sh2/general_queue_drain.bin
SH2_GEN_DRAIN_INC = $(SH2_GEN_DIR)/general_queue_drain.inc
# slave_comm7_idle_check (COMM7 doorbell handler for Slave idle loop)
SH2_COMM7_CHECK_SRC = $(SH2_EXP_DIR)/slave_comm7_idle_check.asm
SH2_COMM7_CHECK_BIN = $(BUILD_DIR)/sh2/slave_comm7_idle_check.bin
SH2_COMM7_CHECK_INC = $(SH2_GEN_DIR)/slave_comm7_idle_check.inc
# cmd22_single_shot (B-004 single-shot 2D block copy handler)
SH2_CMD22_SINGLE_SHOT_SRC = $(SH2_EXP_DIR)/cmd22_single_shot.asm
SH2_CMD22_SINGLE_SHOT_BIN = $(BUILD_DIR)/sh2/cmd22_single_shot.bin
SH2_CMD22_SINGLE_SHOT_INC = $(SH2_GEN_DIR)/cmd22_single_shot.inc
# cmd25_single_shot (B-005 single-shot decompression handler)
SH2_CMD25_SINGLE_SHOT_SRC = $(SH2_EXP_DIR)/cmd25_single_shot.asm
SH2_CMD25_SINGLE_SHOT_BIN = $(BUILD_DIR)/sh2/cmd25_single_shot.bin
SH2_CMD25_SINGLE_SHOT_INC = $(SH2_GEN_DIR)/cmd25_single_shot.inc
# vis_bitmask_handler (Stage 1 entity visibility bitmask handler)
SH2_VIS_BITMASK_SRC = $(SH2_EXP_DIR)/vis_bitmask_handler.asm
SH2_VIS_BITMASK_BIN = $(BUILD_DIR)/sh2/vis_bitmask_handler.bin
SH2_VIS_BITMASK_INC = $(SH2_GEN_DIR)/vis_bitmask_handler.inc
.PHONY: sh2-assembly sh2-verify
# Build all SH2 assembly sources
sh2-assembly: dirs $(SH2_FUNC000_INC) $(SH2_FUNC022_INC) $(SH2_FUNC017_INC) $(SH2_FUNC018_INC) $(SH2_FUNC019_INC) $(SH2_FUNC020_INC) $(SH2_FUNC021_ORIG_INC) $(SH2_FUNC023_INC) $(SH2_FUNC040_INC) $(SH2_FUNC040_CASES_INC) $(SH2_FUNC040_UTIL_INC) $(SH2_FUNC041_INC) $(SH2_FUNC042_INC) $(SH2_FUNC043_INC) $(SH2_FUNC044_INC) $(SH2_FUNC045_INC) $(SH2_FUNC046_INC) $(SH2_FUNC047_INC) $(SH2_FUNC048_INC) $(SH2_FUNC049_INC) $(SH2_FUNC050_INC) $(SH2_FUNC051_INC) $(SH2_FUNC052_INC) $(SH2_FUNC053_INC) $(SH2_FUNC054_INC) $(SH2_FUNC055_INC) $(SH2_FUNC067_INC) $(SH2_FUNC068_INC) $(SH2_FUNC069_INC) $(SH2_FUNC070_INC) $(SH2_FUNC071_INC) $(SH2_FUNC072_INC) $(SH2_FUNC073_INC) $(SH2_FUNC074_INC) $(SH2_FUNC075_INC) $(SH2_FUNC076_INC) $(SH2_FUNC077_INC) $(SH2_FUNC078_INC) $(SH2_FUNC079_INC) $(SH2_FUNC080_INC) $(SH2_FUNC081_INC) $(SH2_FUNC082_INC) $(SH2_FUNC083_INC) $(SH2_FUNC084_INC) $(SH2_FUNC085_INC) $(SH2_FUNC086_INC) $(SH2_FUNC087_INC) $(SH2_FUNC088_INC) $(SH2_FUNC089_INC) $(SH2_FUNC090_INC) $(SH2_FUNC091_INC) $(SH2_FUNC032_INC) $(SH2_FUNC011_INC) $(SH2_FUNC012_INC) $(SH2_FUNC013_INC) $(SH2_FUNC014_015_INC) $(SH2_FUNC024_INC) $(SH2_FUNC025_INC) $(SH2_FUNC026_INC) $(SH2_FUNC001_INC) $(SH2_FUNC002_INC) $(SH2_FUNC003_004_INC) $(SH2_FUNC029_030_031_INC) $(SH2_FUNC033_INC) $(SH2_FUNC034_INC) $(SH2_FUNC036_INC) $(SH2_FUNC037_038_039_INC) $(SH2_FUNC005_INC) $(SH2_FUNC007_INC) $(SH2_FUNC006_INC) $(SH2_FUNC008_INC) $(SH2_FUNC016_INC) $(SH2_FUNC009_INC) $(SH2_FUNC010_INC) $(SH2_FUNC065_INC) $(SH2_FUNC066_INC) $(SH2_FUNC021_OPT_INC) $(SH2_BATCH_COPY_INC) $(SH2_CMD27_DRAIN_INC) $(SH2_SLAVE_WRAPPER_V2_INC) $(SH2_HANDLER_FRAME_SYNC_INC) $(SH2_MASTER_DISPATCH_HOOK_INC) $(SH2_SLAVE_TEST_FUNC_INC) $(SH2_SHADOW_PATH_WRAPPER_INC) $(SH2_CMDINT_HANDLER_INC) $(SH2_QUEUE_PROCESSOR_INC) $(SH2_COMM7_CHECK_INC) $(SH2_GEN_DRAIN_INC) $(SH2_CMD22_SINGLE_SHOT_INC) $(SH2_CMD25_SINGLE_SHOT_INC) $(SH2_VIS_BITMASK_INC)
# Build data_copy binary from source (requires linker script for PC-relative addressing)
$(SH2_FUNC000_BIN): $(SH2_FUNC000_SRC) $(SH2_FUNC000_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: data_copy (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/data_copy.o $<
$(SH2_LD) -T $(SH2_FUNC000_LDS) -o $(BUILD_DIR)/sh2/data_copy.elf $(BUILD_DIR)/sh2/data_copy.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/data_copy.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 26)"
$(SH2_FUNC000_INC): $(SH2_FUNC000_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: data_copy.inc..."
@echo "; Auto-generated from $(SH2_FUNC000_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@
@echo " Output: $@ ($$(wc -l < $@) lines)"
# Build wait_ready binary from source (requires linker script for PC-relative addressing)
$(SH2_FUNC022_BIN): $(SH2_FUNC022_SRC) $(SH2_FUNC022_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: wait_ready (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/wait_ready.o $<
$(SH2_LD) -T $(SH2_FUNC022_LDS) -o $(BUILD_DIR)/sh2/wait_ready.elf $(BUILD_DIR)/sh2/wait_ready.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/wait_ready.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 26)"
$(SH2_FUNC022_INC): $(SH2_FUNC022_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: wait_ready.inc..."
@echo "; Auto-generated from $(SH2_FUNC022_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@
@echo " Output: $@ ($$(wc -l < $@) lines)"
# Build quad_helper binary from source (requires linker script for PC-relative addressing)
$(SH2_FUNC017_BIN): $(SH2_FUNC017_SRC) $(SH2_FUNC017_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: quad_helper (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/quad_helper.o $<
$(SH2_LD) -T $(SH2_FUNC017_LDS) -o $(BUILD_DIR)/sh2/quad_helper.elf $(BUILD_DIR)/sh2/quad_helper.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/quad_helper.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 26)"
$(SH2_FUNC017_INC): $(SH2_FUNC017_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: quad_helper.inc..."
@echo "; Auto-generated from $(SH2_FUNC017_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@
@echo " Output: $@ ($$(wc -l < $@) lines)"
# Build scanline_setup binary from source (requires linker script for PC-relative addressing)
$(SH2_FUNC032_BIN): $(SH2_FUNC032_SRC) $(SH2_FUNC032_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: scanline_setup (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/scanline_setup.o $<
$(SH2_LD) -T $(SH2_FUNC032_LDS) -o $(BUILD_DIR)/sh2/scanline_setup.elf $(BUILD_DIR)/sh2/scanline_setup.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/scanline_setup.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 32)"
$(SH2_FUNC032_INC): $(SH2_FUNC032_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: scanline_setup.inc..."
@echo "; Auto-generated from $(SH2_FUNC032_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@
@echo " Output: $@ ($$(wc -l < $@) lines)"
# Build display_list_loop binary from source (requires linker script for PC-relative addressing)
$(SH2_FUNC011_BIN): $(SH2_FUNC011_SRC) $(SH2_FUNC011_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: display_list_loop (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/display_list_loop.o $<
$(SH2_LD) -T $(SH2_FUNC011_LDS) -o $(BUILD_DIR)/sh2/display_list_loop.elf $(BUILD_DIR)/sh2/display_list_loop.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/display_list_loop.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 84)"
$(SH2_FUNC011_INC): $(SH2_FUNC011_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: display_list_loop.inc..."
@echo "; Auto-generated from $(SH2_FUNC011_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@
@echo " Output: $@ ($$(wc -l < $@) lines)"
# Build display_entry binary from source (requires linker script for PC-relative addressing)
$(SH2_FUNC012_BIN): $(SH2_FUNC012_SRC) $(SH2_FUNC012_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: display_entry (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/display_entry.o $<
$(SH2_LD) -T $(SH2_FUNC012_LDS) -o $(BUILD_DIR)/sh2/display_entry.elf $(BUILD_DIR)/sh2/display_entry.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/display_entry.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 92)"
$(SH2_FUNC012_INC): $(SH2_FUNC012_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: display_entry.inc..."
@echo "; Auto-generated from $(SH2_FUNC012_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@
@echo " Output: $@ ($$(wc -l < $@) lines)"
# Build vdp_init_short binary from source (requires linker script for PC-relative addressing)
$(SH2_FUNC013_BIN): $(SH2_FUNC013_SRC) $(SH2_FUNC013_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: vdp_init_short (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/vdp_init_short.o $<
$(SH2_LD) -T $(SH2_FUNC013_LDS) -o $(BUILD_DIR)/sh2/vdp_init_short.elf $(BUILD_DIR)/sh2/vdp_init_short.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/vdp_init_short.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 92)"
$(SH2_FUNC013_INC): $(SH2_FUNC013_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: vdp_init_short.inc..."
@echo "; Auto-generated from $(SH2_FUNC013_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@
@echo " Output: $@ ($$(wc -l < $@) lines)"
# Build vdp_copy_short binary from source (requires linker script for PC-relative addressing)
# VDP data copy utilities (56 bytes)
$(SH2_FUNC014_015_BIN): $(SH2_FUNC014_015_SRC) $(SH2_FUNC014_015_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: vdp_copy_short (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/vdp_copy_short.o $<
$(SH2_LD) -T $(SH2_FUNC014_015_LDS) -o $(BUILD_DIR)/sh2/vdp_copy_short.elf $(BUILD_DIR)/sh2/vdp_copy_short.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/vdp_copy_short.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 56)"
$(SH2_FUNC014_015_INC): $(SH2_FUNC014_015_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: vdp_copy_short.inc..."
@echo "; Auto-generated from $(SH2_FUNC014_015_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@
@echo " Output: $@ ($$(wc -l < $@) lines)"
# Build screen_coords_short binary from source (requires linker script for PC-relative addressing)
# Screen coordinate calculator (62 bytes)
$(SH2_FUNC024_BIN): $(SH2_FUNC024_SRC) $(SH2_FUNC024_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: screen_coords_short (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/screen_coords_short.o $<
$(SH2_LD) -T $(SH2_FUNC024_LDS) -o $(BUILD_DIR)/sh2/screen_coords_short.elf $(BUILD_DIR)/sh2/screen_coords_short.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/screen_coords_short.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 62)"
$(SH2_FUNC024_INC): $(SH2_FUNC024_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: screen_coords_short.inc..."
@echo "; Auto-generated from $(SH2_FUNC024_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@
@echo " Output: $@ ($$(wc -l < $@) lines)"
# Build coord_offset_short binary from source (requires linker script for PC-relative addressing)
# Coordinate offset calculator (16 bytes)
$(SH2_FUNC025_BIN): $(SH2_FUNC025_SRC) $(SH2_FUNC025_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: coord_offset_short (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/coord_offset_short.o $<
$(SH2_LD) -T $(SH2_FUNC025_LDS) -o $(BUILD_DIR)/sh2/coord_offset_short.elf $(BUILD_DIR)/sh2/coord_offset_short.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/coord_offset_short.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 16)"
$(SH2_FUNC025_INC): $(SH2_FUNC025_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: coord_offset_short.inc..."
@echo "; Auto-generated from $(SH2_FUNC025_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@
@echo " Output: $@ ($$(wc -l < $@) lines)"
# Build bounds_compare_short binary from source (requires linker script for PC-relative addressing)
# Includes func_027 and func_028 (shared exit paths)
$(SH2_FUNC026_BIN): $(SH2_FUNC026_SRC) $(SH2_FUNC026_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: bounds_compare_short (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/bounds_compare_short.o $<
$(SH2_LD) -T $(SH2_FUNC026_LDS) -o $(BUILD_DIR)/sh2/bounds_compare_short.elf $(BUILD_DIR)/sh2/bounds_compare_short.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/bounds_compare_short.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 68)"
$(SH2_FUNC026_INC): $(SH2_FUNC026_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: bounds_compare_short.inc..."
@echo "; Auto-generated from $(SH2_FUNC026_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@
@echo " Output: $@ ($$(wc -l < $@) lines)"
# Build main_coordinator_short binary from source (main coordinator / switch dispatcher)
$(SH2_FUNC001_BIN): $(SH2_FUNC001_SRC) $(SH2_FUNC001_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: main_coordinator_short (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/main_coordinator_short.o $<
$(SH2_LD) -T $(SH2_FUNC001_LDS) -o $(BUILD_DIR)/sh2/main_coordinator_short.elf $(BUILD_DIR)/sh2/main_coordinator_short.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/main_coordinator_short.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 76)"
$(SH2_FUNC001_INC): $(SH2_FUNC001_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: main_coordinator_short.inc..."
@echo "; Auto-generated from $(SH2_FUNC001_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@
@echo " Output: $@ ($$(wc -l < $@) lines)"
# Build case_handlers_short binary from source (case handlers block)
$(SH2_FUNC002_BIN): $(SH2_FUNC002_SRC) $(SH2_FUNC002_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: case_handlers_short (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/case_handlers_short.o $<
$(SH2_LD) -T $(SH2_FUNC002_LDS) -o $(BUILD_DIR)/sh2/case_handlers_short.elf $(BUILD_DIR)/sh2/case_handlers_short.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/case_handlers_short.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 88)"
$(SH2_FUNC002_INC): $(SH2_FUNC002_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: case_handlers_short.inc..."
@echo "; Auto-generated from $(SH2_FUNC002_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@
@echo " Output: $@ ($$(wc -l < $@) lines)"
# Build offset_copy_short binary from source (requires linker script for PC-relative addressing)
# Includes case_handlers_short exit paths, func_003, and func_004
$(SH2_FUNC003_004_BIN): $(SH2_FUNC003_004_SRC) $(SH2_FUNC003_004_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: offset_copy_short (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/offset_copy_short.o $<
$(SH2_LD) -T $(SH2_FUNC003_004_LDS) -o $(BUILD_DIR)/sh2/offset_copy_short.elf $(BUILD_DIR)/sh2/offset_copy_short.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/offset_copy_short.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 32)"
$(SH2_FUNC003_004_INC): $(SH2_FUNC003_004_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: offset_copy_short.inc..."
@echo "; Auto-generated from $(SH2_FUNC003_004_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@
@echo " Output: $@ ($$(wc -l < $@) lines)"
# Build visibility_short binary from source (requires linker script for PC-relative addressing)
# Includes func_029 (visibility), func_030 and func_031 (shared exit paths)
$(SH2_FUNC029_030_031_BIN): $(SH2_FUNC029_030_031_SRC) $(SH2_FUNC029_030_031_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: visibility_short (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/visibility_short.o $<
$(SH2_LD) -T $(SH2_FUNC029_030_031_LDS) -o $(BUILD_DIR)/sh2/visibility_short.elf $(BUILD_DIR)/sh2/visibility_short.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/visibility_short.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 82)"
$(SH2_FUNC029_030_031_INC): $(SH2_FUNC029_030_031_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: visibility_short.inc..."
@echo "; Auto-generated from $(SH2_FUNC029_030_031_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@
@echo " Output: $@ ($$(wc -l < $@) lines)"
# Build render_quad_short binary from source (requires linker script for PC-relative addressing)
# Quad rendering / edge walking (98 bytes)
$(SH2_FUNC033_BIN): $(SH2_FUNC033_SRC) $(SH2_FUNC033_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: render_quad_short (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/render_quad_short.o $<
$(SH2_LD) -T $(SH2_FUNC033_LDS) -o $(BUILD_DIR)/sh2/render_quad_short.elf $(BUILD_DIR)/sh2/render_quad_short.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/render_quad_short.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 98)"
$(SH2_FUNC033_INC): $(SH2_FUNC033_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: render_quad_short.inc..."
@echo "; Auto-generated from $(SH2_FUNC033_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@
@echo " Output: $@ ($$(wc -l < $@) lines)"
# Build span_filler_short binary from source (requires linker script for PC-relative addressing)
$(SH2_FUNC034_BIN): $(SH2_FUNC034_SRC) $(SH2_FUNC034_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: span_filler_short (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/span_filler_short.o $<
$(SH2_LD) -T $(SH2_FUNC034_LDS) -o $(BUILD_DIR)/sh2/span_filler_short.elf $(BUILD_DIR)/sh2/span_filler_short.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/span_filler_short.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 122)"
$(SH2_FUNC034_INC): $(SH2_FUNC034_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: span_filler_short.inc..."
@echo "; Auto-generated from $(SH2_FUNC034_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@
@echo " Output: $@ ($$(wc -l < $@) lines)"
# Build render_dispatch_short binary from source (requires linker script for PC-relative addressing)
$(SH2_FUNC036_BIN): $(SH2_FUNC036_SRC) $(SH2_FUNC036_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: render_dispatch_short (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/render_dispatch_short.o $<
$(SH2_LD) -T $(SH2_FUNC036_LDS) -o $(BUILD_DIR)/sh2/render_dispatch_short.elf $(BUILD_DIR)/sh2/render_dispatch_short.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/render_dispatch_short.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 72)"
$(SH2_FUNC036_INC): $(SH2_FUNC036_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: render_dispatch_short.inc..."
@echo "; Auto-generated from $(SH2_FUNC036_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@
@echo " Output: $@ ($$(wc -l < $@) lines)"
# Build helpers_short binary from source (requires linker script for PC-relative addressing)
$(SH2_FUNC037_038_039_BIN): $(SH2_FUNC037_038_039_SRC) $(SH2_FUNC037_038_039_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: helpers_short (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/helpers_short.o $<
$(SH2_LD) -T $(SH2_FUNC037_038_039_LDS) -o $(BUILD_DIR)/sh2/helpers_short.elf $(BUILD_DIR)/sh2/helpers_short.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/helpers_short.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 64)"
$(SH2_FUNC037_038_039_INC): $(SH2_FUNC037_038_039_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: helpers_short.inc..."
@echo "; Auto-generated from $(SH2_FUNC037_038_039_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@
@echo " Output: $@ ($$(wc -l < $@) lines)"
# Build quad_batch_short binary from source (requires linker script for PC-relative addressing)
$(SH2_FUNC018_BIN): $(SH2_FUNC018_SRC) $(SH2_FUNC018_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: quad_batch_short (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/quad_batch_short.o $<
$(SH2_LD) -T $(SH2_FUNC018_LDS) -o $(BUILD_DIR)/sh2/quad_batch_short.elf $(BUILD_DIR)/sh2/quad_batch_short.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/quad_batch_short.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 112)"
$(SH2_FUNC018_INC): $(SH2_FUNC018_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: quad_batch_short.inc..."
@echo "; Auto-generated from $(SH2_FUNC018_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@
@echo " Output: $@ ($$(wc -l < $@) lines)"
# Build quad_batch_alt_short binary from source (requires linker script for PC-relative addressing)
$(SH2_FUNC019_BIN): $(SH2_FUNC019_SRC) $(SH2_FUNC019_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: quad_batch_alt_short (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/quad_batch_alt_short.o $<
$(SH2_LD) -T $(SH2_FUNC019_LDS) -o $(BUILD_DIR)/sh2/quad_batch_alt_short.elf $(BUILD_DIR)/sh2/quad_batch_alt_short.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/quad_batch_alt_short.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 140)"
$(SH2_FUNC019_INC): $(SH2_FUNC019_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: quad_batch_alt_short.inc..."
@echo "; Auto-generated from $(SH2_FUNC019_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@
@echo " Output: $@ ($$(wc -l < $@) lines)"
# Build vertex_helper_short binary from source (requires linker script for PC-relative addressing)
$(SH2_FUNC020_BIN): $(SH2_FUNC020_SRC) $(SH2_FUNC020_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: vertex_helper_short (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/vertex_helper_short.o $<
$(SH2_LD) -T $(SH2_FUNC020_LDS) -o $(BUILD_DIR)/sh2/vertex_helper_short.elf $(BUILD_DIR)/sh2/vertex_helper_short.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/vertex_helper_short.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 40)"
$(SH2_FUNC020_INC): $(SH2_FUNC020_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: vertex_helper_short.inc..."
@echo "; Auto-generated from $(SH2_FUNC020_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@
@echo " Output: $@ ($$(wc -l < $@) lines)"
# Build vertex_transform_orig binary from source (requires linker script for PC-relative addressing)
$(SH2_FUNC021_ORIG_BIN): $(SH2_FUNC021_ORIG_SRC) $(SH2_FUNC021_ORIG_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: vertex_transform_orig (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/vertex_transform_orig.o $<
$(SH2_LD) -T $(SH2_FUNC021_ORIG_LDS) -o $(BUILD_DIR)/sh2/vertex_transform_orig.elf $(BUILD_DIR)/sh2/vertex_transform_orig.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/vertex_transform_orig.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 38)"
$(SH2_FUNC021_ORIG_INC): $(SH2_FUNC021_ORIG_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: vertex_transform_orig.inc..."
@echo "; Auto-generated from $(SH2_FUNC021_ORIG_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@
@echo " Output: $@ ($$(wc -l < $@) lines)"
# Build frustum_cull_short binary from source (requires linker script for PC-relative addressing)
$(SH2_FUNC023_BIN): $(SH2_FUNC023_SRC) $(SH2_FUNC023_LDS) | dirs
@mkdir -p $(BUILD_DIR)/sh2
@echo "==> Assembling SH2: frustum_cull_short (with linker script)..."
$(SH2_AS) $(SH2_ASFLAGS) -o $(BUILD_DIR)/sh2/frustum_cull_short.o $<
$(SH2_LD) -T $(SH2_FUNC023_LDS) -o $(BUILD_DIR)/sh2/frustum_cull_short.elf $(BUILD_DIR)/sh2/frustum_cull_short.o
$(SH2_OBJCOPY) -O binary --only-section=.text $(BUILD_DIR)/sh2/frustum_cull_short.elf $@
@echo " Output: $@ ($$(wc -c < $@) bytes, expected 238)"
$(SH2_FUNC023_INC): $(SH2_FUNC023_BIN)
@mkdir -p $(SH2_GEN_DIR)
@echo "==> Generating dc.w include: frustum_cull_short.inc..."
@echo "; Auto-generated from $(SH2_FUNC023_SRC)" > $@
@echo "; DO NOT EDIT - regenerate with 'make sh2-assembly'" >> $@
@echo "" >> $@
@xxd -p $< | fold -w4 | awk '{print " dc.w $$" toupper($$1)}' >> $@