Скачать Плавная смена цвета в Текстовом Режиме

20.11.1997
Скачать файл (1,10 Кб)

Uses Crt;
 
Procedure SetColor(Col : byte ; R,G,B : byte);Assembler;
asm
   Mov Dx,3C8h
   Mov Al,[Col]
   Out Dx,Al
   Inc Dx
   Mov Al,[R]
   Out Dx,Al
   Mov Al,[G]
   Out Dx,Al
   Mov Al,[B]
   Out Dx,Al
end;
 
Procedure WaitRetrace;Assembler;
 Asm
     Mov Dx,3DAh
  @loop1:
     In Al,Dx
     Test Al,08h
     Jnz @loop1
  @loop2:
     In Al,Dx
     Test Al,08h
     Jz @loop2
End;
 
Var
a,b:byte;
d:boolean;
Begin
 ClrScr;
 TextBackGround(4);
 TextColor(15);
 WriteLn('   THIS  TEXT  IS  FADEING  =)                            ');
 WriteLn;
 TextBackGround(0); TextColor(1);
 WriteLn('.::oOo| AND THIS |oOo::. ');
 b:=62;
 d:=true;
Repeat
 
delay(100);
if d then
begin
if b=0 then
begin
d:=false;
end else
b:=b-1;
end else
begin
if b=62 then
begin
d:=true;
end else
b:=b+1;
end;
 
 
SetColor(4,b,0,0);  { Для кpасного }
SetColor(1,0,0,b);  { Для синего }
WaitRetrace;
 
until Keypressed;
ReadKey;
Asm Mov Ax,0003h ; Int 10h ; End; { Reset TextMode }
End.
{Пpимеp by War Hawk =) }