home *** CD-ROM | disk | FTP | other *** search
/ PC Underground / UNDERGROUND.ISO / graphic / sintest.pas < prev    next >
Pascal/Delphi Source File  |  1995-07-28  |  1KB  |  37 lines

  1. {$N-}                           {Coprocessor off}
  2. Uses Crt,Tools;
  3.  
  4. Var phi,                        {Angle}
  5.     x,y:Word;                   {Coordinates}
  6.     Character:Byte;             {Used character}
  7.     Sine:Array[1..360] of Word; {receives the sine table}
  8.  
  9. Procedure Sine_Real;            {draws a circle 26 times}
  10. Begin
  11.   For Character:=Ord('A') to Ord('Z')do         {26 passes}
  12.     For phi:=1 to 360 do Begin
  13.       x:=Trunc(Round(Sin(phi/180*pi)*20+40)); {calculate x-coordinate}
  14.       y:=Trunc(Round(Cos(phi/180*pi)*10+12)); {calculate y-coordinate}
  15.       mem[$b800:y*160+x*2]:=Character;        {characters on the screen}
  16.     End;
  17. End;
  18. Procedure Sine_new;             {draws a circle 26 times}
  19. Begin
  20.   For Character:=Ord('A') to Ord('Z')do       {26 passes}
  21.     For phi:=1 to 360 do Begin
  22.       x:=Sine[phi]+40;          {calculate x-coordinate}
  23.       If phi<=270 Then          {calculate y-coordinate}
  24.         y:=Sine[phi+90] div 2 + 12 Else       {Cosine as shifted sine}
  25.         y:=Sine[phi-270] div 2 + 12;
  26.       mem[$b800:y*160+x*2]:=Character;        {characters on the screen}
  27.     End;
  28. End;
  29.  
  30. Begin
  31.   Sin_Gen(Sine,360,20,0);       {prepare sine table}
  32.   ClrScr;                       {clear screen}
  33.   Sine_real;                    {draw circles}
  34.   ClrScr;                       {clear screen}
  35.   Sine_new;                     {draw circles}
  36. End.
  37.