Difference between revisions of "Microsoft KB Archive/50221"

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - "&" to "&")
 
Line 44: Line 44:
 
The text mode cursor and its size, blinking, and position are all controlled by the video hardware. The text mode cursor is not created by the QuickBasic editor, compiler, or its applications. Because the hardware supports cursor emulation only in text mode (that is, SCREEN 0 in Basic) there is no graphics mode cursor. This is not a problem or limitation of QuickBasic.<br />
 
The text mode cursor and its size, blinking, and position are all controlled by the video hardware. The text mode cursor is not created by the QuickBasic editor, compiler, or its applications. Because the hardware supports cursor emulation only in text mode (that is, SCREEN 0 in Basic) there is no graphics mode cursor. This is not a problem or limitation of QuickBasic.<br />
 
<br />
 
<br />
Even though there is no hardware-generated blinking cursor in a graphics mode, the BIOS does keep track of the current text position. The program can call BIOS INTERRUPT &amp;H10 functions &amp;H2 and &amp;H3 to get and set the current position of the cursor. If desired, a graphics mode cursor can be placed on the screen by the program itself. Basic uses a solid, nonblinking block cursor in graphics mode. This graphics mode cursor is placed there by the QuickBasic editor and compiler.<br />
+
Even though there is no hardware-generated blinking cursor in a graphics mode, the BIOS does keep track of the current text position. The program can call BIOS INTERRUPT &H10 functions &H2 and &H3 to get and set the current position of the cursor. If desired, a graphics mode cursor can be placed on the screen by the program itself. Basic uses a solid, nonblinking block cursor in graphics mode. This graphics mode cursor is placed there by the QuickBasic editor and compiler.<br />
 
<br />
 
<br />
 
The cursor is controlled by CALLing BIOS service routines that allow the cursor to be enabled, disabled, and resized. The largest possible cursor fills one entire character box. Depending on the graphics adapter, one character box can have a different number of scan lines. For the BIOS routines to work regardless of the video adapter, the BIOS routines assume that there is an 8-pixel by 8-scan-line format for the cursor. This means that you can set the cursor to eight different sizes by CALLing the BIOS.<br />
 
The cursor is controlled by CALLing BIOS service routines that allow the cursor to be enabled, disabled, and resized. The largest possible cursor fills one entire character box. Depending on the graphics adapter, one character box can have a different number of scan lines. For the BIOS routines to work regardless of the video adapter, the BIOS routines assume that there is an 8-pixel by 8-scan-line format for the cursor. This means that you can set the cursor to eight different sizes by CALLing the BIOS.<br />
Line 59: Line 59:
 
CLS
 
CLS
 
' Set up the parameters to disable the cursor emulation.
 
' Set up the parameters to disable the cursor emulation.
inregs.ax = &amp;H1201  ' AH = 12H for function 12H
+
inregs.ax = &H1201  ' AH = 12H for function 12H
 
                     ' AL = 1 to disable the cursor.
 
                     ' AL = 1 to disable the cursor.
inregs.bx = &amp;H34    ' Subfunction 34
+
inregs.bx = &H34    ' Subfunction 34
 
' Disable the cursor:
 
' Disable the cursor:
 
' For QB.EXE : run QB /L QB.QLB, or LINK to QB.LIB, to enable
 
' For QB.EXE : run QB /L QB.QLB, or LINK to QB.LIB, to enable
Line 67: Line 67:
 
' For QBX.EXE: run QBX/L QBX.QLB, or LINK to QBX.LIB, to enable
 
' For QBX.EXE: run QBX/L QBX.QLB, or LINK to QBX.LIB, to enable
 
'    CALL INTERRUPT.
 
'    CALL INTERRUPT.
CALL interrupt(&amp;H10, inregs, outregs)
+
CALL interrupt(&H10, inregs, outregs)
 
PRINT &quot;The cursor should be off. Hit ENTER to bring it back &quot;
 
PRINT &quot;The cursor should be off. Hit ENTER to bring it back &quot;
 
WHILE INKEY$ = &quot;&quot;: WEND
 
WHILE INKEY$ = &quot;&quot;: WEND
  
 
' Set up parameters to enable cursor emulation.
 
' Set up parameters to enable cursor emulation.
inregs.ax = &amp;H1200 ' AH = 12H for function 12H
+
inregs.ax = &H1200 ' AH = 12H for function 12H
 
                   ' AL = 0 to enable the cursor.
 
                   ' AL = 0 to enable the cursor.
inregs.bx = &amp;H34  ' BX = 34H for subfunction 34H.
+
inregs.bx = &H34  ' BX = 34H for subfunction 34H.
  
 
'Enable cursor emulation.
 
'Enable cursor emulation.
CALL interrupt(&amp;H10, inregs, outregs)
+
CALL interrupt(&H10, inregs, outregs)
  
 
' Even though the cursor has been enabled, it will not show.
 
' Even though the cursor has been enabled, it will not show.
Line 85: Line 85:
 
FOR i = 1 TO 8 ' 0 - 8 is the maximum size.
 
