3 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
4 <META NAME="Author" CONTENT="Joshua Neal">
5 <META NAME="Description" CONTENT="Pure VGA/SVGA hardware programming (registers, identification, and otherlow-level stuff.)">
6 <META NAME="KeyWords" CONTENT="VGA SVGA hardware video programming">
7 <TITLE>VGA/SVGA Video Programming--Manipulating the Text-mode Cursor</TITLE>
11 <CENTER><A HREF="../home.htm">Home</A> <A HREF="#intro">Intro</A> <A HREF="#enable">Visibility</A>
12 <A HREF="#position">Position</A> <A HREF="#shape">Shape</A> <A HREF="#blink">Blink
13 Rate</A> <A HREF="#color">Color</A> <A HREF="vga.htm#general">Back</A>
14 <HR WIDTH="100%"><B>Hardware Level VGA and SVGA Video Programming Information
17 <CENTER>Manipulating the Text-mode Cursor
18 <HR WIDTH="100%"></CENTER>
22 <A HREF="#intro">Introduction</A> -- gives overview of text-mode cursor
26 <A HREF="#enable">Enabling/Disabling the Cursor</A> -- details on making
27 the cursor visible or not visible</LI>
30 <A HREF="#position">Manipulating the Cursor Position</A> -- details on
31 controlling the cursor's placement</LI>
34 <A HREF="#shape">Manipulating the Cursor Shape</A> -- details on controlling
35 the cursor's appearance</LI>
38 <A HREF="#blink">Cursor Blink Rate</A> -- provides information about the
39 cursor's blink rate</LI>
42 <A HREF="#color">Cursor Color</A> -- provides information regarding the
45 <A NAME="intro"></A><B>Introduction</B>
46 <BR><B> </B>When dealing with
47 the cursor in most high-level languages, the cursor is defined as the place
48 where the next text output will appear on the display. When dealing directly
49 with the display, the cursor is simply a blinking area of a particular
50 character cell. A program may write text directly to the display independent
51 of the current location of the cursor. The VGA provides facilities for
52 specifying whether a cursor is to be displayed, where the cursor is to
53 appear, and the shape of the cursor itself. Note that this cursor is only
54 used in the text modes of the standard VGA and is not to be confused with
55 the graphics cursor capabilities of particular SVGA chipsets.
57 <P><A NAME="enable"></A><B>Enabling/Disabling the Cursor</B>
58 <BR> On the VGA there are three
59 main ways of disabling the cursor. The most straightforward is to set the
60 <A HREF="crtcreg.htm#0A">Cursor Disable</A> field to 1. Another way is
61 to set the <A HREF="crtcreg.htm#0B">Cursor Scan Line End</A> field to a
62 value less than that of the <A HREF="crtcreg.htm#0A">Cursor Scan Line Start</A>
63 field. On some adapters such as the IBM EGA, this will result instead in
64 a split block cursor. The third way is to set the cursor location to a
65 location off-screen. The first two methods are specific to VGA and compatible
66 adapters and are not guaranteed to work on non-VGA adapters, while the
69 <P><A NAME="position"></A><B>Manipulating the Cursor Position</B>
70 <BR><B> </B>When dealing with
71 the cursor in standard BIOS text modes, the cursor position is specified
72 by row and column. The VGA hardware, due to its flexibility to display
73 any different text modes, specifies cursor position as a 16-bit address.
74 The upper byte of this address is specified by the <A HREF="crtcreg.htm#0E">Cursor
75 Location High Register</A>, and the lower by the <A HREF="crtcreg.htm#0F">Cursor
76 Location Low Register</A>. In addition this value is affected by the <A HREF="crtcreg.htm#0B">Cursor
77 Skew</A> field. When the hardware fetches a character from display memory
78 it compares the address of the character fetched to that of the cursor
79 location added to the <A HREF="crtcreg.htm#0B">Cursor Skew</A> field. If
80 they are equal and the cursor is enabled, then the character is written
81 with the current cursor pattern superimposed. Note that the address compared
82 to the cursor location is the address in display memory, not the address
83 in host memory. Characters and their attributes are stored at the same
84 address in display memory in different planes, and it is the odd/even addressing
85 mode usually used in text modes that makes the interleaved character/attribute
86 pairs in host memory possible. Note that it is possible to set the cursor
87 location to an address not displayed, effectively disabling the cursor.
88 <BR> The <A HREF="crtcreg.htm#0B">Cursor
89 Skew</A> field was used on the EGA to synchronize the cursor with internal
90 timing. On the VGA this is not necessary, and setting this field to any
91 value other than 0 may result in undesired results. For example, on one
92 particular card, setting the cursor position to the rightmost column and
93 setting the skew to 1 made the cursor disappear entirely. On the same card,
94 setting the cursor position to the leftmost column and setting the skew
95 to 1 made an additional cursor appear above and to the left of the correct
96 cursor. At any other position, setting the skew to 1 simply moved the cursor
97 right one position. Other than these undesired effects, there is no function
98 that this register can provide that could not be obtained by simply increasing
101 <P><A NAME="shape"></A><B>Manipulating the Cursor Shape</B>
102 <BR><B> </B> On the VGA, the text-mode
103 cursor consists of a line or block of lines that extend horizontally across
104 the entire scan line of a character cell. The first, topmost line is specified
105 by the <A HREF="crtcreg.htm#0A">Cursor Scan Line Start</A> field. The last,
106 bottom most line is specified by the <A HREF="crtcreg.htm#0B">Cursor Scan
107 Line End</A> field. The scan lines in a character cell are numbered from
108 0 up to the value of the <A HREF="crtcreg.htm#09">Maximum Scan Line</A>
109 field. On the VGA if the <A HREF="crtcreg.htm#0B">Cursor Scan Line End</A>
110 field is less than the <A HREF="crtcreg.htm#0A">Cursor Scan Line Start</A>
111 field, no cursor will be displayed. Some adapters, such as the IBM EGA
112 may display a split-block cursor instead.
114 <P><A NAME="blink"></A><B>Cursor Blink Rate</B>
115 <BR> On the standard VGA, the
116 blink rate is dependent on the vertical frame rate. The on/off state of
117 the cursor changes every 16 vertical frames, which amounts to 1.875 blinks
118 per second at 60 vertical frames per second. The cursor blink rate is thus
119 fixed and cannot be software controlled on the standard VGA. Some SVGA
120 chipsets provide non-standard means for changing the blink rate of the
123 <P><A NAME="color"></A><B>Cursor Color</B>
124 <BR> On the standard VGA, the
125 cursor color is obtained from the foreground color of the character that
126 the cursor is superimposing. On the standard VGA there is no way to modify
130 <P>Notice: All trademarks used or referred to on this page are the property
131 of their respective owners.
132 <BR>All pages are Copyright © 1997, 1998, J. D. Neal, except where
133 noted. Permission for utilization and distribution is subject to the terms
134 of the <A HREF="license.htm">FreeVGA Project Copyright License</A>.