home *** CD-ROM | disk | FTP | other *** search
- Program CursorControl;
- { This program will use several different Inline Procedures }
- { to do different types of cursor manipulations. Included }
- { here are routines to hide the cursor, restore the cursor, }
- { define a block cursor, and to restore the cursor to its }
- { default underline state. }
- Uses Crt; { Included here so we can do a ClrScr }
-
- Var
- Row, Column : Byte; { Position to replace cursor }
- Mode : Byte Absolute $40:$49;{ To determine video mode }
- Ch : Char; { Used for user input }
-
- Procedure CursorOn;
- { This procedure will turn the cursor on by returning it to a }
- { displayable position. The position is determined by the }
- { global variables Row and Column.. This is necessary because }
- { of the way in which we hide the cursor. Note that we also }
- { define a local variable into the Bios Data Area so we can }
- { determine the current active video page. }
- Var
- ActivePage : Byte Absolute $40:$62;
- { Bios Data Area for the current page }
-
- Begin
- Inline( $B8/$00/$02/ { MOV AX,0200 }
- $8A/$BE/ActivePage/{ MOV BH,ACTIVEPAGE }
- $8A/$36/Row/ { MOV DH,ROW }
- $8A/$16/Column/ { MOV DL,COLUMN }
- $CD/$10 ); { INT 10 }
- End;
-
- Procedure CursorOff;
- { This procedure turns the cursor off by placing it into a }
- { position that is not normally displayable. That is, we }
- { reposition the cursor to screen position 255,255. This is }
- { one of two documented ways to hide the cursor. Again we }
- { define a local variable to determine the current video page }
- Var
- ActivePage : Byte Absolute $40:$62;
- { BIOS data area for the active page }
-
- Begin
- Inline( $B8/$00/$02/ { MOV AX,0200 }
- $8A/$BE/ActivePage/{ MOV BH,ACTIVEPAGE }
- $B6/$FF/ { MOV DH,$FF }
- $B2/$FF/ { MOV DL,$FF }
- $CD/$10 ); { INT 10 }
- End;
-
- Procedure NormalCursor;
- { This procedure will return the cursor to its normal state. }
- { Since the definition of the cursor is dependant upon the }
- { current video mode (mono versus color), we declare a }
- { variable into the BIOS data area where the current video }
- { mode value is kept. We can then use this inside the inline }
- { code. }
-
- Begin
- Inline( $B8/$00/$01/ { MOV AX,0100 }
- $8A/$0E/Mode/ { MOV CL,MODE }
- $B1/$07/ { CMP CL,07 }
- $75/$06/ { JNZ 06 }
- $B5/$0B/ { MOV CH,0B }
- $B1/$0C/ { MOV CL,0C }
- $EB/$04/ { JMP 04 }
- $B5/$06/ { MOV CH,06 }
- $B1/$07/ { MOV CL,07 }
- $CD/$10 ); { INT 10 }
- End;
-
- Procedure BlockCursor;
- { We can redefine the cursor to be any size by changing the }
- { beginning and ending scan lines. This procedure will set }
- { the beginning value at 0 regardless of monitor type. It }
- { will then set the ending scan line based on the type of }
- { monitor on the system. }
-
- { To modify this routine to turn the cursor off, simply }
- { follow the comments next to the assembly mnemonics inside }
- { the inline code. }
- Begin { Cursor Off }
- Inline( $B8/$00/$01/ { MOV AX,0100 }
- $B5/$00/ { MOV CH,00 MOV CH,20 }
- $8A/$0E/Mode/ { MOV CL,MODE }
- $38/$C8/ { CMP AL,CL }
- $75/$06/ { JNZ 04 }
- $B1/$0C/ { MOV CL,0C MOV CL,20 }
- $EB/$02/ { JMP 02 }
- $B1/$07/ { MOV CL,07 MOV CL,20 }
- $CD/$10 ); { INT 10 }
- End;
-
- Begin
- ClrScr; { Clear the output screen }
- Row := 10; { Set the cursor restore Y Coord }
- Column := 20; { Set the cursor restore X Coord }
- Write( 'Ready to kill the Cursor?' );
- Ch := Readkey;
- Writeln;
- Writeln( 'I''m Gone!' );
- CursorOff; { Turn off the cursor }
- Readln; { Pause for viewing }
- CursorOn; { Turn the cursor back on }
- Writeln( 'I''m Back!' );
- Readln; { Pause for screen viewing }
- BlockCursor; { Redifine to a block cursor }
- Writeln( 'Now I''m a Block Cursor!' );
- Readln; { Pause for screen viewing }
- NormalCursor; { Restore to original state }
- Writeln( 'I''m an underline again... :(' );
- Readln; { Pause for screen viewing }
- End.
-