community.borland.com

Article #15152: Toggling the cursor ON/OFF

 Technical Information Database

TI152D.txt - Toggling the cursor ON/OFF

Category   :Turbo Pascal
Platform   :DOS
Product    :

Description:

The following example routines are  public  domain  programs that
have been uploaded to  our  Forum on CompuServe. As a courtesy to
our  users  that  do  not  have immediate access  to  CompuServe,
Technical Support distributes these routines free of charge.

However, because these routines are public  domain  programs, not
developed by  Borland International, we are unable to provide any
technical support or assistance using these routines. If you need
assistance   using   these   routines,   or    are   experiencing
difficulties, we  recommend  that  you  log  onto  CompuServe and
request assistance from the Forum  members  that  developed these
routines.

To  turn  the  cursor on and off you must use BIOS interrupt $10.
For more information on  this  interrupt,  please  refer to a DOS
programmer's guide.   Of course, manipulating the cursor can only
be done in text mode and not graphics mode.

The  following procedure turns the cursor on  and  off  in  Turbo
Pascal:

        procedure SetCursor(On: Boolean);
        var
          reg : Registers;
        begin
          if On then              { Turn cursor on }
         if Mem[$0040:$0049] = 7 then
              reg.cx := $B0C  { If monochrome monitor }
         else
           reg.cx := $607  { If color monitor }
          else                    { Turn cursor off }
            reg.cx := $2020;
          reg.bx := 0;
          reg.ax := $0100;    { Set the interrupt function }
          Intr($10,reg);      { Call the interrupt }
        end;  { procedure SetCursor }

This procedure was  revised  from the question and answer section
in the Turbo Pascal Tutor  and Turbo Pascal version 3.0 reference
guide.

In the procedure you do not need to declare  the  type  Registers
because it is predefined for you in the DOS unit.   Therefore, to
use this procedure, your program must also use the DOS unit.


Reference:
 

3/30/99 3:59:41 PM
 

Last Modified: 01-SEP-99