1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
(* dosfetch - a neofetch clone for DOS
*
* Written by Leah Neukirchen <leah@vuxu.org>
*
* To the extent possible under law, the creator of this work has waived
* all copyright and related or neighboring rights to this work.
*)
program dosfetch;
uses crt, dos;
{
More ideas:
- uptime (hard)
- CPU details
}
function cmos(cmd: byte): byte;
begin
port[$70] := cmd;
cmos := port[$71];
end;
procedure base_memory;
var a : integer;
begin
asm
int $12;
mov a, ax;
end;
writeln(a, ' KB');
end;
procedure extended_memory;
begin
writeln(cmos($17) + 256*longint(cmos($18)), ' KB');
end;
procedure disksize(disk: byte);
var a, b, c, d : integer;
total, free : longint;
begin
asm
mov ah, $36;
mov dl, disk;
int $21;
mov a, ax;
mov b, bx;
mov c, cx;
mov d, dx;
end;
free := longint(a)*longint(c)*longint(b);
total := longint(a)*longint(c)*longint(d);
write(free div 1024, '/', total div 1024, ' KB (');
writeln(round(100-(free/total)*100), '% free)');
end;
procedure dosver;
var maj, min, ven : byte;
smaj, smin, sven : string;
begin
asm
mov ax, $3000;
int $21;
mov ven, bh;
mov ax, $3306;
int $21;
mov maj, bl;
mov min, bh;
end;
case ven of
$00 : write('IBM DOS ');
$FD : write('FreeDOS ');
$FF : write('MS DOS ');
else write('Unknown DOS ');
end;
writeln(maj, '.', min);
end;
procedure floppy;
var a : byte; f : integer;
begin
asm
int $11;
mov a, al;
end;
if ((a and $1) = $1) then
f := (a shr 6) + 1
else
f := 0;
writeln(f);
end;
procedure fpu;
var a : byte;
begin
asm
int $11;
mov a, al;
end;
if ((a and $2) = $2) then
writeln('YES')
else
writeln('no');
end;
procedure colorline(s : string);
var y, b, r : string;
begin
write(' ');
textcolor(yellow); write(copy(s, 1, 14));
textcolor(lightblue); write(copy(s, 15,14));
textcolor(lightred); write(copy(s, 29,14));
normvideo;
write(' ');
end;
begin
clrscr;
writeln;
colorline('88888888ba, ,ad8888ba, ad88888ba ');
textcolor(white); write('OS: '); normvideo; dosver;
colorline('88 `"8b d8"'' `"8b d8" "8b ');
textcolor(white); write('Shell: '); normvideo; writeln(getenv('COMSPEC'));
colorline('88 `8b d8'' `8b Y8, ');
textcolor(white); write('Floppy drives: '); normvideo; floppy;
colorline('88 88 88 88 `Y8aaaaa, ');
textcolor(white); write('Disk: '); normvideo; disksize(0);
colorline('88 88 88 88 `"""""8b, ');
textcolor(white); write('Base Memory: '); normvideo; base_memory;
colorline('88 8P Y8, ,8P `8b ');
textcolor(white); write('Ext. Memory: '); normvideo; extended_memory;
colorline('88 .a8P Y8a. .a8P Y8a a8P ');
textcolor(white); write('Floating Point Unit: '); normvideo; fpu;
colorline('88888888Y"'' `"Y8888Y"'' "Y88888P"');
writeln;
end.
|