home *** CD-ROM | disk | FTP | other *** search
/ PC Interdit / pc-interdit.iso / sound / sbmod / mod386.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1994-10-27  |  19.8 KB  |  658 lines

  1. {
  2.  
  3.  ****************************************************************************
  4.  ***                   MICRO APPLICATION PC INTERDIT                      ***
  5.  ***                  ===============================                     ***
  6.  ***                                                                      ***
  7.  ***                      Programme exemple MOD386                        ***
  8.  ***                                                                      ***
  9.  *** Ce programme illustre la mise en oeuvre de l'unité MOD_SB. Il permet ***
  10.  *** d'exécuter des fichiers MOD et VOC. Le lancement de ce programme     ***
  11.  *** sans paramètre, abouti à un menu de sélection qui permet de choisir  ***
  12.  *** un fichier son parmi ceux du répertoire courant. Le paramètre -r     ***
  13.  *** active le mode Repeat. Appuyer alors sur ESC si vous  désirez        ***
  14.  *** sortir du programme.                                                 ***
  15.  ***                                                                      ***
  16.  *** Auteur          : Boris Bertelsons  (InspirE)                        ***
  17.  *** Nom du fichier  : MOD386.PAS                                         ***
  18.  *** Date            : 04.04.1994                                         ***
  19.  *** Version         : 2.0                                                ***
  20.  *** Compilateur     : Turbo Pascal 7                                     ***
  21.  ****************************************************************************
  22.  
  23. }
  24.  
  25.  
  26.  
  27. uses crt,dos,mod_sb,variab,design;
  28.  
  29. { $define polling}
  30. {
  31.  Normalement, la valeur est renvoyée par Timer-Interrupt. Mais s'il vous
  32.  faut synchroniser avec le Retrace horizontal, vous devez utiliser la
  33.  méthode Polling, qui calcule le son d'une façon non-périodique, quand
  34.  elle a le temps. C'est une méthode, plus lente, qui produit une moins
  35.  bonne qualité. Elle peut conduire à des problèmes avec des MOD à
  36.  8 voix. Son utilisation est conséillée, si on ne peut pas faire
  37.  autrement.
  38. }
  39.  
  40. type
  41.   t = record                      { Pour une impression directe sur l'écran }
  42.        c : char;
  43.        a : byte;
  44.      end;
  45.  
  46. const Nummods : byte = 0;
  47.       repeatmode : boolean = false;
  48.  
  49. var gi : integer;
  50.     my_modname : string;
  51.     stapo,stinc : integer;
  52.     ch,dch : char;
  53.     next_song : integer;
  54.     effects : array[1..4] of effect_type;
  55.     Modd : array[1..10] of string;
  56.  
  57. procedure Scala_boxes;
  58. var li : integer;
  59. begin;
  60.   textcolor(1);
  61.   textbackground(black);
  62.   clrscr;
  63.   write(' MOD386  Version 2.0, (c) 1994 MICRO APPLICATION',
  64.           ' Programmeur : Boris Bertelsons (InspirE)');
  65.   textcolor(lightblue);
  66.   for li := 1 to 10 do begin;
  67.     gotoxy(2,li+4);
  68.     write(li:2,'. ',noms_inst[li]);
  69.     gotoxy(28,li+4);
  70.     write(li+10:2,'. ',noms_inst[li+10]);
  71.     gotoxy(54,li+4);
  72.     write(li+20:2,'. ',noms_inst[li+20]);
  73.   end;
  74.   if Voix = 4 then begin;
  75.   textcolor(black);
  76.   textbackground(7);
  77.   writexy(02,16,'╔════════════════════════╦════════════════════'+
  78.                   '═══════════════════════════════╗');
  79.   writexy(02,17,'║                        ║                    '+
  80.                   '                               ║');
  81.   writexy(02,18,'║                        ║                    '+
  82.                   '                               ║');
  83.   writexy(02,19,'║                        ║                    '+
  84.                   '                               ║');
  85.   writexy(02,20,'║                        ║                    '+
  86.                   '                               ║');
  87.   writexy(02,21,'╚════════════════════════╩════════════════════'+
  88.                   '═══════════════════════════════╝');
  89.   gotoxy(1,23);
  90.   end else begin;
  91.   textcolor(black);
  92.   textbackground(7);
  93.   writexy(02,16,'╔════════════════════════╦════════════════════'+
  94.                   '═══════════════════════════════╗');
  95.   writexy(02,17,'║                        ║                    '+
  96.                   '                               ║');
  97.   writexy(02,18,'║                        ║                    '+
  98.                   '                               ║');
  99.   writexy(02,19,'║                        ║                    '+
  100.                   '                               ║');
  101.   writexy(02,20,'║                        ║                    '+
  102.                   '                               ║');
  103.   writexy(02,21,'║                        ║                    '+
  104.                   '                               ║');
  105.   writexy(02,22,'║                        ║                    '+
  106.                    '                               ║');
  107.   writexy(02,23,'║                        ║                    '+
  108.                   '                               ║');
  109.   writexy(02,24,'║                        ║                    '+
  110.                   '                               ║');
  111.   writexy(02,25,'╚════════════════════════╩════════════════════'+
  112.                   '═══════════════════════════════╝');
  113.   gotoxy(1,23);
  114.   end;
  115.   textbackground(black);
  116.   textcolor(lightblue);
  117.   writexy(47,2,'Volume: ');
  118.   textcolor(lightcyan);
  119.   write(Mastervolume:2);
  120.   textcolor(lightblue);
  121.   textbackground(black);
  122.   writexy(58,2,'Balance ');
  123.   textcolor(14);
  124.   writexy(66,2,'■■■■■■■■■■■■■');
  125.   textcolor(4);
  126.   writexy(78-Balance DIV 2,2,'■');
  127.   textcolor(lightblue);
  128.   textbackground(black);
  129.   writexy(36,2,'Filtre');
  130.   textcolor(lightcyan);
  131.   write(' OFF');
  132. end;
  133.  
  134. procedure Scala;
  135. var li,lj : integer;
  136.     screen : array[1..50,1..80] of t absolute $B800:$0000;
  137.     secu : string[3];
  138. begin;
  139.   textcolor(lightblue);
  140.   textbackground(black);
  141.   str(secpass,secu);
  142.   if secpass < 10 then secu := '0'+secu;
  143.   gotoxy(2,3);
  144.   write('Nom de la chanson : ');
  145.   textcolor(lightcyan);
  146.   write(Nom_chanson);
  147.   gotoxy(34,3);
  148.   textcolor(lightblue);
  149.   write('Fréquence : ');
  150.   textcolor(lightcyan);
  151.   write(Sampling_Frequence:5);
  152.   textcolor(lightblue);
  153.   write(' KHz   Durée : ');
  154.   textcolor(lightcyan);
  155.   write(minpass:2,':',secu);
  156.   gotoxy(2,4);
  157.   textcolor(lightblue);
  158.   write('Pattern No.:');
  159.   textcolor(lightcyan);
  160.   write(Chanson[mlj]:3);
  161.   textcolor(lightblue);
  162.   write('    Pattern :');
  163.   textcolor(lightcyan);
  164.   write(mlj:3,'/',ChansonLongueur:3);
  165.   textcolor(lightblue);
  166.   write('    Ligne :');
  167.   textcolor(lightcyan);
  168.   write(mli:3);
  169.   textcolor(lightblue);
  170.   write('    Vitesse : ');
  171.   textcolor(lightcyan);
  172.   write(Playspeed:3,'/128');
  173.   gotoxy(2,2);
  174.   textcolor(lightblue);
  175.   write('Memoire de libre : ');
  176.   textcolor(lightcyan);
  177.   write(Maxavail:6,' KB');
  178.   textcolor(black);
  179.   textbackground(7);
  180.   for li := 1 to Voix do
  181.     if In_St[li] <> 0 then writexy(4,16+li,Noms_Inst[In_St[li]]);
  182.  
  183.   for lj := 1 to Voix do begin;
  184.     for li := 1 to 16 do begin;
  185.       if (Frappe_Notes[lj] div 10) > li then
  186.         begin;
  187.           screen[16 +lj,29+li].c := '■';
  188.           screen[16 +lj,29+li].a := 114;
  189.         end else begin;
  190.           screen[16 +lj,29+li].c := '■';
  191.           screen[16 +lj,29+li].a := 112;
  192.         end;
  193.     end;
  194.     for li := 16  to 32 do begin;
  195.       if (Frappe_Notes[lj] div 10) > li then
  196.         begin;
  197.           screen[16 +lj,29+li].c := '■';
  198.           screen[16 +lj,29+li].a := 126;
  199.         end else begin;
  200.           screen[16 +lj,29+li].c := '■';
  201.           screen[16 +lj,29+li].a := 112;
  202.         end;
  203.     end;
  204.     for li := 33 to 48 do begin;
  205.       if (Frappe_Notes[lj] div 10) > li then
  206.         begin;
  207.           screen[16 +lj,29+li].c := '■';
  208.           screen[16 +lj,29+li].a := 116;
  209.         end else begin;
  210.           screen[16 +lj,29+li].c := '■';
  211.           screen[16 +lj,29+li].a := 112;
  212.         end;
  213.     end;
  214.   end;
  215. end;
  216.  
  217. var retraceincs : word;
  218.     systemspeed : longint;
  219.     modspeed    : longint;
  220.  
  221. procedure test_waitretrace;
  222. begin;
  223. retraceincs := 0;
  224.   asm
  225.     MOV   DX,03dAh
  226. @WD_R:
  227.     inc word ptr retraceincs
  228.     IN    AL,DX
  229.     TEST  AL,8d
  230.     JZ    @WD_R
  231. @WD_D:
  232.     inc word ptr retraceincs
  233.     IN    AL,DX
  234.     TEST  AL,8d
  235.     JNZ   @WD_D
  236.   end;
  237. end;
  238.  
  239. procedure test_systemspeed;
  240. var li : integer;
  241. begin;
  242.   writeln;
  243.   writeln('Test de rapidité du système, patientez SVP ...');
  244.   writeln;
  245.   test_waitretrace;
  246.   systemspeed := 0;
  247.   for li := 1 to 70 do begin;
  248.     test_waitretrace;
  249.     systemspeed := systemspeed+retraceincs;
  250.   end;
  251. end;
  252.  
  253. procedure test_modspeed;
  254. var li : integer;
  255. begin;
  256.   writeln;
  257.   writeln('Test de MOD-Speed, patientez SVP ...');
  258.   writeln;
  259.   test_waitretrace;
  260.   modspeed := 0;
  261.   for li := 1 to 210 do begin;
  262.     test_waitretrace;
  263.     modspeed := modspeed+retraceincs;
  264.   end;
  265.   modspeed := modspeed div 3;
  266. end;
  267.  
  268. procedure write_performance;
  269. begin;
  270.   writeln;
  271.   writeln('Reste :',(modspeed*100/systemspeed):6:2,' % performance du processeur');
  272.   writeln;
  273.   writeln;
  274.   writeln;
  275.   write('Appuyez sur <Entrée> pour continuer ...');
  276.   readln;
  277. end;
  278.  
  279. procedure Play_the_Mod(s : string);
  280. var h : byte;
  281.     error : integer;
  282.     li : integer;
  283. begin;
  284.  Reset_Sb16;
  285.  mod_SetSpeed(66);
  286.  mod_Samplefreq(Samfreq);
  287.  dsp_rdy_sb16 := true;
  288.  error := charge_fichiermod(s,AUTO,AUTO,Samfreq);
  289.  if error <> 0 then begin;
  290.    clrscr;
  291.    writeln('Erreur pendant le chargement du fichier MOD ! ');
  292.    if error = -1 then writeln('Fichier introuvable !');
  293.    if error = -2 then writeln('Mémoire insuffisante !');
  294.    halt(0);
  295.  end;
  296.  {$ifdef polling}
  297.  start_polling;
  298.  {$else}
  299.  periodic_on;   { Active l'exécution périodique }
  300.  {$endif}
  301.  Scala_boxes;
  302.  ch := #255;
  303.  while not (ch=#27) and not (upcase(ch)='X')
  304.    and not (upcase(ch)='N') do begin;
  305.   {$ifdef polling}
  306.   mod_waitretrace(15);
  307.   {$endif}
  308.   Scala;
  309.   if keypressed then ch := readkey;
  310.   case ch of
  311.     #0  : begin;
  312.             dch := readkey;
  313.             case dch of
  314.               #61 : begin; { F3 }
  315.                        if Mastervolume > 0 then dec(Mastervolume);
  316.                        Set_Volume(Mastervolume);
  317.                        textbackground(black);
  318.                        textcolor(lightblue);
  319.                        writexy(47,2,'Volume: ');
  320.                        textcolor(lightcyan);
  321.                        write(Mastervolume:2);
  322.                        ch := #255;
  323.                      end;
  324.               #62 : begin; { F4 }
  325.                        if Mastervolume < 31 then inc(Mastervolume);
  326.                        Set_Volume(Mastervolume);
  327.                        textbackground(black);
  328.                        textcolor(lightblue);
  329.                        writexy(47,2,'Volume : ');
  330.                        textcolor(lightcyan);
  331.                        write(Mastervolume:2);
  332.                        ch := #255;
  333.                      end;
  334.               #63 : begin; { F5 }
  335.                        if Balance > 0 then dec(Balance);
  336.                        Set_Balance(Balance);
  337.                        textcolor(lightblue);
  338.                        textbackground(black);
  339.                        writexy(58,2,'Balance ');
  340.                        textcolor(14);
  341.                        writexy(66,2,'■■■■■■■■■■■■■');
  342.                        textcolor(4);
  343.                        writexy(78-Balance DIV 2,2,'■');
  344.                        ch := #255;
  345.                      end;
  346.               #64 : begin; { F6 }
  347.                        if Balance < 24 then inc(Balance);
  348.                        Set_Balance(Balance);
  349.                        textcolor(lightblue);
  350.                        textbackground(black);
  351.                        writexy(58,2,'Balance ');
  352.                        textcolor(14);
  353.                        writexy(66,2,'■■■■■■■■■■■■■');
  354.                        textcolor(4);
  355.                        writexy(78-Balance DIV 2,2,'■');
  356.                        ch := #255;
  357.                      end;
  358.               else begin;
  359.                      ch := #255;
  360.                    end;
  361.              end;
  362.           end;
  363.     '6' : begin;
  364.             inc(mli);
  365.             ch := #255;
  366.           end;
  367.     'f' : begin;
  368.             filtre_actif := not filtre_actif;
  369.             if filtre_actif then begin;
  370.                           filtre_on;
  371.               textcolor(lightblue);
  372.               textbackground(black);
  373.               writexy(36,2,'Filtre');
  374.               textcolor(lightcyan);
  375.               write(' ON ');
  376.             end else begin;
  377.                           filtre_mid;
  378.               textcolor(lightblue);
  379.               textbackground(black);
  380.               writexy(36,2,'Filtre');
  381.               textcolor(lightcyan);
  382.               write(' OFF');
  383.             end;
  384.             ch := #255;
  385.           end;
  386.     '4' : begin;
  387.             if mli > 0 then
  388.               dec(mli)
  389.             else begin;
  390.               if mlj > 0 then begin;
  391.                 dec(mlj);
  392.                 mli := 63
  393.               end else begin;
  394.                 mli := 0;
  395.                 mlj := 0;
  396.               end;
  397.             end;
  398.             ch := #255;
  399.            end;
  400.     '3' : begin;
  401.             mli := 0;
  402.             inc(mlj);
  403.             ch := #255;
  404.           end;
  405.     '1' : begin;
  406.             if mlj > 0 then begin;
  407.               dec(mlj);
  408.               mli := 0;
  409.             end;
  410.             ch := #255;
  411.            end;
  412.     'N',
  413.     'n' : begin;
  414.             next_song := 1;
  415.           end;
  416.     'x' : begin;
  417.             next_song := 255;
  418.           end;
  419.     #27 : begin;
  420.             next_song := 255;
  421.           end;
  422.     else begin;
  423.            ch := #255;
  424.     end;
  425.    end;
  426.  end;
  427.  outfading := true;
  428.  while outvolume > 1 do begin;
  429.    Scala;
  430.  end;
  431.  {$ifndef polling}
  432.  periodic_off;
  433.  {$endif}
  434.  fin_mod;
  435.  Reset_Sb16;
  436. end;
  437.  
  438.  
  439.  
  440. procedure Write_Helptext;
  441. begin;
  442.   textcolor(lightgray);
  443.   textbackground(black);
  444.   clrscr;
  445.   writeln(' MOD386  Version 2.0, (c) 1994 MICRO APPLICATION',
  446.           ' Programmeur : Boris Bertelsons (InspirE)');
  447.   writeln;
  448.   writeln(' Utilisation : Mod386 <Nom de fichier[.MOD]> [options]');
  449.   writeln;
  450.   writeln(' Options possibles :');
  451.   writeln(' -H        : cette écran');
  452.   writeln(' -In       : utilise l''interruption n');
  453.   writeln(' -Dn       : utilise le canal DMA n');
  454.   writeln(' -Pxxx     : Utilise l''adresse xxx');
  455.   writeln(' -Snn      : Choix du taux d''échantillonnage en KHz possible : ',
  456.             '8,10,13,16,22');
  457.   writeln(' -r        : sélectionne le mode "Repeat"');
  458.   writeln(' -sb       : sans détection d''une SB16');
  459.   writeln(' <nom>     : zusätzliche .MOD-Datei, spielt in zufälliger',
  460.             ' Reihenfolge');
  461.   writeln;
  462.   writeln;
  463.   writeln('             - Appuyez sur une touche pour continuer -');
  464.   writeln;
  465.   repeat until keypressed; readkey;
  466.   clrscr;
  467.   writeln(' MOD386  Version 2.0, (c) 1994 MICRO APPLICATION',
  468.           '  Programmeur : Boris Bertelsons (InspirE)');
  469.   writeln;
  470.   writeln('Fonction des touches durant l''exécution du programme ');
  471.   writeln;
  472.   writeln('  F : Filtre X-Bass On/Off');
  473.   writeln(' F3 : Baisse le volume        F4 : Augmente le volume');
  474.   writeln(' F5 : Balance vers la gauche  F6 : Balance vers la droite');
  475.   writeln('  1 : Retour d''un Pattern      3 : Avance d''un pattern');
  476.   writeln('  4 : Retour d''une ligne       6 : Avance d''une ligne');
  477.   writeln('  n : Fichier suivant      esc,X : Quitter');
  478.   writeln('  p : Performance du système');
  479.   writeln;
  480.   Cursor_On;
  481.   halt(0);
  482. end;
  483.  
  484. procedure interprete_commandline;
  485. var cs,hs : string;
  486.     li,code : integer;
  487.     sampelfr : word;
  488.     Datnm : boolean;
  489. begin;
  490.   for li := 1 to 10 do begin;
  491.     cs := paramstr(li);
  492.     Datnm := true;
  493.     { Utilisation de l'aide ? }
  494.     if (pos('-h',cs) <> 0) or (pos('/h',cs) <> 0) or
  495.        (pos('-H',cs) <> 0) or (pos('/H',cs) <> 0) or
  496.        (pos('-?',cs) <> 0) or (pos('/?',cs) <> 0) then begin;
  497.        write_Helptext;
  498.       Datnm := false;
  499.     end;
  500.     { mode repeat ? }
  501.     if (pos('-r',cs) <> 0) or (pos('/r',cs) <> 0) or
  502.        (pos('-R',cs) <> 0) or (pos('/R',cs) <> 0) then begin;
  503.        Repeatmode := true;
  504.       Datnm := false;
  505.     end;
  506.     { Force NO Sb16 ? }
  507.     if (pos('-sb',cs) <> 0) or (pos('/sb',cs) <> 0) or
  508.        (pos('-SB',cs) <> 0) or (pos('/SB',cs) <> 0) then begin;
  509.        force_SB := true;
  510.       Datnm := false;
  511.     end;
  512.     if (pos('-i',cs) <> 0) or (pos('/i',cs) <> 0) or
  513.        (pos('-I',cs) <> 0) or (pos('/I',cs) <> 0) then begin;
  514.       force_irq := true;
  515.       hs := copy(cs,3,length(cs)-2);
  516.       val(hs,dsp_irq,code);
  517.       Datnm := false;
  518.     end;
  519.     { Force DMA ? }
  520.     if (pos('-d',cs) <> 0) or (pos('/d',cs) <> 0) or
  521.        (pos('-D',cs) <> 0) or (pos('/D',cs) <> 0) then begin;
  522.       force_dma := true;
  523.       hs := copy(cs,3,length(cs)-2);
  524.       val(hs,dma_ch,code);
  525.       Datnm := false;
  526.     end;
  527.     { Force Base ? }
  528.     if (pos('-p',cs) <> 0) or (pos('/p',cs) <> 0) or
  529.        (pos('-P',cs) <> 0) or (pos('/P',cs) <> 0) then begin;
  530.        hs := copy(cs,3,length(cs)-2);
  531.        if hs = '200' then dsp_adr := $200;
  532.        if hs = '210' then dsp_adr := $210;
  533.        if hs = '220' then dsp_adr := $220;
  534.        if hs = '230' then dsp_adr := $230;
  535.        if hs = '240' then dsp_adr := $240;
  536.        if hs = '250' then dsp_adr := $250;
  537.        if hs = '260' then dsp_adr := $260;
  538.        if hs = '270' then dsp_adr := $270;
  539.        if hs = '280' then dsp_adr := $280;
  540.        Startport := dsp_adr;
  541.        Endport   := dsp_adr;
  542.       Datnm := false;
  543.     end;
  544.     { Indiquer Sampelrate ? }
  545.     if (pos('-s',cs) <> 0) or (pos('/s',cs) <> 0) or
  546.        (pos('-S',cs) <> 0) or (pos('/S',cs) <> 0) then begin;
  547.       hs := copy(cs,3,length(cs)-2);
  548.       val(hs,Sampelfr,code);
  549.       if Sampelfr >= 8000 then Sampelfr := Sampelfr DIV 1000;
  550.       if Sampelfr >= 8 then Samfreq := 8;
  551.       if Sampelfr >= 10 then Samfreq := 10;
  552.       if Sampelfr >= 13 then Samfreq := 13;
  553.       if Sampelfr >= 16 then Samfreq := 16;
  554.       if Sampelfr >= 22 then Samfreq := 22;
  555.       Datnm := false;
  556.     end;
  557.     if Datnm then begin;
  558.       if cs <> '' then begin;
  559.         Inc(Nummods);
  560.         Modd[Nummods] := cs;
  561.       end;
  562.     end;
  563.   end;
  564. end;
  565.  
  566. procedure write_vocmessage;
  567. begin;
  568.   clrscr;
  569.   writexy(10,08,'Attention !  Le Voc entrera dans une boucle sans fin !!!');
  570.   writexy(10,10,'Commencer  par  Q  ');
  571.   writexy(10,11,'Pause     avec  P  ');
  572.   writexy(10,12,'Continuer avec  C  ');
  573.   writexy(10,13,'Reprendre avec  N  ');
  574.   writexy(10,21,'                         E N J O Y');
  575. end;
  576.  
  577. procedure play_sound(datname : string);
  578. var li : integer;
  579.     ch : char;
  580. begin;
  581.   for li := 1 to length(datname) do
  582.      datname[li] := upcase(Datname[li]);
  583.   if pos('.MOD',datname) <> 0 then begin;
  584.     Play_The_Mod(datname);
  585.     exit;
  586.   end;
  587.   if pos('.VOC',datname) <> 0 then begin;
  588.   repeat
  589.     Reset_Sb16;
  590.     write_vocmessage;
  591.     Init_Voc(datname);
  592.     ch := #0;
  593.     repeat
  594.       if keypressed then ch := readkey;
  595.       if ch = 'p' then begin;
  596.         voc_pause;
  597.         repeat
  598.           ch := readkey;
  599.         until ch = 'c';
  600.         voc_continue;
  601.       end;
  602.     until VOC_READY or (ch = 'n') or (upcase(ch) = 'Q');
  603.     VOC_DONE;
  604.   until upcase(ch) = 'Q';
  605.   end;
  606. end;
  607.  
  608.  
  609. begin;
  610.  scala_boxes;
  611.  Samfreq := 22;
  612.  clrscr;
  613.  Test_systemspeed;
  614.  cursor_off;
  615.  interprete_commandline;
  616.  if (Nummods = 0) and not repeatmode then begin;
  617.    textcolor(15);
  618.    textbackground(1);
  619.    clrscr;
  620.    Nummods := 1;
  621.    modd[1] := select_fichier('*.?o?','*.?o?','','Sélection de fichiers son');
  622.    if modd[1] = 'xxxx' then begin;
  623.      clrscr;
  624.          writeln('Vous avez donc déjà un fichier son !');
  625.      Cursor_on;
  626.      halt(0);
  627.    end;
  628.  end;
  629.  for i := 1 to Nummods do begin;
  630.    if pos('.',modd[i]) = 0 then modd[i] := modd[i]+'.mod';
  631.  end;
  632.  Init_The_Mod;
  633.  stereo := false;
  634.  next_song := random(Nummods)+1;
  635.  textcolor(lightgray);
  636.  textbackground(black);
  637.  write_sbconfig;
  638.  writeln;
  639.  writeln;
  640.  write('            ENTREE pour continuer ...');
  641.  readln;
  642.  repeat
  643.    if repeatmode then begin;
  644.      textcolor(15);
  645.      textbackground(1);
  646.      clrscr;
  647.      modd[1] := select_fichier('*.?o?','*.?o?','','');
  648.      if modd[1] = 'xxxx' then next_song := 255
  649.      else Play_Sound(modd[1]);
  650.    end else
  651.      Play_Sound(modd[next_song]);
  652.    if next_song <> 255 then next_song := random(Nummods)+1;
  653.  until next_song = 255;
  654.  cursor_on;
  655.  textmode(3);
  656. end.
  657.  
  658.