Организация параллельной работы нескольких процессов. Описание процедур, страница 4

var my_stroka_n:byte;

begin

my_stroka_n:=length(name);

if (my_stroka_i-14)>my_stroka_n then my_stroka_i:=15;

if stroka = 1 then

begin

If Not On[3] Then begin

gotoxy(15,2);

textcolor(1);

write(name);

Exit;

end

else begin

gotoxy(my_stroka_i,2);

textcolor(random(16));

write(name[my_stroka_i-14]);

inc(my_stroka_i);

end;

end

else

begin

If Not On[3] Then begin

gotoxy(15,23);

textcolor(1);

write(name);

Exit;

end

else begin

gotoxy(my_stroka_i,23);

textcolor(random(16));

write(name[my_stroka_i-14]);inc(my_stroka_i);end;

end;

end;

{===========================================================================}

procedure my_kbrd; interrupt;

var ch:char;

begin

inline ($9C);

my_kbrd_Old;

if Port[$60] < $80 then

if keypressed then

begin

ch := readkey;

case ch of

#27 : begin

on[1]:=false;

on[3]:=false;

on[4]:=false;

on[5]:=false;

on[6]:=false;

end;

'c' : begin

On[1]:= Not On[1];

if on[1]=true then textcolor(green)

else textcolor(white);

gotoxy(60,7);write('C');

end;

']' : if n1<10 then inc(n1);

'[' : if n1>1 then dec(n1);

'p' : if n2<10 then inc(n2);

'o' : if n2>1 then dec(n2);

'i' : if n3<10 then inc(n3);

'u' : if n3>1 then dec(n3);

'w' : if n4<50 then inc(n4);

'q' : if n4>1 then dec(n4);

'r' : if n5<50 then inc(n5);

'e' : if n5>1 then dec(n5);

's' : begin

On[3]:= Not On[3];

if on[3]=true then textcolor(green)

else begin

textcolor(white);

my_stroka_i:=15;

end;

gotoxy(60,6);write('S');

end;

'k' : begin

On[4]:= Not On[4];

if on[4]=true then textcolor(green)

else textcolor(white);

gotoxy(60,8);write('K');

end;

'l' : begin

On[5]:= Not On[5];

if on[5]=true then textcolor(green)

else textcolor(white);

gotoxy(60,9);write('L');

end;

'z' : begin

On[6]:= Not On[6];

if on[6]=true then textcolor(green)

else textcolor(white);

gotoxy(60,5);write('Z');

end;

end;

if ((not On[1])and(not On[3])and(not On[4])and(not On[5])and(not On[6]))

then

onexit;

end;

end;

{===========================================================================}

procedure my_rule; interrupt;

begin

inline ($9C);

my_rule_Old;

inc(t1);

inc(t2);

inc(t3);

my_clock;

textcolor(6);gotoxy(54,5);write(n3:2,',',n2:2);

textcolor(6);gotoxy(57,6);write(n1:2);

textcolor(6);gotoxy(57,8);write(n4:2);

textcolor(6);gotoxy(57,9);write(n5:2);

if t1>=n1 then

begin t1:=0;my_stroka;

end;

my_letalka;

if tic > Kvant[Number] then

begin

Kvant[0]:=random(n4);

gotoxy(26,13);

textcolor(13);

if on[4] then write(':',Kvant[0]:2)

else write(':--');

Kvant[1]:=random(n5);

gotoxy(55,13);

textcolor(13);

if on[5] then write(':',Kvant[1]:2)

else write(':--');

Tic:= 0;

Number:=random(2);

end;

Inc(Tic);

Case Number Of

0: begin

gotoxy(39,13);

textcolor(7);

if  on[5] then write('Waiting':7);

my_producter;

end;

1: begin

gotoxy(12,13);

textcolor(7);

if  on[4] then write('Waiting':7);

my_consumer;

end;

End;

my_buffer;

end;

{$F-}

{===========================================================================}

procedure error_check;

begin

if (paramCount<>4)

or (code1<>0) or (code2<>0) or (code3<>0) or (code4<>0)

or (stroka<1) or (stroka>2)

or (XC<60)    or (XC>71)

or (YC<13)    or (YC>21)

or (ReloadSize<1) or (ReloadSize>59)

then

begin

writeln('Error!');

writeln('HELP:');

writeln('(stroka 1 or 2)');

writeln('(XC [60;71])');

writeln('(YC [13,21])');

writeln('(discret<59)');

halt(0);

end;

end;

{===========================================================================}

procedure my_interface;

var my_interface_i:byte;