aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/dosver.asm76
-rw-r--r--gwfetch.bas115
2 files changed, 186 insertions, 5 deletions
diff --git a/asm/dosver.asm b/asm/dosver.asm
new file mode 100644
index 0000000..8406663
--- /dev/null
+++ b/asm/dosver.asm
@@ -0,0 +1,76 @@
+ push bp
+ mov bp, sp
+
+ mov al, 0
+ mov ah, 0x30
+
+ int 0x21
+
+ ; Push actual version info onto stack
+ push ax
+
+ cmp bh, 0x00
+ jne notdrdos
+
+ ; Check if it is DR_DOS lying about being PC_DOS
+ mov ax, 0x4452
+ int 0x21
+ jc notdrdos
+
+ ; Mark drdos as 0xee
+ mov bh, 0xee
+
+ ; clear the stack in a meaningless way
+ pop cx
+
+ ; DrDos version, or something like it, is already in the ax reggy
+ jmp alldone
+
+
+notdrdos:
+ ; pop the actual version into ax now that we're done
+ ; with drdos checks
+ pop ax
+
+ cmp al, 5
+ je five
+
+ ; if al is still zero, it's dos 1
+ cmp al, 0
+ jne alldone
+
+ ; Mark it as MS-DOS 1.0
+ mov al, 1
+ mov ah, 0
+ mov bh, 0xFF
+ jmp alldone
+
+five:
+ ; Store the OEM version
+ push bx
+
+ mov ax, 0x3306
+ int 0x21
+
+ ; True version should have been in bx
+ push bx
+ pop ax
+ pop bx
+
+alldone:
+
+ mov cl, 8
+ shr bx, cl
+ xor bh, bh
+
+ ; second argument - OEM code in high byte
+ mov di, [bp]+6
+ mov [di], bx
+
+ ; first argument - major (al) minor(ah) versions
+ mov di, [bp]+8
+ mov [di], ax
+
+ pop bp
+ retf 4
+ \ No newline at end of file
diff --git a/gwfetch.bas b/gwfetch.bas
index 196f4c7..ac3caab 100644
--- a/gwfetch.bas
+++ b/gwfetch.bas
@@ -20,6 +20,13 @@
290 REM Get a machine name
300 GOSUB 14000
+310 REM DOS version
+320 GOSUB 12500
+329 REM DR-DOS is a mess, probably to fool MS software
+330 IF OEM% = &HEE THEN GOSUB 12900
+339 REM Get a name for this OS
+340 GOSUB 12700
+
500 REM Just produce an MSDOS logo for now
510 DIM LOGO$(25)
520 GOSUB 20000
@@ -35,6 +42,8 @@
1040 LOCATE R,C:PRINT STRING$(LEN(COMPNAME$),"-");
1095 R = R + 1
1100 REM Normal output
+1170 LOCATE R,C:PRINT "OS: ";OEM$;" Version ";DVERMAJOR$;".";DVERMINOR$;
+1175 R = R + 1
1180 IF LEN(MACHINE$) = 0 THEN GOTO 1200
1190 LOCATE R,C:PRINT "Host: ";MACHINE$;
1195 R = R + 1
@@ -49,8 +58,9 @@
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
+1997 LOCATE ROWS, 41:PRINT "Press any key...";
+1998 WHILE LEN(INKEY$) = 0:WEND
+1999 SYSTEM
2000 END
3000 REM Logo output
@@ -242,6 +252,97 @@
12380 CPU$ = MFG$+" "+CPUNAME$(CPUID%)
12390 RETURN
+12500 REM DOS Version
+12501 DIM Q2%(200)
+12505 DEF SEG=VARSEG(Q2%(0))
+12506 OS%=VARPTR(Q2%(0))
+12510 FOR I = 1 TO 75
+12520 READ JC:POKE I+OS%, JC
+12530 NEXT I
+12540 DOSVER = 1 + OS%
+12550 CALL DOSVER(DVER%, OEM%)
+12560 DEF SEG
+12570 TOTRIM$ = STR$(DVER% MOD 256):GOSUB 30000:DVERMAJOR$ = TOTRIM$
+12580 TOTRIM$ = STR$(INT(DVER% / 256)):GOSUB 30000:DVERMINOR$ = TOTRIM$
+12600 DATA &H55 : REM push bp
+12601 DATA &H89, &HE5 : REM mov bp, sp
+12602 DATA &HB0, &H00 : REM mov al, 0
+12603 DATA &HB4, &H30 : REM mov ah, 0x30
+12604 DATA &HCD, &H21 : REM int 0x21
+12605 REM ; Push actual version info onto stack
+12606 DATA &H50 : REM push ax
+12607 DATA &H80, &HFF, &H00 : REM cmp bh, 0x00
+12608 DATA &H75, &H0D : REM jne notdrdos
+12609 REM ; Check if it is DR_DOS lying about being PC_DOS
+12610 DATA &HB8, &H52, &H44 : REM mov ax, 0x4452
+12611 DATA &HCD, &H21 : REM int 0x21
+12612 DATA &H72, &H06 : REM jc notdrdos
+12613 REM ; Mark drdos as 0xee
+12614 DATA &HB7, &HEE : REM mov bh, 0xee
+12615 REM ; clear the stack in a meaningless way
+12616 DATA &H59 : REM pop cx
+12617 REM ; DrDos version, or something like it, is already in the ax reggy
+12618 DATA &HE9, &H1B, &H00 : REM jmp alldone
+12619 REM notdrdos:
+12620 REM ; pop the actual version into ax now that we're done
+12621 REM ; with drdos checks
+12622 DATA &H58 : REM pop ax
+12623 DATA &H3C, &H05 : REM cmp al, 5
+12624 DATA &H74, &H0D : REM je five
+12625 REM ; if al is still zero, it's dos 1
+12626 DATA &H3C, &H00 : REM cmp al, 0
+12627 DATA &H75, &H12 : REM jne alldone
+12628 REM ; Mark it as MS-DOS 1.0
+12629 DATA &HB0, &H01 : REM mov al, 1
+12630 DATA &HB4, &H00 : REM mov ah, 0
+12631 DATA &HB7, &HFF : REM mov bh, 0xFF
+12632 DATA &HE9, &H09, &H00 : REM jmp alldone
+12633 REM five:
+12634 REM ; Store the OEM version
+12635 DATA &H53 : REM push bx
+12636 DATA &HB8, &H06, &H33 : REM mov ax, 0x3306
+12637 DATA &HCD, &H21 : REM int 0x21
+12638 REM ; True version should have been in bx
+12639 DATA &H53 : REM push bx
+12640 DATA &H58 : REM pop ax
+12641 DATA &H5B : REM pop bx
+12642 REM alldone:
+12643 DATA &HB1, &H08 : REM mov cl, 8
+12644 DATA &HD3, &HEB : REM shr bx, cl
+12645 DATA &H30, &HFF : REM xor bh, bh
+12646 REM ; second argument - OEM code in high byte
+12647 DATA &H8B, &H7E, &H06 : REM mov di, [bp]+6
+12648 DATA &H89, &H1D : REM mov [di], bx
+12649 REM ; first argument - major (al) minor(ah) versions
+12650 DATA &H8B, &H7E, &H08 : REM mov di, [bp]+8
+12651 DATA &H89, &H05 : REM mov [di], ax
+12652 DATA &H5D : REM pop bp
+12653 DATA &HCA, &H04, &H00 : REM ); { retf 4}
+12654 REM Total Bytes in Data: 75
+12699 RETURN
+
+12700 REM Returns the DOS type from the OEM% value
+12710 OEM$ = "MS-DOS"
+12720 IF OEM% = &HEE OR OEM% = &HEF THEN OEM$ = "DR-DOS":RETURN
+12730 IF OEM% = &HFD THEN OEM$ = "FreeDos":RETURN
+12740 IF OEM% = 0 THEN OEM$ = "PC-DOS":RETURN
+12750 IF OEM% = &H66 THEN OEM$ = "PTS-DOS":RETURN
+12760 IF OEM% = &H5E THEN OEM$ = "RxDOS":RETURN
+12769 REM If we're here, stick with MS-DOS...
+12770 RETURN
+
+12900 REM Decipher DR-DOS versioning
+12910 LOWVER% = DVER% MOD 256
+12920 IF LOWVER% = &H41 THEN DVERMAJOR$ = "1":DVERMINOR$ = "2":RETURN
+12930 IF LOWVER% = &H60 THEN DVERMAJOR$ = "2":DVERMINOR$ = "0":RETURN
+12940 IF LOWVER% = &H63 THEN DVERMAJOR$ = "3":DVERMINOR$ = "41":RETURN
+12950 IF LOWVER% = &H64 THEN DVERMAJOR$ = "3":DVERMINOR$ = "42":RETURN
+12960 IF LOWVER% = &H65 THEN DVERMAJOR$ = "5":DVERMINOR$ = "0":RETURN
+12970 IF LOWVER% = &H67 OR LOWVER% = &H71 THEN DVERMAJOR$ = "6":DVERMINOR$ = "0":RETURN
+12980 IF LOWVER% = &H72 OR LOWVER% = &H73 THEN DVERMAJOR$ = "7":DVERMINOR$ = "0":RETURN
+12990 DVERMAJOR$ = "?":DVERMINOR$ = "?"
+12999 RETURN
+
13000 REM Create an Uptime string
13010 HOURS = INT(TIMER / 3600)
13020 MINUTES = INT(TIMER / 60) MOD 60
@@ -305,9 +406,13 @@
30010 REM input/output: TOTRIM$
30015 IF LEN(TOTRIM$) = 0 THEN RETURN
30016 IF INSTR(TOTRIM$, " ") = 0 THEN RETURN
-30020 FOR IDX = 1 TO LEN(TOTRIM$):IF MID$(TOTRIM$, IDX, 1) <> " " THEN GOTO 30030:NEXT IDX
-30030 FOR RDX = LEN(TOTRIM$) TO IDX STEP -1:IF MID$(TOTRIM$, RDX, 1) <> " " THEN GOTO 30050:NEXT RDX
-30040 TOTRIM$ = MID$(TOTRIM$, IDX, RDX - IDX)
+30020 FOR IDX = 1 TO LEN(TOTRIM$)
+30022 IF MID$(TOTRIM$, IDX, 1) <> " " THEN GOTO 30030
+30024 NEXT IDX
+30030 FOR RDX = LEN(TOTRIM$) TO IDX STEP -1
+30032 IF MID$(TOTRIM$, RDX, 1) <> " " THEN GOTO 30040
+30034 NEXT RDX
+30040 TOTRIM$ = MID$(TOTRIM$, IDX, RDX - IDX + 1)
30050 RETURN
30100 REM Row check