From 4075a189f237bf9c5b223e512d4c0eaf24ca0cef Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Thu, 14 Nov 2024 14:57:26 -0500 Subject: The machine type is now guessed using video memory detection on the bow or the model number from bios on IBMs. --- gwfetch.bas | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 53 insertions(+), 7 deletions(-) (limited to 'gwfetch.bas') diff --git a/gwfetch.bas b/gwfetch.bas index fd22767..196f4c7 100644 --- a/gwfetch.bas +++ b/gwfetch.bas @@ -1,6 +1,10 @@ 10 REM Customization! -20 COMPNAME$ = "" +19 REM Maybe you want to name the computer? +20 COMPNAME$ = ENVIRON$("HOSTNAME") +28 REM Uptime can be shown, but is meaningless if the system has a clock +29 REM battery or the time has been set +30 SHOWUPTIME = 1 200 PRINT "Working..." 210 TMPFILE$ = "TEST.TMP" @@ -13,6 +17,9 @@ 270 REM CPU Detection 280 GOSUB 12000:GOSUB 12300 +290 REM Get a machine name +300 GOSUB 14000 + 500 REM Just produce an MSDOS logo for now 510 DIM LOGO$(25) 520 GOSUB 20000 @@ -27,12 +34,20 @@ 1035 R = R + 1 1040 LOCATE R,C:PRINT STRING$(LEN(COMPNAME$),"-"); 1095 R = R + 1 -1100 LOCATE R,C:PRINT "Shell: ";INTERP$; -1102 IF LEN(VERSION$) > 0 THEN PRINT " ";VERSION$; -1105 R = R + 1 -1110 LOCATE R,C:PRINT "CPU: ";CPU$; -1115 R = R + 1 -1120 LOCATE R,C:PRINT "Memory: ";MEMFREE$;" / ";MEMTOTAL$; +1100 REM Normal output +1180 IF LEN(MACHINE$) = 0 THEN GOTO 1200 +1190 LOCATE R,C:PRINT "Host: ";MACHINE$; +1195 R = R + 1 +1199 REM Uptime really only makes sense if the time was never set +1200 IF SHOWUPTIME <> 1 THEN GOTO 1220 +1201 LOCATE R,C:PRINT "Uptime Today: ";:GOSUB 13000 +1205 R = R + 1 +1220 LOCATE R,C:PRINT "Shell: ";INTERP$; +1222 IF LEN(VERSION$) > 0 THEN PRINT " ";VERSION$; +1225 R = R + 1 +1230 LOCATE R,C:PRINT "CPU: ";CPU$; +1235 R = R + 1 +1240 LOCATE R,C:PRINT "Memory: ";MEMFREE$;" / ";MEMTOTAL$; 1998 LOCATE ROWS, 41:PRINT "Press any key..."; 1999 WHILE LEN(INKEY$) = 0:WEND @@ -227,6 +242,37 @@ 12380 CPU$ = MFG$+" "+CPUNAME$(CPUID%) 12390 RETURN +13000 REM Create an Uptime string +13010 HOURS = INT(TIMER / 3600) +13020 MINUTES = INT(TIMER / 60) MOD 60 +13040 IF HOURS > 0 THEN PRINT HOURS;" hours "; +13050 PRINT MINUTES;" minutes"; +13060 RETURN + +14000 REM Guess machine +14010 REM output: MACHINE$ +14015 MACHID = 0 +14020 REM Check for Rainbow video memory first +14030 DEF SEG=&HEE00 +14040 IF PEEK(0) = &HFF AND PEEK(1) = 3 AND PEEK(3) = &HFF AND PEEK(4) = 18 THEN MACHID=100 +14050 DEF SEG +14099 IF MACHID > 0 THEN GOTO 14200 +14100 REM Detect using the machine id from the IBM bios +14110 DEF SEG=&HF000 +14120 MACHID = PEEK(&HFFFE) +14130 DEF SEG +14200 REM Parse Machine ID +14210 IF MACHID = 100 THEN MACHINE$="Digital Rainbow 100":GOTO 14299 +14220 IBMID = MACHID - &HF8 +14230 DIM IBMMODELS$(7) +14240 IBMMODELS$(0) = "PS/2 Model 80":IBMMODELS$(1) = "Convertible PC":IBMMODELS$(2) = "PS/2 Model 30" +14241 IBMMODELS$(3) = "PC/XT":IBMMODELS$(4) = "PC/AT or Compatible":IBMMODELS$(5) = "PCjr":: +14242 IBMMODELS$(6) = "PC/XT":IBMMODELS$(7) = "PC" +14250 IF IBMID >= 0 THEN MACHINE$ = "IBM "+IBMMODELS$(IBMID):GOTO 14299 +14260 IF MACHID = 154 OR MACHID = 46 THEN MACHINE$ = "Compaq PC":GOTO 14299 +14270 IF MACHID = 49 THEN MACHINE$ = "Sperry PC":GOTO 14299 +14299 RETURN + 20000 REM MS-DOS Logo 20010 LOGO$(1) = " " 20011 LOGO$(2) = " &&&&&& &&&&&& &&&&&&&&" -- cgit v1.2.3