Uses Crt; CONST VGA=$a000; Var Pall,Pall2 : Array[0..255,1..3] of Byte; {--------------------------------------------------------------------------} Procedure SetMCGA; { This procedure gets you into 320x200x256 mode. } BEGIN asm mov ax,0013h int 10h end; END; {--------------------------------------------------------------------------} Procedure SetText; { This procedure returns you to text mode. } BEGIN asm mov ax,0003h int 10h end; END; {--------------------------------------------------------------------------} procedure WaitRetrace; assembler; label l1, l2; asm mov dx,3DAh l1: in al,dx and al,08h jnz l1 l2: in al,dx and al,08h jz l2 end; {--------------------------------------------------------------------------} Procedure GetPal(ColorNo : Byte; Var R,G,B : Byte); Begin Port[$3c7] := ColorNo; R := Port[$3c9]; G := Port[$3c9]; B := Port[$3c9]; End; {--------------------------------------------------------------------------} Procedure Pal(ColorNo : Byte; R,G,B : Byte); Begin Port[$3c8] := ColorNo; Port[$3c9] := R; Port[$3c9] := G; Port[$3c9] := B; End; {--------------------------------------------------------------------------} Procedure Putpixel (X,Y : Integer; Col : Byte); BEGIN Mem [VGA:X+(Y*320)]:=Col; END; {--------------------------------------------------------------------------} Procedure line(a,b,c,d,col:integer); Function sgn(a:real):integer; BEGIN if a>0 then sgn:=+1; if a<0 then sgn:=-1; if a=0 then sgn:=0; END; var u,s,v,d1x,d1y,d2x,d2y,m,n:real; i:integer; BEGIN u:= c - a; v:= d - b; d1x:= SGN(u); d1y:= SGN(v); d2x:= SGN(u); d2y:= 0; m:= ABS(u); n := ABS(v); IF NOT (M>N) then BEGIN d2x := 0; d2y := SGN(v); m := ABS(v); n := ABS(u); END; s := INT(m / 2); FOR i := 0 TO round(m) DO BEGIN putpixel(a,b,col); s := s + n; IF not (s0 then dec (Tmp[1]); If Tmp[2]>0 then dec (Tmp[2]); If Tmp[3]>0 then dec (Tmp[3]); { If the Red, Green or Blue values of color loop2 are not yet zero, then, decrease them by one. } Pal (loop2,Tmp[1],Tmp[2],Tmp[3]); { Set the new, altered pallette color. } END; END; END; {--------------------------------------------------------------------------} Procedure RestorePallette; VAR loop1:integer; BEGIN WaitRetrace; For loop1:=0 to 255 do pal (loop1,Pall2[loop1,1],Pall2[loop1,2],Pall2[loop1,3]); END; BEGIN SetMCGA; GrabPallette; SetUpScreen; repeat PalPlay; { Call the PalPlay procedure repeatedly until a key is pressed. } Until Keypressed; RestorePallette; SetText; END.