-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FADER.PAS
90 lines (74 loc) · 1.59 KB
/
FADER.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
{ In Procdures FADEIN & FADEOUT, the (X) is the delay between
screen darkenings. }
Unit Fader;
Interface
Uses Crt;
Const
PelAddrRgR = $3C7;
PelAddrRgW = $3C8;
PelDataReg = $3C9;
Type
RGB = Record
R,
G,
B : Byte;
End;
Color = Array [0..63] Of RGB;
Var
Col : Color;
Procedure GetCol(C : Byte; Var R, G, B : Byte);
Procedure SetCol(C, R, G, B : Byte);
Procedure SetInten(B : Byte);
Procedure FadeIn (X:Integer);
Procedure FadeOut (X:Integer);
Implementation
Procedure GetCol(C : Byte; Var R, G, B : Byte);
Begin
Port[PelAddrRgR] := C;
R := Port[PelDataReg];
G := Port[PelDataReg];
B := Port[PelDataReg];
End;
Procedure SetCol(C, R, G, B : Byte);
Begin
Port[PelAddrRgW] := C;
Port[PelDataReg] := R;
Port[PelDataReg] := G;
Port[PelDataReg] := B;
End;
Procedure SetInten(b : Byte);
Var
I : Integer;
FR, FG, FB : Byte;
Begin
For I:=0 To 63 Do
Begin
FR:=Col[I].R*B Div 63;
FG:=Col[I].G*B Div 63;
FB:=Col[I].B*B Div 63;
SetCol(I, FR, FG, FB);
End;
End;
Procedure FadeIn (X:Integer);
Var
Y:Integer; (* Y is the LCV *)
Begin
For Y:=0 To 63 Do
Begin
SetInten(Y);
Delay(X);
End;
End;
Procedure FadeOut (X:Integer);
Var
Y:Integer; (* Y is the LCV *)
Begin
For Y:=0 To 63 Do
GetCol(Y, Col[Y].R, Col[Y].G, Col[Y].B);
For Y:=63 DownTo 0 Do
Begin
SetInten(Y);
Delay(X);
End;
End;
End.