home *** CD-ROM | disk | FTP | other *** search
- Program MCGATest;
-
- uses
- Crt,Dos,MCGA04;
-
- var
- Stop,
- Start : LongInt;
- Regs : Registers;
- PicBuf : Pointer;
- const
- NumTimes = 10;
-
- Procedure LoadBuffer (S:String;Buf:Pointer);
- var
- F : File;
- BlocksRead : Word;
- begin
- Assign (F,S);
- Reset (F,1);
- BlockRead (F,Buf^,65000,BlocksRead);
- Close (F);
- end;
-
- Function Tick : LongInt;
- begin
- Regs.ah := 0;
- Intr ($1A,regs);
- Tick := Regs.cx shl 16 + Regs.dx;
- end;
-
- Procedure ShowAndTell;
- var
- Ch : Char;
- begin
- TextMode (3);
- WriteLn ('We just displayed a PCX file to the screen ',NumTimes,' times.');
- WriteLn ('Routine took ',(Stop-Start)/NumTimes:6:4,' ticks or ');
- WriteLn ((Stop-Start)/18.2/NumTimes:4:3,' seconds per image!');
- WriteLn ('That''s about ',18.2/((Stop-Start)/NumTimes):6:4,' times per second.');
- Repeat Until Keypressed;
- While Keypressed do Ch := Readkey;
- end;
-
- Procedure Control;
- var
- I : Integer;
- begin
- SetGraphMode ($13);
- LoadBuffer ('E:\NAVAJO.PCX',PicBuf);
-
- Start := Tick;
- For I := 1 to NumTimes do
- DisplayPCXPas (0,0,PicBuf);
- Stop := Tick;
- ShowAndTell;
-
- SetGraphMode ($13);
-
- Start := Tick;
- For I := 1 to NumTimes do
- DisplayPCXAsm (0,0,PicBuf);
- Stop := Tick;
- ShowAndTell;
- end;
-
- Procedure Init;
- begin
- Randomize;
- GetMem (PicBuf,65500);
- end;
-
- Begin
- Init;
- Control;
- End.
-