/[projet1]/public/atari/tools/MOULINEX/PLAYMODE.S
Defence Force logotype

Contents of /public/atari/tools/MOULINEX/PLAYMODE.S

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1389 - (show annotations)
Tue Mar 7 19:16:33 2017 UTC (2 years, 7 months ago) by dbug
File size: 14683 byte(s)
Added Moulinex, old tool to convert MOD files to LOW format and vice versa
1 fin_ech = 800 * attente apres la fin du sample
2 nb_oct = 205 * nb d'octet joue par vbl
3 opt w-,o+,d+
4 rsreset
5 note rs.l 1
6 adr_debut_sample rs.l 1
7 adr_fin_sample rs.l 1
8 adr_fin_sample_bis rs.l 1
9 adr_debut_boucle rs.l 1
10 adr_fin_boucle rs.l 1
11 lenght_boucle rs.l 1 *x2
12 lenght_boucle_bis rs.l 1 *x2
13 lenght_intrument rs.l 1
14 frq rs.l 1
15 * .w
16 nnote rs.w 1
17 volume rs.w 1
18 instrument rs.b 1
19 commande rs.b 1
20 parametre_commande rs.b 1
21 rs.b 1
22 lenght_pack=__rs
23
24 test_carte
25 move.b $fffb0001,d7
26 move.b d7,d6
27 and.b #$f0,d6
28 cmp.b #$70,d6
29 bne.s testbat
30 move.b #1,streplay
31 move.b #0,bat
32 bra.s fin_test_select
33 testbat
34 cmp.b #$ff,d7 * bat
35 beq.s monitor_outpout
36 move.b #0,streplay
37 move.b #1,bat
38 bra.s fin_test_select
39 monitor_outpout * moniteur
40 move.b #0,streplay
41 move.b #0,bat
42 fin_test_select
43 rts
44
45
46 joue_strk
47 clr rout
48 * init buffer
49 move.l #buffer,d0
50 move.l d0,buffer1
51 move.l d0,a0
52 add.l #nb_oct*2,d0
53 move.l d0,buffer2
54 move.l d0,adr_replay
55
56 move #nb_oct-1,d0
57 .clear
58 clr.w (a0)+
59 dbra d0,.clear
60
61 * on clear des pointeur
62 lea info_voie_1,a1
63 bsr net_voice
64 lea info_voie_2,a1
65 bsr net_voice
66 lea info_voie_3,a1
67 bsr net_voice
68 lea info_voie_4,a1
69 bsr net_voice
70
71 lea modfile,a0
72 bsr init_pointeur
73
74 move sr,-(sp)
75 move #$2700,sr
76 move.l $70.w,s_70
77 move.l #vbl,$70.w
78 move.b $fffffa07.w,s_smfp
79 move.b $fffffa09.w,s_smfp+1
80 move.b $fffffa13.w,s_smfp+2
81 move.b $fffffa17.w,s_smfp+3
82
83 * init yamaha ...
84 lea $ffff8800.w,a0
85 move.l #00000000,(a0)
86 move.l #01000000,(a0)
87 move.l #02000000,(a0)
88 move.l #03000000,(a0)
89 move.l #04000000,(a0)
90 move.l #05000000,(a0)
91 move.l #06000000,(a0)
92 move.b #7,(a0)
93 move.b 2(a0),sym
94 move.b #$ff,2(a0)
95
96 move.b #1,$fffffa19.w
97 move.b #60,$fffffa1f.w
98 bclr #3,$fffffa17.w
99 or.b #$20,$fffffa07.w
100 or.b #$20,$fffffa13.w
101 move.l #Routine_timer_a,$134.w
102 move (sp)+,sr
103 rts
104
105
106 stop_strk
107 move sr,-(sp)
108 move.w #$2700,sr
109 move.l s_70,$70.w
110 lea $ffff8800.w,a0
111 move.b #7,(a0)
112 move.b sym,2(a0)
113 lea s_smfp,a0
114 move.b (a0)+,$fffffa07.w
115 move.b (a0)+,$fffffa09.w
116 move.b (a0)+,$fffffa13.w
117 move.b (a0)+,$fffffa17.w
118 move (sp)+,sr
119 rts
120
121 net_voice
122 clr.w (a1)
123 move.l #sample_nul,adr_debut_sample(a1)
124 move.l #sample_nul+fin_ech,adr_fin_sample(a1)
125 move.l #sample_nul+fin_ech,adr_fin_sample_bis(a1)
126 move.l #sample_nul,adr_debut_boucle(a1)
127 move.l #sample_nul+fin_ech,adr_fin_boucle(a1)
128 clr.l lenght_boucle_bis(a1)
129 clr.l lenght_boucle(a1)
130 clr.b instrument(a1)
131 clr.w volume(a1)
132 clr.b commande(a1)
133 clr.b parametre_commande(a1)
134 rts
135
136 * code
137
138 init_pointeur
139
140
141 * format a l'instant du .low:
142 * 4 octets "OLLH"
143 * 2 octets nb de d'intruments (x)
144 * x*16 les intruments......
145 * 2 octets longueur en mots
146 * 2 octets volume
147 * 2 octets offset pour la boucle en mots aussi
148 * 2 octets longueur de la boucle en mots aussi
149 * si 1 alors pas boucle .......
150 * 1 octet nb d'octets ds la partition des patern (x) ki suit
151 * x chaque octet represente le numero du pattern a jouer
152 * on met aune adr paire
153 * pattern puis sample... la pas de probleme.....
154
155 lea modfile,a0
156 cmp.l #"OLLH",(a0)+
157 beq.s .okmen
158 illegal
159 .okmen
160
161 move.w (a0)+,d0
162 move d0,d1
163 lsl #4,d1
164 lea modfile+6,a1
165 adda.w d1,a1
166 moveq #0,d1
167 move.b (a1)+,d1
168 move d1,nb_max_positions
169 move.l a1,adr_positions_pattern
170 moveq #0,d2
171 move.b (a1),d2
172 subq #1,d1
173 moveq #0,d3
174 .boch
175 move.b (a1)+,d3
176 cmp d2,d3
177 ble.s .boch1
178 move d3,d2
179 .boch1
180 dbra d1,.boch
181
182 move.l a1,d1
183 and.w #$fffe,d1
184 addq.l #2,d1
185 move.l d1,a1
186 *
187 move.l a1,adr_contenu_pattern
188
189 * d2 n max de pattern
190 addq.l #1,d2
191 swap d2
192 lsr.l #6,d2
193 add.l a1,d2
194
195 lea adr_buffer_debut_sample,a1
196 lea buffer_fin_sample,a2
197 lea modfile+6,a0
198 subq #1,d0
199 move d0,d7
200 take_instruments_sample_adr
201 move.l d2,(a1)+ * met l'adresse du sample de l'intruments ds le buffer
202 add.l (a0),d2 *pointe sur la longueur de l'intrument en mots
203 move.l d2,(a2)+
204 tst.b 14(a0)
205 beq.s .rin
206 add.l #fin_ech,d2
207 .rin
208 lea 16(a0),a0
209 dbra d0,take_instruments_sample_adr
210
211 * adr debut des samples
212 * adr fin des samples
213
214
215 lea offset_sur_position_pattern,a0
216 clr (a0)
217 moveq #0,d1
218 move.b (a1)+,d1
219 move.l adr_positions_pattern,a1
220 swap d1
221 lsr.l #6,d1
222 ;* mulu #1024,d1
223 add.l adr_contenu_pattern,d1
224 move.l d1,adr_positions_pattern_courante
225 ;* multiplie par 1024
226
227
228 clr.w offset_ds_pattern
229 clr.w compteur_vbl
230 move.w #6,vitesse
231
232 lea sample_nul,a2
233 move.l a2,a3
234 move #fin_ech-1,d0
235 .loop
236 move.w #$7f7f,(a3)+
237 dbra d0,.loop
238
239
240 move.l a2,a3 * a2 voie 1
241 move.l a3,a4 * a3 voie 2
242 move.l a4,a5 * a4 voie 3
243 * a5 voie 4
244 movem.l a2-a5,registre
245 rts
246
247
248 routimer
249 dc.l calc_digit0,calc_digit1
250
251 vbl
252 movem.l d0-a6,-(sp)
253
254 move rout,d0
255 move.l routimer(pc,d0.w),a0
256 jsr (a0)
257
258 bsr gere_voi_3_4
259 lea compteur_vbl,a0
260 addq #1,(a0)
261 move (a0),d0
262 cmp.w vitesse,d0
263 beq gestion_module
264 * pas de gestion...
265
266 lea info_voie_1,a1
267 tst.b parametre_commande(a1)
268 beq.s effet_vbl_voi1
269 bsr.s gere_effet_vbl
270 effet_vbl_voi1
271
272 lea info_voie_2,a1
273 tst.b parametre_commande(a1)
274 beq.s effet_vbl_voi2
275 bsr.s gere_effet_vbl
276 effet_vbl_voi2
277
278 lea info_voie_3,a1
279 tst.b parametre_commande(a1)
280 beq.s effet_vbl_voi3
281 bsr.s gere_effet_vbl
282 effet_vbl_voi3
283
284 lea info_voie_4,a1
285 tst.b parametre_commande(a1)
286 beq.s effet_vbl_voi4
287 bsr.s gere_effet_vbl
288 effet_vbl_voi4
289
290 movem.l (sp)+,d0-a6
291 move.l s_70,-(sp)
292 rts
293
294
295 gere_effet_vbl
296 rts
297
298 moveq #0,d0
299 move.b commande(a1),d0
300 cmp #1,d0
301 beq portamento_up
302 cmp #2,d0
303 beq portamento_down
304 rts
305
306
307 portamento_up
308 rts
309
310 portamento_down
311 rts
312
313
314 decrypte_mod_voie
315 move.l d2,a0
316 addq.l #4,d2
317 *
318 move.b (a0)+,commande(a1)
319 move.b (a0)+,parametre_commande(a1)
320 *
321 move.b (a0)+,d1
322 move.b (a0)+,d0
323 *
324 lea tfreq,a0
325 move d0,nnote(a1)
326 add d0,d0
327 add d0,d0
328 adda.w d0,a0
329 move.l (a0),frq(a1)
330 *
331 tst.b d1
332 beq info_intrument_non_change
333 *
334 move.l (a0),(a1)
335 *
336 and #$1f,d1
337 subq #1,d1
338 move.b d1,instrument(a1)
339 move d1,d0
340 add d1,d1
341 add d1,d1
342 lea adr_buffer_debut_sample,a0
343 move.l (a0,d1.w),adr_debut_sample(a1)
344 move.l 31*4(a0,d1.w),adr_fin_sample(a1)
345 *
346 lsl #4,d0 * 8 octets par instruments
347 lea modfile+6,a0
348 adda.w d0,a0
349 move.l (a0),lenght_intrument(a1)
350 *
351 move.l 6(a0),d1
352 add.l adr_debut_sample(a1),d1
353 move.l d1,adr_debut_boucle(a1)
354 move.l d1,adr_fin_boucle(a1)
355 *
356 move.w 4(a0),volume(a1)
357 *
358 move.l 10(a0),d1 *lenght boucle/2
359 move.l d1,lenght_boucle(a1)
360 add.l d1,adr_fin_boucle(a1)
361 *
362 info_intrument_non_change
363 * test commande
364 moveq #0,d0
365 move.b commande(a1),d0 * octet de commande
366
367 cmp.b #$b,d0
368 beq.s commande_jump
369 cmp.b #$c,d0
370 beq.s commande_set_volume
371 cmp.b #$d,d0
372 beq.s commande_break_pattern
373 cmp.b #$f,d0
374 beq commande_set_vitesse
375 rts
376
377 commande_jump
378 move.b parametre_commande(a1),d0
379 lea offset_sur_position_pattern,a0
380 move.w d0,(a0)
381 move.l adr_positions_pattern,a1
382 adda.w d0,a1
383 moveq #0,d1
384 move.b (a1),d1
385 swap d1
386 lsr.l #6,d1
387 ;* mulu #1024,d1
388 add.l adr_contenu_pattern,d1
389 move.l d1,adr_positions_pattern_courante
390 ;* multiplie par 1024
391 rts
392
393 commande_set_volume
394 ; perhaps another time
395 moveq #0,d0
396 move.b parametre_commande(a1),d0
397 tst.b d0
398 bne mt_back
399 move.l #sample_nul,adr_debut_sample(a1)
400 move.l #sample_nul+fin_ech,adr_fin_sample(a1)
401 clr.l lenght_boucle_bis(a1)
402 rts
403
404 commande_break_pattern
405 lea offset_sur_position_pattern,a0
406 move (a0),d0
407 addq #1,d0
408 cmp nb_max_positions,d0
409 blt.s ok_pas_fin_mus
410 clr d0
411 ok_pas_fin_mus
412 move d0,(a0)
413 move.l adr_positions_pattern,a1
414 adda.w d0,a1
415 moveq #0,d1
416 move.b (a1),d1
417 swap d1
418 lsr.l #6,d1
419 ;* mulu #1024,d1
420 add.l adr_contenu_pattern,d1
421 move.l d1,adr_positions_pattern_courante
422 ;* multiplie par 1024
423 rts
424
425 commande_set_vitesse
426 move.b parametre_commande(a1),d0
427 and.b #$f,d0
428 beq.s mt_back
429 clr.w compteur_vbl
430 move d0,vitesse
431 mt_back
432 rts
433
434
435
436
437
438
439 Routine_timer_a
440 move.l a0,-(sp)
441 move.l d0,-(sp)
442 move.l adr_replay(pc),a0
443 addq.l #2,adr_replay
444 move.w (a0)+,d0
445 and.w #$fffc,d0
446 add d0,d0
447 lea $ffff8800.w,a0
448 move.l digitab(pc,d0.w),(a0)
449 move.l digitab+4(pc,d0.w),d0
450 movep.l d0,(a0)
451 move.l (sp)+,d0
452 move.l (sp)+,a0
453 rte
454 * pour gagner du temps kelkes variable vont etre ici !
455 adr_replay ds.l 1
456 digitab incbin digital.bin
457 even
458
459
460 ************** routine 5 Khz
461
462
463
464
465 calc_digit1
466 movem.l registre,a2-a5
467 * on echange les buffers
468 move.l buffer2,a6
469 move.l buffer1,d1
470 move.l d1,buffer2
471 move.l a6,buffer1
472 move.l d1,adr_replay
473 *
474 opt d-,o-
475 moveq #0,d7
476 moveq #0,d1
477 move.b #120,$fffffa1f.w *5Khz
478 bra calc_digit
479
480
481
482 calc_digit0
483 move.b #60,$fffffa1f.w *10Khz
484 movem.l registre,a2-a5
485 * on echange les buffers
486 move.l buffer2,a6
487 move.l buffer1,d1
488 move.l d1,buffer2
489 move.l a6,buffer1
490 move.l d1,adr_replay
491 *
492 opt d-,o-
493 moveq #0,d7
494 moveq #2-1,d1
495
496 calc_digit
497
498 voic1 = *+2
499 move.b 0(a2),d7
500 move.w d7,d6
501 voic2 = *+2
502 move.b 0(a3),d7
503 add.w d7,d6
504 voic3 = *+2
505 move.b 0(a4),d7
506 add.w d7,d6
507 voic4 = *+2
508 move.b 0(a5),d7
509 add.w d7,d6
510 move d6,(a6)+
511 fvoice equ 2+(*-voic1)
512
513 loop_sound
514
515 rept 103-2
516 move.b 0(a2),d7
517 move.w d7,d6
518 move.b 0(a3),d7
519 add.w d7,d6
520 move.b 0(a4),d7
521 add.w d7,d6
522 move.b 0(a5),d7
523 add.w d7,d6
524 move d6,(a6)+
525 endr
526
527
528 ajvoic1 = *+2
529 lea 0(a2),a2
530 ajvoic2 = *+2
531 lea 0(a3),a3
532 ajvoic3 = *+2
533 lea 0(a4),a4
534 ajvoic4 = *+2
535 lea 0(a5),a5
536
537 move.b (a2),d7
538 move.w d7,d6
539 move.b (a3),d7
540 add.w d7,d6
541 move.b (a4),d7
542 add.w d7,d6
543 move.b (a5),d7
544 add.w d7,d6
545 move d6,(a6)+
546
547 dbra d1,loop_sound
548
549
550 fin_calc
551 opt d+,o+
552
553 lea info_voie_1,a6
554 cmp.l adr_fin_sample_bis(a6),a2
555 blt.s no_ini1
556 tst.l lenght_boucle_bis(a6)
557 beq.s nul1
558 sub.l lenght_boucle_bis(a6),a2
559 bra.s no_ini1
560 nul1
561 move.l #sample_nul,a2
562 move.l #sample_nul+fin_ech,adr_fin_sample_bis(a6)
563 clr.l lenght_boucle_bis(a6)
564 no_ini1
565
566
567 lea info_voie_2,a6
568 cmp.l adr_fin_sample_bis(a6),a3
569 blt.s no_ini2
570 tst.l lenght_boucle_bis(a6)
571 beq.s nul2
572 sub.l lenght_boucle_bis(a6),a3
573 bra.s no_ini2
574 nul2
575 move.l #sample_nul,a3
576 move.l #sample_nul+fin_ech,adr_fin_sample_bis(a6)
577 clr.l lenght_boucle_bis(a6)
578 no_ini2
579
580 lea info_voie_3,a6
581 cmp.l adr_fin_sample_bis(a6),a4
582 blt.s no_ini3
583 tst.l lenght_boucle_bis(a6)
584 beq.s nul3
585 sub.l lenght_boucle_bis(a6),a4
586 bra.s no_ini3
587 nul3
588 move.l #sample_nul,a4
589 move.l #sample_nul+fin_ech,adr_fin_sample_bis(a6)
590 clr.l lenght_boucle_bis(a6)
591 no_ini3
592
593
594 lea info_voie_4,a6
595 cmp.l adr_fin_sample_bis(a6),a5
596 blt.s No_ini4
597 tst.l lenght_boucle_bis(a6)
598 beq.s nul4
599 sub.l lenght_boucle_bis(a6),a5
600 bra.s no_ini4
601 nul4
602 move.l #sample_nul,a5
603 move.l #sample_nul+fin_ech,adr_fin_sample_bis(a6)
604 clr.l lenght_boucle_bis(a6)
605 no_ini4
606
607 movem.l a2-a5,registre
608 rts
609
610
611
612
613
614 gestion_module
615 clr.w (a0)
616
617 moveq #0,d1
618 move offset_ds_pattern,d1
619 add.l adr_positions_pattern_courante,d1
620 move.l d1,d2
621
622 lea info_voie_1,a1
623 bsr decrypte_mod_voie
624
625 lea info_voie_2,a1
626 bsr decrypte_mod_voie
627
628 lea info_voie_3,a1
629 bsr decrypte_mod_voie
630
631 lea info_voie_4,a1
632 bsr decrypte_mod_voie
633
634 gestion_offset_ds_pattern
635 lea offset_ds_pattern,a0
636 add #16,(a0)
637 cmp #64*16,(a0)
638 bne.s pas_new_pattern
639
640 clr (a0)
641 lea offset_sur_position_pattern,a0
642 moveq #0,d0
643 move.w (a0),d1
644 addq.w #1,d1
645 cmp.w nb_max_positions,d1
646 blt.s pas_fin_musike
647 clr.w d1
648 pas_fin_musike
649 move d1,(a0)
650 *
651 move.l adr_positions_pattern,a1
652 adda.w (a0),a1
653 moveq #0,d1
654 move.b (a1),d1
655 swap d1
656 lsr.l #6,d1
657 ;* mulu #1024,d1
658 add.l adr_contenu_pattern,d1
659 move.l d1,adr_positions_pattern_courante
660 ;* multiplie par 1024
661 *
662 pas_new_pattern
663
664 bsr gere_voi_1_2
665
666 movem.l (sp)+,d0-a6
667 move.l s_70,-(sp)
668 rts
669
670
671 gere_voi_1_2
672
673 lea info_voie_1,a1
674 move.l (a1),d0
675 beq fin_gere_voi_1
676 clr.l (a1)
677 move.l adr_debut_sample(a1),registre
678 move.l adr_fin_sample(a1),adr_fin_sample_bis(a1)
679 move.l lenght_boucle(a1),lenght_boucle_bis(a1)
680 move.l d0,a0
681 lea voic1,a2
682 x set 0
683 rept 103-1
684 move (a0)+,x(a2)
685 x set x+fvoice
686 endr
687 move (a0)+,ajvoic1
688 fin_gere_voi_1
689
690
691 lea info_voie_2,a1
692 move.l (a1),d0
693 beq gere_voie_3
694 clr.l (a1)
695 move.l adr_debut_sample(a1),registre+4
696 move.l adr_fin_sample(a1),adr_fin_sample_bis(a1)
697 move.l lenght_boucle(a1),lenght_boucle_bis(a1)
698 move.l d0,a0
699 lea voic2,a2
700 x set 0
701 rept 103-1
702 move (a0)+,x(a2)
703 x set x+fvoice
704 endr
705 move (a0)+,ajvoic2
706 ; bra fin_fgere_voi_2_3_4
707 gere_voie_3
708 rts
709
710
711 gere_voi_3_4
712
713 lea info_voie_3,a1
714 move.l (a1),d0
715 beq gere_la_voie_4
716 clr.l (a1)
717 move.l adr_debut_sample(a1),registre+4*2
718 move.l adr_fin_sample(a1),adr_fin_sample_bis(a1)
719 move.l lenght_boucle(a1),lenght_boucle_bis(a1)
720 move.l d0,a0
721 lea voic3,a2
722 x set 0
723 rept 103-1
724 move (a0)+,x(a2)
725 x set x+fvoice
726 endr
727 move (a0)+,ajvoic3
728 ; bra fin_fgere_voi_2_3_4
729
730 gere_la_voie_4
731
732 lea info_voie_4,a1
733 move.l (a1),d0
734 beq fin_fgere_voi_2_3_4
735 clr.l (a1)
736 move.l adr_debut_sample(a1),registre+4*3
737 move.l adr_fin_sample(a1),adr_fin_sample_bis(a1)
738 move.l lenght_boucle(a1),lenght_boucle_bis(a1)
739 move.l d0,a0
740 lea voic4,a2
741 x set 0
742 rept 103-1
743 move (a0)+,x(a2)
744 x set x+fvoice
745 endr
746 move (a0)+,ajvoic4
747 fin_fgere_voi_2_3_4
748 rts
749
750
751
752
753
754 st_replay
755 lsr.w #1,d6
756 move.b (a6,d6.w),d6
757 rte
758
759 carte_bat
760 add.w d6,d6
761 add.w d6,d6
762 move.b (a6,d6.w),d6
763 rte
764
765 even
766 include tab10315.s
767 even
768
769 tfreq
770 dc.l n0,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19,n20
771 dc.l n21,n22,n23,n24,n25,n26,n27,n28,n29,n30,n31,n32,n33,n34,n35,n36
772
773 even
774 info_voie_1 ds.b lenght_pack
775 even
776 info_voie_2 ds.b lenght_pack
777 even
778 info_voie_3 ds.b lenght_pack
779 even
780 info_voie_4 ds.b lenght_pack
781 even
782
783 offset_sur_position_pattern ds.w 1
784 offset_ds_pattern ds.w 1
785 compteur_vbl ds.w 1
786
787 adr_buffer_debut_sample ds.l 31
788 buffer_fin_sample ds.l 31
789
790 nb_max_positions ds.w 1
791 mt_register ds.l 1
792 position_pattern_courante ds.l 1
793 mt_debpat ds.l 1
794 mt_adrsave ds.l 1
795
796 s_smfp ds.l 1
797 s_70 ds.l 1
798 sym ds.w 1
799 bat ds.b 1
800 streplay ds.b 1
801 vitesse ds.w 1
802 adr_positions_pattern ds.l 1
803 adr_positions_pattern_courante ds.l 1
804 adr_contenu_pattern ds.l 1
805 buffer1 ds.l 1
806 buffer2 ds.l 1
807 adr_car ds.l 1
808 adr_ecr ds.l 1
809 sample_nul ds.w fin_ech
810 registre ds.l 9
811 rout ds.w 1
812 even
813 buffer
814 ds.w nb_oct*2
815

  ViewVC Help
Powered by ViewVC 1.1.26