Procedure Ramka. Procedure Process. Procedure New_KeyBoard. Procedure New_Timer, страница 2

if (xx+vx>=x2) then vx:=-1;

if (xx+vx<=x1) then vx:=1;

if (yy+vy>=y2) then vy:=-1;

if (yy+vy<=y1) then vy:=1;

end;

textcolor(4);

gotoxy(xx,yy);

write('_');

delay(70);

end;

Procedure Process6;{gen sim}

var

Yes:boolean;

k:integer;

Begin

If Free1 = 0 Then Pn[6]:=False;

While Pn[6] and (Free1>0) Do

Begin

Yes:=True;

k:=2;

While k<=round(Sqrt(w+1)) do

Begin

if(w mod k)=0 then

Begin

Yes:=False;

break;

end;

inc(k);

end;

if (Yes) then

begin

l:=b1+1-Free1;

Buffer_Sim[l]:=w;

Free1:=Free1-1;

end;

inc(w);

if w>500 then w:=3;

End;

End;

Procedure Process7;{viv sim}

Begin

TextColor(9);

Ramka(22,48,2,12);

TextColor(LightMagenta);

GotoXY(33,3);

Writeln('Simple');

If Free1 = b1 Then Pn[7]:=False;

While Pn[7] and (Free1<b1) Do

Begin

if GoX1>40 then begin GoX1:=23; inc(GoY1);end;

if GoY1>11 then GoY1:=4;

l:=b1-Free1;

GotoXY(GoX1,GoY1);

Write(Buffer_Sim[l]:4);

Free1:=Free1+1;

GoX1:=GoX1+4;

Delay(10);

End;

End;

{$F+}

Procedure New_KeyBoard; Interrupt ;

Begin

Code:= Port[$60];

while keypressed do readkey;

Case Code of

130: Begin Flag[1]:= not Flag[1];End;

131: Begin Flag[2]:= not Flag[2];End;

132: Begin Flag[3]:= not Flag[3];End;

133: Begin Flag[4]:= not Flag[4];End;

134: Begin Flag[5]:= not Flag[5];End;

135: Begin Flag[6]:= not Flag[6];End;

136: Begin Flag[7]:= not Flag[7];End;

End;

Inline($9C);

Old_KeyBoard;

End;

{$F-}

{$F+}

Procedure New_Timer;Interrupt;

Begin

p:=Random(7)+1;

Case p of

1: Begin If Flag[1] Then Pn[1]:=True;End;

2: Begin If Flag[2] Then Pn[2]:=True;End;

3: Begin If Flag[3] Then Pn[3]:=True;End;

4: Begin If Flag[4] Then Pn[4]:=True;End;

5: Begin If Flag[5] Then Pn[5]:=True;End;

6: Begin If Flag[6] Then Pn[6]:=True;End;

7: Begin If Flag[7] Then Pn[7]:=True;End;

End;

End;

{$F-}

Begin

ClrScr;

Assign(F,'h:\oc\sandra\english.txt');

Reset(F);

GetIntVec($1C, @Old_Timer);

SetIntVec($1C, Addr(New_Timer));

GetIntVec($9,@Old_KeyBoard);

SetIntVec($9,Addr(New_KeyBoard));

fll:=false;

vx:=1;

vy:=1;

Pn[1]:=True;

Pn[2]:=True;

Pn[3]:=True;

Pn[4]:=True;

Pn[5]:=True;

Pn[6]:=True;

Pn[7]:=True;

For i:=1 to 8 do

Flag[i]:=True;

Free:=b; Free1:=b1;

n1:=0; n2:=1;

w:=3;

GoX:=52;GoY:=4;

GoX1:=23;GoY1:=4;

Textcolor(10);

Ramka(3,18,7,22);

GotoXY(5,8);

TextColor(15);

Write('1-In buf(sqr)');

GotoXY(5,10);

TextColor(15);

Write('2-Fr buf(sqr)');

GotoXY(5,12);

TextColor(15);

Write('3-Reader ');

GotoXY(5,14);

TextColor(15);

Write('4-Print ');

GotoXY(5,16);

TextColor(15);

Write('5-Object');

GotoXY(5,18);

TextColor(15);

Write('6-In buf(sim)');

GotoXY(5,20);

TextColor(15);

Write('7-Fr buf(sim)');

While True Do

Begin

Textcolor(9);

Ramka(3,20,2,5);

If (Flag[1]) then

Begin

TextColor(15);

GotoXY(5,8);

Write('1-In buf(sqr)');

GotoXY(7,4); Write('1 process');

If Pn[1] Then Process1;

End

Else Begin

TextColor(7);

GotoXY(5,8);

Write('1-In buf(sqr)');

End;

If (Flag[2]) then

Begin

TextColor(15);

GotoXY(5,10);

Write('2-Fr buf(sqr)');

GotoXY(7,4); Write('2 process');

If Pn[2] Then Process2;

End

Else Begin

TextColor(7);

GotoXY(5,10);

Write('2-Fr buf(sqr)');

End;

If (Flag[3]) then

Begin

TextColor(15);

GotoXY(5,12);

Write('3-Reader ');

GotoXY(7,4); Write('3 process');

If Pn[3] Then Process3;

End

Else Begin

TextColor(7);

GotoXY(5,12);

Write('3-Reader ');

End;

If (Flag[4]) then

Begin

TextColor(15);

GotoXY(5,14);

Write('4-Print ');

GotoXY(7,4); Write('4 process');

If Pn[4] Then Process4;

End

Else  Begin

TextColor(7);

GotoXY(5,14);

Write('4-Print');

End;

If (Flag[5]) then

Begin

TextColor(15);

GotoXY(5,16);

Write('5-Object');

GotoXY(7,4); Write('5 process');

If Pn[5] Then Process5(20,42,13,25);

End

Else Begin

TextColor(7);

GotoXY(5,16);

Write('5-Object');

End;

If (Flag[6]) then

Begin

TextColor(15);

GotoXY(5,18);

Write('6-In buf(sim)');

GotoXY(7,4); Write('6 process');

If Pn[6] Then Process6;

End

Else Begin

TextColor(7);

GotoXY(5,18);

Write('6-In buf(sim)');

End;

If (Flag[7]) then

Begin

TextColor(15);

GotoXY(5,20);

Write('7-Fr buf(sim)');

GotoXY(7,4); Write('7 process');

If Pn[7] Then Process7;

End

Else Begin

TextColor(7);

GotoXY(5,20);

Write('7-Fr buf(sim)');

End;

If (not (Flag[1] or Flag[2] or Flag[3] or Flag[4]

or Flag[5] or Flag[6] or Flag[7])) Then begin Break;end;

End;

End.

___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________