home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / program / pascal / passrc / spr2.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1985-11-18  |  4.1 KB  |  127 lines

  1. { -----------------------------------------------------------------------------
  2.  
  3.                                  NOTICE:
  4.  
  5.       THESE MATERIALS are UNSUPPORTED by OSS!  If you do not understand how to
  6.       use them do not contact OSS for help!  We will not teach you how to 
  7.       program in Pascal.  If you find an error in these materials, feel free
  8.       to SEND US A LETTER explaining the error, and how to fix it.
  9.  
  10.       THE BOTTOM LINE:
  11.  
  12.          Use it, enjoy it, but you are on your own when using these materials!
  13.  
  14.  
  15.                                DISCLAIMER:
  16.  
  17.       OSS makes no representations or warranties with respect to the contents
  18.       hereof and specifically disclaim all warranties of merchantability or
  19.       fitness for any particular purpose.   This document is subject to change
  20.       without notice.
  21.       
  22.       OSS provides these materials for use with Personal Pascal.  Use them in
  23.       any way you wish.
  24.  
  25.    -------------------------------------------------------------------------- }
  26.  
  27.  
  28. {$M+}
  29. {$E+}
  30. { link this with sprite.o }
  31.  
  32. program addr_stuff;
  33.         { this is a module to go with sprite.pas - necessary in order to
  34.           convert addresses to integers }
  35.  
  36. type
  37.         { these are echos of types in sprite.pas }
  38.  
  39.    scrn_memory = array[1..16000] of integer;
  40.    mfdb_fields = (addr1,addr2,wid_pix,ht_pix,wid_wds,flag,num_planes,r1,r2,r3);
  41.    mfdb = array[mfdb_fields] of integer;
  42.  
  43. PROCEDURE init_form(var form : MFDB; addr : long_integer);
  44.         { initializes a form to point to a chunk of memory off screen }
  45.         { note that the caller passes a 32K chunk of memory as what it
  46.           thinks is a var parameter, thus passing its address }
  47. var
  48.    hi_byte,lo_byte : integer;
  49.  
  50. begin
  51.         { convert the address to integers }
  52.    lo_byte := int(addr & $0000ffff);
  53.    hi_byte := int( ShR(addr,16) & $0000ffff);
  54.         { and initialize all fields of the MFDB }
  55.    form[addr1] := hi_byte;
  56.    form[addr2] := lo_byte;
  57.         { some assumptions here }
  58.    form[wid_pix] := 640;        { medium or high rez }
  59.    form[ht_pix] := 200;         { medium rez }
  60.    form[wid_wds] := 40;
  61.    form[flag] := 0;             { device dependent }
  62.    form[num_planes] := 2;       { again, med rez }
  63. end;
  64.  
  65.  
  66. PROCEDURE copy_rect(src,dst : long_integer;
  67.                     from_x,from_y,to_x,to_y,width,height : integer);
  68.         { heres where we actually copy a rectangle from one loc. to another }
  69.         { using gem raster copy function }
  70.  
  71.     TYPE
  72.       Ctrl_Parms      = ARRAY [ 0..11 ] OF integer ;
  73.       Int_In_Parms    = ARRAY [ 0..15 ] OF integer ;
  74.       Int_Out_Parms   = ARRAY [ 0..45 ] OF integer ;
  75.       Pts_In_Parms    = ARRAY [ 0..11 ] OF integer ;
  76.       Pts_Out_Parms   = ARRAY [ 0..11 ] OF integer ;
  77.  
  78.     VAR
  79.       control : Ctrl_Parms ;
  80.       int_in  : Int_In_Parms ;
  81.       int_out : Int_Out_Parms ;
  82.       pts_in  : Pts_In_Parms ;
  83.       pts_out : Pts_Out_Parms ;
  84.  
  85.       hi_byte,lo_byte : integer;
  86.  
  87.  
  88.     PROCEDURE VDI_Call( cmd, sub_cmd : integer ; nints, npts : integer ;
  89.                 VAR ctrl : Ctrl_Parms ;
  90.                 VAR int_in : Int_In_Parms ; VAR int_out : Int_Out_Parms ;
  91.                 VAR pts_in : Pts_In_Parms ; VAR pts_out : Pts_Out_Parms ;
  92.                 translate : boolean ) ;
  93.       EXTERNAL ;
  94.  
  95.  
  96. begin
  97.         { put source MFDB address in control array }
  98.    lo_byte := int(src & $0000ffff);
  99.    hi_byte := int( ShR(src,16) & $0000ffff);
  100.    control[7] := hi_byte; control[8] := lo_byte;
  101.  
  102.        { and same for destination MFDB }
  103.    lo_byte := int(dst & $0000ffff);
  104.    hi_byte := int( ShR(dst,16) & $0000ffff);
  105.    control[9] := hi_byte; control[10] := lo_byte;
  106.  
  107.    int_in[0] := 3;      { replace mode }
  108.  
  109.         { set the points for src and dest }
  110.    pts_in[0] := from_x; pts_in[1] := from_y;
  111.    pts_in[2] := from_x + width - 1;
  112.    pts_in[3] := from_y + height - 1;
  113.  
  114.    pts_in[4] := to_x; pts_in[5] := to_y;
  115.    pts_in[6] := to_x + width - 1;
  116.    pts_in[7] := to_y + height - 1;
  117.  
  118.         { do the copy }
  119.    VDI_Call(109,0,1,8,control,int_in,int_out,pts_in,pts_out,false);
  120.  
  121. end;
  122.  
  123.         { just a module, no main program }
  124. begin
  125. end.
  126.  
  127.