-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathTOPBSTUB.PAS
175 lines (156 loc) · 4.82 KB
/
TOPBSTUB.PAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
{$M 4096,0,655360}
program topbstub;
{
The Oldskool PC Benchmarking stub. This runs all benchmarking suites and
write the information to a file that can be imported into
TOPBENCH's database. This stub can run on system with as little as
128KB total RAM, provided the user uses a non-bloated DOS boot disk.
}
{$I TOPBCONF.INC}
uses
{$IFDEF OVERLAYS}
overlay, bstubov, {preserve this order or overlay system won't work}
{$ENDIF}
support,
{cmdlin,} {not compatible with DOS 2.1}
topb_detect,
topb_constants,
inifiles,
btsuites;
{$IFDEF OVERLAYS}
{The following units are safe to overlay (only called once and/or far call model).}
{$O topb_detect}
{{$O inifiles} {to prevent floppy disk contention}
{$O detectconstants}
{$O detectglobal}
{$O detectGraphics}
{$O detectGlobal}
{$O detectBIOS}
{$O detectTime}
{$O cputype}
{$O crc16}
{$O dos}
{{$O support} {to ensure waitfloppy doesn't wait for itself}
{$ENDIF}
const
{command-line params}
fname:string[79]='output.ini';
description:string[79]='';
skiptests:boolean=false;
var
oldmem:longint;
i:PINIfile;
wrappos:byte;
{$IFNDEF OVERLAYS}
procedure __doswrite(s:string); assembler;
asm
push ds
cld
lds si,s
lodsb
xor ah,ah
xchg cx,ax {cx=#0 of string which contains length}
jcxz @exit {if string is length 0 then bail}
mov ah,2 {get ready for DOS func. INT 21,2 - Standard Output}
@L1:
lodsb
mov dl,al {ah=02, dl=character to output}
int 21h {do it}
loop @L1
@exit:
pop ds
end;
procedure __doswriteln(s:string);
begin
__doswrite(s+#13#10);
end;
{$ENDIF}
Procedure WriteWrap(s:string80);
{If string is only 1 char long, it's not a string; it's a column to reset
wrapping on.}
const
endcol=79;
begin
{if we have actual string to work with}
if s[0]<>#1 then begin
{if length of string will exceed rightmost column, tack a newline at front}
if byte(s[0])+wrappos > endcol
then begin
s:=#13#10+s;
wrappos:=0;
end;
{write it out}
__DOSWrite(s);
inc(wrappos,byte(s[0]));
end else wrappos:=byte(s[1]);
end;
procedure stubtext; external;
{$L stubtext.obj}
begin
oldmem:=memavail;
__DOSWrite(StubBanner+#13#10);
{print out the stubtext}
asm
mov ah,09h
mov bx,seg stubtext
mov dx,offset stubtext
push ds
mov ds,bx
int 21h
pop ds
end;
new(i,init(fname,appendfile,1024));
i^.WriteComment('Data collected by: '+StubBanner);
i^.WriteComment('This file contains fingerprinting information about your computer. Please');
i^.WriteComment('email this file to [email protected] with a subject line of "Benchmark" to');
i^.WriteComment('help test these routines and seed the TOPBENCH database.');
i^.StartNewSection(WhatMachineUID,'');
__DOSWrite(#13#10#10'Waiting for floppy drive spindown... '); WaitFloppySpindown; __DOSWriteln('done.');
writewrap(#0);
writewrap('Benchmarking your system: ');
writewrap('Memory speed... ');
i^.WriteKeyValue(LTestMem,inttostr(testMemoryBlockOps));
writewrap('CPU opcode exercises... ');
i^.WriteKeyValue(LTestOpcodes,inttostr(testCPUOpcodes));
writewrap('video memory speed... ');
i^.WriteKeyValue(LTestVidMem,inttostr(testVideoAdapterWrites));
writewrap('effective addressing and instruction fetch... ');
i^.WriteKeyValue(LTestMemEA,inttostr(testMemEA));
writewrap('3-D game opcode distribution... ');
i^.WriteKeyValue(LTest3DGames,inttostr(test3DGames));
WaitFloppySpindown;
writewrap('Calculating your system''s TOPBENCH score... '); i^.WriteKeyValue(LScore,inttostr(TOPScoreFingerprint));
writewrap('Done. Identifying your system: ');
if not skiptests then begin
writewrap('CPU... ');
i^.WriteKeyValue(LCPU,WhatCPU);
writewrap('CPU speed... ');
i^.WriteKeyValue(LCpuSpeed,WhatMHz);
end;
writewrap('BIOS... ');
i^.WriteKeyValue(LBIOSInfo,WhatBIOS);
writewrap('Machine Model... ');
i^.WriteKeyValue(LMachineModel,hexword(WhatModelWord));
writewrap('Date... ');
i^.WriteKeyValue(LBIOSDate,IntToStr(WhatBIOSDateNormalized));
writewrap('CRC... ');
i^.WriteKeyValue(LBIOSCRC16,hexword(WhatBIOSCRC16));
writewrap('Video subsystem... ');
i^.WriteKeyValue(LVidSystem,WhatVideoSubsystem);
if not skiptests then begin
writewrap('Video adapter... ');
i^.WriteKeyValue(LVidAdapter,WhatVideoAdapter);
end;
writewrap('Machine type... ');
i^.WriteKeyValue(LName,WhatMachineType);
if description<>'' then begin
writewrap('System Description... ');
i^.WriteKeyValue(LDescription,description);
end;
dispose(i,Done);
writewrap('Finished. Results written to '+fname+'.'#13#10);
{FileToSTDOUT(fname);}
{done, check for memory leaks:}
if oldmem<>memavail
then __DOSWriteln('Memory leak of '+inttostr(oldmem-memavail)+' bytes detected!');
end.