home *** CD-ROM | disk | FTP | other *** search
- { Qbench.pas - produces a 'Screens/second' table for ver 3.0, 08-31-87 }
- { QWIK Screen procedures. }
- { I'm not trying to support this program, so don't expect it to be perfect.
- It will just give you a good feel for speed. The time is adjusted for
- an average 8 second test for each condition - total of 150 seconds. For
- more accurate results, change TestTime:=16. Or for a quicker but less
- accurate test, change TestTime:=1. }
-
- {$i qwik30.inc}
- {$i timerd12.inc}
-
- type
- Attrs = (Attr,NoAttr);
-
- const
- Procs = 11;
- TestTime = 8; { TestTime in seconds for each case. 8 gives +/- 1% }
-
- var
- Attrib, Count, Screens, OldCursor: integer;
- Row, Col, Rows, Cols, ProcNumber: byte;
- ScrPerSec: array[1..Procs] of array[Attr..NoAttr] of real;
- Strng: string[80];
- A: Attrs;
- ScrArray: array[1..4000] of byte;
- Names: array[1..Procs] of string[80];
- FV: text;
- ToDisk: boolean;
- Ch: char;
-
- procedure CheckCursor;
- var CursorMode: integer absolute $0040:$0060;
- begin
- if ActiveDD=MdaMono then
- if CursorMode=$0607 then
- CursorChange($0B0C,OldCursor);
- end;
-
- procedure CheckTime;
- begin
- Strng:='TimerTest ';
- for Col:=1 to 3 do Strng:=Strng+Strng;
- Qfill (1,1,25,80,14,' ');
- timer (start);
- for Count:=1 to Screens do
- for row:=1 to 25 do
- QwriteV (Row,1,14,Strng);
- timer (Stop);
- Screens:=trunc(Screens*TestTime/ElapsedTime);
- end;
-
- procedure WritesFillsProcedures (ProcNumber: byte);
- begin
- case ProcNumber of
- 1: begin
- timer (start);
- for Count:=1 to Screens do
- for Row:=1 to 25 do
- QwriteLV (Row,1,Attrib,80,Strng[1]);
- timer (Stop);
- end;
- 2: begin
- timer (start);
- for Count:=1 to Screens do
- for Row:=1 to 25 do
- QwriteV (Row,1,Attrib,Strng);
- timer (Stop);
- end;
- 3: begin
- timer (start);
- for Count:=1 to Screens do
- for Row:=1 to 25 do
- Qwrite (Row,1,Attrib,Strng);
- timer (Stop);
- end;
- 4: begin
- timer (start);
- for Count:=1 to Screens do
- for Row:=1 to 25 do
- QwriteC (Row,1,80,Attrib,Strng);
- timer (Stop);
- end;
- 5: begin
- timer (start);
- for Count:=1 to Screens do
- for Row:=1 to 25 do
- QwriteCV (Row,1,80,Attrib,Strng);
- timer (Stop);
- end;
- 6: begin
- timer (start);
- for Count:=1 to Screens do
- QfillC (1,1,80,25,80,Attrib,'C');
- timer (Stop);
- end;
- 7: begin
- timer (start);
- for Count:=1 to Screens do
- Qfill (1,1,25,80,Attrib,'F');
- timer (Stop);
- end;
- end; { Case ProcNumber of }
- if Attrib>=0 then
- case ProcNumber of
- 8: begin
- Qfill (1,1,25,80,Attrib,'a');
- timer (start);
- for Count:=1 to Screens do
- Qattr (1,1,25,80,Attrib);
- timer (Stop);
- end;
- 9: begin
- Qfill (1,1,25,80,Attrib,'c');
- timer (start);
- for Count:=1 to Screens do
- QattrC (1,1,80,25,80,Attrib);
- timer (Stop);
- end;
- end; { Case ProcNumber of }
- if ElapsedTime<>0.0 then
- ScrPerSec[ProcNumber,A]:=Screens/ElapsedTime;
- end;
-
- procedure StoresProcedures (ProcNumber: byte);
- begin
- for Row:=1 to 25 do
- QwriteV (Row,1,Attrib,Strng);
- case ProcNumber of
- 10: begin
- timer (start);
- for Count:=1 to Screens do
- QstoreToMem (1,1,25,80,ScrArray);
- timer (Stop);
- end;
- 11: begin
- QstoreToMem (1,1,25,80,ScrArray);
- timer (start);
- for Count:=1 to Screens do
- QstoreToScr (1,1,25,80,ScrArray);
- timer (Stop);
- end;
- end; { Case ProcNumber of }
- ScrPerSec[ProcNumber,A]:=Screens/ElapsedTime;
- end;
-
- procedure LoopWritesFills (At: Attrs; Att: integer);
- begin
- A:=At;
- Attrib:=Att;
- for ProcNumber:=1 to 9 do
- begin
- Strng:=Names[ProcNumber];
- if Qwait then
- Strng:=Strng+' Wait '
- else Strng:=Strng+' No Wait ';
- if A=Attr then
- Strng:=Strng+' w/Attr '
- else Strng:=Strng+' No Attr ';
- fillchar (Strng[32],49,ProcNumber+48);
- Strng[0]:=#80;
- WritesFillsProcedures (ProcNumber);
- end;
- end;
-
- procedure LoopStores (At: Attrs; Att: integer);
- begin
- A:=At;
- Attrib:=Att;
- for ProcNumber:=10 to 11 do
- begin
- Strng:=Names[ProcNumber];
- if Qwait then
- Strng:=Strng+' Wait '
- else Strng:=Strng+' No Wait ';
- Strng:=Strng+' w/Attr ';
- fillchar (Strng[32],49,ProcNumber+48);
- Strng[0]:=#80;
- StoresProcedures (ProcNumber);
- end;
- end;
-
- begin
- Qinit;
- Qfill (1,1,25,80,14,' ');
- if Qwait then
- begin
- Qwait:=false;
- GotoRC (12,52);
- repeat
- repeat
- QwriteC (12,1,80,-1,'Do you see snow? [Y/N]?');
- until Keypressed;
- Read (Kbd,Ch);
- until Ch in ['Y','y','N','n'];
- case upcase(Ch) of
- 'Y': Qwait:=true;
- 'N': begin
- QwriteC (10,1,80,-1,'Congratulations! You have a card better');
- QwriteC (11,1,80,-1,'than the standard IBM CGA.');
- QwriteC (12,1,80,-1,'However, to make it faster, you will need');
- QwriteC (13,1,80,-1,'to set Qwait:=false manually.');
- QwriteC (14,1,80,-1,'Please contact me about this.');
- QwriteC (16,1,80,-1,'Press any key ...');
- GotoRC (16,49);
- read (kbd,Ch);
- end;
- end;
- end;
- Qfill (1,1,25,80,14,' ');
- QwriteC (12,1,80,-1,'Data to Screen or Disk [s/d]?');
- GotoRC (12,55);
- repeat
- Read (Kbd,Ch);
- until Ch in ['S','s','D','d',^M];
- if upcase(Ch)='D' then
- ToDisk:=true
- else ToDisk:=false;
- CheckCursor;
- CursorOff;
- Qfill (1,1,1,80,14,' ');
-
- for ProcNumber:=1 to Procs do
- for A:= Attr to NoAttr do
- ScrPerSec[ProcNumber,A]:=0.0;
-
- Names[1]:= ' QwriteLV ';
- Names[2]:= ' QwriteV ';
- Names[3]:= ' Qwrite ';
- Names[4]:= ' QwriteC ';
- Names[5]:= ' QwriteCV ';
- Names[6]:= ' QfillC ';
- Names[7]:= ' Qfill ';
- Names[8]:= ' Qattr ';
- Names[9]:= ' QattrC ';
- Names[10]:= ' QstoreToMem ';
- Names[11]:= ' QstoreToScr ';
-
- if Qwait then
- Screens:=8 { First guess for screens }
- else Screens:=80; { First guess for screens }
- CheckTime;
- LoopWritesFills (Attr, 14);
- LoopStores (Attr, 14);
- Qattr (1,1,25,80,7);
- LoopWritesFills (NoAttr, -1);
-
- Qfill (1,1,25,80,14,' ');
- if ToDisk then
- begin
- assign (FV,'Qbench.dta');
- rewrite (FV);
- end
- else
- assign (FV,'Con:');
- GotoRC (1,1);
- writeln (FV,'S C R E E N S / S E C O N D');
- writeln (FV,' Chng');
- writeln (FV,'Procedure Attr S/sec');
- writeln (FV,'--------- ---- -----');
- for ProcNumber:=1 to 7 do
- for A:=Attr to NoAttr do
- begin
- if A=Attr then
- write (FV,Names[ProcNumber])
- else write (FV,' ');
- if A=Attr then
- write (FV,'Yes ')
- else write (FV,'No ');
- writeln (FV,ScrPerSec[ProcNumber,A]:5:1);
- end;
- for ProcNumber:=8 to 11 do
- begin
- write (FV,Names[ProcNumber]);
- if ProcNumber<10 then
- write (FV,'Yes ')
- else write (FV,'n/a ');
- writeln (FV,ScrPerSec[ProcNumber,Attr]:5:1);
- end;
- GotoRC (23,1);
- writeln (FV,'Wait-for-retrace= ',Qwait,'; SystemID= ',SystemID);
- writeln (FV,'Screens/test= ',Screens,'; SubModelID= ',SubmodelID);
- if ToDisk then close (FV);
- GotoRC (24,1);
- CursorOn;
- end.