-
Notifications
You must be signed in to change notification settings - Fork 0
/
_Scroll.S
2025 lines (1637 loc) · 45.3 KB
/
_Scroll.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
;
; SCROLLING USING VIDEO POINTER
; Arnaud FBY
;
;--- GESTION DE CONF ---
;2021-10-12 début
;2021-10-25 scrolling avec Tiles
;2021-11-10 Scrolling 1 bitplane
;--- TODO
;séquenceur TILES = f(position 65535)
;séquenceur OBJETS = f(position 65535)
;scrolling horizontal
;passer en 32 couleurs
;affichage BOB 32x32 en x,y au blitter
;affichage BOB 32x32 en x,y au CPU
;affichage BOB 16x16 en x,y au blitter
;affichage BOB 16x16 en x,y au CPU
;affichage BOB 8x8 en x,y au blitter
;affichage BOB 8x8 en x,y au CPU
;LIFO restauration background pour les BOB
;gestion d'objets (BOB) : déclenchement, trajectoire, comportement, fin de vie
;gestion collisions
;gestion interface joystick
;gestion clavier
;afficher les sprites
;Gain cycles : organiser les Data TILES à la suite (et pas en matrice)
;--- CONFIGURATION
CST.DEBUG.DisplayTime = 1 ;=0 ;COUT=2 HBL ;affiche le compteur de rater
CST.DEBUG.DisplayRaster = 1 ;affiche la couleur raster rouge/vert
CST.DEBUG.CountWaitBlit=1 ;count waitblit and put value in CTRWAIT:
CST.DEBUG.AfficherVariables = 0 ;COUT=60 HBL
CST_Scroll_PasAPas = 0 ;1 : step by step with right button
CST_Scroll_PosYInit = 0 ;starting position? bug=138
CST_Scroll_Sens = 0 ;0 bas, 1 haut
CST.RUN.AfficherTexteFixe = 0 ;COUT=37 HBL environ ;texte fixe
CST.RUN.EffacerBitPlaneCache = 0 ;COUT=43 HBL ;3eme Bitplane
incdir "Arn-Scroll/"
;--- REFERENCES
;Architecture de Yragael http://www.stashofcode.fr
;Font8 de Yragael https://www.stashofcode.fr/code/coder-un-sine-scroll-sur-amiga/sinescroll.zip
;Textes paragraphes https://www.topster.fr/texte-ascii/ivrit.html
;--- DOC
;http://obligement.free.fr/articles/assembleur_programmation_blitter.php
; CMP A,B Entier (signé) Naturel(non signé)
; A > B BLT BLO (ou BCS)
; A >= B BLE BLS
; A = B BEQ BEQ
; A <> B BNE BNE
; A < B BGT BHI
; A <= B BGE BHS (ou BCC)
; CONDITION D ASSEMBLAGE
; IFEQ Assemble if expression = zero
; IFNE Assemble if expression <> zero
; IFGT Assemble if expression > zero
; 1FGE Assemble if expression >= zero
; IFLT Assemble if expression < zero
; IFLE Assemble if expression <= zero
; ENDC
;--- BLITTER
; AREA MODE LINE MODE
; Bit BLTCON0 BLTCON1 Bit BLTCON0 BLTCON1
; 15 ASH3 BSH3 15 ASH3 BSH3
; 14 ASH2 BSH2 14 ASH2 BSH2
; 13 ASH1 BSH1 13 ASH1 BSH1
; 12 ASA0 BSH0 12 ASH0 BSH0
; 11 USEA 0 11 1 0
; 10 USEB 0 10 0 0
; 09 USEC 0 09 1 0
; 08 USED 0 08 1 0
; 07 LF7 DOFF 07 LF7 DPFF
; 06 LF6 0 06 LF6 SIGN
; 05 LF5 0 05 LF5 OVF
; 04 LF4 EFE 04 LF4 SUD
; 03 LF3 IFE 03 LF3 SUL
; 02 LF2 FCI 02 LF2 AUL
; 01 LF1 DESC 01 LF1 SING
; 00 LF0 LINE(=0)00 LF0 LINE(=1)
;
; Function Description
; ASH3-0 Shift value of A source
; BSH3-0 Shift value of B source and line texture
; USEA Mode control bit to use source A
; USEB Mode control bit to use source B
; USEC Mode control bit to use source C
; USED Mode control bit to use destination D
; LF7-0 Logic function minterm select lines
; LFx Minterm
; 0 /a /b /c
; 1 /a /b C
; 2 /a B /c
; 3 /a B C
; 4 A /b /c
; 5 A /b C
; 6 A B /c
; 7 A B C
; EFE Exclusive fill enable
; IFE Inclusive fill enable
; FCI Fill carry input
; DESC Descending (dec address)control bit
; LINE Line mode control bit
; SIGN Line draw sign flag
; OVF Line/draw r/l word overflow flag
; SUD Line draw, Sometimes up or down (=AUD)
; SUL Line draw, Sometimes up or left
; AUL Line draw, Always up or left
; SING Line draw, Single bit per horiz line
; DOFF Disables the D output- for external ALUs
; The cycle occurs normally, but the data
; bus is tristate (hires chips only)
SECTION Arnaud.68000,CODE_F
include "Lib_Et_Registres.s"
include "macros.s"
;Config Programme
DISPLAY_X_MASQUES = 16
DISPLAY_DEPTH=5
DISPLAY_DX=320+DISPLAY_X_MASQUES ;car 16 pixels masqués pour scroll H
DISPLAY_DY=256
BITPLANE_DX=DISPLAY_DX+16 ;au final 32 pixels
BITPLANE_DY=DISPLAY_DY+64
DISPLAY_X=$81-DISPLAY_X_MASQUES
DISPLAY_Y=$2C
TAILLE_BITPLANE=((BITPLANE_DX*BITPLANE_DY)>>3)
; ___ _ _
; | \ ___ | |__ _ _ | |_
; | |) | / -_) | '_ \ | || | | _|
; |___/ \___| |_.__/ \_,_| \__|
;
;---------- Initialisations ----------
Debut:
movem.l d0-d7/a0-a6,-(SP) ;Empiler les registres
lea $DFF000,a5
movea.l $4.w,a6
bsr.w ReserverMemoireCHIP
bsr.w CouperHardware
bsr.w InitiliserCopperList
bsr.w CreerPolice16x16
; _
; | | ___ ___ _ __
; | |__ / _ \ / _ \ | '_ \
; |____| \___/ \___/ | .__/
; |_|
;---------- Boucle principale ----------
_loop:
lea $DFF000,a5
IFNE CST.DEBUG.CountWaitBlit
move.l #0,CTRWait
ENDC
;--- Attendre que le faisceau d'électrons a terminé de tracer l'écran
_waitVBL:
move.l VPOSR(a5),d0
lsr.l #8,d0
and.w #$01FF,d0
cmp.w #DISPLAY_Y+DISPLAY_DY,d0
blt.s _waitVBL
IFNE CST.DEBUG.DisplayRaster
move.w #$0FFF,COLOR00(a5) ;si DEBUG on passe en rouge la couleur du fond
ENDC
;--- CONFIGURER L'AFFICHAGE
bsr PermuterBplEtConfigurerAffichage
IFNE CST.DEBUG.DisplayRaster
move.w #$0AAA,COLOR00(a5) ;si DEBUG on passe en rouge la couleur du fond
ENDC
;--- CONSTRUIRE L'IMAGE
;Incrémenter valeur du scrolling
IFEQ CST_Scroll_PasAPas
bsr CompterCTR65536
bsr TraiterScrolling ;crée TILES -> bpl C et copie -> bpl A et B
ENDC
IFNE CST.DEBUG.DisplayRaster
move.w #$0d00,COLOR00(a5) ;si DEBUG on passe en rouge la couleur du fond
ENDC
;Afficher du texte
IFNE CST.RUN.AfficherTexteFixe
AFFTEXTE 0,8,"Scroll - Arnaud - 2021-09-28" ;MACRO : x,y,"texte"
AFFTEXTE 0,9,"Amiga68000@gmail.com" ;MACRO : x,y,"texte" ;(pc) ;cout 37 HBL
ENDC
IFNE CST.DEBUG.DisplayRaster
move.w #$044f,COLOR00(a5) ;si DEBUG on passe en rouge la couleur du fond
ENDC
;--- AFFICHER LES VARIABLES
IFNE CST.DEBUG.AfficherVariables
bsr Afficher_Variables
ENDC
IFNE CST.DEBUG.DisplayRaster
move.w #$088f,COLOR00(a5) ;si DEBUG on passe en rouge la couleur du fond
ENDC
bsr TestAffBob32
; ;--- AFFICHER TEST COULEUR
; movea.l bitplaneB_ptr(pc),a1
; move.l #%10101010101010101010101010101010,(a1)
; add.l #TAILLE_BITPLANE,a1
; move.l #%11001100110011001100110011001100,(a1)
; add.l #TAILLE_BITPLANE,a1
; move.l #%11110000111100001111000011110000,(a1)
; add.l #TAILLE_BITPLANE,a1
; move.l #%11111111000000001111111100000000,(a1)
; add.l #TAILLE_BITPLANE,a1
; move.l #%11111111111111110000000000000000,(a1)
;--- EFFACER LE BITPLANE CACHE (Bitplane C)
IFNE CST.RUN.EffacerBitPlaneCache
;jsr Effacer_BitPlaneC(pc)
bsr.w Effacer_BitPlaneC0 ;(pc)
bsr.w Effacer_BitPlaneC1 ;(pc)
bsr.w Effacer_BitPlaneC2 ;(pc)
ENDC
;--- AFFICHER LE FAISCEAU EN VERT
IFNE CST.DEBUG.DisplayRaster
move.w #$044f,COLOR00(a5)
ENDC
;--- DEBUGDISPLAYTIME
IFNE CST.DEBUG.DisplayTime
;affiche le nb de lignes écoulées depuis la fin de l'écran (depuis la ligne DISPLAY_Y+DISPLAY_DY incluse)
;la trame se termine en DISPLAY_Y+DISPLAY_DY-1
;le temps est donc compté en nombre de ligne à partir de DISPLAY_Y+DISPLAY_DY incluse
movem.l d0-d2/a0-a3,-(sp)
AFFTEXTE 0,0,"Time=" ;MACRO : x.car,y.car,"texte"
move.l VPOSR(a5),d0
lsr.l #8,d0
and.w #$01FF,d0
cmp.w #DISPLAY_Y+DISPLAY_DY,d0
bge.s _timeBelowBitplanes
;on est passé en haut de l'écran
add.w #1+312-(DISPLAY_Y+DISPLAY_DY-1),d0 ;312 est la ligne la plus basse que peut trace le faisceau d'électrons
bra.s _timeDisplayCounter
_timeBelowBitplanes:
;on est toujours en bas de l'écran
sub.w #DISPLAY_Y+DISPLAY_DY-1,d0
_timeDisplayCounter:
movea.l bitplaneB_ptr(pc),a1
lea 8*(BITPLANE_DX>>3)(a1),a1
bsr AFficherNombre ;(pc) ;D0=nombre 9999, A1=ptr
movem.l (sp)+,d0-d2/a0-a3
ENDC
;--- AFFICHER LE FAISCEAU EN VERT
IFNE CST.DEBUG.DisplayRaster
move.w #$00F0,COLOR00(a5)
ENDC
;--- SOURIS PRESSEE ?
TestClicDroit;
btst #10,$dff016 ; test RIGHT mouse click
bne.s .clicDroitNonEnfonce
;-- clic droit enfoncé
.loopCG:
;-- clic droit non laché
btst #10,$dff016 ; test RIGHT mouse click
beq .loopCG
;-- clic droit laché
;-- ACTION ICI
IFNE CST_Scroll_PasAPas
bsr CompterCTR65536
bsr TraiterScrolling ;modifie AffLigneY
ENDC
.clicDroitNonEnfonce:
TestClicGauche:
btst #6,$bfe001
bne.w _loop ;enfoncé
;-- ici enfoncé
; ___ _
; | __| (_) _ _
; | _| | | | ' \
; |_| |_| |_||_|
;
;--- ON QUITTE ------------
_loopEnd:
WAITBLIT
bsr.w RestaurerHardware
bsr.w LibererMemoireCHIP
ErrorMem:
movem.l (sp)+,d0-d7/a0-a6 ;Dépiler les registres
rts
; ___ _ _ ___ ___ _ _
; / __| | | | | | _ ) ___ | _ \ ___ _ _ | |_ (_) _ _ ___ ___
; \__ \ | |_| | | _ \ |___| | / / _ \ | || | | _| | | | ' \ / -_) (_-<
; |___/ \___/ |___/ |_|_\ \___/ \_,_| \__| |_| |_||_| \___| /__/
;
IFNE CST.DEBUG.AfficherVariables
Afficher_Variables:
;--- AFFICHER LA POSITION SCROLLING
AFFTEXTE 0,5,"AffLigneY=" ;MACRO : x,y,"texte"
;1er endroit
movea.l bitplaneB_ptr(pc),a1
lea 6*8*(BITPLANE_DX>>3)(a1),a1
move.w AffLigneY,d0
bsr AFficherNombre ;(pc) ;D0=nombre 9999, A1=ptr
;2eme endroit
AFFTEXTE 0,16,"AffLigneY=" ;MACRO : x.car,y.car,"texte"
movea.l bitplaneB_ptr(pc),a1
lea 17*8*(BITPLANE_DX>>3)(a1),a1
move.w AffLigneY,d0
bsr AFficherNombre ;(pc) ;D0=nombre 9999, A1=ptr
;-- AFFICHER CTR 65536
move.w CTR_65536,d0
movea.l bitplaneB_ptr(pc),a1
lea 32+(0*8*(BITPLANE_DX>>3))(a1),a1
bsr AFficherNombre ;(pc) ;D0=nombre 9999, A1=ptr
AFFTEXTE 20,0,"CTR 65536=" ;MACRO : x.car,y.car,"texte"
;-- AFFICHER CTR 32
move.w CTR0..31,d0
movea.l bitplaneB_ptr(pc),a1
lea 32+(3*8*(BITPLANE_DX>>3))(a1),a1
bsr AFficherNombre ;(pc) ;D0=nombre 9999, A1=ptr
AFFTEXTE 20,3,"CTR 0..31=" ;MACRO : x.car,y.car,"texte"
;-- AFFICHER Pos Tile ;DEBUG ***************************
move.w CTR_posYTile,d0
movea.l bitplaneB_ptr(pc),a1
lea 32+(5*8*(BITPLANE_DX>>3))(a1),a1
bsr AFficherNombre ;(pc) ;D0=nombre 9999, A1=ptr
AFFTEXTE 20,5,"PosY TILE=" ;MACRO : x.car,y.car,"texte"
rts
ENDC
; ___ _ _ _
; / _ \ | |__ (_) ___ | |_
; | (_) | | '_ \ | | / -_) | _|
; \___/ |_.__/ _/ | \___| \__|
; |__/
;
;Type_Objets
; engin au Sol : l'objet suit le scrolling
; engin en l'Air : l'objet suit une trajectoire
; bouclier au sol
; munition ennemie
; vaisseau joueur
; tir joueur
; objet à récupérer
TraiterObjets:
rts
Evenements:
dc.w 32 ;declencheur Y
dc.l Vaisseau_Ennemi
dc.w 255,50 ;x,y départ
dc.l Trajectoire1
Objets:
Vaisseau_Ennemi:
dc.w 0 ;type objet (comportement)
dc.w 10 ;vitesse pix
dc.w 10 ;points de vie init
dc.w 20 ;tempo TIR
dc.l Objet_Boulet
Objet_Boulet:
dc.l 0
Trajectoire1:
dc.w 0,0
dc.w 10,0
dc.w 20,0
dc.w 30,0
dc.w 40,0
dc.w 50,0
dc.w $ffff,$ffff
;DEBUG ****************************
TestAffBOB:
move.w #BOB_Y,d1
move.w #BOB_DY,d2
rts
; ___ ___ ___
; | _ ) / _ \ | _ )
; | _ \ | (_) | | _ \
; |___/ \___/ |___/
TestAffBob32:
;TEST 50x BOBs 1 plan
;50xBOB 1 plan h32 : equiv=196 (189 en 1 partie / 255 quand bob en 2 parties)
;50xBOB 1 plan h32 : 188 en 1 partie (pas de test de tronquage)
;10xBOB 1 plan h32*5 : 170 en 1 partie
;Conclusion : s'orienter sur Bitplanes entrelacés
BOB_X=165
BOB_Y=150
BOB_DX=32
BOB_DY=32
movem.l d0-d7/a0-a6,-(sp)
lea $DFF000,a5
move.l #50,d7
Bcl_Aff_BOB:
move.w #BOB_X,d0 ;x.pix
move.w #BOB_Y,d1 ;y.pix
lea bob_img,a0 ;bob
;bsr AfficherBob32
bsr Copy_Blit_BOB_h32
dbf d7,Bcl_Aff_BOB
movem.l (sp)+,d0-d7/a0-a6
rts
;
;-- AFFICHER BOB x,y
;
BOB32_DX=32
BOB32_DY=32
; CMP A,B Entier (signé) Naturel(non signé)
; A > B BLT BLO (ou BCS)
; A >= B BLE BLS
; A = B BEQ BEQ
; A <> B BNE BNE
; A < B BGT BHI
; A <= B BGE BHS (ou BCC)
AfficherBob32:
;Entree:
; d0=x.pix
; d1=y.pix (physical location (0,0) = upper left corner)
; a0=image 32x32
; a5= DFF000
;Sortie:
;
;Interne:
; d4, d5, a1=ptr screen.dest, d2=offset screen.dest
add.w AffLigneY,d1 ;D1 = BOB_Ligne_Ydeb = BOB_Y + AffLigneY
cmp.w #BITPLANE_DY,d1
blo .saut1
;CAS 1 : BITPLANE_DY <= BOB_Ligne_Ydeb
sub.w #BITPLANE_DY,d1
;deplacer en 1 bloc d0=x, d1=y
bsr Copy_Blit_BOB_h32 ;d0=x, d1=y, a0=adr BOB, a5=$dff000, [a1], [d2]
rts
.saut1:
;BITPLANE_DY > BOB_Ligne_Ydeb
move.w d1,d4
add.w #BOB32_DY,d4 ;d4 = BOB_Ligne_YFin
cmp.w #BITPLANE_DY,d4
bls .saut2 ;blo <= bls <
;CAS 2 : BITPLANE_DY < BOB_Ligne_YFin
;deplacer en 2 blocs
move.w d4,d5
move.w #BITPLANE_DY,d4
sub.w d1,d4 ;d4 = DY1 = BITPLANE_DY - BOB_Ligne_Ydeb
;bloc 1 : d1 = Y1, d4 = DY1
move.w d0,d3 ;sauve d0=x.pix
bsr Copy_Blit_BOB_hd4 ;d0=x, d1=y, d4=dy, a0=adr BOB, a5=$dff000, [a1], [d2]
move.w d3,d0 ;restaure d0=x.pix
moveq.l #0,d1 ;y.pix = 0
move.w d5,d4 ;restaure
sub.w #BITPLANE_DY,d4 ;d4 = DY2 = BOB_Ligne_YFin - BITPLANE_DY
;bloc 2 : d1 = 0, d4 = DY2
bsr Copy_Blit_BOB_hd4 ;d0=x, d1=y, d4=dy, a0=adr BOB, a5=$dff000, [a1], [d2]
rts
.saut2:
;CAS 3 : BITPLANE_DY > BOB_Ligne_YFin
;deplacer en 1 bloc
;d1 = Y1, d2 = DY
bsr Copy_Blit_BOB_h32 ;d0=x, d1=y, a0=adr BOB, a5=$dff000, [a1], [d2]
rts
Copy_Blit_BOB_hd4:
;-- COPY BOB AU BLITTER selon h=d4
;ENTREE
; d0 = x.pix
; d1 = y.pix
; d4 = dy.pix ********************
; a0 = adresse bob
; a5 = $DFF000
;MODIFIE
; d0, d1, d2, d4, a1
move.w d0,d2
and.w #$F,d0
ror.w #4,d0
or.w #%0000101111111010,d0 ;4 bits AShift - 4 bits used ABCD - 8b minterms A+/aC
lsr.w #3,d2 ;pos.x en octet
and.b #$FE,d2 ;pos.x au mot près 16bits
mulu #BITPLANE_DX>>3,d1
add.w d1,d2
movea.l bitplaneB_ptr(pc),a1 ;backBuffer
lea (a1,d2.w),a1
;Calcul de size #(BOB32_DY<<6)!((BOB32_DX+16)>>4)
lsl.w #6,d4
add.w #((BOB32_DX+16)>>4),d4
WAITBLIT
move.w d0,BLTCON0(a5)
move.w #$0000,BLTCON1(a5)
move.w #$FFFF,BLTAFWM(a5)
move.w #$0000,BLTALWM(a5)
move.w #-2,BLTAMOD(a5)
move.w #(BITPLANE_DX-(BOB32_DX+16))>>3,BLTCMOD(a5)
move.w #(BITPLANE_DX-(BOB32_DX+16))>>3,BLTDMOD(a5)
move.l a0,BLTAPTH(a5)
move.l a1,BLTCPTH(a5)
move.l a1,BLTDPTH(a5)
move.w d4,BLTSIZE(a5)
rts
Copy_Blit_BOB_h32:
;-- AFFICHER BOB AU BLITTER
;ENTREE
; d0 = x.pix
; d1 = y.pix
; a0 = adresse bob
; a5 = $DFF000
;INTERNE
; a1
; d2
move.w d0,d2
and.w #$F,d0
ror.w #4,d0
or.w #%0000101111111010,d0 ;4 bits AShift - 4 bits used ABCD - 8b minterms A+/aC
lsr.w #3,d2
and.b #$FE,d2
mulu #BITPLANE_DX>>3,d1
add.w d1,d2
movea.l bitplaneB_ptr(pc),a1 ;backBuffer
lea (a1,d2.w),a1
WAITBLIT
move.w d0,BLTCON0(a5)
move.w #$0000,BLTCON1(a5)
move.w #$FFFF,BLTAFWM(a5)
move.w #$0000,BLTALWM(a5)
move.w #-2,BLTAMOD(a5)
move.w #(BITPLANE_DX-(BOB32_DX+16))>>3,BLTCMOD(a5)
move.w #(BITPLANE_DX-(BOB32_DX+16))>>3,BLTDMOD(a5)
move.l a0,BLTAPTH(a5)
move.l a1,BLTCPTH(a5)
move.l a1,BLTDPTH(a5)
move.w #(BOB32_DY<<6)!((BOB32_DX+16)>>4),BLTSIZE(a5)
rts
;--- BLITTER
; AREA MODE LINE MODE
; Bit BLTCON0 BLTCON1 Bit BLTCON0 BLTCON1
; 15 ASH3 BSH3 15 ASH3 BSH3
; 14 ASH2 BSH2 14 ASH2 BSH2
; 13 ASH1 BSH1 13 ASH1 BSH1
; 12 ASA0 BSH0 12 ASH0 BSH0
; 11 USEA 0 11 1 0
; 10 USEB 0 10 0 0
; 09 USEC 0 09 1 0
; 08 USED 0 08 1 0
; 07 LF7 DOFF 07 LF7 DPFF
; 06 LF6 0 06 LF6 SIGN
; 05 LF5 0 05 LF5 OVF
; 04 LF4 EFE 04 LF4 SUD
; 03 LF3 IFE 03 LF3 SUL
; 02 LF2 FCI 02 LF2 AUL
; 01 LF1 DESC 01 LF1 SING
; 00 LF0 LINE(=0)00 LF0 LINE(=1)
;BLTCON0
; bit Minterm
; 7 A B C
; 6 A B /c
; 5 A /b C
; 4 A /b /c
; 3 /a B C
; 2 /a B /c
; 1 /a /b C
; 0 /a /b /c
Aff_Blit_BOB32_GENERIQUE:
;-- AFFICHER BOB AU BLITTER
;ENTREE
; d0 = x.pix
; d1 = y.pix
; a0 = adresse bob
; a5 = $DFF000
;INTERNE
; a1
; d2
move.w d0,d2
and.w #$F,d0
ror.w #4,d0
or.w #%0000101111111010,d0 ;4 bits AShift - 4 bits used ABCD - 8b minterms A+/aC
lsr.w #3,d2
and.b #$FE,d2
mulu #BITPLANE_DX>>3,d1
add.w d1,d2
movea.l bitplaneB_ptr(pc),a1 ;backBuffer
lea (a1,d2.w),a1
WAITBLIT
move.w d0,BLTCON0(a5)
move.w #$0000,BLTCON1(a5)
move.w #$FFFF,BLTAFWM(a5)
move.w #$0000,BLTALWM(a5)
move.w #-2,BLTAMOD(a5)
move.w #(BITPLANE_DX-(BOB32_DX+16))>>3,BLTCMOD(a5)
move.w #(BITPLANE_DX-(BOB32_DX+16))>>3,BLTDMOD(a5)
move.l a0,BLTAPTH(a5)
move.l a1,BLTCPTH(a5)
move.l a1,BLTDPTH(a5)
move.w #(BOB32_DY<<6)!((BOB32_DX+16)>>4),BLTSIZE(a5)
rts
; ___ _ _ _
; / __| __ _ _ ___ | | | | (_) _ _ __ _
; \__ \ / _| | '_| / _ \ | | | | | | | ' \ / _` |
; |___/ \__| |_| \___/ |_| |_| |_| |_||_| \__, |
; |___/
; GESTION DU SCROLLING
TraiterScrolling:
move.w CTR_65536,d0
btst #0,d0
bne .sauteSCroll
;scrolling 1 fois sur 2
bsr.w IncrementerPosYScrolling
bsr IncrementerPosXScrolling
.sauteSCroll:
bsr.w CompterCTR31
bsr.w Sequenceur_SCROLL
rts
;--- INCREMENTE POSITION Y DU BITMAP A AFFICHER
IncrementerPosYScrolling:
;----- Incremente Position affichage
moveq.l #0,d1
move.w AffLigneY,d1
IFEQ CST_Scroll_Sens
;-- SENS BAS, Sens descente
subq #1,d1
bge .pasDeb ;tester si <=0 ; bge signé A <= B
move.w #BITPLANE_DY-1,d1
.pasDeb:
ELSE
;-- SENS HAUT, Sens montée
addq #1,d1
cmp.w #BITPLANE_DY,d1
blo .pasFin ;blo BITPLANE_DY > d1
moveq.l #0,d1
.pasFin:
ENDC
move.w d1,AffLigneY
rts
AffLigneY: dc.w CST_Scroll_PosYInit ;0 .. 287
;--- INCREMENT POS X DE L'AFFICHAGE
IncrementerPosXScrolling:
movea.l AffEcranPosX_Ptr(pc),a0
add.l #2,a0
move.w (a0),d1
cmp.w #$ffff,d1
bne .pasReset
move.l #AffEcranPosX_Data,a0
move.w (a0),d1
.pasReset:
move.w d1,AffEcranPosX
movea.l a0,AffEcranPosX_Ptr
rts
AffEcranPosX:
dc.w 0
AffEcranPosX_Ptr:
dc.l AffEcranPosX_Data
AffEcranPosX_Data:
;dc.w 0,0,0,0,0,0,0,0
;dc.w 5,5,5,5,5,5,5,5
;dc.w 5,5,5,5,5,5,5,5
;dc.w 5,5,5,5,5,5,5,5
;dc.w $ffff
dc.w 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
dc.w 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
dc.w 30,29,28,27,26,25,24,23,22,21,20,19,18,17,16
dc.w 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
dc.w $FFFF
;---- COMPTEUR 0..65535
CompterCTR65536:
add.w #1,CTR_65536
rts
CTR_65536:dc.w 0
;---- COMPTEUR 0..31
CompterCTR31:
move.w AffLigneY,d0
and.w #%11111,d0
move.w d0,CTR0..31
rts
CTR0..31: dc.w 0
;--- ACTION = f(CTR31)
Sequenceur_SCROLL:
;31 : CALCUL POINTEUR ZONE NEW TILES
;30 à 20: COPIER TILES du decor correspondant dans bitplane C
;19 : copier TILES bitplane C --> A
;18 : copier TILES bitplane C --> B
move.w CTR0..31,d0
cmp.w #31,d0
bne .pas31
;CTR=31
;--- calcul du pointeur zone new Tiles
;movea.l bitplaneB_ptr(pc),a0 ;DEBUG ***************************
move.w AffLigneY,d1 ;y
sub.w #31+32,d1
bge .pasDepasse ;bge signé : A <= B
;-- inf a 0 strictement
add.w #BITPLANE_DY,d1
.pasDepasse:
move.w d1,CTR_posYTile ;DEBUG**********************
mulu #BITPLANE_DX>>3,d1
movea.l bitplaneC_ptr(pc),a0
add.l d1,a0
movea.l a0,bitplaneZoneNewTile_PTR
rts
.pas31:
cmp.w #20,d0 ;/!\ changer valeur plus bas aussi
blo .pas20 ;si 20>d0
;CTR=20 à 30
;--- copier de new Tiles dans bitplane C
and.l #$ff,d0
sub.w #20,d0 ;0..10
add.w d0,d0 ;0..20 pas de 2 octets
moveq.l #0,d1
move.w d0,d1
movea.l Decor_Tiles_PTR(pc),a2
move.w (a2,d0),d0 ;n° du Tile
add.w d1,d1 ;pos X du Tile en octet
move.l bitplaneZoneNewTile_PTR(pc),a0
add.l d1,a0
bsr CopyTileBlit
rts
.pas20:
cmp.w #19,d0
bne .pas19
;CTR=20
;--- copier Bitplane zone Tiles créées C --> A
movea.l bitplaneZoneNewTile_PTR(pc),a0
move.l a0,a1
sub.l #TAILLE_BITPLANE*DISPLAY_DEPTH*1,a1
Bra .CopierBlitter
.pas19:
cmp.w #18,d0
bne pas18
;CTR=19
;--- copier Bitplane zone Tiles créées C --> B
movea.l bitplaneZoneNewTile_PTR(pc),a0
move.l a0,a1
sub.l #TAILLE_BITPLANE*DISPLAY_DEPTH*2,a1
.CopierBlitter:
;rts ;DEBUG ******************************
movem.l d0-d7/a0-a6,-(sp)
lea $DFF000,a5
move.w #DISPLAY_DEPTH-1,d7
bclCopyAreaTilesBlit:
WAITBLIT
move.l a0,BLTAPTH(a5) ;adresse source
move.l a1,BLTDPTH(a5) ;adresse dest
move.w #%0000100111110000,BLTCON0(a5) ;canal A et D, D=A
move.w #%0000000000000000,BLTCON1(a5)
move.w #%1000000001000000,DMACON(a5)
move.w #0,BLTAMOD(a5)
move.w #0,BLTDMOD(a5)
move.w #$FFFF,BLTAFWM(a5) ;Masque 1er mot de chaque ligne de A
move.w #$FFFF,BLTALWM(a5) ;Masque dernier mot de chaque ligne de A
move.w #(32<<6)!((BITPLANE_DX)>>4),BLTSIZE(a5) ;32pix de haut
add.l #TAILLE_BITPLANE,a0
add.l #TAILLE_BITPLANE,a1
dbf d7,bclCopyAreaTilesBlit
movem.l (sp)+,d0-d7/a0-a6
rts
pas18:
cmp.w #17,d0
bne .pas17
;CTR=17, incrémenter TILE_PTR
movea.l Decor_Tiles_PTR(pc),a0
lea 22(a0),a0 ;TODO configurer avec variables
move.w (a0),d1
cmp.w #$FFFF,d1
bne .pasRaz
;raz
lea Decor_Tiles(pc),a0
.pasRAZ:
move.l a0,Decor_Tiles_PTR
.pas17:
FinCTR:
rts
CTR_posYTile: dc.w 0 ;DEBUG ******************************
bitplaneZoneNewTile_PTR: dc.l ScreenA ;evite le bug
;---- COPIER TILES
; move.l bitplaneB_ptr(pc),a0
; moveq.l #0,d0
; bsr CopyTile ; ;A0 = ptr dest, D0 = num du tile 0 à 79
; lea (a0,d2.w),a2 ;12 cycles
; lea BITPLANE_DX>>3(a3),a3 ;8cycles
TILES_DX = 32
TILES_DY = 32
TILES_BDD_DX = 320
TILES_BDD_DY = 256
TILES_BITPLANE_SIZE = (TILES_BDD_DX*TILES_BDD_DY)>>3
; CopyTile:
; ;A0 = ptr destination
; ;D0 = numéro du tile 0 à 79
; ;utilisé A1
; lea Tiles,a1
; and.l #$ff,d0
; divu #10,d0
; move.w d0,d1 ;n° x
; swap d0 ;n°y
; and.l #$ff,d0
; add.w d0,d0
; add.w d0,d0 ;x en octet
; mulu #(TILES_BDD_DX>>3)*TILES_DY,d1
; add.l d1,d0 ;offset en octet du tile
; add.l d0,a1 ;ptr sur tile à copier
; moveq.l #TILES_DY-1,d0
; .bcl:
; move.l (a1),(a0) ;TILES_DX = 32 pixels
; add.l #40,a1
; add.l #BITPLANE_DX>>3,a0
; dbf d0,.bcl
; rts
CopyTileBlit:
movem.l d0-d7/a0-a6,-(sp)
lea Tiles,a1
and.l #$ff,d0
divu #10,d0
move.w d0,d1 ;n° x