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

  1.  
  2.  
  3. {*************************************************************************}
  4. procedure   charcolor(style:integer); {..select color of charactors to use}
  5. {.....................................style=0 is black,  style=1 is white }
  6. begin
  7.   inline($0E/$0D/            {ld  c,13       select function }
  8.          $2A/style/          {ld hl,(nn)     select style    }
  9.          $EF );              {rst 28h       go for it        }
  10.   end;
  11. {*************************************************************************}
  12.  
  13.  
  14. {*************************************************************************}
  15. procedure CharGraph(message : screenline); {..write on the graphics screen}
  16. {    This produces a charactor string on the screen beginning at the      }
  17. {     current curser position and in the current charcolor.  The position }
  18. {    of the curser is not up dated.  Use charcolor (charactor color) of   }
  19. {    white when writing on a dark background                              }
  20.  
  21. var  long:integer;
  22.      byte:char;
  23.      counter:integer;
  24.      register:integer;
  25. begin
  26.    long := length(message);
  27.    inline ($21/$00/$FF/             {ld  hl,0ff00h   put addr of addr in hl  }
  28.            $5E/                     {ld  E,(HL)      get half of the address }
  29.            $23/                     {inc HL          point to second half    }
  30.            $56/                     {ld  D,(HL)      get other half          }
  31.            $EB/                     { ex DE,HL       switch                  }
  32.                               { ........HL now has the address of the array  }
  33.                         {....now enter the size of the array into the array  }
  34.            $ED/$5B/long/          {ld  DE,(nn)     get the size              }
  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.            $22/register );        {ld  (nn),HL    save the register         }
  40.  
  41. for counter := 1 to long do
  42.      begin
  43.        byte := copy(message,counter,1);
  44.        inline (
  45.            $2A/register/          {ld  HL,(nn)  get the register            }
  46.            $3A/byte/              {ld  A,(nn)   get the byte                }
  47.            $77/                   {ld  (HL),A  put it in array              }
  48.            $23/                   {inc HL                                   }
  49.            $23/                   {inc HL        full word                  }
  50.            $22/register  );       {ld (nn),HL   save the register           }
  51.      end;
  52.      inline ($0E/$06/               {ld  C,6     select function              }
  53.              $EF );                 {rst 28h     call                         }
  54. end;
  55. {*************************************************************************}
  56.  
  57.  
  58.  
  59. {*************************************************************************}
  60. procedure    initgraph;      {.........................initalize graphics }
  61.    begin
  62.      inline ( $0E/$01/       {  LD      C,1     ;initialize graphics mode }
  63.               $EF      );    {  RST     28H                               }
  64.    end;
  65. {*************************************************************************}
  66.  
  67.  
  68. {*************************************************************************}
  69. procedure    cleargraph;     {.......................clear grapics screen }
  70.   begin
  71.     inline (  $0E/$02/       {  LD      C,2     ;clear the graphic screen }
  72.               $EF      );    {  RST     28H                               }
  73.   end;
  74. {*************************************************************************}
  75.  
  76.  
  77. {*************************************************************************}
  78. procedure    setline(style:integer);   {................set the line style}
  79.   begin
  80.     inline (  $0E/$0B/       {  LD     C,11     ;set the line style       }
  81.               $2A/style/     {  LD     HL,style ;refer below for styles   }
  82.               $EF   );       {  RST    28H                                }
  83. {.........................................................................
  84.   The line style refered to here has eight types..
  85.  
  86.     style := 1       solid lines are drawn
  87.     style := 2       dashed lines are drawn
  88.     style := 3       dotted lines are drawn
  89.     style := 4       lines are dash-dot
  90.     style := 5       lines are long-dash
  91.     style := 6       lines are short-dash
  92.     style := 7       lines are dot-dot-dash
  93.     style := 8       lines are long-dot
  94. ..........................................................................}
  95.   end;
  96. {*************************************************************************}
  97.  
  98.  
  99.  
  100. {*************************************************************************}
  101. procedure linecolor(color:integer);   {..........switch visible/invisible }
  102.   begin
  103.     inline (  $0E/$0C/       {  LD     C,12     ;set line color           }
  104.               $2A/color/     {  LD     HL,color ; 1 = white   0 = black   }
  105.               $EF  );        {  RST    28H                                }
  106.   end;
  107. {*************************************************************************}
  108.  
  109.  
  110. {*************************************************************************}
  111. procedure    writemode(mode:integer);   {....set logical mode for writing }
  112.   begin
  113.     inline (  $0E/$0E/       {  LD     C,14     ;set write mode           }
  114.               $2A/mode/      {  LD     HL,mode  ;refer below for logic    }
  115.               $EF   );       {  RST    28H                                }
  116. {.........................................................................
  117. There are two ways of understanding this stuff, people with flip/flops for
  118. brain cells may look to the left, everyone else can look to the right...
  119.  
  120. 1) replace           writing = color choosen and style
  121. 2) logical (or)      writing = both color or style, fills in overlapping holes
  122. 3) (xor)             writing = exclusively color or style
  123. 4) (not)             writes where you tell it not to write
  124.                       ie:  white = black, black = white
  125. 5) compliment then replace
  126. 6) compliment then logical (or)
  127. 7) compliment then exclusive or (xor)
  128. 8) compliment then not
  129.  
  130.                     To compliment is to reverse the logic.  This gets
  131.                     a little messy to think about.  If you want to understand
  132.                     it you had best talk to an assembly language hacker.
  133.                     Trying to understand by just playing around with modes
  134.                     3,5,6,7, and 8 will probably just lead to increased
  135.                     confusion.  Keeping with mode #1 will lead to the
  136.                     results you would normally expect.
  137. ..........................................................................}
  138. end;
  139. {*************************************************************************}
  140.  
  141.