home *** CD-ROM | disk | FTP | other *** search
/ PC Underground / UNDERGROUND.ISO / graphic / gif.pas < prev    next >
Pascal/Delphi Source File  |  1995-07-28  |  2KB  |  48 lines

  1. unit gif;                       {Header for gif.asm}
  2.  
  3. Interface
  4. uses modexlib;                  {because of SetPal}
  5.   var
  6.   vram_pos,                     {current position in VGA-RAM}
  7.   rest, errorno:word;           {remaining bytes in RAM and error}
  8.  
  9.   gifname:String;               {Name, including #0}
  10.   Procedure LoadGif(GName:String);
  11.                                 {Loads Gif file "GName.gif" into vscreen}
  12.   Procedure LoadGif_Pos(GName:String;Posit:Word);
  13.                                 {Loads Gif file at screen offset Posit}
  14.  
  15. Implementation
  16.   Procedure ReadGif;external;   {custom Gif loader, complete in Assembler}
  17.   {$l gif}
  18.  
  19.   Procedure LoadGif;
  20.   {Loads Gif file "GName.gif" into vscreen}
  21.   Begin
  22.     If pos('.',gname) = 0 then  {add ".gif" extension if necessary}
  23.       gname:=gname+'.gif';
  24.     Gifname:=GName+#0;;         {generate ASCIIZ string}
  25.     vram_pos:=0;                {start in VGA-Ram at Offset 0}
  26.     ReadGif;                    {and load image}
  27.     If Errorno <> 0 Then        {terminate if error}
  28.       Halt(Errorno);
  29.     SetPal;                     {set loaded palette}
  30.   End;
  31.  
  32.   Procedure LoadGif_pos;
  33.   {Loads Gif file at screen offset Posit}
  34.   Begin
  35.     If pos('.',gname) = 0 then  {add ".gif" extension if necessary}
  36.       gname:=gname+'.gif';
  37.     Gifname:=GName+#0;          {generate ASCIIZ string}
  38.     vram_pos:=posit;            {start in VGA-Ram at passed offset}
  39.     ReadGif;                    {and load image}
  40.     If Errorno <> 0 Then        {terminate if error}
  41.       Halt(Errorno);
  42.     SetPal;                     {set loaded palette}
  43.   End;
  44. Begin
  45.   errorno:=0;                   {normally no error}
  46.   GetMem(VScreen,64000);        {allocate virtual screen}
  47. End.
  48.