home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / pascal / spx10.zip / SPX_DOC.ZIP / SPX_VGA.DOC < prev   
Text File  |  1993-05-04  |  23KB  |  695 lines

  1. { SPX Library Version 1.0  Copyright 1993 Scott D. Ramsay }
  2.  
  3.  SPX_VGA  is the main graphics kernel.  All the graphic primitives
  4. are here.
  5.  
  6. ───────────────────────────────────────────────────────────────────────────
  7. procedure MatteVsp(var from,too);
  8.  
  9.   Create a matte for a sprite file.  Uses the SET thdmat to determine
  10.   which colors will be transparent.
  11.  
  12.   FROM: Sprite to convert;
  13.   TOO:  Created masked sprite
  14.  
  15.   NOTE:  The buffer "too" must be pre-allocated.
  16.  
  17. ───────────────────────────────────────────────────────────────────────────
  18. procedure VSinc;
  19.  
  20.   Waits for a vertical retrace to occur.
  21.  
  22. ───────────────────────────────────────────────────────────────────────────
  23. procedure SetDefaultColors;
  24.  
  25.   Sets the VGA palette to the default SPX library colors.
  26.  
  27. ───────────────────────────────────────────────────────────────────────────
  28. procedure Switch(var a,b:integer);
  29.  
  30.   Exchanges the values of A and B.
  31.  
  32. ───────────────────────────────────────────────────────────────────────────
  33. procedure Parse(var x,y:integer);
  34.  
  35.   Clips the point (x,y). to the legal range.
  36.  
  37.     X:  Column coordinate 0..319;
  38.     Y:  Row coordinate 0..199
  39.  
  40. ───────────────────────────────────────────────────────────────────────────
  41. function BuffSize(x,y:integer):word;
  42.  
  43.   Returns the size of the buffer needed for a sprite size of (x,y).
  44.  
  45.   X:  Width of the sprite;
  46.   Y:  Height of the sprite
  47.  
  48. ───────────────────────────────────────────────────────────────────────────
  49. function ImageSize(var image):word;
  50.  
  51.   Returns the size of the memory used by the sprite.
  52.  
  53.   IMAGE: Sprite
  54.  
  55. ───────────────────────────────────────────────────────────────────────────
  56. procedure ImageDims(var image;var x,y:integer);
  57.  
  58.   Returns the width and height of a sprite.
  59.  
  60.   IMAGE: Sprite;
  61.   X:     Width of the sprite;
  62.   Y:     Height of the sprite
  63.  
  64. ───────────────────────────────────────────────────────────────────────────
  65. procedure SetPtr(var i:PtrRec;var buff);
  66.  
  67.   Returns a PtrRec  (Segment:offset) of a given buffer.
  68.  
  69.   I:      Returning record;
  70.   BUFF:   Any memory buffer or variable
  71.  
  72. ───────────────────────────────────────────────────────────────────────────
  73. function pt(x,y:integer):word;
  74.  
  75.   Returns the offset of the location (x,y).
  76.  
  77.   X:   Column position;
  78.   Y:   Row position
  79.  
  80. ───────────────────────────────────────────────────────────────────────────
  81. procedure OpenMode(npages:byte);
  82.  
  83.   Sets the VGA to 320x200x256 mode and allocates virtual pages.
  84.  
  85.   NPAGES:  Number of pages to use
  86.  
  87.   NOTE:  Page 1 is always the visual page.  Pages 2..n are created
  88.          dynamically on the heap.
  89.  
  90. ───────────────────────────────────────────────────────────────────────────
  91. function Point(x,y:integer;pg:byte):byte;
  92.  
  93.   Returns the color value of a location on a page.
  94.  
  95.   X:   Column position;
  96.   Y:   Row position;
  97.   PG:  Page to retrieve the color
  98.  
  99. ───────────────────────────────────────────────────────────────────────────
  100. procedure Pset(x,y:integer;n:byte);
  101.  
  102.   Draw a point onto the active page.
  103.  
  104.   X:   Column position;
  105.   Y:   Row position;
  106.   n:   Color
  107.  
  108. ───────────────────────────────────────────────────────────────────────────
  109. procedure fPcopy(var from,too);
  110.  
  111.   Copies one page to another.
  112.  
  113.   FROM:  Buffer location of the source page;
  114.   TOO:   Buffer location of the destination page
  115.  
  116.   NOTE:  If 386 or later processor is present, 386 copies will be used.
  117.  
  118. ───────────────────────────────────────────────────────────────────────────
  119. procedure Pcopy(from,too:byte);
  120.  
  121.   Same as fPcopy, copies only predefined virtual pages.
  122.  
  123.   FROM:  Page number of the source page;
  124.   TOO:   Page number of the destination page
  125.  
  126. ───────────────────────────────────────────────────────────────────────────
  127. procedure CopyRect(x1,y1,x2,y2:integer;var from,too);
  128.  
  129.   Copy a rectangular region from one page to another.
  130.  
  131.   X1,Y1:  Top-left coordinate of the region;
  132.   X2,Y2:  Bottom-right coordinate of the region;
  133.   FROM:   Buffer location of the source page;
  134.   TOO:    Buffer location of the destination page
  135.  
  136.   EXAMPLE:
  137.  
  138.       CopyRect(100,100,200,140,pages[2]^,pages[1]^);
  139.  
  140.       Copies a region on page 2 to the visual page.
  141.  
  142.   NOTE: If 386 or later processor is present, 386 copies wiil be used.
  143.     Unpredictable results will happen if the source and destination page
  144.     are the same.
  145.  
  146. ───────────────────────────────────────────────────────────────────────────
  147. procedure fwCopyRect(x1,y1,x2,y2:integer;var from,too);
  148.  
  149.   Same as CopyRect.  Forces even amount width moves.
  150.  
  151.   X1,Y1:  Top-left coordinate of the region;
  152.   X2,Y2:  Bottom-right coordinate of the region;
  153.   FROM:   Buffer location of the source page;
  154.   TOO:    Buffer location of the destination page
  155.  
  156.   NOTE: Make sure that (X2-X1+1) is an even number. Unpredictable results
  157.    will happen if the source and destination page are the same.
  158.  
  159. ───────────────────────────────────────────────────────────────────────────
  160. procedure SwapRect(x1,y1,x2,y2:integer;from,too:byte);
  161.  
  162.   Exchange regions from two pages.
  163.  
  164.   X1,Y1:  Top-left coordinate of the region;
  165.   X2,Y2:  Bottom-right coordinate of the region;
  166.   FROM:   Page number of the source page;
  167.   TOO:    Page number of the destination page
  168.  
  169.   NOTE:  Unpredictable results will happen if the source and destination
  170.        page are the same.
  171.  
  172. ───────────────────────────────────────────────────────────────────────────
  173. procedure Line_clip(x1,y1,x2,y2:integer;n:byte);
  174.  
  175.   Draws a line on the active page.  Clips the line according to
  176.   WinMinX, WinMinY, WinMaxX, WinMaxY.
  177.  
  178.   X1,Y1:  Coordinate one of the line;
  179.   X2,Y2:  Coordinate two of the line;
  180.   n:      Color of line
  181.  
  182. ───────────────────────────────────────────────────────────────────────────
  183. procedure Line(x1,y1,x2,y2:integer;n:byte);
  184.  
  185.   Draw a line on the active page.  DOES NOT preform any clipping.  Faster
  186.   than the Line_clip procedure.
  187.  
  188.   X1,Y1:  Coordinate one of the line;
  189.   X2,Y2:  Coordinate two of the line;
  190.   n:      Color of line
  191.  
  192. ───────────────────────────────────────────────────────────────────────────
  193. procedure Bar(x1,y1,x2,y2:integer;n:byte);
  194.  
  195.   Draws a filled rectangle on the active page.
  196.  
  197.   X1,Y1:  Coordinate one of the bar;
  198.   X2,Y2:  Coordinate two of the bar;
  199.   n:      Color of bar
  200.  
  201. ───────────────────────────────────────────────────────────────────────────
  202. procedure Rectangle(x1,y1,x2,y2:integer;n:byte);
  203.  
  204.   Draws a rectangle on the active page.
  205.  
  206.   X1,Y1:  Coordinate one of the rectangle;
  207.   X2,Y2:  Coordinate two of the rectangle;
  208.   n:      Color of bar
  209.  
  210. ───────────────────────────────────────────────────────────────────────────
  211. procedure Circle(x1,y1,r:integer;n:byte);
  212.  
  213.   Draws a circle on the active page.
  214.  
  215.   X1,Y1:  Center coordinate of the circle;
  216.   R:      Radius of the circle;
  217.   N:      Color of circle
  218.  
  219. ───────────────────────────────────────────────────────────────────────────
  220. procedure Ellipse(xc,yc,a0,b0:integer;c:byte);
  221.  
  222.   Draws an ellipse on the active page.
  223.  
  224.   XC,YC:  Center coordinate of the ellipse;
  225.   A0:     Height radius of ellipse;
  226.   B0:     Width radius of ellipse;
  227.   C:      Color of ellipse
  228.  
  229. ───────────────────────────────────────────────────────────────────────────
  230. procedure ftput(x,y:integer;var buff;center:boolean);
  231.  
  232.   Displays a sprite on the active page with color 0 as a transparent
  233.   color.  Does NOT preform any clipping.
  234.  
  235.   X,Y:    Coordinate to display top-left of sprite.  If CENTER is TRUE
  236.           X,Y is the coordinate of the center of the sprite;
  237.   BUFF:   Sprite;
  238.   CENTER: Set to TRUE to display sprite centered on X,Y
  239.  
  240. ───────────────────────────────────────────────────────────────────────────
  241. procedure ftput_clip(x,y:integer;var buff;center:boolean);
  242.  
  243.   Displays a sprite on the active page with color 0 as a transparent
  244.   color.  Clips the sprite according to WinMinX, WinMinY, WinMaxX, WinMaxY.
  245.  
  246.   X,Y:    Coordinate to place top-left of sprite.  If CENTER is TRUE
  247.           X,Y is the coordinate of the center of the sprite;
  248.   BUFF:   Sprite;
  249.   CENTER: Set to TRUE to display sprite centered on X,Y
  250.  
  251. ───────────────────────────────────────────────────────────────────────────
  252. procedure cls(b:byte);
  253.  
  254.   Clears the active page.
  255.  
  256.   B:  The color to clear the active page
  257.  
  258. ───────────────────────────────────────────────────────────────────────────
  259. procedure CloseMode;
  260.  
  261.   Restores the video mode and deallocates virtual pages.
  262.  
  263. ───────────────────────────────────────────────────────────────────────────
  264. procedure fget(x1,y1,x2,y2:integer;var image);
  265.  
  266.   Grabs a sprite from the active page.
  267.  
  268.   X1,Y1:  Coordinate one of the region;
  269.   X2,Y2:  Coordinate two of the region;
  270.   IMAGE:  Sprite to create
  271.  
  272.   NOTE:  IMAGE must be pre-allocated
  273.  
  274. ───────────────────────────────────────────────────────────────────────────
  275. procedure fput(x1,y1:integer;var image;center:boolean);
  276.  
  277.   Displays a sprite on the active page.
  278.  
  279.   X1,Y1:  Coordinate to place top-left of sprite.  If CENTER is TRUE
  280.           X1,Y1 is the coordinate of the center of the sprite;
  281.   IMAGE:  Sprite;
  282.   CENTER: Set to TRUE to display sprite centered on X1,Y1
  283.  
  284. ───────────────────────────────────────────────────────────────────────────
  285. procedure fput_mask(x1,y1:integer;var image;rmw:byte);
  286.  
  287.   Displays a sprite on the active page.
  288.  
  289.   X1,Y1:  Coordinate to place top-left of sprite.
  290.   IMAGE:  Sprite;
  291.   RMW:    Type of display method
  292.  
  293.           CopyPut      : Use normal copy. (fput recommened instead)
  294.           XORPut       : XOR the sprite with the active display
  295.           OrPut        : OR the sprite with the active display
  296.           AndPut       : AND the sprite with the active display
  297.  
  298. ───────────────────────────────────────────────────────────────────────────
  299. procedure fput_clip(x,y:integer;var buff;center:boolean);
  300.  
  301.   Displays a sprite on the active page. Clips the sprite according
  302.    to WinMinX, WinMinY, WinMaxX, WinMaxY.
  303.  
  304.   X,Y:    Coordinate to place top-left of sprite.  If CENTER is TRUE
  305.           X,Y is the coordinate of the center of the sprite;
  306.   buff:   Sprite;
  307.   CENTER: Set to TRUE to display sprite centered on X,Y
  308.  
  309. ───────────────────────────────────────────────────────────────────────────
  310. procedure SetPageActive(page:byte);
  311.  
  312.   Changes the active page.
  313.  
  314.   PAGE: New page number to become active.
  315.  
  316.   NOTE:  If allocated memory for virtual page.  Use SCNSEG:SCNOFS to
  317.     change the active page.
  318.  
  319.   EXAMPLE:
  320.        var
  321.           MyVirt : pointer;
  322.           .
  323.           .
  324.           .
  325.  
  326.         Getmem(MyVirt,64000);   { Allocate a virtual page }
  327.         SetPageActive(1);       { Sets the active page to page 1 }
  328.  
  329.         SCNSEG := seg(MyVirt^); { Sets the active page to MyVirt }
  330.         SCNOFS := ofs(MyVirt^);
  331.  
  332. ───────────────────────────────────────────────────────────────────────────
  333. procedure GetColor(num:byte;var red,green,blue:byte);
  334.  
  335.    Retrieves a color from the current palette.
  336.  
  337.    NUM:    Color number;
  338.    RED:    Red componet of the color;
  339.    GREEN:  Green componet of the color;
  340.    BLUE:   Blue componet of the color
  341.  
  342. ───────────────────────────────────────────────────────────────────────────
  343. procedure SetColor(num,red,green,blue:byte);
  344.  
  345.   Sets a color of the current palette.
  346.  
  347.    NUM:    Color number;
  348.    RED:    Red componet of the color;
  349.    GREEN:  Green componet of the color;
  350.    BLUE:   Blue componet of the color
  351.  
  352. ───────────────────────────────────────────────────────────────────────────
  353. procedure fSetColors(var colors);
  354.  
  355.    Sets all the colors of the current palette.
  356.  
  357.    COLORS:  A buffer which contains a red, green and blue componet for
  358.      each of the 256 colors
  359.  
  360. ───────────────────────────────────────────────────────────────────────────
  361. procedure fGetColors(var colors);
  362.  
  363.    Retrieves all the colors from the current palette.
  364.  
  365.    COLORS:  A buffer which will contain a red, green and blue componet for
  366.      each of the 256 colors
  367.  
  368.    NOTE:  Can be used repeatedly for custom fades.  (Does not flicker)
  369.  
  370. ───────────────────────────────────────────────────────────────────────────
  371. procedure FadeIn(steps:word;var color);
  372.  
  373.    Fade the screen from black to the palette specified.
  374.  
  375.    STEPS: Speed of the fade;
  376.    COLOR: Final palette after the fade
  377.  
  378. ───────────────────────────────────────────────────────────────────────────
  379. procedure FadeOut(steps:word;var color);
  380.  
  381.    Fade the screen from palette specified to black.
  382.  
  383.    STEPS: Speed of the fade;
  384.    COLOR: Palette before the fade, (Usually is the current palette)
  385.  
  386.    EXAMPLE:
  387.  
  388.       var
  389.         Apal : RGBlist;
  390.  
  391.       fgetcolors(Apal);  { grab the current palette }
  392.       FadeOut(30,Apal);  { Fade the screen to black }
  393.  
  394. ───────────────────────────────────────────────────────────────────────────
  395. procedure ColorsChange(var color:rgblist;filter:rgbtype);
  396.  
  397.    Change the color palette using a color filter.
  398.  
  399.    COLOR:  Palette to change;
  400.    FILTER: Red, green, blue componets of the filter
  401.  
  402.    EXAMPLE:
  403.  
  404.       TanFilter : RGBtype;
  405.       Apal      : RBGlist;
  406.  
  407.       TanFilter.red := 63;
  408.       TanFilter.green := 30;
  409.       TanFilter.blue := 13;
  410.       fgetcolors(Apal);  { grab the current palette }
  411.       ChangeColors(Apal,TanFilter);
  412.       fsetcolors(Apal);  { change the palette to tan screen }
  413.  
  414. ───────────────────────────────────────────────────────────────────────────
  415. procedure ColorCycle(var colors:rgblist;start:byte;count:integer;fwd:boolean);
  416.  
  417.   Cycles a range of colors one step forward or backwards.
  418.  
  419.   COLORS:  Palette to change;
  420.   START:   Starting color index;
  421.   COUNT:   Number of colors to rotate;
  422.   FWD:     Set to TRUE to cycle forward
  423.  
  424.   EXAMPLE:
  425.  
  426.      var
  427.        Apal : RGBlist;
  428.  
  429.        fgetcolors(Apal);
  430.        repeat
  431.          ColorCycle(Apal,0,256,true);   { Cycle the entire palette }
  432.          fsetcolors(Apal);              { using fsetcolors to set the palette }
  433.        until crt.Keypressed;            { until a key is pressed }
  434.  
  435. ───────────────────────────────────────────────────────────────────────────
  436. function LoadColors(filename:string;var colors;count:integer):integer;
  437.  
  438.   Load a color palette from disk.
  439.  
  440.   FILENAME:  Palette dos file name;
  441.   COLORS:    Buffer to store the palette;
  442.   COUNT:     Number of color entries to load.  "256 to load the entire palette"
  443.  
  444. ───────────────────────────────────────────────────────────────────────────
  445. function SaveColors(filename:string;var colors;count:integer):integer;
  446.  
  447.   Save a color palette to disk.
  448.  
  449.   FILENAME:  Palette dos file name;
  450.   COLORS:    Palette to save;
  451.   COUNT:     Number of color entries to load.  "256 to load the entire palette"
  452.  
  453. ───────────────────────────────────────────────────────────────────────────
  454. procedure Paint(x,y:integer;n:byte);
  455.  
  456.   Flood fills a region.
  457.  
  458.   X,Y: The location to start filling;
  459.   N:   The color to fill
  460.  
  461.   NOTE:  This procedure does not use the a border algorthim.  It fills
  462.      the area with color (n) that has the occurances of the color at
  463.      location (X,Y)
  464.  
  465. ───────────────────────────────────────────────────────────────────────────
  466. procedure CopyTo(x1,y1,x2,y2,x,y:integer;var from,too);
  467.  
  468.   Copies a region to another area.
  469.  
  470.   X1,Y1:  Top-left coordinate of the source region;
  471.   X2,Y2:  Bottom-right coordinate of the source region;
  472.   X,Y:    Top-left coordinate of the destination region;
  473.   FROM:   Buffer location of the source page;
  474.   TOO:    Buffer location of the destination page
  475.  
  476.   NOTE: Unpredictable results will happen if the source and destination page
  477.     are the same and the region overlapps.
  478.  
  479. ───────────────────────────────────────────────────────────────────────────
  480. function LoadVSP(fn:string;var buff):integer;
  481.  
  482.   Load a sprite file.
  483.  
  484.   FN:    DOS file name of the .VSP file;
  485.   BUFF:  An array of pointer to hold the sprites
  486.  
  487.   NOTE:  Buff MUST be a pointer, or an array of pointer.  And they can NOT
  488.     be preallocated.  Does not check the array is smaller that the number
  489.     of sprites in the file.  Returns the number of sprites loaded.
  490.  
  491.   EXAMPLE:
  492.  
  493.      var
  494.        asprite : pointer;
  495.        sprites : array[0..19] of pointer;
  496.        moresp  : array[0..20] of pointer;
  497.  
  498.       { below are legal statements }
  499.  
  500.        loadvsp('onevsp.vsp',asprite);
  501.        loadvsp('20vsps.vsp',sprites);
  502.        loadvsp('onevsp.vsp',moresp[10]);
  503.  
  504. ───────────────────────────────────────────────────────────────────────────
  505. function FileVSP(var fil:file;var buff;size:longint):integer;
  506.  
  507.   Loads sprites from an open file.
  508.  
  509.   FIL:   Binary file that contains sprites;
  510.   BUFF:  An array of pointer to hold the sprites;
  511.   SIZE:  Size of the sprites in the area.
  512.  
  513.   NOTE:  Does not close the file.  Returns the number of sprites loaded.
  514.     Be sure that SIZE corresponds to the exact size of the sprites to
  515.     load.
  516.  
  517. ───────────────────────────────────────────────────────────────────────────
  518. procedure ScaleVSP(var src,dest;nx,ny:word);
  519.  
  520.   Stretches or shrinks a sprite to a new size.
  521.  
  522.   SRC:    Sprite to scale;
  523.   DEST:   New sprite scaled;
  524.   NX,NY:  Width and Height of the new sprite
  525.  
  526.   NOTE:  DEST must be preallocated.
  527.  
  528.   EXAMPLE:
  529.  
  530.   var
  531.     MySprite,
  532.     NewSize  : pointer;
  533.  
  534.        .
  535.        .
  536.        .
  537.     getmem(NewSize,buffsize(16,16));
  538.     ScaleVSP(MySprite^,NewSize^,16,16);  { Changes MySprite to be size 16x16 }
  539.  
  540. ───────────────────────────────────────────────────────────────────────────
  541. function AnalyzeScreen:byte;
  542.  
  543.   Returns the color number that is used the most on the active page.
  544.  
  545. ───────────────────────────────────────────────────────────────────────────
  546. procedure MemWrite(var source,dest;size:word;var off:longint);
  547.  
  548.   Copies data from SOURCE to DEST.
  549.  
  550.   SOURCE:  Source buffer;
  551.   DEST:    Destination buffer;
  552.   SIZE:    Number of bytes to copy;
  553.   OFF:     Offset in DEST to start the copy
  554.  
  555.   NOTE:  Upon returning  OFF = OFF+SIZE
  556.  
  557. ───────────────────────────────────────────────────────────────────────────
  558. procedure MemRead(var source,dest;size:word;var off:longint);
  559.  
  560.   Copies data from SOURCE to DEST.
  561.  
  562.   SOURCE:  Source buffer;
  563.   DEST:    Destination buffer;
  564.   SIZE:    Number of bytes to copy;
  565.   OFF:     Offset in SOURCE to start the copy
  566.  
  567.   NOTE:  Upon returning OFF = OFF+SIZE
  568.  
  569. ───────────────────────────────────────────────────────────────────────────
  570. procedure fwput(x1,y1:integer;var image);
  571.  
  572.   Displays a sprite on the active page.  Forces even amount width moves.
  573.  
  574.   X1,Y1:  Coordinate to place top-left of sprite.
  575.   IMAGE:  Sprite;
  576.  
  577. ───────────────────────────────────────────────────────────────────────────
  578. procedure moveDW(var source,dest;size:word);
  579.  
  580.   Same as Turbo Pascal's move procedure.  Uses 386 instructions.
  581.  
  582.   SOURCE: Source buffer;
  583.   DEST:   Destination buffer;
  584.   SIZE:   Size in bytes of memory to copy
  585.  
  586. ───────────────────────────────────────────────────────────────────────────
  587. procedure fputDW(x:word;var buff);
  588.  
  589.   Displays a sprite on the active page.  Forces 386 instructions.  Does
  590.    not preform any clipping.
  591.  
  592.   X:     Offset of the active page.  E.G.  = pt(x,y);
  593.   BUFF:  Sprite to display
  594.  
  595.   NOTE:  This is the fastest sprite drawing routine.  The width of the
  596.     sprite must be divisible by 4.
  597.  
  598. ───────────────────────────────────────────────────────────────────────────
  599. procedure PcopyDW(var from,too);
  600.  
  601.   Same a fPcopy.  Forces 386 instructions.  Copies one page to another.
  602.  
  603.   FROM:  Buffer location of the source page;
  604.   TOO:   Buffer location of the destination page
  605.  
  606. ───────────────────────────────────────────────────────────────────────────
  607. procedure fillDW(var dest;c:word;v:byte);
  608.  
  609.   Fills a memory region with the value V.  Forces 386 instructions.
  610.  
  611.   DEST:  The memory area to fill;
  612.   C:     Number of bytes to fill;
  613.   V:     Value to fill
  614.  
  615. ───────────────────────────────────────────────────────────────────────────
  616. procedure clsDW(c:byte);
  617.  
  618.   Same as CLS.  Clears the active page.  Forces 386 instructions.
  619.  
  620.   C:  The color to clear the active page
  621.  
  622. ───────────────────────────────────────────────────────────────────────────
  623. procedure displayer(x,y:integer;var pic,virt;plv:byte);
  624.  
  625.    Displays a Sprite (pic) on the current page. Based on the sprite's level
  626.    (plv).  The (virt) is the virtual page that keeps track of all of the
  627.    sprites currently on the screen.
  628.  
  629.    Think of the display having 256 layers.  Layer 0 is furthest back and
  630.     layer 255 is the top layer.  For example, a sprite "Displayer" with
  631.     plv=4 will only overwrite sprites that have been written with a plv
  632.     value less than 4.  Sprites greater than 4 will be unaffected.
  633.  
  634.    The how DispLayer works:
  635.       Functions the same as ftput, except that it also checks the
  636.       screen location on the "virt" page.  If that pixel value is less
  637.       than the "plv" value, then the pixel is drawn.
  638.  
  639.    Use the "DispLayer" function with DispVirt to update the virtual page.
  640.  
  641.  
  642.    X,Y:   Top-left position of sprite;
  643.    PIC:   Sprite to display;
  644.    VIRT:  Virtual page for sprite levels;
  645.    PLV:   Sprite level value
  646.  
  647.    See the file DEMO3.PAS for an example.
  648.  
  649. ───────────────────────────────────────────────────────────────────────────
  650. procedure eraselayer(x,y:integer;bkpage:byte;var pic,virt;plv:byte);
  651.  
  652.    Erases a sprite on the current page.
  653.  
  654.    X,Y:    Coordinates to place the sprite;
  655.    BKPAGE: Backgroun page to write to the current screen;
  656.    PIC:    Sprite to erase;
  657.    VIRT:   Virtual page for sprite levels;
  658.    PLV:    Sprite level value
  659.  
  660.    Erases each sprite pixel when the byte on the (virt) page is
  661.    less than or equal to (plv).
  662.  
  663. ───────────────────────────────────────────────────────────────────────────
  664. procedure dispvirt(x,y:integer;var pic,virt;plv:byte);
  665.  
  666.    Updates the virtual page with the sprite level value.
  667.  
  668.    X,Y:  Coordinates of the sprite;
  669.    PIC:  Sprite to update;
  670.    VIRT: Virtual page to be updated;
  671.    PLV:  Sprite level value
  672.  
  673. ───────────────────────────────────────────────────────────────────────────
  674. procedure erasevirt(x,y:integer;var pic,virt;plv:byte);
  675.  
  676.    Erases the virtual page with the sprite level value.
  677.  
  678.    X,Y:  Coordinates of the sprite;
  679.    PIC:  Sprite to update;
  680.    VIRT: Virtual page to be erased;
  681.    PLV:  Sprite level value
  682.  
  683. ───────────────────────────────────────────────────────────────────────────
  684. procedure copyvirt(x,y:integer;var pic,v1,v2;plv:byte);
  685.  
  686.    Copies a virtual area to another virtual page
  687.  
  688.    X,Y:  Coordinates of the sprite;
  689.    PIC:  Sprite to update;
  690.    V1:   Virtual page source;
  691.    V1:   Virtual page destination;
  692.    PLV:  Sprite level value
  693.  
  694. ───────────────────────────────────────────────────────────────────────────
  695.