forked from ericde45/mega_JAG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmega.s
4267 lines (3485 loc) · 114 KB
/
mega.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
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
; megascroller en object list
;
;; object list OK
; 26*16 = 416
; resolution : debut = 20 (40) / fin = 261 (522) / de 56 à 520
; OK - calculer les 14 valeurs de Y intervalles entre les 2 lignes, en signé ! ligne basse - ligne haute / 15 => 16 lignes
; OK - lire les fontes 12 de large x 16 de haut : font_alien.png pour ne garder que les couples YX à afficher
; OK - trier les couples YX / en fait ne pas trier mais parcourir et mettre dans les sous-listes de 16 lignes/Y + 8 lignes/Y => 256/16 = 16 groupes
; OK - créer une object list pour les N sprites, 16 lignes à chaque fois. entre X et X+8
; OK table de tailles de caractere
; OK - largeur de fonte variable ! i=3 / 1=3 / calés sur la droite
; OK - largeur des lettres trop larges : M V W
; OK - tester sprite sur la gauche, X négatif - reglé
; OK - fade IN/ face OUT sur certains textes
; OK - écran d'intro avec fade in : image de fond puis chaque texte en fade in fade out
; OK - integrer LSP
;CC (Carry Clear) = %00100
;CS (Carry Set) = %01000
;EQ (Equal) = %00010
;MI (Minus) = %11000
;NE (Not Equal) = %00001
;PL (Plus) = %10100
;HI (Higher) = %00101
;T (True) = %00000
include "jaguar.inc"
introduction_ON_OFF equ 1
CLEAR_BSS .equ 1 ; 1=efface toute la BSS jusqu'a la fin de la ram utilisée
vitesse_scrolling equ 4
GPU_OL_interrupt equ 1 ; object list GPU interrupt used to sync OL and GPU
nb_octets_par_ligne equ 320
nb_lignes equ 260
premiere_ligne equ 20 ; premiere ligne de l'ecran pour OL
derniere_ligne equ 261 ; derniere ligne de l'ecran pour OL
nb_colonnes_de_sprites_a_afficher equ 26
nb_lignes_de_sprites_a_afficher equ 16
ob_list_1 equ (ENDRAM-64000) ; address of read list
ob_list_2 equ (ENDRAM-128000) ; address of read list
ob_list_introduction equ (ENDRAM-130000)
; codes de controle du scrolling
GPU_scrolling_code_de_controle_code_minimal equ 128
GPU_scrolling_code_de_controle_code_fin_de_texte equ 128
; forme du scrolling
GPU_scrolling_code_de_controle_code_forme_0 equ 130 ; No effect
GPU_scrolling_code_de_controle_code_forme_1 equ 131 ; Sine 1
GPU_scrolling_code_de_controle_code_forme_2 equ 132 ; Sine 2
GPU_scrolling_code_de_controle_code_forme_3 equ 133 ; Bounce 1
GPU_scrolling_code_de_controle_code_forme_4 equ 134 ; Bounce 2
GPU_scrolling_code_de_controle_code_forme_5 equ 135 ; Rotate slow
GPU_scrolling_code_de_controle_code_forme_6 equ 136 ; Rotate quick
GPU_scrolling_code_de_controle_code_forme_7 equ 137 ; Cylinder
GPU_scrolling_code_de_controle_code_forme_8 equ 138 ; Triangle
GPU_scrolling_code_de_controle_code_forme_9 equ 139 ; Pack/Unpack
; codes dessin du sprites
GPU_scrolling_code_de_controle_code_0 equ 140 ; // Yellow
GPU_scrolling_code_de_controle_code_1 equ 141 ; // Blue
GPU_scrolling_code_de_controle_code_2 equ 142 ; // Purple
GPU_scrolling_code_de_controle_code_3 equ 143 ; // Germany
GPU_scrolling_code_de_controle_code_4 equ 144 ; // France
GPU_scrolling_code_de_controle_code_5 equ 145 ; // Belgium
GPU_scrolling_code_de_controle_code_6 equ 146 ; // Great-Britain
GPU_scrolling_code_de_controle_code_7 equ 147 ; // Sweden
GPU_scrolling_code_de_controle_code_8 equ 148 ; // Nethelands
GPU_scrolling_code_de_controle_code_9 equ 149 ; // Scotland
GPU_scrolling_code_de_controle_code_10 equ 150 ; // Spain
GPU_scrolling_code_de_controle_code_11 equ 151 ; // Australia
GPU_scrolling_code_de_controle_code_12 equ 152 ; // Portugal
GPU_scrolling_code_de_controle_code_13 equ 153 ; // Switzerland
GPU_scrolling_code_de_controle_code_14 equ 154 ; // Luxembourg
colrY equ GPU_scrolling_code_de_controle_code_0
colrB equ GPU_scrolling_code_de_controle_code_1
colrP equ GPU_scrolling_code_de_controle_code_2
flgDE equ GPU_scrolling_code_de_controle_code_3
flgFR equ GPU_scrolling_code_de_controle_code_4
flgBE equ GPU_scrolling_code_de_controle_code_5
flgGB equ GPU_scrolling_code_de_controle_code_6
flgSE equ GPU_scrolling_code_de_controle_code_7
flgNL equ GPU_scrolling_code_de_controle_code_8
flgSC equ GPU_scrolling_code_de_controle_code_9
flgES equ GPU_scrolling_code_de_controle_code_10
flgAU equ GPU_scrolling_code_de_controle_code_11
flgPT equ GPU_scrolling_code_de_controle_code_12
flgCH equ GPU_scrolling_code_de_controle_code_13
flgLU equ GPU_scrolling_code_de_controle_code_14
fNoop equ GPU_scrolling_code_de_controle_code_forme_0
fSin1 equ GPU_scrolling_code_de_controle_code_forme_1
fSin2 equ GPU_scrolling_code_de_controle_code_forme_2
fBce1 equ GPU_scrolling_code_de_controle_code_forme_3
fBce2 equ GPU_scrolling_code_de_controle_code_forme_4
fRot1 equ GPU_scrolling_code_de_controle_code_forme_5
fRot2 equ GPU_scrolling_code_de_controle_code_forme_6
fCyld equ GPU_scrolling_code_de_controle_code_forme_7
fTria equ GPU_scrolling_code_de_controle_code_forme_8
fGrow equ GPU_scrolling_code_de_controle_code_forme_9
GPU_STACK_SIZE equ 32 ; long words
GPU_USP equ (G_ENDRAM-(4*GPU_STACK_SIZE))
GPU_ISP equ (GPU_USP-(4*GPU_STACK_SIZE))
; ------------------------ LSP
DSP_music_ON .equ 1 ; 0/1 = music Off/On
LSP_DSP_Audio_frequence .equ 32000 ; real hardware needs lower sample frequencies than emulators
nb_bits_virgule_offset .equ 10 ; 9 ok DRAM/ 8 avec samples en ram DSP
display_infos_debug .equ 1
DSP_DEBUG .equ 0
I2S_during_Timer1 .equ 0 ; 0= I2S waits while timer 1 / 1=IMASK cleared while Timer 1
LSP_avancer_module .equ 1 ; 1=incremente position dans le module
channel_1 .equ 1
channel_2 .equ 1
channel_3 .equ 1
channel_4 .equ 1
DSP_STACK_SIZE equ 32 ; long words
DSP_USP equ (D_ENDRAM-(4*DSP_STACK_SIZE))
DSP_ISP equ (DSP_USP-(4*DSP_STACK_SIZE))
;------------------
.opt "~Oall"
.text
.68000
move.l #$70007,G_END
move.l #$70007,D_END
move.l #INITSTACK, sp
move.w #%0000011011000111, VMODE ; 320x256 / 16 bit RGB / $6C7
move.w #$100,JOYSTICK
; clear BSS
.if CLEAR_BSS=1
lea DEBUT_BSS,a0
lea FIN_RAM,a1
moveq #0,d0
boucle_clean_BSS:
move.b d0,(a0)+
cmp.l a0,a1
bne.s boucle_clean_BSS
; clear stack
lea INITSTACK-100,a0
lea INITSTACK,a1
moveq #0,d0
boucle_clean_BSS2:
move.b d0,(a0)+
cmp.l a0,a1
bne.s boucle_clean_BSS2
; clear object list, fill with stop
lea ob_list_2,a0
lea ENDRAM,a1
moveq #0,d0
boucle_clean_BSS3:
move.l #0,(a0)+
move.l #4,(a0)+
cmp.l a0,a1
bne.s boucle_clean_BSS3
.endif
;move #$70,BG ; vert
bsr convert_texte_scrolling
bsr InitVideo2
; init LSP
;check ntsc ou pal:
moveq #0,d0
move.w JOYBUTS ,d0
move.l #26593900,frequence_Video_Clock ; PAL
move.l #415530,frequence_Video_Clock_divisee
btst #4,d0
beq.s jesuisenpal
jesuisenntsc:
move.l #26590906,frequence_Video_Clock ; NTSC
move.l #415483,frequence_Video_Clock_divisee
jesuisenpal:
move.l #0,D_CTRL
; copie du code DSP dans la RAM DSP
lea YM_DSP_debut,A0
lea D_RAM,A1
move.l #YM_DSP_fin-DSP_base_memoire,d0
lsr.l #2,d0
sub.l #1,D0
boucle_copie_bloc_DSP:
move.l (A0)+,(A1)+
dbf D0,boucle_copie_bloc_DSP
; init LSP
lea LSP_module_music_data,a0
lea LSP_module_sound_bank,a1
jsr LSP_PlayerInit
move.l m_lspInstruments,a0
; Out : a0: music BPM pointer (16bits).w
; d0: music len in tick count
; launch DSP
move.l #REGPAGE,D_FLAGS
move.l #DSP_routine_init_DSP,D_PC
move.l #DSPGO,D_CTRL
move.l #0,LSP_DSP_flag
move.l #0,vbl_counter
; all colors to black
lea ecran_intro,a0
bsr copie_couleurs_dans_CLUT
.if introduction_ON_OFF=1
bsr introduction
.endif
move.l #1,LSP_DSP_flag
.if DSP_music_ON=0
move.l #0,LSP_DSP_flag
.endif
; -----------------
.if GPU_OL_interrupt=1
bsr InitVideo ; Setup our video registers.
.endif
.if GPU_OL_interrupt=0
bsr InitVideo2 ; Setup our video registers.
.endif
;move.w #%0000001011000111, VMODE ; 640x256 / 16 bit RGB / $2C7
;move.l #VBL,LEVEL0 ; Install 68K LEVEL0 handler
;move.w a_vde,d0 ; Must be ODD
;sub.w #16,d0
;ori.w #1,d0
;move.w d0,VI
;move.w #%01,INT1 ; Enable video interrupts 11101
;move.l #ob_liste_stop,d0
;swap d0
;move.l d0,OLP
;move #$2700,sr
;move #$70,BG ; vert
lea ob_list_1,a6
bsr preparation_OL
lea ob_list_2,a6
bsr preparation_OL
;move #$700,BG ; bleu
lea bob,a0
bsr copie_couleurs_dans_CLUT
;jsr copy_olist ; use Blitter to update active list from shadow
;move.l #ob_list_1,d0 ; set the object list pointer
;swap d0
;move.l d0,OLP
; mise en place vecteur VBL 68000
move.l #VBL,LEVEL0 ; Install 68K LEVEL0 handler
move.w a_vde,d0 ; Must be ODD
sub.w #16,d0
ori.w #1,d0
move.w d0,VI
move.w #%01,INT1 ; Enable video interrupts 11101
;and.w #%1111100011111111,sr ; 1111100011111111 => bits 8/9/10 = 0
and.w #$f8ff,sr
moveq #3-1,d2
vsync2:
;vsync*2
move.l vbl_counter,d0
vsync1:
move.l vbl_counter,d1
cmp.l d0,d1
beq.s vsync1
dbf d2,vsync2
; copie du code GPU
move.l #0,G_CTRL
; copie du code GPU dans la RAM GPU
lea GPU_debut,A0
lea G_RAM,A1
move.l #GPU_fin-GPU_base_memoire,d0
lsr.l #2,d0
sub.l #1,D0
boucle_copie_bloc_GPU:
move.l (A0)+,(A1)+
dbf D0,boucle_copie_bloc_GPU
; launch GPU
move.l #REGPAGE,G_FLAGS
move.l #GPU_init,G_PC
move.l #RISCGO,G_CTRL ; START GPU
move.l vbl_counter,d0
vsync11:
move.l vbl_counter,d1
cmp.l d0,d1
beq.s vsync11
;move.l #ob_list_1,d0 ; set the object list pointer
;swap d0
;move.l d0,OLP
;lea liste_points_sprites,a0
;stop #$2700
;stop #8448
;move #$770,BG ; bleu
toto:
;move.l vbl_counter,d0
;move.l vbl_counter_GPU,d1
bra.s toto
;-----------------------------------------------------------------------------------
; introduction avec sa VBL et son OL
introduction:
jsr copy_olist_intro
jsr copy_image_sur_ecran_intro
move.l #ob_list_introduction,d0 ; set the object list pointer
swap d0
move.l d0,OLP
; mise en place vecteur VBL 68000
move.l #VBL_intro,LEVEL0 ; Install 68K LEVEL0 handler
move.w a_vde,d0 ; Must be ODD
sub.w #16,d0
ori.w #1,d0
move.w d0,VI
move.w #%01,INT1 ; Enable video interrupts 11101
and.w #$f8ff,sr
; FADE IN sur les couleurs du fond
lea image_debut,a0
bsr copie_couleurs_dans_CLUT_FADEIN
; copie le texte 1
lea texte_intro1,a0
lea ecran_intro+(136*320),a1
move.l #(320*34)/2,d1
jsr copy_texte_intro_sur_ecran
; FADE IN sur le 255
; Bits [0-5] are green, bits [6-10] are blue and
; bits [11-15] are red.
FADE_IN_TEXTE1:
lea CLUT+(255*2),a1
moveq #0,d0
move.w #31-1,d7
move.w #%0000100001000010,d3
boucle2a1:
move.w #4-1,d6
boucle1a1:
move.l vbl_counter,d1
wait_1_VBLa1:
move.l vbl_counter,d2
cmp.l d1,d2
beq.s wait_1_VBLa1
dbf d6,boucle1a1
add.w d3,d0
move.w d0,(a1)
;move.w $FFFF,(a1)
dbf d7,boucle2a1
move.w d0,d4
; wait 10 secondes
move.l #(50*10),d0
wait_N_VBLa11:
move.l vbl_counter,d1
wait_1_VBLa11:
move.l LSP_DSP_buttonB_pressed,d3
cmp.l #0,d3
beq.s oka112
jmp retour_introduction
oka112:
move.l vbl_counter,d2
cmp.l d1,d2
beq.s wait_1_VBLa11
dbf d0,wait_N_VBLa11
; FADE OUT sur le 255
; Bits [0-5] are green, bits [6-10] are blue and
; bits [11-15] are red.
FADE_OUT_TEXTE1:
lea CLUT+(255*2),a1
move.w d4,d0 ; precedente couleur
move.w #31-1,d7
move.w #%0000100001000010,d3
.boucle2:
move.w #4-1,d6
.boucle1:
move.l vbl_counter,d1
.wait_1_VBL:
move.l vbl_counter,d2
cmp.l d1,d2
beq.s .wait_1_VBL
dbf d6,.boucle1
sub.w d3,d0
move.w d0,(a1)
;move.w $FFFF,(a1)
dbf d7,.boucle2
move.w #0,(a1)
; ecrase le bas de l'image avec l'originale
lea image_debut+512+(136*320),a0
lea ecran_intro+(136*320),a1
move.l #(320*35)/2,d1
jsr copy_texte_intro_sur_ecran_ecrase
; TEXTE2
; copie le texte 2
lea texte_intro1+(320*44),a0
lea ecran_intro+(136*320),a1
move.l #(320*55)/2,d1
jsr copy_texte_intro_sur_ecran
; FADE IN sur le 255
; Bits [0-5] are green, bits [6-10] are blue and
; bits [11-15] are red.
FADE_IN_TEXTE2:
lea CLUT+(255*2),a1
moveq #0,d0
move.w #31-1,d7
move.w #%0000100001000010,d3
boucle2a2:
move.w #4-1,d6
boucle1a2:
move.l vbl_counter,d1
wait_1_VBLa2:
move.l vbl_counter,d2
cmp.l d1,d2
beq.s wait_1_VBLa2
dbf d6,boucle1a2
add.w d3,d0
move.w d0,(a1)
;move.w $FFFF,(a1)
dbf d7,boucle2a2
move.w d0,d4
; wait 10 secondes
move.l #(50*10),d0
wait_N_VBL2:
move.l vbl_counter,d1
wait_1_VBL2:
move.l LSP_DSP_buttonB_pressed,d3
cmp.l #0,d3
beq.s oka114
jmp retour_introduction
oka114:
move.l vbl_counter,d2
cmp.l d1,d2
beq.s wait_1_VBL2
dbf d0,wait_N_VBL2
; FADE OUT sur le 255
; Bits [0-5] are green, bits [6-10] are blue and
; bits [11-15] are red.
FADE_OUT_TEXTE2:
lea CLUT+(255*2),a1
move.w d4,d0 ; precedente couleur
move.w #31-1,d7
move.w #%0000100001000010,d3
boucle22:
move.w #4-1,d6
boucle12:
move.l vbl_counter,d1
wait_1_VBL2a1:
move.l vbl_counter,d2
cmp.l d1,d2
beq.s wait_1_VBL2a1
dbf d6,boucle12
sub.w d3,d0
move.w d0,(a1)
;move.w $FFFF,(a1)
dbf d7,boucle22
move.w #0,(a1)
; ecrase le bas de l'image avec l'originale
lea image_debut+512+(136*320),a0
lea ecran_intro+(136*320),a1
move.l #(320*55)/2,d1
jsr copy_texte_intro_sur_ecran_ecrase
; TEXTE3
; copie le texte 3
lea texte_intro1+(320*100),a0
lea ecran_intro+(136*320),a1
move.l #(320*50)/2,d1
jsr copy_texte_intro_sur_ecran
; FADE IN sur le 255
; Bits [0-5] are green, bits [6-10] are blue and
; bits [11-15] are red.
FADE_IN_TEXTE3:
lea CLUT+(255*2),a1
moveq #0,d0
move.w #31-1,d7
move.w #%0000100001000010,d3
boucle2a2a3:
move.w #4-1,d6
boucle1a2a3:
move.l vbl_counter,d1
wait_1_VBLa2a3:
move.l vbl_counter,d2
cmp.l d1,d2
beq.s wait_1_VBLa2a3
dbf d6,boucle1a2a3
add.w d3,d0
move.w d0,(a1)
;move.w $FFFF,(a1)
dbf d7,boucle2a2a3
move.w d0,d4
; wait 10 secondes
move.l #(50*10),d0
wait_N_VBL2a3:
move.l vbl_counter,d1
wait_1_VBL2a3:
move.l LSP_DSP_buttonB_pressed,d3
cmp.l #0,d3
beq.s oka116
jmp retour_introduction
oka116:
move.l vbl_counter,d2
cmp.l d1,d2
beq.s wait_1_VBL2a3
dbf d0,wait_N_VBL2a3
; FADE OUT sur le 255
; Bits [0-5] are green, bits [6-10] are blue and
; bits [11-15] are red.
FADE_OUT_TEXTE2a3:
lea CLUT+(255*2),a1
move.w d4,d0 ; precedente couleur
move.w #31-1,d7
move.w #%0000100001000010,d3
boucle22a3:
move.w #4-1,d6
boucle12a3:
move.l vbl_counter,d1
wait_1_VBL2a1a3:
move.l vbl_counter,d2
cmp.l d1,d2
beq.s wait_1_VBL2a1a3
dbf d6,boucle12a3
sub.w d3,d0
move.w d0,(a1)
;move.w $FFFF,(a1)
dbf d7,boucle22a3
move.w #0,(a1)
; ecrase le bas de l'image avec l'originale
lea image_debut+512+(136*320),a0
lea ecran_intro+(136*320),a1
move.l #(320*50)/2,d1
jsr copy_texte_intro_sur_ecran_ecrase
retour_introduction:
rts
;-----------------------------------------------------------------------------------
; convertir le texte du scrolling, -32 puis 4 bits=ligne / 4bits = colonne
convert_texte_scrolling:
lea texte_scrolling,a0
lea fin_texte_scrolling,a1
boucle_convert_scrolling:
moveq #0,d0
move.b (a0),d0
cmp.w #GPU_scrolling_code_de_controle_code_minimal,d0
bge.s .ok2
cmp.w #97,d0
blt.s .ok
sub.w #97-65,d0
.ok:
sub.l #32,d0 ; caler sur les fontes
move.l d0,d1
divu #10,d0
moveq #0,d2
move.w d0,d2 ; d2=ligne
move.l d2,d0
lsl.l #4,d2 ; ligne en haut sur 4 bits
mulu #10,d0
sub.l d0,d1
or.l d2,d1
move.b d1,(a0)
.ok2:
addq.l #1,a0
cmp.l a0,a1
bne.s boucle_convert_scrolling
fin_convert_scrolling:
rts
;-----------------------------------------------------------------------------------
; preparation de l'Objects list
; Condition codes (CC):
;
; Values Comparison/Branch
; --------------------------------------------------
; 000 Branch on equal (VCnt==VC)
; 001 Branch on less than (VCnt>VC)
; 010 Branch on greater than (VCnt<VC)
; 011 Branch if OP flag is set
; input A6=adresse object list
preparation_OL:
move.l a6,a1
;lea ob_list_1,a1
; insertion de Branch if YPOS < 0 a X+16
move.l #$00000003,d0 ; branch
or.l #%0100000000000000,d0 ; <
move.l #premiere_ligne,d3
add.l d3,d3 ; *2 : half line
lsl.l #3,d3
or.l d3,d0 ; Ymax
move.l a1,d1
add.l #16,d1
lsr.l #3,d1
move.l d1,d2
lsl.l #8,d1 ; <<24 : 8 bits
lsl.l #8,d1
lsl.l #8,d1
or.l d1,d0
lsr.l #8,d2
move.l d2,(a1)+
move.l d0,(a1)+
; insertion de Branch if YPOS < Ymax à X+16
move.l #$00000003,d0 ; branch
or.l #%0100000000000000,d0 ; <
move.l #derniere_ligne,d3
add.l d3,d3 ; *2 : half line
lsl.l #3,d3
or.l d3,d0 ; Ymax
move.l a1,d1
add.l #16,d1
lsr.l #3,d1
move.l d1,d2
lsl.l #8,d1 ; <<24 : 8 bits
lsl.l #8,d1
lsl.l #8,d1
or.l d1,d0
lsr.l #8,d2
move.l d2,(a1)+
move.l d0,(a1)+
; insertion de STOP
moveq #0,d0
move.l d0,(a1)+
move.l #4,d0
move.l d0,(a1)+
move.l a6,a2
add.l #512,a2
;lea ob_list_1+512,a2 ; bloc0_8
; insertion de Branch if YPOS <8 bloc0_8
move.l #$00000003,d0 ; branch
or.l #%0100000000000000,d0 ; <
move.l #premiere_ligne,d3
add.l #8,d3
add.l d3,d3 ; *2 : half line
lsl.l #3,d3
or.l d3,d0 ; Ymax
move.l a2,d1
lsr.l #3,d1
move.l d1,d2
lsl.l #8,d1 ; <<24 : 8 bits
lsl.l #8,d1
lsl.l #8,d1
or.l d1,d0
lsr.l #8,d2
move.l d2,(a1)+
move.l d0,(a1)+
; boucle remplissage de 24 a nb_lignes
; a1=dest
; a2=bloc, à incrementer de 1664
; d3=VC, à incrementer de 8
; d3=premiere ligne de test
move.l #36,d3
move.l a6,a2
add.l #512,a2
; lea ob_list_1+512,a2
move.l #29-1,d7 ; 30-1
boucle_branch_OL:
move.l #$00000003,d0 ; branch
or.l #%0100000000000000,d0 ; <
move.l d3,d4
add.l d4,d4 ; *2 : half line
lsl.l #3,d4
or.l d4,d0 ; VC
move.l a2,d1
lsr.l #3,d1
move.l d1,d2
lsl.l #8,d1 ; <<24 : 8 bits
lsl.l #8,d1
lsl.l #8,d1
or.l d1,d0
lsr.l #8,d2
move.l d2,(a1)+
move.l d0,(a1)+
; insertion d'1 STOP au point de saut
; moveq #0,d0
move.l d0,(a2)
move.l #4,d0
move.l d0,4(a2)
; insertion d'1 STOP au point de saut
moveq #0,d0
move.l d0,(a2)
move.l #4,d0
move.l d0,4(a2)
add.l #1664,a2
add.l #8,d3
dbf d7,boucle_branch_OL
.if GPU_OL_interrupt=1
; insertion GPU object
moveq #0,d0
move.l d0,(a1)+
move.l #$3FFA,d0 ; $3FFA
move.l d0,(a1)+
.endif
; insertion de STOP
moveq #0,d0
move.l d0,(a1)+
move.l #4,d0
move.l d0,(a1)+
; insertion de STOP
moveq #0,d0
move.l d0,(a1)+
move.l #4,d0
move.l d0,(a1)+
; insertion de STOP
moveq #0,d0
move.l d0,(a1)+
move.l #4,d0
move.l d0,(a1)+
; insertion de STOP
moveq #0,d0
move.l d0,(a1)+
move.l #4,d0
move.l d0,(a1)+
.if 1=0
;63 56 48 40 32 24 16 8 0
; +--------^---------^-----+------------^--------+--------^--+-----^----+---+
; | data-address | Link-address | Height | YPos |000|
; +------------------------+---------------------+-----------+----------+---+
; 63 .............43 42.........24 23....14 13....3 2.0
; 21 bits 19 bits 10 bits 11 bits 3 bits
; (11.8)
; insere un sprite en Y=96
; YPOS, HEIGHT, LINK, DATA, XPOS,DEPTH,PITCH=1,DWIDTH=2,IWIDTH=2,TRANS
move.l #1664,d0
mulu #7,d0 ; 12 pour 96
;lea ob_list_1+512,a2
move.l a6,a2
add.l #512,a2
add.l d0,a2
; A2=dest dans l'OL
move.l #$00020000,d0 ; heigth +00
move.l #bob+512,d1 ; debut dessin
lsr.l #3,d1
lsl.l #8,d1
lsl.l #3,d1 ; pos 11=43
lea 16(a2),a3 ; LINK / 19 bits
move.l a3,d3
lsr.l #3,d3
move.l d3,d4
; sur le 2eme .LONG, 0 à 10 bits = LINK
lsr.l #8,d3
or.l d3,d1
move.l d1,(a2)+
and.l #$FF,d4
swap d4 ; 8 bits du bas dans 23-16
lsl.l #8,d4
or.l d4,d0
; YPOS
move.l #56,d4 ; YPOS
add d4,d4 ; *2 pour half line
lsl.l #3,d4
or.l d4,d0
move.l d0,(a2)+
; 63 56 48 40 32 24 16 8 0
; +--------^-+------+^----+----^--+-----^---+----^----+---+---+----^--------+
; | unused |1stpix| flag| idx | iwidth | dwidth | p | d | x-pos |
; +----------+------+-----+-------+---------+---------+---+---+-------------+
; 63...55 54..49 48.45 44.38 37..28 27..18 17.15 14.12 11.....0
; 9bit 6bit 4bit 7bit 10bit 10bit 3bit 3bit 12bit
; (6.4)
move.l #$2008B060,d0 ; XPOS=96 / depth = 3 / Pitch=1 / DWIDTH=2 / IWIDTH=2 : $60+3000+8000+80000+20000000
move.l #$8000,d1 ; Trans=1
move.l d1,(a2)+
move.l d0,(a2)+
.endif
; insertion de STOP
moveq #0,d0
move.l d0,(a2)+
move.l #4,d0
move.l d0,(a2)+
.if 1=0
; copie liste 1 dans liste 2
move.l #ob_list_2,A1_BASE ; = DEST
move.l #$0,A1_PIXEL
move.l #PIXEL16|XADDPHR|PITCH1,A1_FLAGS
move.l #ob_list_1,A2_BASE ; = source
move.l #$0,A2_PIXEL
move.l #PIXEL16|XADDPHR|PITCH1,A2_FLAGS
move.w #1,d0
swap d0
move.l #64000/4,d1
move.w d1,d0
move.l d0,B_COUNT
move.l #LFU_REPLACE|SRCEN,B_CMD
;wait for blitter
.wait_blitter:
move.l B_CMD,d0
btst #0,d0
beq.s .wait_blitter
.endif
rts
;-----------------------------------------------------------------------------------
;--------------------------
; VBL
VBL:
movem.l d0-d7/a0-a6,-(a7)
;move.l GPU_pointeur_object_list_a_modifier,d0
;move.l GPU_pointeur_object_list_a_afficher,GPU_pointeur_object_list_a_modifier
;move.l d0,GPU_pointeur_object_list_a_afficher
;swap d0
;move.l d0,OLP
;lea ob_list_1,a6
;bsr preparation_OL
;jsr copy_olist ; use Blitter to update active list from shadow
;addq.w #1,BG
; is alive ?
;move.l vbl_counter,d0
;move.w d0,BG
addq.l #1,vbl_counter
move.w #$101,INT1 ; Signal we're done
move.w #$0,INT2
.exit:
movem.l (a7)+,d0-d7/a0-a6
rte