home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / cursor / cursor.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1994-04-21  |  2.1 KB  |  72 lines

  1. {
  2. -------------------------------------------------------------------------------
  3.   TITLE : Cursor Definition
  4. -------------------------------------------------------------------------------
  5.      This is a sample program that demonstrates how to change the cursor
  6.      on an IBM PC.                                                           }
  7.  
  8. Program Cursor;
  9.  
  10. uses
  11.   dos;
  12.  
  13. var
  14.    ch     : char;
  15.    start,
  16.    endcur : integer;
  17.  
  18. procedure SetCursor (StartLine,EndLine : Integer);
  19. {  This procedure does the actual cursor setting thru the TURBO
  20.    INTR procedure                                                }
  21.  
  22. var
  23.    RegPack    : Registers;
  24.    CxRegArray : Array [1..2] of Byte;
  25.    CxReg      : WORD absolute CxRegArray;
  26.  
  27. begin
  28.      CxRegArray[2] := Lo(StartLine);
  29.      CxRegArray[1] := Lo(EndLine);
  30.      With RegPack do
  31.           begin
  32.                ax := $0100;          {ah = 1 means set cursor type         }
  33.                bx := $0;             {bx = page number, zero for us        }
  34.                cx := CxReg;          {cx bits 4 to 0 = start line for      }
  35.                                      {Cursor                               }
  36.                                      {cl bits 4 to 0 = end line for cursor }
  37.                intr ($10,RegPack);   {set cursor                           }
  38.           end;
  39. end;
  40.  
  41. procedure BoxCursor;
  42. {  This procedure calls SetCursor to show a block (box) cursor  }
  43.  
  44. begin
  45.      SetCursor (2,5);
  46. end;
  47.  
  48. {-----------------------------------------------------------------------------
  49.   TITLE : Cursor Definition
  50. ------------------------------------------------------------------------------}
  51.  
  52. procedure NoCursor;
  53. { This procedure calls SetCursor to turn the cursor off                    }
  54.  
  55. begin
  56.      SetCursor (32,0);      {Setting bit 5 turns off cursor                }
  57. end;
  58.  
  59. procedure ULCursor;
  60. { This procedure calls SetCursor to show the 'underscore' cursor           }
  61.  
  62. begin
  63.      SetCursor (6,7);
  64. end;
  65.  
  66.  
  67. begin
  68.      write ('Box:'); BoxCursor; readln; writeln;
  69.      write ('No:'); NoCursor;   readln; writeln;
  70.      write ('UL:'); ULCursor;   readln; writeln;
  71. end.
  72.