Вывод заголовка pаботы в виде "бегущей стpоки". Методы вывода и основные параметры, страница 2

inline($9C);

oldklava;

end;

procedure Time; interrupt;

var c1,c2,c3 : string;

temp_sec : word;

begin

time1:=time1+1;

count2:=0;

count1:=count1+1;

if(count1 mod 18 = 0) then

begin

sec:=sec+1;

inc(count2);

if (count2 = 5) then

begin

dec(count1);

count2:=0;

end;

if(sec mod n4 = 0) then  diskret:=diskret+n4;

if (sec >= 60) then

begin

sec:=0;

diskret:=sec;

m:=m+1;

if(m>=60) then

begin

m:=0;

h:=h+1;

if(h>=24) then h:=0;

end;

end;

end;

str(h,c1);

str(m,c2);

str(diskret,c3);

if(Length(c1)=1) then c1:='0'+c1;

if(Length(c2)=1) then c2:='0'+c2;

if(Length(c3)=1) then c3:='0'+c3;

if (clock and (temp_sec<>sec) and not(cs)) then

begin

cs:=true;

TextColor(9);

gotoxy(time_x,time_y);

write(c1,':',c2,':',c3);

textcolor(15);

cs:=false;

end;

temp_sec:=sec;

inline($9C);

oldhandler;

end;

procedure menu;

begin

gotoxy(45,6);

write('Clock(F1)   : on');

gotoxy(45,7);

write('Stroka(F2)  : on');

gotoxy(45,8);

write('Object(F3)  : on');

gotoxy(45,9);

write('In buf(F4)  : on');

gotoxy(45,10);

write('Out buf(F5) : on');

end;

procedure dvig;

var dx,dy : integer;

begin

textcolor(15);

gotoxy(ox,oy);

write(' ');

dx:=random(2);

dy:=random(2);

if gor then ox:=ox+dx else ox:=ox-dx;

if ver then oy:=oy+dy else oy:=oy-dy;

if ox>40 then begin ox:=ox-dx; gor:=false;end;

if ox<3 then begin ox:=ox+dx; gor:=true;     end;

if oy>20 then begin oy:=oy-dy; ver:=false;    end;

if oy<6 then begin oy:=oy+dy; ver:=true;     end;

if not(cs) then begin

cs:=true;

gotoxy(ox,oy);

write('O');

cs:=false;

end;

end;

procedure ramka;

begin

for i:=5 to 20 do

begin

gotoxy(2,i);

write('|');

gotoxy(41,i);

write('|');

end;

gotoxy(2,5);

write('----------------------------------------');

gotoxy(2,21);

write('----------------------------------------');

for i:=15 to 20 do

begin

gotoxy(44,i);

write('|');

gotoxy(61,i);

write('|');

end;

gotoxy(44,14);

write('------------------');

gotoxy(44,21);

write('------------------');

end;

procedure in_buf;

var j : integer;

begin

if free>0 then

begin

j:=Random(999);

If round(sqrt(j))-sqrt(j)=0 then

Begin

i:=max+1-Free;

Buffer_Sqrt[i]:=j;

Free:=Free-1;

End;

end;

end;

procedure out_buf;

begin

if ((Free<max) and (free<>max)) then

Begin

if buf_x>60 then begin buf_x:=45;inc(buf_y); end;

if buf_y=21 then buf_y:=15;

i:=max-Free;

GotoXY(buf_x,buf_y);

Write(Buffer_Sqrt[i]:4);

Free:=Free+1;

buf_x:=buf_x+4;

Delay(10);

End;

end;

procedure strka;

begin

gotoxy(s_x,s_y);

write('                      ');

dec(s_x);

if s_x<1 then s_x:=62;

if not(cs) then

begin

textcolor(15);

cs:=true;

gotoxy(s_x,s_y);

write('Sergeev Sergey P-12');

cs:=false;

end;

end;

begin

asm

mov  ah,01

mov  cx,0FFFFh

int  10h

end;

if paramCount<>4 then

begin

error;

exit;

end;

val(paramStr(1), n1, cod1);

val(paramstr(2), n2, cod2);

val(paramstr(3), n3, cod3);

val(paramstr(4), n4, cod4);

if (cod1<>0) or (cod2<>0) or (cod3<>0) or (cod4<>0)   then

begin

error;

exit;

end;

if ((n4<1) or (n3>2) or (n3<1) or (n1>2) or (n1<1) or (n2>2) or (n2<1)) then

begin

error;

exit;

end;

if n1=1 then s_y:=3 else s_y:=22;

if n2=1 then time_x:=2 else time_x:=70;

if n3=1 then time_y:=2 else time_y:=24;

clrscr;

menu;

ramka;

ver:=true;

gor:=true;

exit1:=false;

stroka:=true;

clock:=true;

objekt:=true;

in_b:=true;

out_b:=true;

n1:=1;

free:=max;

buf_x:=45;

buf_y:=15;

s_x:=10;

ox:=12;

oy:=20;

cs:=false;

GetTime(h, m, sec, sec100);

temp_sec:=sec;

GetIntVec($1C,@oldhandler);

SetIntVec($1C,addr(Time));

GetIntVec($9,@oldklava);

SetIntVec($9,addr(klava));

repeat

for i:=1 to 4 do

time_v[i]:=random(3);

while (time_v[1]>=time1 ) do

if (stroka and not(cs)) then begin strka;delay(700); end;

time1:=0;

while (time_v[2]>=time1) do

if (objekt and not(cs)) then begin dvig;delay(1000); end;

time1:=0;

while (time_v[3]>=time1) do

if (in_b) then begin in_buf; end;

time1:=0;

while (time_v[4]>=time1) do

if (out_b and not(cs)) then begin out_buf; end;

time1:=0;

until ((not(stroka) and not(clock) and not(objekt) and not(in_b) and not(out_b))or exit1);

end.