forked from christoh/fdformat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DESQVIEW.PAS
107 lines (94 loc) · 2.02 KB
/
DESQVIEW.PAS
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
{$F+,O+,I-}
UNIT desqview;
INTERFACE
USES dos;
TYPE str2 = String[2];
VAR desqresult : Byte;
desqregs : Registers;
desqversion : Word;
FUNCTION DesqviewPresent:Boolean;
PROCEDURE StartTask(x: str2);
PROCEDURE GiveUpCPU;
PROCEDURE GiveUpIdle;
PROCEDURE ExitTask;
IMPLEMENTATION
FUNCTION DesqviewPresent;
BEGIN
desqresult:=0;
WITH desqregs DO BEGIN
ax:=$2b01;
bx:=0;
cx:=$4445;
dx:=$5351;
msdos(desqregs);
IF bx=2 THEN bx:=Swap(bx);
IF bx=0 THEN DesqviewPresent:=False ELSE DesqviewPresent:=True;
desqversion:=bx;
END;
END;
PROCEDURE StartTask;
VAR fn: pathstr;
pif : ARRAY[0..415] OF Byte;
f : FILE;
BEGIN
desqresult:=0;
IF (DesqviewPresent) AND (desqversion>=$200) THEN BEGIN
fn:=FSearch(x+'-PIF.DVP',GetEnv('PATH'));
IF fn='' THEN BEGIN
desqresult:=1;
Exit;
END;
Assign(f,fn);
Reset(f,1);
IF IoResult<>0 THEN BEGIN
desqresult:=2;
Exit;
END;
IF FileSize(f)<>416 THEN BEGIN
desqresult:=3;
Close(f);
Exit;
END;
BlockRead(f,pif,416);
IF IoResult<>0 THEN BEGIN
desqresult:=4;
Close(f);
Exit;
END;
Close(f);
WITH desqregs DO BEGIN
ds:=Seg(pif);
es:=Seg(pif);
di:=Ofs(pif);
bx:=$1a0;
ax:=$102c;
intr($15,desqregs);
IF bx=0 THEN BEGIN
desqresult:=6;
Exit;
END;
END;
END ELSE
desqresult:=5;
END;
PROCEDURE GiveUpCPU;
BEGIN
WITH desqregs DO BEGIN
ax:=$1000;
intr($15,desqregs);
END;
END;
PROCEDURE GiveUpIdle;
BEGIN
WITH desqregs DO BEGIN
ah:=1;
intr($16,desqregs);
IF (flags AND FZero) <> 0 THEN GiveUpCPU;
END;
END;
PROCEDURE ExitTask;
BEGIN
IF DesqviewPresent THEN intr($19,desqregs);
desqresult:=1;
END;
END.