aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gwfetch.bas52
1 files changed, 48 insertions, 4 deletions
diff --git a/gwfetch.bas b/gwfetch.bas
index f2d394a..1dcd1ed 100644
--- a/gwfetch.bas
+++ b/gwfetch.bas
@@ -11,13 +11,17 @@
152 PRINT "While we have some time, please consider donating if you"
153 PRINT "like this software. I suggest:"
154 PRINT
-155 IF INT(TIMER) MOD 2 = 0 THEN GOTO 165
+155 IF INT((TIMER - INT(TIMER)) * 10) MOD 2 = 0 THEN GOTO 165
160 PRINT "The Greater Cleveland Food Bank"
161 PRINT "https://greaterclevelandfoodbank.org/"
-162 GOTO 190
+162 PRINT:PRINT "Working to end hunger today, tomorrow, and for a lifetime"
+163 PRINT "in northeast Ohio (U.S.A)."
+164 GOTO 190
165 PRINT "Colors+ Youth Center"
166 PRINT "https://colorsplus.org/"
-167 GOTO 190
+167 PRINT:PRINT "Working to strengthen LGBTQ+ youth and allies by promoting"
+168 PRINT "individual and community wellness in northeast Ohio (U.S.A.)."
+169 GOTO 190
190 PRINT:PRINT "(The author of GWFetch has no affiliation with the above org."
191 PRINT "Please consider donating if you like this software.)"
@@ -50,7 +54,9 @@
400 REM Memory free
410 IF DOSBOX = 1 THEN GOSUB 14700:GOTO 500
-420 CMD$ = "chkdsk":GOSUB 5000:GOSUB 11000
+419 REM MS-DOS version 4 and up should have MEM available as a cmd
+420 IF OEM$ = "MS-DOS" AND VAL(DVERMAJOR$) >= 4 THEN CMD$ = "mem":GOSUB 5000:GOSUB 15000:GOTO 500
+430 CMD$ = "chkdsk":GOSUB 5000:GOSUB 11000
500 REM Just produce an MSDOS logo for now
510 DIM LOGO$(25)
@@ -452,6 +458,29 @@
14870 MEMFREE$ = TOTRIM$+"MB"
14880 RETURN
+15000 REM MS-DOS mem parser
+15010 REM TMPFILE$ contains the file to open
+15011 REM output: MEMTOTAL$ is the total memory in kbytes
+15012 REM MEMFREE$ is the available memory in bytes
+15020 MEMTOTAL$ = "":MEMFREE$ = "":MEMLINE$ = ""
+15030 OPEN TMPFILE$ FOR INPUT AS #2
+15040 INPUT#2, MEMLINE$
+15050 IF INSTR(MEMLINE$, "Total memory") > 0 THEN GOTO 15070
+15060 IF EOF(2) THEN GOTO 15070 ELSE GOTO 15040
+15070 CLOSE #2
+15080 TOTRIM$ = MEMLINE$:GOSUB 30000
+15089 REM Get rid of the "Total memory" text
+15090 TOTRIM$ = RIGHT$(TOTRIM$, LEN(TOTRIM$) - 13):GOSUB 30000
+15099 REM pull out the tokens, should be total, used, free
+15100 GOSUB 30300:MEMTOTAL$ = TOKEN$
+15110 GOSUB 30300
+15120 GOSUB 30300:MEMFREE$ = TOKEN$
+15130 IDX = INSTR(MEMTOTAL$, "K")
+15140 IF IDX > 0 THEN MEMTOTAL$ = LEFT$(MEMTOTAL$, IDX-1) + "kB" ELSE MEMTOTAL$ = MEMTOTAL$ + "B"
+15150 IDX = INSTR(MEMFREE$, "K")
+15160 IF IDX > 0 THEN MEMFREE$ = LEFT$(MEMFREE$, IDX-1) + "kB" ELSE MEMFREE$ = MEMFREE$ + "B"
+15170 RETURN
+
20000 REM MS-DOS Logo
20010 LOGO$(1) = " "
20011 LOGO$(2) = " &&&&&& &&&&&& &&&&&&&&"
@@ -565,3 +594,18 @@
30230 IF C$ = "." THEN ISNUM = 1:RETURN
30240 IF ASC(C$) >= ASC("0") AND ASC(C$) <= ASC("9") THEN ISNUM = 1:RETURN
30250 ISNUM = 0:RETURN
+
+30300 REM Split first token by spaces
+30301 REM input: TOTRIM$
+30302 REM output: TOKEN$ the first token split on spaces
+30303 REM TOTRIM$ the remaining string
+30310 GOSUB 30000
+30320 FOR I = 1 TO LEN(TOTRIM$)
+30330 IF MID$(TOTRIM$, I, 1) = " " THEN GOTO 30350
+30340 NEXT I
+30350 TOKEN$ = LEFT$(TOTRIM$, I)
+30360 REMAINING = LEN(TOTRIM$) - I
+30370 IF REMAINING < 1 THEN TOTRIM$ = "":RETURN
+30380 TOTRIM$ = RIGHT$(TOTRIM$, REMAINING)
+30390 GOSUB 30000
+30395 RETURN