Uses Crt,Gif,ModeXLib;
Procedure Flow;
var i,
    Old9:Byte;
Begin
  Port[$3d4]:=9;                      {select CRTC Register 9 (Maximum Row Address)}
  Old9:=Port[$3d5] and $80;           {save old contents, }
  for i:=2 to 31 do begin             {saves on constant read out}
    WaitRetrace;                      {synchronization}
    Port[$3d5]:=old9 or i;            {write value}
  End;
End;

Begin
  asm mov ax,13h; int 10h End;        {Mode 13h on (or different graphic mode)}
  LoadGif('upfold');                  {load wallpaper}
  Move(vscreen^,Ptr($a000,0)^,64000); {and to screen}
  ReadLn;
  Flow;                               {read out}
  ReadLn;
  TextMode(3);                        {restore VGA to original state}
End.
