diff options
author | Jeffrey Armstrong <jeff@approximatrix.com> | 2024-11-13 21:29:56 -0500 |
---|---|---|
committer | Jeffrey Armstrong <jeff@approximatrix.com> | 2024-11-13 21:29:56 -0500 |
commit | 422cc37dd87a17957801db4c6ac1b2086b415b2b (patch) | |
tree | ab1c1e69915b2e5c895e9566a0f01a01d944fa14 | |
parent | a12b553ffbb45f20edbbe4255a07c3fa8a574b30 (diff) | |
download | GWFetch-422cc37dd87a17957801db4c6ac1b2086b415b2b.tar.gz GWFetch-422cc37dd87a17957801db4c6ac1b2086b415b2b.zip |
Niceties and cleanup to the output thus far
-rw-r--r-- | gwfetch.bas | 63 |
1 files changed, 46 insertions, 17 deletions
diff --git a/gwfetch.bas b/gwfetch.bas index d26bc85..2a8e665 100644 --- a/gwfetch.bas +++ b/gwfetch.bas @@ -1,15 +1,34 @@ -10 TMPFILE$ = "TEST.TMP"
-19 REM Determine the OS and interpretter
-20 REM CMD$ = "ver":GOSUB 5000:GOSUB 10000
-30 PRINT "INTERPRETER: ";INTERP$
-40 IF LEN(VERSION$) > 0 THEN PRINT "VERSION: ";VERSION$
-100 REM Determine memory
-110 REM CMD$ = "chkdsk":GOSUB 5000:GOSUB 11000
-120 PRINT "MEMORY: ";MEMFREE$;"/";MEMTOTAL$
-130 GOSUB 12000
-140 PRINT "CPUID: ";CPUID%
-1000 END
+10 REM Customization!
+20 COMPNAME$ = ""
+
+200 PRINT "Working..."
+210 TMPFILE$ = "TEST.TMP"
+219 REM Determine the OS and interpretter
+220 CMD$ = "ver":GOSUB 5000:GOSUB 10000
+230 REM PRINT "INTERPRETER: ";INTERP$
+240 REM IF LEN(VERSION$) > 0 THEN PRINT "VERSION: ";VERSION$
+250 REM Determine memory
+260 CMD$ = "chkdsk":GOSUB 5000:GOSUB 11000
+270 REM CPU Detection
+280 GOSUB 12000:GOSUB 12300
+
+1000 REM Output time
+1001 CLS
+1010 R = 2:C=41
+1020 IF LEN(COMPNAME$) = 0 THEN GOTO 1100
+1030 LOCATE R,C:PRINT COMPNAME$;
+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$;
+
+2000 END
5000 REM Run and pipe command
5010 REM TMPFILE$ contains the file for capture
@@ -22,7 +41,7 @@ 10011 REM output: INTERP$ is the interpeter
10012 REM VERSION$ is the version
10020 OPEN TMPFILE$ FOR INPUT AS #2
-10025 REM ON ERROR GOTO 10040
+10025 ON ERROR GOTO 10040
10030 INPUT#2, VERLINE$
10035 IF LEN(G$) = 0 THEN GOTO 10030 ELSE GOTO 10050
10040 RESUME 10060
@@ -33,13 +52,14 @@ 10100 IDX = INSTR(VERLINE$, "ersion")
10110 IF IDX = 0 THEN INTERP$ = VERLINE$:VERSION$="":RETURN
10120 IDX = IDX - 1
-10130 INTERP$ = LEFT$(VERLINE$, IDX - 1)
+10130 INTERP$ = LEFT$(VERLINE$, IDX - 2)
10140 IDX = IDX + 7
10150 VERSION$ = RIGHT$(VERLINE$, LEN(VERLINE$) - IDX)
10160 FOR IDX = 1 TO LEN(VERSION$)
10170 IF MID$(VERSION$, IDX, 1) = " " THEN VERSION$ = LEFT$(VERSION$,IDX-1)
10180 NEXT IDX
-10190 RETURN
+10190 IF INTERP$ = "MS-DOS" OR INTERP$="PC-DOS" THEN INTERP$ = INTERP$ + " Command"
+10200 RETURN
11000 REM 'chkdsk' output parser
11010 REM TMPFILE$ contains the file to open
11011 REM output: MEMTOTAL$ is the total memory in bytes
@@ -77,8 +97,7 @@ 12060 POKE BWOFFSET+1, INT(TGTOFFSET / 256)
12080 CPUQ = 1 + OS%
-12090 print "Calling!"
-12095 CALL CPUQ(CPUID%)
+12090 CALL CPUQ(CPUID%)
12097 DEF SEG
12100 REM ; Results:
@@ -170,9 +189,19 @@ 12186 DATA &H5D : REM pop bp
12187 DATA &HCA, &H02, &H00 : REM ); { retf 2}
12188 REM Total Bytes in Data: 100
-
12200 RETURN
+12300 REM Interprets CPUID% and returns a CPU name
+12310 DIM CPUNAME$(7)
+12320 CPUNAME$(0) = "8088" : CPUNAME$(1) = "8086"
+12330 CPUNAME$(2) = "V20" : CPUNAME$(3) = "V30"
+12340 CPUNAME$(4) = "80188" : CPUNAME$(5) = "80186"
+12350 CPUNAME$(6) = "80286"
+12360 CPUNAME$(7) = "80386"
+12370 IF CPUID% = 2 OR CPUID% = 3 THEN MFG$ = "NEC" ELSE MFG$ = "Intel"
+12380 CPU$ = MFG$+" "+CPUNAME$(CPUID%)
+12390 RETURN
+
30000 REM String Trim Function
30010 REM input/output: TOTRIM$
30020 FOR IDX = 1 TO LEN(TOTRIM$):IF MID$(TOTRIM$, IDX, 1) <> " " THEN GOTO 30030:NEXT IDX
|