-
Notifications
You must be signed in to change notification settings - Fork 2
/
+W.s
16724 lines (15934 loc) · 309 KB
/
+W.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
;
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;
; LIBRAIRIE GRAPHIQUE AMOS
;
;
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
***************************************************************************
IFND EZFlag
EZFlag equ 0
ENDC
***************************************************************************
IncDir "includes/"
Include "exec/types.i"
Include "graphics/rastport.i"
Include "graphics/clip.i"
Include "graphics/layers.i"
Include "graphics/text.i"
Include "devices/input.i"
Include "devices/inputevent.i"
Include "exec/interrupts.i"
Include "exec/io.i"
Include "hardware/intbits.i"
Include "graphics/layers_lib.i"
Include "graphics/graphics_lib.i"
Include "+AMOS_Includes.S"
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Version MACRO
dc.b 0,"$VER: 2.00",0
even
ENDM
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WDebut bra Startall Cold start
bra Endall End
dc.l L_Trappe Length of data zone
bra IceStart Access of System functions
bra IceEnd Stop access of system functions
dc.b "P110" Version Pro 1.10
BugBug movem.l d0-d2/a0-a2,-(sp)
.Ll move.w #$FF0,$DFF180
btst #6,$BFE001
bne.s .Ll
move.w #20,d0
.L0 move.w #10000,d1
.L1 move.w d0,$DFF180
dbra d1,.L1
dbra d0,.L0
btst #6,$BFE001
beq.s .Ill
movem.l (sp)+,d0-d2/a0-a2
rts
.Ill moveq #0,d1
bsr TAMOSWb
movem.l (sp)+,d0-d2/a0-a2
illegal
rts
Version
IFEQ EZFlag
***********************************************************
* COLLISIONS HARD
******* SET HARDCOL
* D1= Sprites
* D2= Enable
* D3= Compare
HColSet and.w #$000F,d1
lsl.w #8,d1
lsl.w #4,d1
and.w #$003F,d2
lsl.w #6,d2
and.w #$003F,d3
or.w d2,d1
or.w d3,d1
move.w d1,Circuits+$98
moveq #0,d0
rts
******* =HARDCOL
* D1= #Sprite / -1 Si bitplanes
HColGet lea T_TColl(a5),a0
move.l a0,a1
clr.l (a0)+
clr.l (a0)+
clr.l (a0)+
clr.l (a0)+
clr.l (a0)+
clr.l (a0)+
clr.l (a0)+
clr.l (a0)+
move.w Circuits+$0E,d2
tst.w d1
bmi.s HCol3
* Sprites
and.w #$0006,d1
lsl.w #2,d1
lea HColT(pc),a0
add.w d1,a0
moveq #0,d3
moveq #%00000011,d4
moveq #0,d1
move.b (a0)+,d0
HCol1 bmi.s HCol2
btst d0,d2
beq.s HCol2
or.w d4,d3
cmp.w #$0100,d3
bcc.s HCol2
moveq #-1,d1
HCol2 lsl.w #2,d4
move.b (a0)+,d0
bne.s HCol1
* Ok!
ror.w #8,d3
move.w d3,(a1)
moveq #0,d0
rts
******* Playfield / Playfield
HCol3 moveq #0,d1
btst #0,d2
beq.s HCol4
moveq #-1,d1
HCol4 rts
******* Table des bits a tester!
HColT dc.b -1,9,10,11,1,5,0,0
dc.b 9,-1,12,13,2,6,0,0
dc.b 10,12,-1,14,3,7,0,0
dc.b 11,13,14,-1,4,8,0,0
ENDC
***********************************************************
* COLLISIONS SOFT
******* Routine collision:
* A3/A2= descripteur sprite concerne
* D0/D1= bob dest DX/DY
* D2= Image!
* D4/D5= bob source DX/DY
* D6/D7= bob source FX/FY
* A4= banque!
******* RETOUR: BNE-> Pas coll
******* BEQ-> Coll
ColRout:
* Pointe le descripteur
and.w #$3FFF,d2
beq ColRF
cmp.w (a4),d2
bhi ColRF
lsl.w #3,d2
lea -8+2(a4,d2.w),a0
move.l 4(a0),d2
ble ColRF
move.l d2,a1
move.l (a0),d2
beq ColRF
move.l d2,a0
* Prend les coordonnees
move.w 6(a0),d2
lsl.w #2,d2
asr.w #2,d2
sub.w d2,d0
sub.w 8(a0),d1
move.w (a0),d2
lsl.w #4,d2
move.w 2(a0),d3
add.w d0,d2
add.w d1,d3
* Croisement?
cmp.w d4,d2
ble ColRF
cmp.w d6,d0
bge ColRF
cmp.w d5,d3
ble ColRF
cmp.w d7,d1
bge ColRF
* Verifie avec le blitter!
movem.l d4-d7/a2/a3,-(sp)
cmp.w d0,d4 * Met le plus a gauche en D0
bge.s ColR1
exg.l d0,d4
exg.l d1,d5
exg.l d2,d6
exg.l d3,d7
exg.l a1,a3
exg.l a0,a2
ColR1: cmp.w d5,d1
bge.s ColR5
move.w d5,-(sp)
sub.w d1,(sp)
clr.w -(sp)
ColR2: cmp.w d3,d7
bge.s ColR3
move.w d7,-(sp)
bra.s ColR4
ColR3: move.w d3,-(sp)
ColR4: sub.w d5,(sp)
bra.s ColR7a
ColR5: clr.w -(sp)
move.w d1,-(sp)
sub.w d5,(sp)
cmp.w d3,d7
bge.s ColR6
move.w d7,-(sp)
bra.s ColR7
ColR6: move.w d3,-(sp)
ColR7: sub.w d1,(sp)
ColR7a: move.w d4,d1
sub.w d0,d1
cmp.w d2,d6
bge.s ColR8
move.w d6,d3
bra.s ColR9
ColR8: move.w d2,d3
ColR9: sub.w d4,d3
move.w d1,d0
lsl.w #8,d0
lsl.w #4,d0
move.w d0,BltCon1(a6)
move.w #%0000110011000000,BltCon0(a6)
lsr.w #4,d3
tst.w d0
beq.s ColRA
addq.w #1,d3
ColRA: move.w d3,d4
move.w (sp)+,d0
ble.s ColRF0
lsl.w #6,d0
or.w d0,d4
lsl.w #1,d3
move.w (a0),d0
lsl.w #1,d0
; addq.w #2,d0
move.w d0,d6
sub.w d3,d0
move.w d0,BltModA(a6)
move.w (a2),d0
lsl.w #1,d0
; addq.w #2,d0
move.w d0,d5
sub.w d3,d0
move.w d0,BltModB(a6)
mulu (sp)+,d5
lea 4(a3,d5.w),a3
move.l a3,BltAdB(a6)
move.w d1,d0
lsr.w #4,d0
lsl.w #1,d0
mulu (sp)+,d6
add.w d0,d6
lea 4(a1,d6.w),a1
move.l a1,BltAdA(a6)
move.w #-1,BltMaskD(a6)
and.w #$000F,d1
lsl.w #1,d1
lea MCls(pc),a1
move.w 0(a1,d1.w),BltMaskG(a6)
move.w d4,BltSize(a6)
movem.l (sp)+,d4-d7/a2/a3
ColRW: bsr BlitWait
btst #13,DmaConR(a6)
rts
* Yapa collision!
ColRF: moveq #1,d0
rts
* Yapa special!
ColRF0: addq.l #4,sp
ColRF1: movem.l (sp)+,d4-d7/a2/a3
moveq #1,d0
rts
***********************************************************
* BOB COLLIDE
* D1= Numero du bob
* D2= Debut a explorer (Bit 31===> TO SPRITE)
* D3= Fin a explorer
BbColl: movem.l a2-a6/d2-d7,-(sp)
lea Circuits,a6
bsr OwnBlit
lea T_TColl(a5),a0
clr.l (a0)+
clr.l (a0)+
clr.l (a0)+
clr.l (a0)+
clr.l (a0)+
clr.l (a0)+
clr.l (a0)+
clr.l (a0)+
moveq #0,d7
move.l T_SprBank(a5),d0
beq BbColX
move.l d0,a4
bsr BobAd
bne BbColX
* Coordonnees du bob a tester!
move.l a1,a2
tst.b BbAct(a2)
bmi BbColX
move.w d1,a0
move.l BbEc(a2),d1
move.w BbX(a2),d4
move.w BbY(a2),d5
move.w BbI(a2),d0
and.w #$3FFF,d0
beq BbColX
cmp.w (a4),d0
bhi BbColX
lsl.w #3,d0
lea -8+2(a4,d0.w),a2
move.l 4(a2),d0
ble BbColX
move.l d0,a3
move.l (a2),d0
beq BbColX
move.l d0,a2
move.w 6(a2),d0
lsl.w #2,d0
asr.w #2,d0
sub.w d0,d4
sub.w 8(a2),d5
move.w d4,d6
move.w d5,d7
move.w (a2),d0
lsl.w #4,d0
add.w d0,d6
add.w 2(a2),d7
btst #31,d2
bne GoToSp
exg.l a0,a5
move.l T_BbDeb(a0),d0
lea T_TColl(a0),a0
******* Explore la table des bobs!
BbCol1: move.l d0,a1
move.w BbNb(a1),d0
cmp.w d2,d0
bcs.s BbColN
cmp.w d3,d0
bhi.s BbColX
cmp.w a5,d0
beq.s BbColN
cmp.l BbEc(a1),d1
bne.s BbColN
tst.b BbAct(a1)
bmi.s BbColN
movem.l d0-d3/a0/a1,-(sp)
move.w BbX(a1),d0
move.w BbY(a1),d1
move.w BbI(a1),d2
bsr ColRout
movem.l (sp)+,d0-d3/a0/a1
bne.s BbColN
swap d2
and.w #$00FF,d0
move.w d0,d2
lsr.w #3,d0
and.w #$7,d2
bset d2,0(a0,d0.w)
bset #31,d7
swap d2
BbColN: move.l BbNext(a1),d0
bne.s BbCol1
******* Fini!
BbColX: bsr DOwnBlit
btst #31,d7
bne.s BbColT
moveq #0,d0
bra.s BbColXx
BbColT moveq #-1,d0
BbColXx movem.l (sp)+,a2-a6/d2-d7
rts
******* Conversion---> HARD
GoToSp: movem.w d2-d3,-(sp)
move.l d1,a0
sub.w d4,d6
sub.w d5,d7
move.w d4,d1
move.w d5,d2
bsr CXyS
move.w d1,d4
move.w d2,d5
add.w d4,d6
add.w d5,d7
movem.w (sp)+,d2-d3
moveq #-1,d1
bra BbToSp
IFEQ EZFlag
***********************************************************
* SPRITE COLLIDE
* D1= Numero du sprite
* D2= Debut a explorer
* D3= Fin a explorer
SpColl: movem.l a2-a6/d2-d7,-(sp)
lea Circuits,a6
bsr OwnBlit
lea T_TColl(a5),a0
clr.l (a0)+
clr.l (a0)+
clr.l (a0)+
clr.l (a0)+
clr.l (a0)+
clr.l (a0)+
clr.l (a0)+
clr.l (a0)+
moveq #0,d7
move.l T_SprBank(a5),d0
beq BbColX
move.l d0,a4
* Coordonnees du sprite a tester!
cmp.w #64,d1
bcc BbColX
lea T_HsTAct(a5),a2
move.w d1,d0
lsl.w #3,d0
add.w d0,a2
move.w 2(a2),d4
move.w 4(a2),d5
move.w 6(a2),d0
and.w #$3FFF,d0
beq BbColX
cmp.w (a4),d0
bhi BbColX
lsl.w #3,d0
lea -8+2(a4,d0.w),a2
move.l 4(a2),d0
ble BbColX
move.l d0,a3
move.l (a2),d0
beq BbColX
move.l d0,a2
move.w 6(a2),d0
lsl.w #2,d0
asr.w #2,d0
sub.w d0,d4
sub.w 8(a2),d5
move.w d4,d6
move.w d5,d7
move.w (a2),d0
lsl.w #4,d0
add.w d0,d6
add.w 2(a2),d7
btst #31,d2
bne SpToBb
ENDC
BbToSp: cmp.w #64,d3
bcc BbColX
cmp.w d2,d3
bcs BbColX
lea T_TColl(a5),a0
lea T_HsTAct(a5),a1
move.w d2,d0
lsl.w #3,d2
add.w d2,a1
move.w d3,a5
******* Explore la table des sprites!
SpCol1: cmp.w d1,d0
beq.s SpColN
tst.w (a1)
bmi.s SpColN
move.w 6(a1),d2
ble.s SpColN
movem.l d0/d1/a0/a1,-(sp)
move.w 2(a1),d0
move.w 4(a1),d1
bsr ColRout
movem.l (sp)+,d0/d1/a0/a1
bne.s SpColN
move.w d0,d2
move.w d0,d3
lsr.w #3,d2
and.w #$7,d3
bset d3,0(a0,d2.w)
bset #31,d7
SpColN: addq.w #1,d0
addq.l #8,a1
cmp.w a5,d0
bls.s SpCol1
bra BbColX
******* Fin de SPRITE/BOB
SpToBb: move.l T_BbDeb(a5),d0
lea T_TColl(a5),a5
SbCol1: move.l d0,a1
move.w BbNb(a1),d0
cmp.w d2,d0
bcs SbColN
cmp.w d3,d0
bhi BbColX
tst.b BbAct(a1)
bmi SbColN
movem.l d0/d2/d3/a1,-(sp)
move.l BbEc(a1),a0
move.w BbX(a1),d1
move.w BbY(a1),d2
bsr CXyS
move.w d1,d0
move.w d2,d1
move.w BbI(a1),d2
bsr ColRout
movem.l (sp)+,d0/d2/d3/a1
bne.s SbColN
and.w #$00FF,d0
move.w d0,d1
lsr.w #3,d0
and.w #$7,d1
bset d1,0(a5,d0.w)
bset #31,d7
SbColN: move.l BbNext(a1),d0
bne.s SbCol1
bra BbColX
***********************************************************
* =COLL(n) ramene la collision d'un bob/sprite
GetCol: lea T_TColl(a5),a0
tst.l d1
bmi.s GetC2
and.w #$FF,d1
move.w d1,d0
lsr.w #3,d0
and.w #$7,d1
btst d1,0(a0,d0.w)
bne.s GetC1
GetC0: moveq #0,d0
rts
GetC1: moveq #-1,d0
rts
* Ramene le premier en collision
GetC2: neg.l d1
cmp.l #255,d1
bcc.s GetC0
move.w d1,d0
lsr.w #3,d0
add.w d0,a0
move.l d1,d0
and.w #7,d1
.loop btst d1,(a0)
bne.s .found
addq.w #1,d0
addq.w #1,d1
cmp.w #8,d1
bcs.s .loop
moveq #0,d1
addq.l #1,a0
cmp.w #256,d0
bcs.s .loop
bra.s GetC0
.found rts
***********************************************************
* HOT SPOT!
* A2= descripteur
* D1= Mode
* D2= Dx
* D3= Dy
SpotH: move.l (a2),d0
beq.s SpoE
move.l d0,a1
tst.w d1
beq.s Spo4
******* Mode FIXE!
move.w (a1),d2
lsl.w #4,d2
move.w 2(a1),d3
subq.w #1,d1
* En X
move.w d1,d0
lsr.w #4,d0
and.w #3,d0
subq.w #1,d0
bhi.s Spo2
beq.s Spo1
moveq #0,d2
Spo1: lsr.w #1,d2
* En Y
Spo2: and.w #3,d1
subq.w #1,d1
bhi.s Spo4
beq.s Spo3
moveq #0,d3
Spo3: lsr.w #1,d3
* Poke, en respectant les FLAGS!
Spo4: and.w #$C000,6(a1)
and.w #$3FFF,d2
or.w d2,6(a1)
move.w d3,8(a1)
moveq #0,d0
rts
SpoE: moveq #-1,d0
rts
***********************************************************
* GET BOB/BLOC
* A1= Ecran
* A2= descripteur
* D2/D3= X1/Y1
* D4/D5= TX/TY
* D6= X2
GetBob: movem.l d1-d7/a0-a6,-(sp)
move.l a1,a5
* Masque droite
move.w d4,d6
and.w #$000F,d6
lsl.w #1,d6
move.w d6,a4
* Taille en octets!
move.w EcNPlan(a5),d7
add.w #15,d4
lsr.w #4,d4
move.w d4,d6
lsl.w #1,d6
move.w d6,d1
mulu d5,d1
mulu d7,d1
******* Efface l'ancien???
move.l (a2),d0
beq.s GtBb1
move.l d0,a1 * Efface le bob
move.w (a1),d0
lsl.w #1,d0
mulu 2(a1),d0
mulu 4(a1),d0
cmp.l d0,d1
beq.s GtBb1
add.l #10,d0
bsr FreeMm
clr.l (a2)
GtBb1: move.l 4(a2),d0
ble.s GtBb2
move.l d0,a1
move.l (a1),d0
bsr FreeMm
GtBb2 clr.l 4(a2)
******* Reserve le mouveau
tst.l (a2)
bne.s GtBb3
move.l d1,d0
add.l #10,d0
bsr ChipMm2
beq GtBbE
move.l d0,(a2)
******* Ca y est!
GtBb3: move.l (a2),a2
move.w d4,(a2)+
move.w d5,(a2)+
move.w d7,(a2)+
clr.w (a2)+
clr.w (a2)+
******* GETTE!
lea Circuits,a6
bsr OwnBlit
subq.w #1,d7
move.w d2,d0
and.w #$000F,d0
bne.s GtBc
******* Au mot!
moveq #-1,d1
move.w d1,BltMaskG(a6)
move.w a4,d0
beq.s GtBbM
lea MCls(pc),a0
move.w 0(a0,d0.w),d1
not.w d1
GtBbM: move.w d1,BltMaskD(a6)
move.w EcTLigne(a5),d1
mulu d1,d3
lsr.w #4,d2
lsl.w #1,d2
ext.l d2
add.l d2,d3
lea EcCurrent(a5),a1
sub.w d6,d1
move.w d1,BltModA(a6)
move.l a2,BltAdD(a6)
clr.w BltModD(a6)
lsl.w #6,d5
or.w d5,d4
move.w #%0000100111110000,BltCon0(a6)
clr.w BltCon1(a6)
GtBb5: move.l (a1)+,a0
add.l d3,a0
move.l a0,BltAdA(a6)
move.w d4,BltSize(a6)
GtBb6: bsr BlitWait
dbra d7,GtBB5
bra GtBbX
******* Au pixel!
GtBc: move.w #%0000010111001100,BltCon0(a6)
moveq #16,d1
sub.w d0,d1
moveq #12,d0
lsl.w d0,d1
move.w d1,BltCon1(a6)
move.w EcTligne(a5),d1
ext.l d1
mulu d1,d3
lsr.w #4,d2
lsl.w #1,d2
ext.l d2
add.l d2,d3
lea EcCurrent(a5),a1
subq.l #2,a2
addq.w #1,d4
or.w #%0000000001000000,d4
subq.w #1,d5
ext.l d6
move.w a4,d2
lea MCls(pc),a0
move.w 0(a0,d2.w),d2
bmi.s GtBc1
not.w d2
GtBc1: move.l (a1)+,a0
add.l d3,a0
move.w d5,d0
GtBc2: move.l a0,BltAdB(a6)
move.w (a2),a4
move.l a2,BltAdD(a6)
move.w d4,BltSize(a6)
move.l a2,a5
add.l d1,a0
add.l d6,a2
GtBc3: bsr BlitWait
move.w a4,(a5)
and.w d2,(a2)
dbra d0,GtBc2
dbra d7,GtBc1
******* FINI! Pas d'erreur
GtBbX: bsr DOwnBlit
movem.l (sp)+,d1-d7/a0-a6
moveq #0,d0
rts
******* Out of mem
GtBbE: movem.l (sp)+,d1-d7/a0-a6
moveq #-1,d0
rts
***********************************************************
* INITIALISATION BOBS / D0= Nombre de bobs!
BbInit:
********
clr.l T_BbDeb(a5)
* Efface ce qui etait reserve
move.w d0,-(sp)
bsr BbEnd
move.w (sp)+,d1
* Reserve la memoire pour les tables priorites
move.w d1,T_BbMax(a5)
ext.l d1
lsl.w #2,d1
move.l d1,d0
bsr FastMm
beq GFatal
move.l d0,T_BbPrio(a5)
move.l d1,d0
bsr FastMm
beq GFatal
move.l d0,T_BbPrio2(a5)
moveq #0,d0
rts
***********************************************************
* FIN DES BOBS
BbEnd:
*******
move.w T_BbMax(a5),d1
ext.l d1
lsl.l #2,d1
move.l T_BbPrio(a5),d0
beq.s BOBE1
move.l d0,a1
move.l d1,d0
bsr FreeMm
BOBE1: move.l T_BbPrio2(a5),d0
beq.s BOBE2
move.l d0,a1
move.l d1,d0
bsr FreeMm
BOBE2: moveq #0,d0
rts
***********************************************************
* BOB X/Y
BobXY: bsr BobAd
bne.s BobxyE
move.w BbX(a1),d1
move.w BbY(a1),d2
move.w BbI(a1),d3
moveq #0,d0
BobxyE: rts
***********************************************************
* PATCH BOB / ICON
* Dessine simplement un bob/icon
* A1- Buffer de calcul
* A2- Descripteur bob/icon
* D1- Image retournee???
* D2/D3- Coordonnees
* D4- Minterms (0 si rien)
* D5- APlan
TPatch
movem.l d1-d7/a0-a6,-(sp)
move.l a1,a4
* Va retourner le bob
move.l a2,a0
move.w d1,d0
and.w #$C000,d0
bsr Retourne
* Parametres de l'ecran courant
move.l T_EcCourant(a5),a0 * Calculssss
move.w EcClipX0(a0),d0
and.w #$FFF0,d0
move.w d0,BbLimG(a4)
move.w EcClipY0(a0),BbLimH(a4)
move.w EcClipX1(a0),d0
add.w #15,d0
and.w #$FFF0,d0
move.w d0,BbLimD(a4)
move.w EcClipY1(a0),BbLimB(a4)
tst.w d4
beq.s Patch1
and.w #$00FF,d4
bset #15,d4
Patch1 move.w d4,BbACon(a4)
move.w d5,BbAPlan(a4)
move.l a0,BbEc(a4)
exg.l d3,d1
bset #31,d3 * Flag PAS POINT CHAUD!
bsr BobCalc
bne.s PatchO
* Gestion de l'autoback
move.l T_EcCourant(a5),a0
tst.w EcAuto(a0)
beq.s Patch2
bsr TAbk1
bsr PBobA
bsr TAbk2
bsr PBobA
bsr TAbk3
bra.s PatchO
Patch2 bsr PBobA
* Fini!
PatchO moveq #0,d0
movem.l (sp)+,d1-d7/a0-a6
rts
* Appelle la routine d'affichage
PBobA lea Circuits,a6
bsr OwnBlit
move.w BbASize(a4),d2
move.w BbTPlan(a4),d4
ext.l d4
move.l BbAData(a4),a0
move.l BbEc(a4),a3
lea EcCurrent(a3),a3
move.w BbAModD(a4),d0
move.w d0,BltModC(a6)
move.w d0,BltModD(a6)
move.l BbADraw(a4),a2
move.l BbAMask(a4),d5
jsr (a2)
bsr BlitWait
bra DOwnBlit
***********************************************************
* CREATION / CHANGEMENT D'UN BOB
* D1= Numero du CANAL
* D2= X
* D3= Y
* D4= Image
* D5= MODE DECOR
* D6= Plans affiches
* D7= Minterms
BobSet:
********
cmp.w T_BbMax(a5),d1
bcc CreBbS
******* Ecris sur l'ancienne - SI PRESENT -
move.l a1,a0
move.l T_BbDeb(a5),d0
beq.s CreBb1
CreBb0: move.l d0,a1
cmp.w BbNb(a1),d1
beq.s CreBb5
bcs.s CreBb2
move.l BbNext(a1),d0
bne.s CreBb0
* Met a la fin!
bsr ResBOB
bne CreBbE
move.l a1,BbPrev(a0)
move.l a0,BbNext(a1)
move.l a0,a1
bra.s CreBb5
* Au tout debut
CreBb1: bsr ResBOB
bne CreBbE
move.l a0,T_BbDeb(a5)
move.l a0,a1
bra.s CreBb5
* Insere la nouvelle
CreBb2: bsr ResBOB
bne CreBbE
move.l BbPrev(a1),d0
move.l a0,BbPrev(a1)
move.l d0,BbPrev(a0)
bne.s CreBb3
move.l T_BbDeb(a5),d1
move.l a0,T_BbDeb(a5)
bra.s CreBb4
CreBb3: move.l d0,a2
move.l BbNext(a2),d1
move.l a0,BbNext(a2)
CreBb4: move.l d1,BbNext(a0)
move.l a0,a1
* Poke les coordonnees
CreBb5: move.l #EntNul,d7
move.b BbAct(a1),d6
bmi.s CreBb9
cmp.l d7,d2
beq.s CreBb6
move.w d2,BbX(a1)
bset #1,d6
CreBb6: cmp.l d7,d3
beq.s CreBb7
move.w d3,BbY(a1)
bset #2,d6
CreBb7: cmp.l d7,d4
beq.s CreBb8
move.w d4,BbI(a1)
bset #0,d6
CreBb8: move.b d6,BbAct(a1)
* Doit actualiser les bob
CreBb9: bset #BitBobs,T_Actualise(a5)
moveq #0,d0
rts
******* Erreur!
CreBbS: moveq #1,d0
CreBbE: tst.w d0
rts
******* CREATION DE LA TABLE!
ResBOB: move.l #BbLong,d0
bsr FastMm
beq.s ResBErr
move.l d0,a0
move.w d1,BbNb(a0)
move.l T_EcCourant(a5),a2
move.l a2,BbEc(a0)
move.w EcTx(a2),BbLimD(a0)
move.w EcTy(a2),BbLimB(a0)
move.w d6,BbAPlan(a0)
and.w #$00FF,d7
beq.s ResBb0
bset #15,d7
ResBb0 move.w d7,BbACon(a0)
move.w #$01,BbDecor(a0)
btst #BitDble,EcFlags(a2)
beq.s ResBb1
addq.w #1,BbDecor(a0)
move.w #Decor,BbDCur2(a0)
ResBb1: tst.w d5
bpl.s ResBb2
clr.w BbDecor(a0)
ResBb2: move.w d5,BbEff(a0)
moveq #0,d0
rts
* Erreur memoire!
ResBErr moveq #-1,d0
rts
***********************************************************
* BOB OFF d1=#
BobOff:
*******
move.l T_BbDeb(a5),d0
beq.s DBb2
DBb1: move.l d0,a1