home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / MCGA#04.ZIP / TEST04.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1992-06-12  |  1.4 KB  |  77 lines

  1. Program MCGATest;
  2.  
  3. uses
  4.   Crt,Dos,MCGA04;
  5.  
  6. var
  7.   Stop,
  8.   Start       :  LongInt;
  9.   Regs        :  Registers;
  10.   PicBuf      :  Pointer;
  11. const
  12.   NumTimes    = 10;
  13.  
  14. Procedure LoadBuffer (S:String;Buf:Pointer);
  15. var
  16.   F           :  File;
  17.   BlocksRead  :  Word;
  18. begin
  19.   Assign (F,S);
  20.   Reset (F,1);
  21.   BlockRead (F,Buf^,65000,BlocksRead);
  22.   Close (F);
  23. end;
  24.  
  25. Function Tick : LongInt;
  26. begin
  27.   Regs.ah := 0;
  28.   Intr ($1A,regs);
  29.   Tick := Regs.cx shl 16 + Regs.dx;
  30. end;
  31.  
  32. Procedure ShowAndTell;
  33. var
  34.   Ch     :  Char;
  35. begin
  36.   TextMode (3);
  37.   WriteLn ('We just displayed a PCX file to the screen ',NumTimes,' times.');
  38.   WriteLn ('Routine took ',(Stop-Start)/NumTimes:6:4,' ticks or ');
  39.   WriteLn ((Stop-Start)/18.2/NumTimes:4:3,' seconds per image!');
  40.   WriteLn ('That''s about ',18.2/((Stop-Start)/NumTimes):6:4,' times per second.');
  41.   Repeat Until Keypressed;
  42.   While Keypressed do Ch := Readkey;
  43. end;
  44.  
  45. Procedure Control;
  46. var
  47.   I :  Integer;
  48. begin
  49.   SetGraphMode ($13);
  50.   LoadBuffer ('E:\NAVAJO.PCX',PicBuf);
  51.  
  52.   Start := Tick;
  53.   For I := 1 to NumTimes do
  54.     DisplayPCXPas (0,0,PicBuf);
  55.   Stop := Tick;
  56.   ShowAndTell;
  57.  
  58.   SetGraphMode ($13);
  59.  
  60.   Start := Tick;
  61.   For I := 1 to NumTimes do
  62.     DisplayPCXAsm (0,0,PicBuf);
  63.   Stop := Tick;
  64.   ShowAndTell;
  65. end;
  66.  
  67. Procedure Init;
  68. begin
  69.   Randomize;
  70.   GetMem (PicBuf,65500);
  71. end;
  72.  
  73. Begin
  74.   Init;
  75.   Control;
  76. End.
  77.