uses Crt,ModeXLib,gif,fade;
Var pic1_pal,                   {palettes of both pictures}
    pic2_pal:Array[0..767] of Byte;
    pic1,                       {contains 1st picture}
    pic2:Pointer;               {2nd picture, equals vscreen}

Begin
  Init_Mode13;                  {Mode 13h on}
  Screen_off;                   {screen off during loading}
  LoadGif('chess');             {load first picture}
  GetMem(pic1,64000);           {get memory for 1st picture}
  Move(vscreen^,pic1^,64000);   {save in pic1}
  Move(Palette,pic1_pal,768);   {and save the palette}
  Show_Pic13;                   {this picture on screen}

  LoadGif('box');               {load next in vscreen^ }
  pic2:=vscreen;                {pic2 used as a pointer to it}
  Move(Palette,pic2_pal,768);   {save its palette}

  Move(pic1_pal,Palette,768);   {enable palette of picture 1}
  SetPal;                       {and set}
  Screen_on;                    {switch screen back on now}

  ReadLn;                       {wait}
  Fade1(pic2,pic2_pal,0,0,200);
                                {and then fade in picture 2)}

  fade_ResetPic(0,200);         {prepare renewed fading}
  ReadLn;
  Fade1(pic1,pic1_pal,0,0,200);
                                {and fade in picture 1}

  ReadLn;
  TextMode(3);
End.
