-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCRT2.PAS
163 lines (133 loc) · 2.29 KB
/
CRT2.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
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
unit crt2;
interface
uses dos,u_adv;
var textattr:byte;
var creg:registers;
const co80 = 0;
procedure textmode(m:byte);
procedure sound(hz:word);
procedure nosound;
procedure window(x1,x2,y1,y2:integer);
function readkey:char;
function keypressed:boolean;
procedure clrscr;
procedure clreol;
procedure gotoxy(x,y:byte);
function wherex:byte;
function wherey:byte;
procedure writec(x,y,a:byte;s:String);
implementation
procedure textmode;
begin
end;
(*
procedure delay;
var starttime:word;
begin
d:=round(d * 0.018);
creg.ah:=0;
intr($1A,creg);
starttime:=creg.dx;
repeat
creg.ah:=0;
intr($1A,creg);
until abs(creg.dx - starttime) > d;
end;
*)
var saveportb:byte;
procedure sound;
begin
port[$43]:=$B6;
port[$42]:=lo(hz);
port[$42]:=hi(hz);
saveportb:=port[$61];
port[$61]:=saveportb OR $03;
end;
procedure nosound;
begin
saveportb:=port[$61];
port[$61]:=saveportb AND $FC;
end;
procedure window;
begin
end;
function readkey;
begin
if ((mouseon) and (not mouseactive)) then showmouse;
creg.ah:=0;
intr($16,creg);
if creg.al=0 then
begin
readkey:=#0;
creg.ch:=creg.al;
creg.cl:=creg.ah;
creg.ah:=5;
intr($16,creg);
end else
readkey:=char(creg.al);
end;
function keypressed;
var kp:boolean;
begin
if ((mouseon) and (not mouseactive)) then showmouse;
creg.ah:=1;
creg.Flags := creg.Flags OR 68;
intr($16,creg);
{writeln(creg.Flags);}
if (creg.Flags AND 64)<>0 then kp:=false else kp:=true;
{ if kp then
begin
creg.ch:=creg.ah;
creg.cl:=creg.al;
creg.ah:=5;
intr($16,creg);
end;}
keypressed:=kp;
end;
procedure clrscr;
begin
creg.ah:=0;
creg.al:=3;
intr($10,creg);
end;
procedure clreol;
begin
end;
procedure gotoxy;
begin
creg.ah:=2;
creg.bh:=0;
creg.dh:=y;
creg.dl:=x;
intr($10,creg);
end;
function wherex;
begin
creg.ah:=3;
creg.bh:=0;
intr($10,creg);
wherex:=creg.dl;
end;
function wherey;
begin
creg.ah:=3;
creg.bh:=0;
intr($10,creg);
wherey:=creg.dh;
end;
procedure writec;
begin
{ x,y,a,s }
creg.ah:=$13;
creg.al:=1;
creg.bh:=0;
creg.bl:=a;
creg.cx:=length(s);
creg.dh:=y;
creg.dl:=x;
creg.bp:=ofs(s)+1;
creg.es:=seg(s);
intr($10,creg);
end;
begin
end.