home *** CD-ROM | disk | FTP | other *** search
- {SYS_STAT Version 1.0
-
- Program to list equipment attached to a PC and provide additional information
- as to its general configuration. Some provision is made to allow changes to
- the system configuration. written by
- Bob MacDonald
- Rt #1, Box 859
- Lewisport, Ky 42351
- (502)295-3120
- Hope you find this program of some value. Any comments as to your changes
- or suggested enhancements are welcome.}
-
- program System_Status;
- {************************* Global Declarations ****************************}
- type
- date = record
- day, year, month, numday: integer;
- end;
- str2 = string[2];
- str3 = string[3];
- str8 = string[8];
- str25 = string[25];
- str32 = string[32];
- str40 = string[40];
- str64 = string[64];
- str80 = string[80];
- int = -32767..32767;
-
- var
- r : record case integer of
- 1 : (ax,bx,cx,dx,bp,si,di,ds,es,flags : integer);
- 2 : (al,ah,bl,bh,cl,ch,dl,dh : byte);
- end;
- d : date;
- option,max,i : integer;
- p,g,v,m,x,y,
- ch,what : char;
- inserton : boolean;
- buffer : str80;
- error : int;
-
- const
- wk : string[63]='Sunday Monday Tuesday WednesdayThursday Friday Saturday ';
- monthst : string[36] = 'JanFebMarAprMayJunJulAugSepOctNovDec';
- completed : boolean = false;
- {**************************************************************************}
- {$I dataform.lib}
- {$I scrn_hlp.lib}
- {$I drv_data.lib}
- {$I bios.lib}
- {$I data_in.lib}
- {**************************************************************************}
- function equipment(which : char):byte; {Determine attached equip. }
- var {NOTE: in order to isolate bits in a }
- result : integer; {register utilize SHL and SHR. if you }
- temp : byte; {want the X's in this picture }
- begin {xxxxxxXXxxxxxxxx first SHIFT LEFT 6 to}
- intr($11,r); {get XXxxxxxxxx000000 and then SHIFT }
- result := r.ax; {RIGHT 14 for 00000000000000XX which }
- case upcase(which) of {will yield the answer your after. }
- 'P': temp := result shr 14; {no. Printers }
- 'G': temp := (result shl 3) shr 15; {no. Game ports }
- 'R': temp := (result shl 4) shr 13; {no. Rs232 ports }
- 'V': temp := (result shl 10) shr 14; {initial Video mode }
- 'D': temp := (result shl 7) shr 15; {Dma chip installed (Y/N) }
- 'C': temp := (result shl 14) shr 15; {math Coprocessor (Y/N) }
- end;
- equipment := temp;
- end;
- {**************************************************************************}
- function k_available: real; {Ram available to DOS }
- var avail : real; {NOTE: this program is loaded }
- begin {and thus is deducted from the}
- avail := memavail; {available RAM }
- if avail < 0 then avail := avail + 65536.0;
- avail := avail*16;
- k_available := avail;
- end;
- {**************************************************************************}
- function k_installed:real; {Installed Ram avail to DOS }
- begin
- with r do
- begin
- intr($12,r);
- k_installed := r.ax;
- end;
- end;
- {**************************************************************************}
- procedure clr_area; {clear bottom 7 lines of }
- var i : integer; {screen for display of options}
- begin
- for i := 0 to 6 do
- begin
- gotoxy(1,19 +i);clreol;
- end;
- end;
- {**************************************************************************}
- procedure cursor(tln,bln : byte); {cursor control.. }
- begin {NOTE: this function is not }
- with r do {implemented on SANYO 55X }
- begin {tln = top scan line }
- r.ah := 1; {bln = bottom scan line }
- r.ch := tln;
- r.cl := bln;
- intr($10,r);
- end;
- end;
- {**************************************************************************}
- procedure disk_space;
- begin
- gotoxy(3,4);txt(1);writeln('Default Drive Data:');normvideo;
- gotoxy(3,5);write(dsk_format);
- gotoxy(3,6);write('Total Clusters ');writeln(comma(abs(dsk_data('c'))
- ,12,0));
- gotoxy(3,7);write('Bytes per Cluster ');writeln(comma (dsk_data('b'),12,0));
- gotoxy(3,8);write('Bytes Free ');writeln(comma (dsk_data('f'),12,0));
- gotoxy(3,9);write('Total Bytes ');writeln(comma (dsk_data('t'),12,0));
- gotoxy(3,10);write('Percent Free ');writeln(dsk_data('p'):8:2);
- gotoxy(3,11);write('Default Drive ');
- write(def_drv);writeln(': ');
- end;
- {**************************************************************************}
- procedure getdate(var d: date); {get system date }
- begin
- r.ax := $2a00; {load 2Ah into the AH register}
- MsDos (r); {request interrupt 21h }
- d.day := lo(r.ax);
- d.year := r.cx;
- d.month := hi(r.dx);
- d.numday := lo(r.dx);
- end;
- {**************************************************************************}
- procedure verify; {see if disk write verify is on or off}
- begin {look in your AUTOEXEC.BAT file }
- r.ax := $5400; {load 54h into the AH register}
- MsDos(r); {request interrupt 21h }
- if lo(r.ax) = 0 then writeln('Verify is OFF');
- if lo(r.ax) = 1 then writeln('Verify is ON ');
- end;
- {**************************************************************************}
- procedure set_verify; {turn disk write verify on or off }
- var status : byte;
- chng : boolean;
- old,new : str3;
- begin
- r.ax := $5400;
- msdos(r);
- chng := odd(lo(r.ax)); {if ON then true else false }
- if chng then old := ' ON' else old := 'OFF';
- if chng then new := 'OFF' else new := ' ON';
- if chng then status := 0 else status := 1;
- clr_area;
- write('Verify is presently ');r_video;
- write(old);normvideo;txt(3);
- write(' do you want to turn it ');r_video;
- write(new);normvideo;
- write(' ? (Y/N) ');
- cursor(2,12); {create "BIG" cursor }
- repeat
- read(kbd,ch);
- ch := upcase(ch);
- write(ch);
- until (ch = #89) or (ch = #78);
- cursor(48,13); {turn cursor off again }
- if (ch = #78) then exit;
- r.ax := $2E shl 8 + status; {ah = 2EH and al = 1 or 0 }
- r.dx := $0 shr 8; {dl = 0 }
- msdos(r);
- gotoxy(43,15);verify;
- end;
- {**************************************************************************}
- procedure controlbrk; {see if control-break is set or not }
- begin {look in your CONFIG.SYS file }
- r.ax := $3300; {load 33h into the AH register}
- MsDos(r); {request interrupt 21h }
- if lo(r.dx) = 0 then writeln('Ctrl-Break is OFF');
- if lo(r.dx) = 1 then writeln('Ctrl-Break is ON ');
- end;
- {**************************************************************************}
- procedure set_ctrl_break; {turn control-break on or off }
- var status : byte; {NOTE: this procedure is vertually }
- chng : boolean; {identical to 'set_verify' }
- old,new : string[3];
- begin
- r.ax := $3300;
- msdos(r);
- chng := odd(lo(r.dx));
- if chng then old := ' ON' else old := 'OFF';
- if chng then new := 'OFF' else new := ' ON';
- if chng then status := 00 else status := 01;
- clr_area;
- write('Control-Break is presently ');r_video;
- write(old);normvideo;txt(3);
- write(' do you want to turn it ');r_video;
- write(new);normvideo;
- write(' ? (Y/N) ');
- cursor(2,12); {create large cursor}
- repeat
- read(kbd,ch);
- ch := upcase(ch);
- write(ch);
- until (ch = #89) or (ch = #78);
- cursor(48,13); {turn cursor off again}
- if (ch = #78) then exit;
- r.ax := $33 shl 8 + 01;
- r.dl := status;
- msdos(r);
- gotoxy(43,16);controlbrk;
- end;
- {**************************************************************************}
- procedure dos; {get DOS version number }
- begin
- r.ax := $3000; {set AH=30h and AL=00h }
- MsDos(r); {request interrupt 21h }
- writeln('DOS Version ',r.ax and $00ff,'.',r.ax shr 8);
- end;
- {**************************************************************************}
- procedure time; {get and display the system time }
- var
- hour,sec,
- min, hund : integer;
- ampm : str2;
- begin
- r.ax := $2C00; {set AH = 2CH }
- MsDos(r);
- hour := hi(r.cx); {CH contains the hour }
- min := lo(r.cx); {CL contains the minutes }
- sec := hi(r.dx); {DH contains the seconds }
- hund := lo(r.dx); {DL contains 1/100 seconds }
- if hour < 12 then ampm := 'AM' else ampm := 'PM';
- if hour > 12 then hour := hour - 12;
- txt(15);gotoxy(69,2);
- write(hour,':',min);txt(3);write(' ',ampm);
- end;
- {**************************************************************************}
- procedure box_scrn; {box screen for data display }
- begin
- gotoxy(1,1);write(chr(201));
- horzln(2,1,27,205);txt(15);write('[ System Status Report ]');
- txt(3);
- horzln(54,1,27,205);
- gotoxy(80,1);write(chr(187));
- gotoxy(1,2);write(chr(186));
- gotoxy(80,2);write(chr(186));
- gotoxy(1,3);write(chr(204));
- horzln(2,3,38,205);
- gotoxy(40,3);write(chr(203));
- horzln(41,3,39,205);
- gotoxy(80,3);write(chr(185));
- vertln(1,4,9,186);
- vertln(40,4,9,186);
- vertln(80,4,9,186);
- gotoxy(1,13);write(chr(199));
- horzln(2,13,38,196);
- gotoxy(40,13);write(chr(208));
- horzln(41,13,24,196);
- gotoxy(65,13);write(chr(210));
- horzln(66,13,14,196);
- vertln(1,14,4,186);
- vertln(80,14,4,186);
- vertln(65,14,4,186);
- gotoxy(80,13);write(chr(182));
- gotoxy(1,18);write(chr(200));
- horzln(2,18,63,205);
- gotoxy(65,18);write(chr(202));
- horzln(66,18,14,205);
- gotoxy(80,18);write(chr(188));
- end;
- {**************************************************************************}
- procedure key_stat(which :char); {check status of key locks}
- var result : integer;
- temp : byte;
- on : boolean;
- begin
- r.ax := $0200;
- intr($16,r);
- result := lo(r.ax); {temp = 0 for off and}
- case upcase(which) of {temp = 1 for on }
- 'S' : temp := (result shl 3) shr 7; {scroll lock }
- 'N' : temp := (result shl 2) shr 7; {num lock}
- 'C' : temp := (result shl 1) shr 7; {Caps lock}
- 'I' : temp := result shl 7; {insert}
- end;
- on := odd(temp);
- if on then write(' ON') else write('OFF');
- end;
- {**************************************************************************}
- procedure show_key_status; {display the key lock status}
- begin
- gotoxy(66,14);txt(1);write(' Key Locks: ');txt(15);
- gotoxy(67,15);write('Scroll - ');gotoxy(76,15);key_stat('s');
- gotoxy(67,16);write('Num - ');gotoxy(76,16);key_stat('n');
- gotoxy(67,17);write('Caps - ');gotoxy(76,17);key_stat('c');
- end;
- {**************************************************************************}
- procedure big_txt_option; {use extended character set to }
- begin {spell the word "OPTION" }
- gotoxy(8,20);write(chr(201),chr(205),chr(187),' ',chr(201),chr(205),chr(187)
- ,' ',chr(201),chr(203),chr(187),' ',chr(203),' ',chr(201)
- ,chr(205),chr(187),' ',chr(204),chr(205),chr(187),' ',
- chr(201),chr(205),chr(187),' ',chr(254));
- gotoxy(8,21);write(chr(186),' ',chr(186),' ',chr(204),chr(205),chr(188),
- ' ',chr(186),' ',chr(186),' ',chr(186),' ',chr(186),' ',
- chr(186),' ',chr(186),' ',chr(200),chr(205),chr(187));
- gotoxy(8,22);write(chr(200),chr(205),chr(188),' ',chr(208),' ',chr(208),
- ' ',chr(202),' ',chr(200),chr(205),chr(188),' ',
- chr(208),' ',chr(208),' ',chr(200),chr(205),chr(188),
- ' ',chr(254));
- end;
- {**************************************************************************}
- procedure exit_prg; {clean-up first and then exit program }
- begin
- cursor(12,13); { turn cursor back on }
- normvideo; { restore initial screen colors }
- clrscr; { clear screen }
- completed := true; { exit to DOS }
- end;
- {**************************************************************************}
- procedure change_drvs; {select a new default drive }
- var n_drv : char;
- begin
- clr_area;
- gotoxy(32,22);write('Enter new drive ');
- cursor(2,12); {create "BIG" cursor }
- read(kbd,n_drv);
- n_drv := upcase(n_drv);
- write(n_drv,':');
- cursor(48,13); {turn cursor off again }
- chng_def(n_drv);
- disk_space;
- end;
- {**************************************************************************}
- procedure menu;
- begin
- clr_area;
- txt(15);big_txt_option;
- gotoxy(38,20);writeln(' Change DEFAULT drive');
- gotoxy(38,21);writeln(' Set VERIFY switch');
- gotoxy(38,22);writeln(' Set CONTROL-BREAK switch');
- gotoxy(38,23);writeln(' QUIT');
- choice := query(4,38,20,4);
- case choice of
- 1 : change_drvs;
- 2 : set_verify;
- 3 : set_ctrl_break;
- 4 : exit_prg;
- else menu;
- end;
- end;
- {********************** MAIN PROGRAM **************************************}
- begin
- clrscr;
- txt(3); {lowvideo }
- cursor(48,13); {turn the cursor off }
- box_scrn;
- gotoxy(2,2);write('Today is ');txt(15);
- getdate(d);
- write(copy(wk,9*d.day+1,9),' ');
- write(copy(monthst,3*d.month-2,3),d.numday:3,',',d.year:4);
- txt(3);gotoxy(57,2);write('The time is ');time;
- disk_space;
- gotoxy(3,14);txt(1);writeln('System Information:');txt(15);
- gotoxy(3,15);dos;
- gotoxy(3,16);writeln('ROM BIOS Ver. Date ',biosver);
- gotoxy(3,17);write('BIOS (c) -');strip(copywrite);
- gotoxy(43,15);verify;
- gotoxy(43,16);controlbrk;
- show_key_status;
- gotoxy(43,4);txt(1);writeln('Equipment List:');txt(15);
- gotoxy(42,5);writeln(' Computer Model ',sysmodel);
- gotoxy(42,6);writeln(' No. of Printers ',equipment('p'));
- gotoxy(42,7);write(' DMA Chip ');
- case equipment('d') of
- 1 : writeln('NO');
- 0 : writeln('YES');
- end;
- gotoxy(42,8);write(' Math Coprocessor ');
- case equipment('c') of
- 0 : writeln('NO');
- 1 : writeln('YES');
- end;
- gotoxy(42,9);writeln(' No. of RS232 Ports ',equipment('r'));
- gotoxy(42,10);write(' Initial Video Mode ');
- case equipment('v') of
- 1: writeln('40x25 COLOR');
- 2: writeln('80x25 COLOR');
- 3: writeln('80x25 MONO');
- end;
- gotoxy(42,11);writeln(' Installed Ram ',comma((k_installed*1024),7,0)
- ,' bytes');
- gotoxy(42,12);writeln(' Available Ram ',comma(k_available,7,0),
- ' bytes');
- txt(3);
- completed := false;
- while not completed do
- begin
- menu;
- end;
- end.