home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / BEEHIVE / UTILITYS / PUDD.ARC / TOOLS3.PAS < prev    next >
Pascal/Delphi Source File  |  1991-08-11  |  5KB  |  83 lines

  1.  
  2.  
  3. {*************************************************************************}
  4. {**********  The following are all procedures to operate the crosshair  **}
  5. {*************************************************************************}
  6. procedure    xhair(size,mode,centerX,centerY:integer);
  7. var x1,x2,y1,y2:integer;  {... same as used in TeleVideo System Reference }
  8. begin
  9.   y1 := centerY - size;
  10.   if y1 < 0 then y1 := 0;
  11.   y2 := centerY + size;
  12.   if y2 > 239 then y2 := 239;
  13.   x1 := centerX - 2*size;
  14.   if x1 < 0 then x1 := 0;
  15.   x2 := centerX + 2*size;
  16.   if x2 > 639 then x2 := 639;
  17.    inline ($21/$00/$FF/             {ld  hl,0ff00h   put addr of addr in hl  }
  18.            $5E/                     {ld  E,(HL)      get half of the address }
  19.            $23/                     {inc HL          point to second half    }
  20.            $56/                     {ld  D,(HL)      get other half          }
  21.            $EB/                     { ex DE,HL       switch                  }
  22.                               { ........HL now has the address of the array  }
  23.                         {....now enter the size of the array into the array  }
  24.            $ED/$5B/centerY/       {ld  DE,(nn)     get the integer           }
  25.            $73/                   {ld  (HL),E     put in array              }
  26.            $23/                   {inc HL                                   }
  27.            $72/                   {ld  (HL),D    and the high byte          }
  28.            $23/                   {inc HL           (it's done in words)    }
  29.            $ED/$5B/x1/            {ld  DE,(nn)   get the integer            }
  30.            $73/                   {ld  (HL),E  put it in array              }
  31.            $23/                   {inc HL                                   }
  32.            $72/                   {ld  (HL),D  both parts                   }
  33.            $23/                   {inc HL        full word                  }
  34.            $ED/$5B/x2/            {ld  DE,(nn)     get the mode             }
  35.            $73/                   {ld  (HL),E     put in array              }
  36.            $23/                   {inc HL                                   }
  37.            $72/                   {ld  (HL),D    and the high byte          }
  38.            $23/                   {inc HL           (it's done in words)    }
  39.            $ED/$5B/centerX/       {ld  DE,(nn)   get the integer            }
  40.            $73/                   {ld  (HL),E  put it in array              }
  41.            $23/                   {inc HL                                   }
  42.            $72/                   {ld  (HL),D  both parts                   }
  43.            $23/                   {inc HL        full word                  }
  44.            $ED/$5B/y1/            {ld  DE,(nn)     get the mode             }
  45.            $73/                   {ld  (HL),E     put in array              }
  46.            $23/                   {inc HL                                   }
  47.            $72/                   {ld  (HL),D    and the high byte          }
  48.            $23/                   {inc HL           (it's done in words)    }
  49.            $ED/$5B/y2/            {ld  DE,(nn)   get the integer            }
  50.            $73/                   {ld  (HL),E  put it in array              }
  51.            $23/                   {inc HL                                   }
  52.            $72/                   {ld  (HL),D  both parts                   }
  53.            $2A/mode/                {ld  HL,nn   get the mode               }
  54.            $0E/$08/               {ld  C,8h      get the function           }
  55.            $EF  );                {rst 28h                                  }
  56. end;
  57.  
  58. procedure  movXhair(size,xpoz,ypoz:integer);  {........used after init or reInit }
  59. begin
  60.     inline($21/$00/$00/           {ld  HL,nn   get the mode                 }
  61.            $0E/$08/               {ld  C,8h      get the function           }
  62.            $EF  );                {rst 28h                                  }
  63.     xhair(size,1,xpoz,ypoz);
  64. end;
  65.  
  66. procedure initXhair(size,xpoz,ypoz:integer);  {.................. use this first }
  67. begin
  68.  xhair(size,0,xpoz,ypoz);
  69.  end;
  70.  
  71. procedure  reInitXhair(size,xpoz,ypoz:integer); {.. use after any other graphics }
  72. begin
  73.      xhair(size,0,xpoz,ypoz);
  74.      xhair(size,1,xpoz,ypoz);
  75. end;
  76.  
  77. procedure  offXhair(size,xpoz,ypoz:integer); {...........turns off the crosshair }
  78. begin
  79.      xhair(size,1,xpoz,ypoz);
  80. end;
  81. {*************************************************************************}
  82.  
  83.