Uses Crt,Gif,ModeXLib;
Var y,                      {Current value of Linear Starting Address}
    y_dir:word;             {Gives scroll direction}
Begin
  Init_ModeX;               {Enable Mode X}
  LoadGif('upfold');        {Load first image into Pages 0 and 2}
  p13_2_ModeX(0,16000);
  p13_2_ModeX(32000,16000);
  LoadGif('corner');        {Load second image into Pages 1 and 3}
  p13_2_ModeX(16000,16000);
  p13_2_ModeX(48000,16000);
  y:=80;                    {Begin with Line 1}
  y_dir:=80;                {Direction of motion +80 bytes per pass}
  Repeat
    Inc(y,y_dir);           {Motion}
    WaitRetrace;            {Wait for retrace}
    SetStart(y);            {and write new start to register}
    if (y >= 600*80)        {Border reached -> reverse direction}
    or (y <= 80) Then y_dir:=-y_dir;
  Until KeyPressed;         {Run until key is pressed}
End.