From 0de2625936fd03430ff096d8d1d8357826587cc7 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Mon, 25 Nov 2024 21:35:21 -0500 Subject: Added custom DOSBox specific code for getting memory stats --- gwfetch.bas | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/gwfetch.bas b/gwfetch.bas index 3141149..6baaddb 100644 --- a/gwfetch.bas +++ b/gwfetch.bas @@ -15,8 +15,7 @@ 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 REMCMD$ = "chkdsk":GOSUB 5000:GOSUB 11000 + 270 REM CPU Detection 280 GOSUB 12000:GOSUB 12300 @@ -35,6 +34,10 @@ 339 REM Get a name for this OS 340 GOSUB 12700 +400 REM Memory free +410 IF DOSBOX = 1 THEN GOSUB 14700:GOTO 500 +420 CMD$ = "chkdsk":GOSUB 5000:GOSUB 11000 + 500 REM Just produce an MSDOS logo for now 510 DIM LOGO$(25) 520 IF DOSBOX = 1 THEN GOSUB 20050:GOTO 1000 @@ -409,6 +412,30 @@ 14645 DOSBOX = 1 14650 RETURN +14700 REM DOSBox - memory stats +14710 CMD$ = "config -get "+CHR$(34)+"dosbox memsize"+CHR$(34):GOSUB 5000 +14720 OPEN TMPFILE$ FOR INPUT AS #2 +14730 INPUT#2, MEMTOTAL$ +14740 CLOSE#2 +14750 MEMTOTAL$ = MEMTOTAL$+"MB" +14760 CMD$ = "mem":GOSUB 5000 +14761 MEMORY = 0 +14762 EX = 0 +14770 OPEN TMPFILE$ FOR INPUT AS #2 +14780 INPUT#2, TOTRIM$:GOSUB 30000 +14800 FOR I=1 TO LEN(TOTRIM$) +14803 IF MID$(TOTRIM$,I,1) = " " THEN GOTO 14810 +14808 NEXT I +14810 IF (INSTR(TOTRIM$, "extended") + INSTR(TOTRIM$, "expanded")) > 0 THEN EX = EX + 1 +14815 IF EX > 1 THEN GOTO 14830 +14820 MEMFREE$ = MID$(TOTRIM$, 1, I):MEMORY = MEMORY + VAL(MEMFREE$) +14830 IF EOF(2) THEN GOTO 14840 ELSE GOTO 14780 +14840 CLOSE#2 +14850 MEMORY = INT(MEMORY / 1024) +14860 TOTRIM$ = STR$(MEMORY):GOSUB 30000 +14870 MEMFREE$ = TOTRIM$+"MB" +14880 RETURN + 20000 REM MS-DOS Logo 20010 LOGO$(1) = " " 20011 LOGO$(2) = " &&&&&& &&&&&& &&&&&&&&" -- cgit v1.2.3