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 / TOOLS2.PAS < prev    next >
Pascal/Delphi Source File  |  1991-08-11  |  7KB  |  119 lines

  1.  
  2. {*************************************************************************}
  3. procedure moveto(xpos,ypos:integer); {moves curser to xposition,yposition }
  4.   begin
  5.     inline (  $0E/$04/       {  LD     C,4      ;move to x,y              }
  6.               $2A/xpos/      {  LD     HL,xpos  ;this is x                }
  7.               $ED/$5B/ypos/  {  LD     DE,ypos  ;this is y                }
  8.               $EF   );       {  RST    28H                                }
  9. {..........................................................................
  10.     NOTE:
  11.        The valid screen positions are cartesian coordinates in the first
  12.        quadrent from (0,0) to (639,239).  There are other systems in common
  13.        use like (0,0) to (1,1) which will require passing a real value and
  14.        converting it to an integer.  The IBM uses either 320x200 or 640x200.
  15.        These conversions can be done in Pascal before the inline statement.
  16.        If anyone converts this stuff to polar coordinates I would like to
  17.        see it.
  18. .............................................................................}
  19.   end;
  20. {*************************************************************************}
  21.  
  22.  
  23. {*************************************************************************}
  24. procedure   drawto(xpos,ypos:integer); {.......................draw a line }
  25.     { draws from current position to x,y in current line style }
  26.   begin
  27.     inline (  $0E/$05/       {  LD     C,5      ;draw line to x,y         }
  28.               $2A/xpos/      {  LD     HL,xpos  ;x                        }
  29.               $ED/$5B/ypos/  {  LD     DE,ypos  ;y                        }
  30.               $EF   );       {  RST     28H                               }
  31.   end;
  32. {*************************************************************************}
  33.  
  34.  
  35.  
  36. {*************************************************************************}
  37. procedure   alphamode;     {................. returns to the regular mode }
  38.   begin
  39.     inline (  $0E/$00/       {  LD     C,0      ;goto alphanumberic mode  }
  40.               $EF  );        {  RST    28H                                }
  41.   end;
  42. {*************************************************************************}
  43.  
  44.  
  45. {*************************************************************************}
  46. procedure  polyline(size:integer;                {the number of (x,y) pairs}
  47.                     listarry:pointlist );
  48.  
  49. {......This is a single call to the graphics primitives which will draw    }
  50. {    lines between as many as 63 points.  Each point is given as an integer}
  51. {    pair.  The array passed can have a max of 126 integers, or 63 (x,y)   }
  52. {    pairs.  The size is the number of pairs and must not exceed 63.       }
  53. {    Since the procedure is required to rebuild the array at another       }
  54. {    location, there is no overall sigifigant time savings.  There is,     }
  55. {    however, a savings in time for the actual drawing, since it is all    }
  56. {    done in one call.                                                     }
  57.  
  58. var  point:    integer;    {....pointer                                     }
  59.      loop:     integer;    {....the looping is done in pascal, pure lasyness}
  60.      position: integer;    {....passed as integer in machine code stuff     }
  61.  
  62.  
  63. begin    {...............................................polyline            }
  64.    inline ($21/$00/$FF/             {ld  hl,0ff00h   put addr of addr in hl  }
  65.            $5E/                     {ld  E,(HL)      get half of the address }
  66.            $23/                     {inc HL          point to second half    }
  67.            $56/                     {ld  D,(HL)      get other half          }
  68.            $EB/                     { ex DE,HL       switch                  }
  69.                               { ........HL now has the address of the array  }
  70.                         {.now enter the size of the array into the array     }
  71.            $ED/$5B/size/          {ld  DE,(nn)    get the size               }
  72.            $73/                   {ld  (HL),E       .. the low byte          }
  73.            $23/                   {inc HL                 and               }
  74.            $72/                   {ld  (HL),D       .. the high byte        }
  75.            $23/                   {inc HL                                   }
  76.            $22/point );           {ld  (nn),HL    store address in pointer  }
  77.   for loop := 1 to size*2 do
  78.     begin
  79.       position := listarry[loop];
  80.       inline ($2A/point/          {ld  HL,(nn)   get the pointer            }
  81.               $ED/$5B/position/   {ld  DE,(nn)   get the position integer   }
  82.               $73/                {ld  (HL),E    load low byte              }
  83.               $23/                {inc  HL       mov'in right along         }
  84.               $72/                {ld  (HL),D    load high byte             }
  85.               $23/                {inc  HL                                  }
  86.               $22/point );        {ld   (nn),HL   save pointer              }
  87.     end;
  88.   inline ($0E/$03/                {ld   C,3       choose function           }
  89.           $EF )                   {rst  28h                                 }
  90.  end;  {...............................................polyline             }
  91. {*************************************************************************}
  92.  
  93.  
  94.  
  95. {**************************************************************************}
  96. {*   GetLine will return an 80 byte array which is a direct bit           *}
  97. {*  representation of the pixels from left to right on the graphic line   *}
  98. {*  passed as y.                                                          *}
  99. {**************************************************************************}
  100. procedure GetLine(     y        :integer;             {...the line number}
  101.                   var  ByteList :ScanLine );
  102.  
  103. var  LocalY     :integer;
  104.      Pointr     :integer;
  105.      i,j,k      :integer;
  106. begin
  107.    LocalY := y;
  108.    Pointr := addr(ByteList);
  109.    inline($0E/$13/         {ld  C,013h      function is #19                }
  110.           $ED/$6B/Localy/  {ld  HL,(nn)     get the row                    }
  111.           $EF/             {rst 28h         make the call                  }
  112.           $ED/$6B/$00/$FF/ {ld  HL,(0FF00h)    get the 'from' array        }
  113.           $ED/$5B/Pointr/  {ld  DE,(nn)        get the 'to' array          }
  114.           $01/$50/$00/     {ld  BC,80d         move 80 bytes               }
  115.           $ED/$B0);
  116. end;
  117. {**************************************************************************}
  118.  
  119. dr$Edre  LD  LD  LD  LD  LD  LD  LD  LD  LD  LD  LD  LD  LD  LD  LD  LD  LD  LD  LD  LD  LD  LD  LD  LD  LD  LD