home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / grafik / pcx / pcxbin / pcxshow.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1988-09-30  |  2.6 KB  |  67 lines

  1. {$R-,S-}
  2. program pcxshow;
  3.  
  4. uses
  5.   PCXBIN;
  6.  
  7.   procedure grab_a_key;
  8.     { Key result ends up in AX register              }
  9.     { Could be defined as function grab_a_key : Word }
  10.   inline($CD/$28/                 { INT 28 }
  11.          $B4/$01/                 { MOV AH, 01 }
  12.          $CD/$16/                 { INT 16 }
  13.          $74/$F8/                 { JZ -08 }
  14.          $B4/$00/                 { MOV AH, 00 }
  15.          $CD/$16);                { INT 16 }
  16.  
  17.  
  18. var
  19.   OrigMode       : Word;
  20.   Pics           : Byte;
  21.   FileName       : string;
  22.  
  23.   procedure ErrorMsg(Msg : string);
  24.   begin
  25.     DrawMode(OrigMode);
  26.     WriteLn(Msg);
  27.   end;
  28.  
  29. (************************************************************************)
  30. (* This is where your converted picture file is linked into the program.*)
  31. (* Be sure to run BINOBJ with the parameters as follows                 *)
  32. (* BINOBJ picfile.pcx picfile.obj PicProc                               *)
  33. (*            |           |         |                                   *)
  34. (*            |           |         --- Same as the procedure name      *)
  35. (*         your picture   ^--to this--<--                               *)
  36. (*         file                         |                               *)
  37. (* procedure PicProc; external;         |                               *)
  38. (*                                      |                               *)
  39. (* {$L BUGSPIC.OBJ } >-- Change this -->-                               *)
  40. (*                                                                      *)
  41. (* NOTE: Please remember the number of bytes translated by BINOBJ as    *)
  42. (*       I have not figured out a way to tell the filesize.             *)
  43. (*       This number is the second parameter passed to the Drawpic      *)
  44. (*       procedure.                                                     *)
  45. (************************************************************************)
  46.  
  47.   procedure PicProc; external;
  48.   {$L BUGSPIC.OBJ }
  49.  
  50. begin
  51.   OrigMode := LastDrawMode;
  52.   (**********************************************************************)
  53.   (* Draw Picture using PicProc as file to load and 11351 as # of bytes *)
  54.   (* to load                                                            *)
  55.   (**********************************************************************)
  56.   case DrawPic(@PicProc,11351) of
  57.     NoError : ;
  58.     IOError : ErrorMsg('IO Error occurred while reading '+FileName);
  59.     BadFormat : ErrorMsg('I can''t identify '+FileName+' as graphical.');
  60.     PaletteMissing : ErrorMsg('Palette File for '+FileName+' not found.');
  61.   end;
  62.  
  63.   grab_a_key;
  64.  
  65.   DrawMode(OrigMode);
  66. end.
  67.