-
Notifications
You must be signed in to change notification settings - Fork 0
/
ictrl.pas
74 lines (74 loc) · 2.94 KB
/
ictrl.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
Unit ictrl;
(***********************************************************)
(**) interface (**)
(***********************************************************)
const SaveFileName='.\sav\intrctrl.sav';
type ResetProcs = procedure of object;
type IntrCtrl=class
(***********************************************************)
(**) private (**)
(***********************************************************)
resets : array [0..20] of resetProcs;
Ndevices : byte;
(***********************************************************)
(**) public (**)
(***********************************************************)
PendingIntr:boolean; //This indicates which interrupt number is pending. Note by this you may specify any interrupt in VB.
pendingIntNo:byte; //This indicates if interrupt is pending.
interfaces_int:word;
procedure irq(channel:byte); //By this you may request an interruption.
procedure AddResets(r:resetProcs);
procedure StatusSave;
procedure StatusRestore;
constructor create; //Initialize and creates a new object.
procedure reset;
end;
(******************************************************************************)
(**) (**)
(**) implementation (**)
(**) (**)
(******************************************************************************)
Procedure IntrCtrl.irq(channel:byte);
begin
pendingintno:=channel;
pendingintr:=true;
end;
(******************************************************************************)
constructor IntrCtrl.create;
begin
PendingIntr:=false;
Ndevices:=0;
end;
(******************************************************************************)
procedure IntrCtrl.AddResets(r:resetProcs);
begin
resets[Ndevices]:=r;
inc(Ndevices);
end;
(******************************************************************************)
procedure IntrCtrl.reset;
var i:byte;
begin
for i:=0 to Ndevices-1 do resets[i];
end;
(******************************************************************************)
procedure IntrCtrl.StatusSave;
var f:file;
begin
assignfile(f,SaveFileName);
rewrite(f,1);
blockwrite(f,ndevices,1);
blockwrite(f,PendingIntr,4);
closefile(f);
end;
(******************************************************************************)
procedure IntrCtrl.StatusRestore;
var f:file;
begin
assignfile(f,SaveFileName);
system.reset(f,1);
blockread(f,ndevices,1);
blockread(f,PendingIntr,4);
closefile(f);
end;
end.