home *** CD-ROM | disk | FTP | other *** search
- Program MCGATest;
-
- uses
- Crt,Dos,MCGALib;
-
- var
- Stop,
- Start : LongInt;
- Regs : Registers;
- PicBuf,
- StorageBuf : Pointer;
- const
- NumTimes = 1000;
-
- 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;
- NumSecs,
- NumTicks,
- SecsPerIter,
- TicksPerSec,
- TicksPerIter : Real;
- begin
- TextMode (3);
- NumTicks := Stop - Start;
- NumSecs := NumTicks / 18.2;
- TicksPerIter := NumTicks / NumTimes;
- SecsPerIter := NumSecs / NumTimes;
- TicksPerSec := 18.2 / TicksPerIter;
-
- Write ('After ',NumTimes,' iterations ');
- WriteLn ('and ',NumSecs:6:4,' seconds...');
- Write (' Each iteration took ',TicksPerIter:6:4,' ticks or ');
- WriteLn (SecsPerIter:4:3,' seconds!');
- WriteLn (' That''s about ',TicksPerSec:6:4,' times per second.');
- Repeat Until Keypressed;
- While Keypressed do Ch := Readkey;
- end;
-
- Procedure Control;
- var
- I,X,Y : Integer;
- Size : Word;
- begin
- SetGraphMode ($13);
- LoadBuffer ('E:\NAVAJO.PCX',PicBuf);
-
- DisplayPCX (0,0,PicBuf);
-
- Size := ImageSize (40,60,140,160);
- GetMem (StorageBuf,Size);
- GetImagePas (40,60,140,160,StorageBuf);
-
- ClearScreen (0);
-
- Start := Tick;
- For I := 1 to NumTimes do begin
- X := Random (220);
- Y := Random (100);
- PutImagePas (X,Y,StorageBuf);
- end;
- Stop := Tick;
- ShowAndTell;
-
- SetGraphMode ($13);
- Start := Tick;
- For I := 1 to NumTimes do begin
- X := Random (220);
- Y := Random (100);
- PutImageAsm (X,Y,StorageBuf);
- end;
- Stop := Tick;
- ShowAndTell;
- end;
-
- Procedure Init;
- begin
- GetMem (PicBuf,65500);
- end;
-
- Begin
- Init;
- Control;
- End.