home *** CD-ROM | disk | FTP | other *** search
- Program MCGATest;
- uses
- Crt,Dos,MCGA03;
- var
- Stop,
- Start : LongInt;
- Regs : Registers;
- PicBuf : Pointer;
-
- Function Tick : LongInt;
- begin
- Regs.ah := 0;
- Intr ($1A,regs);
- Tick := Regs.cx shl 16 + Regs.dx;
- end;
-
- Procedure ShowAndTell (S:String);
- var
- Ch : Char;
- begin
- Repeat Until Keypressed;
- While Keypressed do Ch := Readkey;
- TextMode (3);
- WriteLn (S);
- WriteLn ('Routine took ',(Stop-Start)/18.2:4:3,' seconds!');
- Write ('or an average of ');
- WriteLn (1000/((Stop-Start)/18.2):6:1,' lines per second.');
- While KeyPressed do Ch := Readkey;
- Repeat Until Keypressed;
- While Keypressed do Ch := Readkey;
- end;
-
- Procedure Control;
- var
- I : Integer;
- begin
- SetGraphMode ($13);
- Start := Tick;
- For I := 1 to 1000 do
- LineEqu (Random (320),Random (200),
- Random (320),Random(200),Random(256));
- Stop := Tick;
- ShowAndTell ('Equation of a line...');
- SetGraphMode ($13);
- Start := Tick;
- For I := 1 to 1000 do
- LineIndiv (Random (320),Random (200),
- Random (320),Random(200),Random(256));
- Stop := Tick;
- ShowAndTell ('Bresenhan''s algorithm, addressing each pixel individually...');
- SetGraphMode ($13);
- Start := Tick;
- For I := 1 to 1000 do
- Line (Random (320),Random (200),
- Random (320),Random(200),Random(256));
- Stop := Tick;
- ShowAndTell ('Bresenhan''s algorithm, incremental addressing each pixel...');
- end;
-
- Procedure Init;
- begin
- Randomize;
- end;
-
- Begin
- Init;
- Control;
- End.
-
-