(*********************************************************************
 *
 *  :Program.	HilfsModul für SCHIFFCHENVERSENKEN
 *  :Author.	Hans Schafft
 *  :Address.	Landfriedstraße 1A - Hinterhaus
 *  :Address.	6900 Heidelberg
 *  :Phone.	06221 - 22416
 *  :Version.	1.0
 *  :Date.	1990
 *  :Copyright.	PD
 *  :Language.	Modula-II
 *  :Translator.M2Amiga
 *  :Contents.
 *
 *********************************************************************)
IMPLEMENTATION MODULE Klang; (* sollte mit Option -b compiliert werden !*)

FROM Hardware		IMPORT	custom,DmaFlags;
FROM SYSTEM		IMPORT	ADR,INLINE,BYTE;
FROM RandomNumber	IMPORT	RND;


VAR x,y : CARDINAL;
    wasser : ARRAY [1..50] OF CARDINAL;
    ton : ARRAY [1..4] OF CARDINAL;


(******************************************************************)
PROCEDURE WasserTon;
BEGIN
  WITH custom DO
    WITH aud[0] DO
      acptr := ADR(wasser);
      aclen := 50;
      acper := 1111;
      acvol := 64;
    END;
    FOR x := 1 TO 64 DO
      aud[0].acvol := 64 - x;
      FOR y := 0 TO 100+2*x DO
      END;
    END;
  END;
END WasserTon;

(******************************************************************)
PROCEDURE GetroffenTon;
BEGIN
  WITH custom DO
    WITH aud[0] DO
      acptr := ADR(ton);
      aclen := 8;
      acper := 555;
      acvol := 64;
    END;
    FOR x := 1 TO 64 DO
      aud[0].acvol := 64 - x;
      FOR y := 0 TO 333 DO
      END;
    END;
  END;
END GetroffenTon;

(******************************************************************)
PROCEDURE VersenktTon;
BEGIN
  WITH custom DO
    WITH aud[0] DO
      acptr := ADR(ton);
      aclen := 8;
      acper := 199;
      acvol := 64;
    END;
    FOR x := 1 TO 64 DO
      aud[0].acvol := 64 - x;
      FOR y := 0 TO 333 DO
      END;
    END;
  END;
END VersenktTon;

(******************************************************************)
PROCEDURE MenschTipTon;
BEGIN
  WITH custom DO
    WITH aud[0] DO
      acptr := ADR(ton);
      aclen := 8;
      acper := 777;
      acvol := 64;
    END;
    FOR x := 1 TO 64 DO
      aud[0].acvol := 64 - x;
      FOR y := 0 TO 444 DO
      END;
    END;
  END;
END MenschTipTon;

(******************************************************************)
PROCEDURE MenschSiegTon;
BEGIN
  WITH custom DO
    WITH aud[0] DO
      acptr := ADR(ton);
      aclen := 8;
      acper := 1333;
      acvol := 64;
    END;
    FOR x := 1 TO 64 DO
      aud[0].acvol := 64 - x;
      FOR y := 0 TO 555 DO
      END;
    END;
  END;
END MenschSiegTon;

(******************************************************************)
PROCEDURE CompSiegTon;
BEGIN
  WITH custom DO
    WITH aud[0] DO
      acptr := ADR(ton);
      aclen := 8;
      acper := 1777;
      acvol := 64;
    END;
    FOR x := 1 TO 64 DO
      aud[0].acvol := 64 - x;
      FOR y := 0 TO 555 DO
      END;
    END;
  END;
END CompSiegTon;

(******************************************************************)
PROCEDURE CompTipTon;
BEGIN
  WITH custom DO
    WITH aud[0] DO
      acptr := ADR(ton);
      aclen := 8;
      acper := 999;
      acvol := 64;
    END;
    FOR x := 1 TO 64 DO
      aud[0].acvol := 64 - x;
      FOR y := 0 TO 444 DO
      END;
    END;
  END;
END CompTipTon;

(******************************************************************)
PROCEDURE SchonmalTon;
BEGIN
  WITH custom DO
    WITH aud[0] DO
      acptr := ADR(ton);
      aclen := 8;
      acper := 1234;
      acvol := 54;
    END;
    FOR x := 1 TO 64 DO
      aud[0].acvol := 64 - x;
      FOR y := 0 TO 444 DO
      END;
    END;
  END;
END SchonmalTon;


(******************************************************************)
(******************************************************************)
BEGIN
  ton[1] := 0; ton[2] := 65535;
  ton[3] := 0; ton[4] := 65535;
  FOR x := 1 TO 50 DO
    wasser[x] := RND(65536);
  END;
  INCL(custom.dmacon,aud0);
  EXCL(custom.dmacon,DmaFlags(9));
  INCL(custom.dmacon,dmaSet);
END Klang.