FOR i = 1 TO 8 ' 0 - 8 is the maximum size.
  
   inregs.ax = &amp;H100 ' AH = 1 for function 1.
+
   inregs.ax = &H100 ' AH = 1 for function 1.
 
   inregs.cx = i    ' CH = 0 for starting line.
 
   inregs.cx = i    ' CH = 0 for starting line.
 
                     ' CL = ending line.
 
                     ' CL = ending line.
   CALL interrupt(&amp;H10, inregs, outregs)
+
   CALL interrupt(&H10, inregs, outregs)
 
   PRINT &quot;Hit return to increase the cursor size: &quot;
 
   PRINT &quot;Hit return to increase the cursor size: &quot;
 
   WHILE INKEY$ = &quot;&quot;: WEND
 
   WHILE INKEY$ = &quot;&quot;: WEND

Latest revision as of 14:14, 21 July 2020

Knowledge Base


How to Resize and Turn On/Off the Text Mode (SCREEN 0) Cursor

Article ID: 50221

Article Last Modified on 11/21/2006

This article was previously published under Q50221

SUMMARY

This article demonstrates how to control the text mode cursor by directly accessing the BIOS with CALL INTERRUPT. There are two ways to control the text mode cursor. The Basic LOCATE statement enables a program to position the cursor, size the cursor, and turn the cursor on and off. This article describes how this can be done by CALLing the BIOS INTERRUPT 10 hex, with function 12 hex, with subfunction 34 hex, which allows a program to turn the cursor on or off. BIOS INTERRUPT 10 hex with function 1 allows a program to set the cursor size.

This information applies to Microsoft QuickBasic 4.00, 4.00b, and 4.50 for MS-DOS and to Microsoft Basic Compiler 6.00, and 6.00b for MS-DOS and Microsoft Basic PDS 7.00 for MS-DOS.

MORE INFORMATION

The text mode cursor and its size, blinking, and position are all controlled by the video hardware. The text mode cursor is not created by the QuickBasic editor, compiler, or its applications. Because the hardware supports cursor emulation only in text mode (that is, SCREEN 0 in Basic) there is no graphics mode cursor. This is not a problem or limitation of QuickBasic.

Even though there is no hardware-generated blinking cursor in a graphics mode, the BIOS does keep track of the current text position. The program can call BIOS INTERRUPT &H10 functions &H2 and &H3 to get and set the current position of the cursor. If desired, a graphics mode cursor can be placed on the screen by the program itself. Basic uses a solid, nonblinking block cursor in graphics mode. This graphics mode cursor is placed there by the QuickBasic editor and compiler.

The cursor is controlled by CALLing BIOS service routines that allow the cursor to be enabled, disabled, and resized. The largest possible cursor fills one entire character box. Depending on the graphics adapter, one character box can have a different number of scan lines. For the BIOS routines to work regardless of the video adapter, the BIOS routines assume that there is an 8-pixel by 8-scan-line format for the cursor. This means that you can set the cursor to eight different sizes by CALLing the BIOS.

For more information on CALLing both BIOS and DOS INTERRUPTs query on the word QB4INT.

The following code example demonstrates how to use the BIOS service routines to turn the cursor off, turn it back on, and how to resize the cursor to each of the possible sizes.

Code Example

REM $INCLUDE: 'qb.bi'
' FOR QBX.EXE editor the include file is 'QBX.BI'

DIM inregs AS regtype, outregs AS regtype
CLS
' Set up the parameters to disable the cursor emulation.
inregs.ax = &H1201  ' AH = 12H for function 12H
                    ' AL = 1 to disable the cursor.
inregs.bx = &H34    ' Subfunction 34
' Disable the cursor:
' For QB.EXE : run QB /L QB.QLB, or LINK to QB.LIB, to enable
'    CALL INTERRUPT.
' For QBX.EXE: run QBX/L QBX.QLB, or LINK to QBX.LIB, to enable
'    CALL INTERRUPT.
CALL interrupt(&H10, inregs, outregs)
PRINT "The cursor should be off. Hit ENTER to bring it back "
WHILE INKEY$ = "": WEND

' Set up parameters to enable cursor emulation.
inregs.ax = &H1200 ' AH = 12H for function 12H
                   ' AL = 0 to enable the cursor.
inregs.bx = &H34   ' BX = 34H for subfunction 34H.

'Enable cursor emulation.
CALL interrupt(&H10, inregs, outregs)

' Even though the cursor has been enabled, it will not show.
' This is because we need to set the size.  The following
' loop cycles through the sizes.

FOR i = 1 TO 8 ' 0 - 8 is the maximum size.

   inregs.ax = &H100 ' AH = 1 for function 1.
   inregs.cx = i     ' CH = 0 for starting line.
                     ' CL = ending line.
   CALL interrupt(&H10, inregs, outregs)
   PRINT "Hit return to increase the cursor size: "
   WHILE INKEY$ = "": WEND
NEXT
END
                


Additional query words: QuickBas BasicCom

Keywords: KB50221