home *** CD-ROM | disk | FTP | other *** search
- {$B-} {- = short circuit boolean evaluation: on }
- {$D-} {+ = debug & lineinfo: on }
- {$F-} {- = force far calls: off }
- {$I-} {+ = I/O error checking: on }
- {$L+} {+ = link buffer: on }
- {$N-} {- = 8087 code: off }
- {$R-} {- = numeric range checking: off }
- {$S-} {+ = stack overflow checking: on }
- {$T-} {- = map file generation: off }
- {$V-} {+ = var-string checking: on }
- {$M 16384,0,0} { memory in bytes: stacksize,heapmin,heapmax }
-
- {=====================================================================
- PC STATUS -- Version 4.0
- Author: John D. Falconer
- Modified by: Michael J. Borowiec [72067,3025] 11.27.87
-
- This modified version of "PCS.PAS" differs from the original:
-
- Function "UseEnv" has been added (is no longer an external codefile)
- and is called differently.
-
- Procedure "ShowSysID" has been added for IBM systems.
-
- Bug fixed in "ShowVideoInfo". (Missing "CrtMode" pointer statement)
-
- Function Self added to show from whence it executes...
-
- Extensively modified for Turbo Pascal 4.0.
-
- =====================================================================}
-
- program PCS;
-
- uses
- DOS,CRT;
- const
- DosDS = $0040;
- DosDSStr = '0040:';
- type
- Info = record case word of
- 1 : (b: byte);
- 2 : (w: word);
- 3 : (pac: packed array[0..7] of char);
- end;
- AddrPtr = ^FullAddr;
- FullAddr = record
- Offset,
- Segment : word
- end;
- String4 = string[4];
- String64 = string[64];
- String80 = string[80];
- var
- Regs : registers;
- CrtModeSet,
- DataPtr : ^Info;
- EquipWord,
- MaxDrives,
- MemSize, I : word;
- CGA80 : boolean;
-
-
- {}procedure QWrite(Row,Col,Attr : byte;
- QWriteStr : String80);
- begin
- gotoxy(Col,Row);
- Crt.TextAttr:= Attr;
- write(QWriteStr);
- {}end; { procedure QWrite }
-
-
- {}procedure Layout;
- begin
- clrscr;
- QWrite(1 ,1 ,3 ,'╔═══════════════════╤═══════════════════╤═════════════════════════════════════╗');
- QWrite(2 ,1 ,3 ,'║');
- QWrite(2 ,3 ,14,'MEMORY:');
- QWrite(2 ,21,3 ,'│');
- QWrite(2 ,23,14,'EQUIPMENT:');
- QWrite(2 ,41,3 ,'│');
- QWrite(2 ,43,14,'VIDEO:');
- QWrite(2 ,79,3 ,'║');
- QWrite(3 ,1 ,3 ,'║ Planar │ Printers │ Initial Mode ║');
- QWrite(4 ,1 ,3 ,'║ Total │ Serial Ports │ Current Mode ║');
- QWrite(5 ,1 ,3 ,'║ Free │ Floppy Drives │ Attribute @ Cursor ║');
- QWrite(6 ,1 ,3 ,'║ From │ Game Adaptor │ Buffer Offset, Length ║');
- QWrite(7 ,1 ,3 ,'╟───────────────────┴───────────────────┤ Video Page ║');
- QWrite(8 ,1 ,3 ,'║');
- QWrite(8 ,3 ,14,'KEYBOARD BUFFER:');
- QWrite(8 ,41,3 ,'│ Cursor Mode ║');
- QWrite(9 ,1 ,3 ,'║ Capacity Start │ 6845 Mode ║');
- QWrite(10,1 ,3 ,'║ ( characters ) End │ 6845 Pallette ║');
- QWrite(11,1 ,3 ,'╟───────────────────┬───────────────────┼─────────────────┬───────────────────╢');
- QWrite(12,1 ,3 ,'║');
- QWrite(12,3 ,14,'DOS VER:');
- QWrite(12,21,3 ,'│');
- QWrite(12,23,14,'ROM VER:');
- QWrite(12,41,3 ,'│');
- QWrite(12,43,14,'^C CHECK:');
- QWrite(12,59,3 ,'│');
- QWrite(12,61,14,'DISK VERIFY:');
- QWrite(12,79,3 ,'║');
- QWrite(13,1 ,3 ,'╟───────────────────┴───────────────────┴─────────────────┴───────────────────╢');
- QWrite(14,1 ,3 ,'║');
- QWrite(14,3 ,14,'FREE SPACE ON DISK DRIVES:');
- QWrite(14,79,3 ,'║');
- QWrite(15,1 ,3 ,'║'); QWrite(15,79,3 ,'║');
- QWrite(16,1 ,3 ,'║'); QWrite(16,79,3 ,'║');
- QWrite(17,1 ,3 ,'╟────────────────────┬────────────────────────────────────────────────────────╢');
- Qwrite(18,1 ,3 ,'║');
- Qwrite(18,3 ,14,'Floppy PARAMETERS:');
- Qwrite(18,22,3 ,'│');
- Qwrite(18,24,14,'ENVIRONMENT SETTINGS:');
- Qwrite(18,79,3 ,'║');
- Qwrite(19,1 ,3 ,'║ On Time ms │'); QWrite(19,79,3 ,'║');
- Qwrite(20,1 ,3 ,'║ Off Time s │'); QWrite(20,79,3 ,'║');
- Qwrite(21,1 ,3 ,'║ Settling ms │'); QWrite(21,79,3 ,'║');
- Qwrite(22,1 ,3 ,'║ B/S, S/T │'); QWrite(22,79,3 ,'║');
- Qwrite(23,1 ,3 ,'╚════════════════════╧════════════════════════════════════════════════════════╝');
- {
- Qwrite(24,1 ,3 ,Self);
- }
- QWrite(24,56,3 ,'PC STATUS - Version 4.0');
- {}end; { procedure Layout }
-
-
- {}function HexString(Number: Word): String4;
- var
- S : String4;
-
- {--}function HexChar(Number: Word): Char;
- begin
- if Number < 10 then
- HexChar:= char(Number + 48) { variable typecasting }
- else
- HexChar:= char(Number + 55); { " " }
- {--}end; { function HexChar }
-
- begin { function HexString }
- S := '';
- S := HexChar((Number shr 1) div 2048);
- Number:= (((Number shr 1) mod 2048) shl 1) + (Number and 1);
- S := S + HexChar(Number div 256);
- Number:= Number mod 256;
- S := S + HexChar(Number div 16);
- Number:= Number mod 16;
- S := S + HexChar(Number);
- HexString:= S;
- {}end; { function HexString }
-
-
- {}procedure WriteHex(Row,Col : byte;
- Value : word);
- begin
- gotoxy(Col,Row);
- write(HexString(Value));
- {}end; { WriteHex }
-
-
- {}procedure ShowSysID;
- var
- IDByte : byte;
- begin
- gotoxy(34,2);
- IDByte:= mem[$F000:$FFFE];
- case IDByte of
- $FF :write('PC':6);
- $FE :write('XT':6);
- $FD :write('PCjr':6);
- $FC :write('AT':6)
- else
- write(HexString(word(IDByte)),'h')
- end;
- {}end; { procedure ShowSysID }
-
-
- {}function Self : String64; { requires MS-DOS 3.x }
- {
- Original function (c)1986 D.M.Armstrong-Allen and
- Published in PC Magazine Vol 6 No 11, June 9, 1987.
- Modified by Michael BoRowiec for Turbo Pascal 4.x
- }
- var
- Temp : String64;
- I,EnvSeg : word;
- begin
- I := 0;
- Temp:= '';
- EnvSeg:= memw[prefixseg:$2C]; { have to set this up like any variable! }
- while memw[EnvSeg:I] <> 0 do { read through environment strings }
- inc(I);
- inc(I,4); { jump around 2 null bytes & word count }
- while mem[EnvSeg:I] <> 0 do { skim off path & filename }
- begin
- Temp:= Temp + upcase(chr(mem[EnvSeg:I]));
- inc(I);
- end;
- Self:= Temp;
- {}end; { function Self }
-
-
- {}procedure ShowEquipment;
- begin
- DataPtr := ptr(DosDS,$0010); { pointer to BIOS equipment list }
- EquipWord:= DataPtr^.W;
- MaxDrives:= ((EquipWord shr 6) and 3) * (1 and EquipWord)
- + (1 and EquipWord); { number of floppies }
- gotoxy(38,3);
- write(EquipWord shr 14:2); { number of printers }
- gotoxy(38,4);
- write((EquipWord shr 9) and 7:2); { number of serial ports }
- gotoxy(38,5);
- write(MaxDrives:2); { write number of floppies }
- gotoxy(38,6);
- write((EquipWord shr 12) and 1:2); { number of game adapters }
- gotoxy(13,3);
- write(((EquipWord shr 2) and 3) * 16 + 16:6, 'K'); { Planar Memory }
- {}end; { procedure ShowEquipment }
-
-
- {}procedure ShowTotalMemory;
- begin
- gotoxy(13,4);
- DataPtr:= ptr(DosDS,$0013); { total memory }
- MemSize:= DataPtr^.W;
- write(MemSize:6,'K');
- {}end; { procedure ShowTotalMemory }
-
-
- {}procedure ShowMemUsage;
- begin
- gotoxy(16,5);
- write(MemSize - (prefixseg + 16) div 64,'K'); { total free memory }
- WriteHex(6,10,prefixseg); { starting address }
- write(':0100h');
- {}end; { procedure ShowMemUsage }
-
-
- {}procedure ShowKBInfo;
- var
- KBStart,
- KBEnd : word;
- begin
- DataPtr := ptr(DosDS,$0080); { start of KB buffer area }
- KBStart := DataPtr^.W;
- gotoxy(30,9);
- write(DosDSStr);
- write(HexString(KBStart),'h');
- DataPtr:= ptr(DosDS,$0082); { end of KB buffer area }
- KBEnd := DataPtr^.W;
- gotoxy(30,10);
- write(DosDSStr);
- write(HexString(KBEnd),'h');
- gotoxy(14,9);
- writeln((KBEnd - KBStart)/2 - 1:0:0); { difference in bytes }
- {}end; { procedure ShowKBInfo }
-
-
- {}procedure ShowVideoInfo;
-
- {--}procedure ShowInitialVideo(Mode : word);
- begin
- gotoxy(64,3);
- case (mode) and 3 of
- 1: write('40 x 25 BW/CGA');
- 2: write('80 x 25 BW/CGA');
- 3: write('80 x 25 BW/BW');
- end; { case }
- {--}end; { procedure ShowInitialVideo }
-
- {--}procedure ShowCurrentVideo;
- begin
- DataPtr:= ptr(DosDS,$0049);
- gotoxy(64,4);
- case (DataPtr^.B) of
- 0: write('40 x 25 BW');
- 1: write('40 x 25 color');
- 2: write('80 x 25 BW');
- 3: write('80 x 25 color');
- end; { case }
- CGA80 := DataPtr^.B = 3
- {--}end; { ShowCurrentVideo }
-
- {--}procedure ShowAttribute; { at cursor }
-
- {----}function GetAttr: byte;
- begin
- Regs.AX:= $0800;
- Regs.BX:= $0100;
- intr($10,Regs);
- GetAttr:= Regs.AX shr 8
- {----}end; { function GetAttr }
-
- begin
- gotoxy(72,5);
- write(GetAttr:6)
- {--}end; { procedure ShowAttribute }
-
- begin
- ShowInitialVideo(EquipWord shr 4);
- ShowCurrentVideo;
- ShowAttribute;
- DataPtr:= ptr(DosDS,$004E); { crt_start }
- gotoxy(65,6);
- write(DataPtr^.W:6,',');
- DataPtr:= ptr(DosDS,$004C); { crt_len }
- gotoxy(72,6);
- write(DataPtr^.W:6);
- DataPtr:= ptr(DosDS,$0062); { active_page }
- gotoxy(72,7);
- write(DataPtr^.B:6);
- DataPtr:= ptr(DosDS,$0060); { cursor_mode }
- gotoxy(72,8);
- write(DataPtr^.W:6);
- DataPtr:= ptr(DosDS,$0049); { crt_mode }
- gotoxy(72,9);
- write(DataPtr^.B:6);
- DataPtr:= ptr(DosDS,$0066); { crt_pallette }
- gotoxy(72,10);
- write(DataPtr^.B:6)
- {}end; { procedure ShowVideoInfo }
-
-
- {}procedure GetVersion(var DosVersion : String4);
- begin
- DosVersion:= ' .00';
- Regs.AX := $3000;
- msdos(Regs);
- DosVersion[1]:= chr(lo(Regs.AX) + ord('0'));
- if hi(Regs.AX) >= 10 then
- DosVersion[3]:= chr((hi(Regs.AX) div 10) + ord('0'));
- DosVersion[4] := chr((hi(Regs.AX) mod 10) + ord('0'));
- {}end; { procedure GetVersion }
-
-
- {}procedure ShowVersionInfo;
- var
- DosVersion : String4;
-
- begin
- GetVersion(DosVersion); { DOS Version }
- gotoxy(16, 12);
- write(DosVersion);
- DataPtr:= ptr($F000, $FFF5); { BIOS Version }
- gotoxy(32, 12);
- for I:= 0 to 7 do
- write(DataPtr^.PAC[I]);
- {}end; { procedure ShowVersionInfo }
-
-
- {}procedure ShowSelf;
- var
- RealVersion : real;
- ValCode : word;
- DosVersion : string[4];
- begin
- GetVersion(DosVersion);
- val(DosVersion,RealVersion,ValCode);
- if (RealVersion >= 3.0) and (ValCode = 0) then
- begin
- gotoxy(1,24);
- write(Self);
- end;
- {}end; { procedure ShowSelf }
-
-
- {}procedure ShowCtrlC;
-
- {--}function CtrlCCheck : boolean;
- begin
- Regs.AX:= $3300;
- msdos(Regs);
- CtrlCCheck:= (Regs.DX and $01) = 1;
- {--}end; { function CtrlCCheck }
-
- begin
- gotoxy(55, 12);
- if CtrlCCheck then
- write('ON':3)
- else
- write('OFF');
- {}end; { procedure ShowCtrlC }
-
-
- {}procedure ShowDiskVerify;
-
- {--}function DiskVerifyCheck : boolean;
- begin
- Regs.AX:= $5400;
- msdos(Regs);
- DiskVerifyCheck:= (Regs.AX and $01) = 1
- {--}end; { function DiskVerifyCheck }
-
- begin
- gotoxy(75, 12);
- if DiskVerifyCheck then
- write('ON':3)
- else
- write('OFF');
- {}end; { procedure ShowDiskVerify }
-
-
- {}function UseEnv(var Name: string80; var Value: string80): boolean;
- var
- Env : string;
- EP0,EP1 : pointer;
- EnvPos : word;
-
- {--}procedure SubString(Source :string;
- DelimL,DelimR :string80;
- var Object :string80;
- var Position :word);
-
- var
- SourceLen,LeftDLen,RightDLen,DelimLPos,DelimRPos : word;
-
- begin
- SourceLen:= length(Source);
- LeftDLen := length(DelimL);
- RightDLen:= length(DelimR);
- Object := '';
- Position := 0;
- if (SourceLen < 2) or (LeftDLen = 0) or (RightDLen = 0) then
- exit;
- DelimLPos:= pos(DelimL,Source);
- if DelimLPos = 0 then
- exit;
- delete(Source,1,DelimLPos + LeftDLen - 1);
- SourceLen:= length(Source);
- if SourceLen = 0 then
- exit;
- DelimRPos:= pos(DelimR,Source);
- if DelimRPos > 0 then
- begin
- Position:= DelimLPos;
- Object := copy(Source,1,DelimRPos - 1)
- end;
- {--}end; { procedure SubString }
-
- begin { function UseEnv }
- EP0 := ptr(memw[prefixseg:$002C],0);
- EP1 := @Env[1];
- Env[0]:= chr($FF);
- move(EP0^,EP1^,length(Env) - 1);
- SubString(Env,Name + '=',chr(0),Value,EnvPos);
- if EnvPos > 0 then
- UseEnv:= true
- else
- UseEnv:= false;
- {}end; { function UseEnv }
-
-
- {}procedure ShowEnvInfo;
- var
- EnvName,
- EnvValue,
- EnvValue2 : string80;
-
- {--}procedure ShowEnv(Row,Col : byte;
- EnvName : string80);
- var
- EnvLength,
- Position : byte;
- TestChar : char;
- begin
- gotoxy(Col,Row);
- write(EnvName + ' = ':10);
- if UseEnv(EnvName,EnvValue) then
- begin
- EnvLength:= length(EnvValue);
- if (EnvName = 'PATH') and (EnvLength > 45) then
- begin
- Position:= EnvLength;
- while (EnvValue[Position] <> ';') or (Position > 45) do
- dec(Position);
- EnvValue2:= copy(EnvValue,Position + 1,EnvLength);
- EnvValue[0]:= chr(Position);
- write(EnvValue);
- gotoxy(Col + 10,Row + 1);
- write(EnvValue2);
- end
- else
- write(EnvValue);
- end
- else
- write('undefined');
- {--}end; { procedure ShowEnv }
-
- begin
- ShowEnv(19,24,'COMSPEC');
- ShowEnv(20,24,'PROMPT');
- ShowEnv(21,24,'PATH');
- {}end; { procedure ShowEnvInfo }
-
-
- {}procedure ShowDiskParms;
- const
- DiskPointer = $0078;
- type
- DiskInfo = record
- Misc1, Misc2, MotorWait,
- BytesSector, SectorsTrack, GapLength,
- DTL, FmtGapLength, FmtFillByte,
- Settle, MotorStart : byte
- end;
- var
- DiskVector : AddrPtr;
- DiskParms : ^DiskInfo;
- begin
- DiskVector:= ptr($0000,DiskPointer);
- DiskParms := ptr(DiskVector^.Segment,DiskVector^.Offset);
- with DiskParms^ do
- begin
- gotoxy(15,19);
- write(125 * MotorStart:3);
- gotoxy(15,20);
- write(MotorWait / 18.5:3:1);
- gotoxy(15,21);
- write(Settle:3);
- gotoxy(14,22);
- write(256 * BytesSector:3,',');
- gotoxy(18,22);
- write(SectorsTrack:3);
- end;
- {}end; { procedure ShowDiskParms }
-
-
- {}procedure ShowDriveSpace;
- var
- Drive,
- ValidDrive : byte;
- FreeBytes : longint;
- begin
- Drive := 0;
- ValidDrive:= 0;
- while (Drive < 26) and (ValidDrive < 9) do
- begin
- gotoxy((3 + ValidDrive mod 4 * 20),(15 + ValidDrive div 4));
- inc(Drive);
- FreeBytes:= diskfree(Drive);
- if FreeBytes >= 0 then
- begin
- write(chr((Drive - 1)+ ord('A')),': ',FreeBytes);
- inc(ValidDrive);
- end;
- end;
- {}end; { procedure ShowDriveSpace }
-
- (*(((((((((((((((((((( O U T E R B L O C K ))))))))))))))))))))*)
-
- BEGIN
- Layout;
- textcolor(green);
- ShowSelf;
- ShowSysID;
- ShowEquipment;
- ShowTotalMemory;
- ShowMemUsage;
- ShowKBInfo;
- ShowVideoInfo;
- ShowVersionInfo;
- ShowCtrlC;
- ShowDiskVerify;
- ShowEnvInfo;
- ShowDiskParms;
- ShowDriveSpace;
- gotoxy(1, 24);
- END.