138 lines
7.1 KiB
HTML
138 lines
7.1 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
|
<META NAME="Author" CONTENT="Joshua Neal">
|
|
<META NAME="Description" CONTENT="Pure VGA/SVGA hardware programming (registers, identification, and otherlow-level stuff.)">
|
|
<META NAME="KeyWords" CONTENT="VGA SVGA hardware video programming">
|
|
<TITLE>VGA/SVGA Video Programming--Manipulating the Text-mode Cursor</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
|
|
<CENTER><A HREF="../home.htm">Home</A> <A HREF="#intro">Intro</A> <A HREF="#enable">Visibility</A>
|
|
<A HREF="#position">Position</A> <A HREF="#shape">Shape</A> <A HREF="#blink">Blink
|
|
Rate</A> <A HREF="#color">Color</A> <A HREF="vga.htm#general">Back</A>
|
|
<HR WIDTH="100%"><B>Hardware Level VGA and SVGA Video Programming Information
|
|
Page</B></CENTER>
|
|
|
|
<CENTER>Manipulating the Text-mode Cursor
|
|
<HR WIDTH="100%"></CENTER>
|
|
|
|
<UL>
|
|
<LI>
|
|
<A HREF="#intro">Introduction</A> -- gives overview of text-mode cursor
|
|
capabilities</LI>
|
|
|
|
<LI>
|
|
<A HREF="#enable">Enabling/Disabling the Cursor</A> -- details on making
|
|
the cursor visible or not visible</LI>
|
|
|
|
<LI>
|
|
<A HREF="#position">Manipulating the Cursor Position</A> -- details on
|
|
controlling the cursor's placement</LI>
|
|
|
|
<LI>
|
|
<A HREF="#shape">Manipulating the Cursor Shape</A> -- details on controlling
|
|
the cursor's appearance</LI>
|
|
|
|
<LI>
|
|
<A HREF="#blink">Cursor Blink Rate</A> -- provides information about the
|
|
cursor's blink rate</LI>
|
|
|
|
<LI>
|
|
<A HREF="#color">Cursor Color</A> -- provides information regarding the
|
|
cursor's color</LI>
|
|
</UL>
|
|
<A NAME="intro"></A><B>Introduction</B>
|
|
<BR><B> </B>When dealing with
|
|
the cursor in most high-level languages, the cursor is defined as the place
|
|
where the next text output will appear on the display. When dealing directly
|
|
with the display, the cursor is simply a blinking area of a particular
|
|
character cell. A program may write text directly to the display independent
|
|
of the current location of the cursor. The VGA provides facilities for
|
|
specifying whether a cursor is to be displayed, where the cursor is to
|
|
appear, and the shape of the cursor itself. Note that this cursor is only
|
|
used in the text modes of the standard VGA and is not to be confused with
|
|
the graphics cursor capabilities of particular SVGA chipsets.
|
|
|
|
<P><A NAME="enable"></A><B>Enabling/Disabling the Cursor</B>
|
|
<BR> On the VGA there are three
|
|
main ways of disabling the cursor. The most straightforward is to set the
|
|
<A HREF="crtcreg.htm#0A">Cursor Disable</A> field to 1. Another way is
|
|
to set the <A HREF="crtcreg.htm#0B">Cursor Scan Line End</A> field to a
|
|
value less than that of the <A HREF="crtcreg.htm#0A">Cursor Scan Line Start</A>
|
|
field. On some adapters such as the IBM EGA, this will result instead in
|
|
a split block cursor. The third way is to set the cursor location to a
|
|
location off-screen. The first two methods are specific to VGA and compatible
|
|
adapters and are not guaranteed to work on non-VGA adapters, while the
|
|
third method should.
|
|
|
|
<P><A NAME="position"></A><B>Manipulating the Cursor Position</B>
|
|
<BR><B> </B>When dealing with
|
|
the cursor in standard BIOS text modes, the cursor position is specified
|
|
by row and column. The VGA hardware, due to its flexibility to display
|
|
any different text modes, specifies cursor position as a 16-bit address.
|
|
The upper byte of this address is specified by the <A HREF="crtcreg.htm#0E">Cursor
|
|
Location High Register</A>, and the lower by the <A HREF="crtcreg.htm#0F">Cursor
|
|
Location Low Register</A>. In addition this value is affected by the <A HREF="crtcreg.htm#0B">Cursor
|
|
Skew</A> field. When the hardware fetches a character from display memory
|
|
it compares the address of the character fetched to that of the cursor
|
|
location added to the <A HREF="crtcreg.htm#0B">Cursor Skew</A> field. If
|
|
they are equal and the cursor is enabled, then the character is written
|
|
with the current cursor pattern superimposed. Note that the address compared
|
|
to the cursor location is the address in display memory, not the address
|
|
in host memory. Characters and their attributes are stored at the same
|
|
address in display memory in different planes, and it is the odd/even addressing
|
|
mode usually used in text modes that makes the interleaved character/attribute
|
|
pairs in host memory possible. Note that it is possible to set the cursor
|
|
location to an address not displayed, effectively disabling the cursor.
|
|
<BR> The <A HREF="crtcreg.htm#0B">Cursor
|
|
Skew</A> field was used on the EGA to synchronize the cursor with internal
|
|
timing. On the VGA this is not necessary, and setting this field to any
|
|
value other than 0 may result in undesired results. For example, on one
|
|
particular card, setting the cursor position to the rightmost column and
|
|
setting the skew to 1 made the cursor disappear entirely. On the same card,
|
|
setting the cursor position to the leftmost column and setting the skew
|
|
to 1 made an additional cursor appear above and to the left of the correct
|
|
cursor. At any other position, setting the skew to 1 simply moved the cursor
|
|
right one position. Other than these undesired effects, there is no function
|
|
that this register can provide that could not be obtained by simply increasing
|
|
the cursor location.
|
|
|
|
<P><A NAME="shape"></A><B>Manipulating the Cursor Shape</B>
|
|
<BR><B> </B> On the VGA, the text-mode
|
|
cursor consists of a line or block of lines that extend horizontally across
|
|
the entire scan line of a character cell. The first, topmost line is specified
|
|
by the <A HREF="crtcreg.htm#0A">Cursor Scan Line Start</A> field. The last,
|
|
bottom most line is specified by the <A HREF="crtcreg.htm#0B">Cursor Scan
|
|
Line End</A> field. The scan lines in a character cell are numbered from
|
|
0 up to the value of the <A HREF="crtcreg.htm#09">Maximum Scan Line</A>
|
|
field. On the VGA if the <A HREF="crtcreg.htm#0B">Cursor Scan Line End</A>
|
|
field is less than the <A HREF="crtcreg.htm#0A">Cursor Scan Line Start</A>
|
|
field, no cursor will be displayed. Some adapters, such as the IBM EGA
|
|
may display a split-block cursor instead.
|
|
|
|
<P><A NAME="blink"></A><B>Cursor Blink Rate</B>
|
|
<BR> On the standard VGA, the
|
|
blink rate is dependent on the vertical frame rate. The on/off state of
|
|
the cursor changes every 16 vertical frames, which amounts to 1.875 blinks
|
|
per second at 60 vertical frames per second. The cursor blink rate is thus
|
|
fixed and cannot be software controlled on the standard VGA. Some SVGA
|
|
chipsets provide non-standard means for changing the blink rate of the
|
|
text-mode cursor.
|
|
|
|
<P><A NAME="color"></A><B>Cursor Color</B>
|
|
<BR> On the standard VGA, the
|
|
cursor color is obtained from the foreground color of the character that
|
|
the cursor is superimposing. On the standard VGA there is no way to modify
|
|
this behavior.
|
|
<BR>
|
|
|
|
<P>Notice: All trademarks used or referred to on this page are the property
|
|
of their respective owners.
|
|
<BR>All pages are Copyright © 1997, 1998, J. D. Neal, except where
|
|
noted. Permission for utilization and distribution is subject to the terms
|
|
of the <A HREF="license.htm">FreeVGA Project Copyright License</A>.
|
|
<BR>
|
|
</BODY>
|
|
</HTML>
|