provided code
59
specs/freevga/feedback.htm
Normal file
@@ -0,0 +1,59 @@
|
||||
<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>FreeVGA Feedback</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="home.htm">Home</A>
|
||||
<HR WIDTH="100%"><B>Hardware Level VGA and SVGA Video Programming Information
|
||||
Page</B></CENTER>
|
||||
|
||||
<CENTER>Feedback Form
|
||||
<HR WIDTH="100%"></CENTER>
|
||||
Note - this form requires that
|
||||
www.goodnet.com be reachable from your client in order to be sent. If it
|
||||
does not return with a success message, check the connection and try sending
|
||||
again.
|
||||
<BR><FORM ACTION="http://www.goodnet.com/~tinara/cgi-bin/feedback.cgi" METHOD="POST"><B>Name:</B>
|
||||
<BR><INPUT TYPE="text" NAME="NAME" SIZE=30>
|
||||
<BR><B>Email:</B>
|
||||
<BR><INPUT TYPE="text" NAME="FROM" SIZE=30>
|
||||
<BR><B>Project/Company/Program:</B>
|
||||
<BR><INPUT TYPE="text" NAME="PROJECT" SIZE=40>
|
||||
<BR><B>Application of Information:</B>
|
||||
<BR><INPUT TYPE="radio" NAME="USE" VALUE="none" CHECKED>Just Curious
|
||||
<BR><INPUT TYPE="radio" NAME="USE" VALUE="game">Game Programming
|
||||
<BR><INPUT TYPE="radio" NAME="USE" VALUE="demo">Demo Programming
|
||||
<BR><INPUT TYPE="radio" NAME="USE" VALUE="os">OS Development
|
||||
<BR><INPUT TYPE="radio" NAME="USE" VALUE="driver">Driver Development
|
||||
<BR><INPUT TYPE="radio" NAME="USE" VALUE="other">Other
|
||||
<BR><B>Type of Software:</B>
|
||||
<BR><INPUT TYPE="radio" NAME="PROGTYPE" VALUE="n/a" CHECKED>Not Applicable
|
||||
<BR><INPUT TYPE="radio" NAME="PROGTYPE" VALUE="personal use">Personal Use
|
||||
<BR><INPUT TYPE="radio" NAME="PROGTYPE" VALUE="public domain">Public Domain
|
||||
<BR><INPUT TYPE="radio" NAME="PROGTYPE" VALUE="freeware">Freeware
|
||||
<BR><INPUT TYPE="radio" NAME="PROGTYPE" VALUE="shareware">Shareware
|
||||
<BR><INPUT TYPE="radio" NAME="PROGTYPE" VALUE="GNU/other">GNU or other
|
||||
free license
|
||||
<BR><INPUT TYPE="radio" NAME="PROGTYPE" VALUE="commercial">Commercial
|
||||
<BR><INPUT TYPE="radio" NAME="PROGTYPE" VALUE="other">Other
|
||||
<CENTER><B>Body of Message:</B></CENTER>
|
||||
|
||||
<CENTER><TEXTAREA NAME="BODY" ROWS=24 COLS=60></TEXTAREA></CENTER>
|
||||
|
||||
<CENTER><INPUT TYPE="submit" value=" Send Mail "></CENTER>
|
||||
</FORM>
|
||||
|
||||
<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>
|
||||
<BR>
|
||||
</BODY>
|
||||
</HTML>
|
||||
255
specs/freevga/freevga.htm
Normal file
@@ -0,0 +1,255 @@
|
||||
<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>FreeVGA--About the FreeVGA Project</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="home.htm">Home</A> <A HREF="#intro">Intro</A> <A HREF="#completeness">Completeness</A>
|
||||
<A HREF="#contrib">Contribution</A> <A HREF="#membership">Membership</A>
|
||||
<A HREF="#questions">Questions</A> <A HREF="home.htm">Back</A>
|
||||
<HR WIDTH="100%"><B>Hardware Level VGA and SVGA Video Programming Information
|
||||
Page</B></CENTER>
|
||||
|
||||
<CENTER>About the FreeVGA Project
|
||||
<HR WIDTH="100%"></CENTER>
|
||||
|
||||
|
||||
<P><A NAME="intro"></A><B>Introduction</B>
|
||||
<BR> As a software programmer
|
||||
for the PC architecture I have noticed that there is plenty of free information
|
||||
existing on the Internet for programming PC hardware, with the notable
|
||||
exception of video adapters, MPEG cards and the like. When the VGA was
|
||||
the standard adapter card in PC's, programming was relatively straightforward.
|
||||
However, when SVGA adapters appeared on the market, there was little standardization
|
||||
between separate vendor's products. For this reason, applications and graphical
|
||||
user interface systems required specialized drivers to utilize the extended
|
||||
capabilities of the SVGA adapters. Either these specialized drivers were
|
||||
written by the video card vendor or they had to be written by the application
|
||||
vendor. Unfortunately due to the cost of specifications and complexity
|
||||
of hardware, most free or shareware programs supported only the standard
|
||||
VGA. The goal of this project, under my direction, is to explore the area
|
||||
of low-level video programming and provide information for programmers
|
||||
of free software throughout the world.
|
||||
<BR> With the growing popularity
|
||||
of the free software concept, more and more specialized applications are
|
||||
written every day. Many of these applications could take advantage of the
|
||||
specialized features of the video hardware but often the information required
|
||||
is not available. This projects goal is to make that information available
|
||||
By gaining the cooperation of both programmers and hardware manufacturers
|
||||
an excellent reference can be developed. Internet technology makes it possible
|
||||
to provide a free resource updated in a timely fashion as opposed to printed
|
||||
matter which takes time to print and deliver.
|
||||
|
||||
<P><A NAME="completeness"></A><B>Completeness</B>
|
||||
<BR> Why would a low-level programmer
|
||||
need this reference rather than simply use datasheets and chipset specifications
|
||||
from the manufacturers themselves? First, the manufacturers may no longer
|
||||
provide literature on "obsolete" chipsets. Second, such datasheets are
|
||||
often aimed at hardware designers rather than programmers. Programmers
|
||||
are trying to implement software on existing hardware rather design hardware.
|
||||
Many of the details needed to program the hardware are dependent on the
|
||||
implementation of the video adapter. Datasheets typically only provide
|
||||
information on one particular component of the video hardware. It is necessary
|
||||
to understand how the components in the adapter are "wired" together to
|
||||
be able to program the adapter. This information is rarely found in datasheets
|
||||
or manufacturer's documentation. Third, as demonstrated on the VGA and
|
||||
some specific SVGA hardware, there are always programmers who can find
|
||||
ways to cleverly program the hardware to provide capabilities unimagined
|
||||
by the manufacturer. To do this, it requires the programmer to have intimate
|
||||
knowledge of the hardware, as BIOS services provide a "lowest common denominator"
|
||||
of capability.
|
||||
|
||||
<P><A NAME="contrib"></A><B>Contribution</B>
|
||||
<BR><B> </B>This section is for
|
||||
those interested in contributing to the FreeVGA Project. The primary objective
|
||||
of this project is to gather information about video hardware, to verify
|
||||
this information as best as possible, then to organize the information
|
||||
in a form usable for any application, and finally to make this information
|
||||
freely available to all programmers. Because of the non-profit nature of
|
||||
this project, all information provided is the result of generous contribution
|
||||
by myself or others. The primary resources required by this project are:
|
||||
chipset datasheets/documentation, developer kits for video boards, video
|
||||
adapter boards used for testing and verifying information, and finally
|
||||
"postcards from the bleeding edge" i.e. information about the real world
|
||||
problems and their workarounds from video programmers. If you can provide
|
||||
any of these resources to the project or any other related assistance myself
|
||||
and other programmers who benefit give thanks to your generosity. Your
|
||||
name will be forever enshrined on the list of contributors, along with
|
||||
a link to your homepage if you so desire.
|
||||
<BR> I can be reached via the <A HREF="feedback.htm">feedback
|
||||
form</A>. If you wish to donate hardware or documentation, please send
|
||||
it, along with your name and the link you wish to include in the list of
|
||||
contributors to:
|
||||
|
||||
<P>Joshua Neal
|
||||
<BR>FreeVGA Project
|
||||
<BR>925 N. Coronado Dr.
|
||||
<BR>Gilbert, AZ 85234
|
||||
|
||||
<P><A NAME="membership"></A><B>Membership</B>
|
||||
<BR> Because of the nature of
|
||||
this project, any contributor can consider themselves a member if they
|
||||
wish to do so. As the founder of this project I am willing to donate my
|
||||
time and resources to ensuring the continuing organization, accuracy, and
|
||||
usability of the FreeVGA Project's documentation. I will continue to do
|
||||
this indefinitely, although if the task becomes overwhelming I will solicit
|
||||
volunteers to assist with the project. There may at some point in the future
|
||||
be special considerations for vendors that choose to support the projects
|
||||
goals.
|
||||
|
||||
<P><A NAME="questions"></A><B>Open-Ended Questions</B>
|
||||
<BR> The problem of documenting
|
||||
video card operation and behavior is difficult because of the large amount
|
||||
of information available, and because video hardware is constantly evolving,
|
||||
making documentation a problem of hitting a moving target. Another problem
|
||||
is that because video cards are projects of human endeavor and due to their
|
||||
complexity, their implementation often differs from published specifications.
|
||||
Even two manufacturer's products based upon the same chipset can contain
|
||||
enough variation to make them separate cases from a programmer's viewpoint.
|
||||
The FreeVGA Project attempts to provide answers to the following questions:
|
||||
<UL>
|
||||
<LI>
|
||||
<B>How does one detect what VGA/SVGA adapter is present even when no access
|
||||
to BIOS is available?</B></LI>
|
||||
</UL>
|
||||
Because video hardware was developed
|
||||
by many independent vendors along separate evolutionary paths, there is
|
||||
very little knowledge about how to identify the particular model of video
|
||||
card present in a machine. Because identifying the particular model is
|
||||
crucial to utilizing the advanced features of a specific model, this is
|
||||
an important task that nearly all software written for the SVGA needs to
|
||||
perform. In many cases, such as when writing programs under an operating
|
||||
system other than MS-DOS/Windows, it may not be possible nor is it good
|
||||
practice to access BIOS for determining the specific model. Furthermore,
|
||||
the more recent PCI bus design is being incorporated into many systems
|
||||
with non-80x86 chips, such as the PowerPC, Alpha, and even high end workstations.
|
||||
However, the manufacturers of the hardware may only support Mac and PC
|
||||
versions of their cards, considering other platforms too much of a niche
|
||||
market to support. Since their inception in the PC market, most video cards
|
||||
have had the capability to work with another card (albeit different) in
|
||||
the same machine. Some newer PCI cards allow multiple cards to be used
|
||||
in one machine. Until recently this capability has been unsupported by
|
||||
operating systems and programs. For debugging video routines there is no
|
||||
equal to having a second monitor attached--one monitor can display the
|
||||
program's output while the other provides the debugging interface. Note
|
||||
that the need for a second monitor could be reduced somewhat if better
|
||||
virtualization of the display hardware was implemented. This project aims
|
||||
to give programmers the skills and knowledge to better utilize the video
|
||||
hardware.
|
||||
<UL>
|
||||
<LI>
|
||||
<B>How does one perform standard video operations on a particular card
|
||||
without utilizing the video BIOS interface?</B></LI>
|
||||
</UL>
|
||||
BIOS was designed to support
|
||||
MS-DOS programs on the 8086. Computers have progressed far beyond that
|
||||
point but BIOS has remained basically the same (with the exception of VESA
|
||||
BIOS.) Even then, most facilities provided by the video BIOS are not particularly
|
||||
useful. An example is the BIOS Read and Write Pixel commands. These are
|
||||
the only BIOS provided method of accessing video memory other than text
|
||||
functions. Anyone like myself who started learning 8086 assembler to speed
|
||||
up their graphics discovered this function, and said "Cool. This is going
|
||||
to be easy." I then ran my first program and discovered that I had just
|
||||
lost a few orders of magnitude of performance. Thus I started to learn
|
||||
to interact with the video card hardware directly. VESA BIOS is better,
|
||||
although I have seen very few on-board implementations that work properly
|
||||
(if present), usually resulting in the user having to run a TSR program
|
||||
that provides VESA services in RAM. While VESA BIOS does provide some facilities
|
||||
for non-real mode problems it still does place a function call penalty
|
||||
on video code. My biggest complaint is that with VESA BIOS you are restricted
|
||||
to programming to the lowest common denominator of all video hardware,
|
||||
and thus to utilize any special features of a chipset, you still have to
|
||||
learn to program the card directly. Many video cards are now considered
|
||||
"obsolete" by their manufacturer (or the manufacturer has joined the great
|
||||
corporation in the sky...) and developer support is no longer available.
|
||||
The unfortunate problem is that these "obsolete" cards are the same cards
|
||||
being used by non-profit organizations and schools who could otherwise
|
||||
reap the benefits of a wide variety of free software.
|
||||
<UL>
|
||||
<LI>
|
||||
<B>What are the specialized hardware features (2D/3D acceleration, hardware
|
||||
cursor, video acceleration, etc.) does a particular card have and how does
|
||||
one utilize these features?</B></LI>
|
||||
</UL>
|
||||
<B> </B>This is probably the area where
|
||||
the documentation is most important. These features are programmed differently
|
||||
on each vendor's video hardware, but can improve the performance of a particular
|
||||
application by several orders of magnitude. Programmers such as video game
|
||||
programmers and assembly demo programmers have demonstrated that by pushing
|
||||
hardware to its limits, previously inconceivable animation and special
|
||||
effects are possible. Recent advances in 3D acceleration have made virtual
|
||||
reality on the desktop a possibility. It is crucial to developers that
|
||||
they be able to thoroughly understand the hardware's operation to maximize
|
||||
its performance.
|
||||
<UL>
|
||||
<LI>
|
||||
<B>What are the differences between specific implementations of particular
|
||||
chipsets, and if so how does one write software that works with these differences?</B></LI>
|
||||
</UL>
|
||||
<B> </B>Even programmers programming for
|
||||
the relatively standard VGA hardware can run into problems in this area.
|
||||
This is the reason so many packages state support for IBM VGA or 100% compatible.
|
||||
Frequently programmers encounter slight differences in hardware that, under
|
||||
specific circumstances can cause their programs to fail to operate properly.
|
||||
If programmers had detailed documentation of the hardware differences of
|
||||
specific implementations, programmers could, and are generally willing
|
||||
to, write workarounds in their code in order to provide support for this
|
||||
hardware. Occasionally subtle hardware problems arise in a particular version
|
||||
of a board and is corrected in a later revision (possibly by simply revising
|
||||
the BIOS.) It is important to recognize the earlier version and be able
|
||||
to write software that can deal with its particular problem. In addition,
|
||||
many chipsets are designed in such a way that they can work with a variety
|
||||
of support devices such as clock generators and Video DACs. It is important
|
||||
to know how to detect and control these support devices, which may (and
|
||||
usually is) be different in every implementation. Some of these devices
|
||||
could be interchanged with pin-compatible devices which could provide additional
|
||||
functionality. However, this would require special programming to utilize
|
||||
the device's features.
|
||||
<UL>
|
||||
<LI>
|
||||
<B>How does one perform diagnostics on a particular video card in order
|
||||
to identify inoperative, semi-inoperative, and improperly configured hardware?</B></LI>
|
||||
</UL>
|
||||
While testing and verifying the operation
|
||||
of various video boards. I discovered some cards that did not respond properly
|
||||
to my programming. My initial thought was that I was doing something wrong
|
||||
and tried to figure out what was wrong. However, further testing on another
|
||||
identical card demonstrated that the first board had simply failed. There
|
||||
is little diagnostic software for the VGA and SVGA adapters particularly
|
||||
when dealing with some of the more esoteric features. This is primarily
|
||||
because little has been identified about the correct behavior of video
|
||||
cards. Many manufacturers fail to include a thorough diagnostics utility
|
||||
with their hardware, and the diagnostics that are provided are usually
|
||||
specific to one operating system.
|
||||
<UL>
|
||||
<LI>
|
||||
<B>How does one properly emulate a particular VGA/SVGA adapter in order
|
||||
to properly implement compatibility for legacy full-screen applications?</B></LI>
|
||||
</UL>
|
||||
<B> </B>This is a particular
|
||||
are of interest to myself and others. This knowledge can be used to create
|
||||
a virtual machine capable of multitasking legacy applications. Particular
|
||||
features that could be provided are the ability to execute a full-screen
|
||||
program in the background, execute a full-screen program in a virtual window
|
||||
on a desktop, emulate a particular video adapter and translate its output
|
||||
to a form compatible with the hardware on the machine, provide the ability
|
||||
to remotely view an applications screen across a network, provide the ability
|
||||
to debug a full-screen application without having to use a dual monitor
|
||||
system or attached text terminal. Huge benefits can be reaped, but all
|
||||
of the details of a particular hardware configuration must be known for
|
||||
proper emulation/virtualization. For example, programs that attempt to
|
||||
autodetect the hardware often rely on undocumented behaviors of video adapters.
|
||||
These undocumented behaviors must be emulated properly for the application
|
||||
to work properly.
|
||||
|
||||
<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>. <IMG SRC="http://www.goodnet.com/~tinara/cgi-bin/imgserv.cgi?logo2.gif" >
|
||||
</BODY>
|
||||
</HTML>
|
||||
100
specs/freevga/glossary.htm
Normal file
@@ -0,0 +1,100 @@
|
||||
<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>FreeVGA - Video Programming Glossary</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="home.htm">Home</A> <A HREF="home.htm#background">Back</A></CENTER>
|
||||
|
||||
<CENTER># | A | B | <A HREF="#C">C</A> | <A HREF="#D">D</A> | E | <A HREF="#F">F</A>
|
||||
| G | H | I | J | K | L | M | N | O | <A HREF="#P">P</A> | Q | <A HREF="#R">R</A>
|
||||
| <A HREF="#S">S</A> | T | U | <A HREF="#V">V</A> | W | X | Y | Z</CENTER>
|
||||
|
||||
<CENTER>
|
||||
<HR><B>Hardware Level VGA and SVGA Video Programming Information Page</B></CENTER>
|
||||
|
||||
<CENTER>Video Programming Glossary
|
||||
<HR></CENTER>
|
||||
<B>Introduction</B>
|
||||
<BR> This page is a glossary
|
||||
covering video programming related terms. It is extremely difficult
|
||||
for me to determine which terms should be included in this page, thus if
|
||||
you have come here looking for a particular term and are dismayed at not
|
||||
finding it listed here, please send a note with the <A HREF="feedback.htm">Feedback
|
||||
Form</A> including the term in the body of the message, and it will be
|
||||
added here.
|
||||
<CENTER><A NAME="C"></A><B>------ C ------</B></CENTER>
|
||||
|
||||
|
||||
<P><B>CLUT</B> -- see <A HREF="#CLUT">Color Look-Up Table</A>
|
||||
|
||||
<P><A NAME="CLUT"></A><B>Color Look-Up Table</B> -- <A HREF="#PLUT">see
|
||||
Palette Look-Up Table</A>
|
||||
<BR>
|
||||
<BR>
|
||||
<CENTER><A NAME="D"></A><B>------ D ------</B></CENTER>
|
||||
|
||||
|
||||
<P><A NAME="DAC"></A><B>DAC</B> -- acronym for Digital to Analog Converter,
|
||||
which is a integrated circuit that converts intensity values to analog
|
||||
signal values. This is used in video chipsets to produce the analog
|
||||
signals that are sent to the monitor. Some DACs, known as RAMDACs
|
||||
contain a palette look-up table.
|
||||
|
||||
<P><B>Digital to Analog Converter</B> -- see <A HREF="#DAC">DAC</A>
|
||||
<CENTER><A NAME="F"></A><B>------ F ------</B></CENTER>
|
||||
|
||||
|
||||
<P><B>Frame Buffer</B> -- RAM that is part of the graphics hardware that
|
||||
stores the pixel values that are converted into color intensity.
|
||||
<CENTER><A NAME="P"></A><B>------ P ------</B></CENTER>
|
||||
|
||||
|
||||
<P><A NAME="PLUT"></A><B>Palette Look-Up Table</B> -- a small table of
|
||||
RAM that contains a set of <A HREF="#RGB">RGB</A> intensity values for
|
||||
each index, of which there are 256 locations. The information in
|
||||
this table is used by the <A HREF="#DAC">DAC</A> to generate the analog
|
||||
signal. Also known as a Color Look-Up Table or CLUT.
|
||||
<CENTER><A NAME="R"></A><B>------ R ------</B></CENTER>
|
||||
|
||||
|
||||
<P><B>RAMDAC</B> -- A <A HREF="#DAC">DAC</A> that contains a built-in <A HREF="#PLUT">palette
|
||||
look-up table</A>.
|
||||
|
||||
<P><A NAME="RGB"></A><B>RGB</B> -- acronym for Red, Blue & Green, which
|
||||
describes the three primary colors of light that a CRT generates to produce
|
||||
the range of visible colors.
|
||||
<CENTER><A NAME="S"></A><B>------ S ------</B></CENTER>
|
||||
|
||||
|
||||
<P><B>Super VGA</B> -- see <A HREF="SVGA">SVGA</A>
|
||||
|
||||
<P><A NAME="SVGA"></A><B>SVGA </B>-- acronym for Super-<A HREF="#VGA">VGA</A>,
|
||||
which is a term applied to chipsets and the advanced functionality of those
|
||||
chipsets that are above and beyond the capabilities of the original IBM
|
||||
<A HREF="#VGA">VGA</A> chipset.
|
||||
<CENTER><A NAME="V"></A><B>------ V ------</B></CENTER>
|
||||
|
||||
|
||||
<P><A NAME="VGA"></A><B>VGA</B> -- acronym for Video Graphics Array, which
|
||||
is the term for IBM's successor to the EGA graphics chipset. This
|
||||
term is also used when describing register compatible functions of other
|
||||
chipsets such as SVGA chipsets.
|
||||
|
||||
<P><B>Video Graphics Array</B> -- see <A HREF="VGA">VGA</A>
|
||||
<BR>
|
||||
<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>
|
||||
<BR>
|
||||
</BODY>
|
||||
</HTML>
|
||||
92
specs/freevga/hardovr.htm
Normal file
@@ -0,0 +1,92 @@
|
||||
<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>FreeVGA - Overview of Video Hardware Functionality</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="home.htm">Home</A> <A HREF="#intro">Introduction</A> <A HREF="#frame">Frame
|
||||
Buffer</A> <A HREF="#graphics">Graphics Controller</A> <A HREF="#display generation">Display
|
||||
Generation</A> <A HREF="home.htm#background">Back</A>
|
||||
<HR><B>Hardware Level VGA and SVGA Video Programming Information Page</B></CENTER>
|
||||
|
||||
<CENTER>Overview of Video Hardware Functionality
|
||||
<HR></CENTER>
|
||||
<A NAME="intro"></A><B>Introduction</B>
|
||||
<BR> This page contains a general
|
||||
overview of the functionality of VGA and SVGA cards into various sections,
|
||||
and gives a description of the functions of each section. This is
|
||||
intended to be a general description for those unfamiliar to the functionality
|
||||
and capabilities of graphics hardware. The basic function of graphics
|
||||
hardware is to allow the CPU to manipulate memory specific to the graphics
|
||||
hardware, and to take the information stored in that memory and output
|
||||
it in a form that a monitor or LCD panel can use.
|
||||
|
||||
<P><A NAME="frame"></A><B>Frame Buffer</B>
|
||||
<BR> This is the component of
|
||||
the video hardware that stores the pixels and information to be displayed
|
||||
on the monitor. This is the center of the video hardware, as nearly
|
||||
all operations are performed on or using this data. The frame buffer
|
||||
is a form of RAM, which is typically located outside the main graphics
|
||||
chip and are implemented using DRAM chips; however, more sophisticated
|
||||
forms of RAM that are ideal for video hardware applications, such as VRAM.
|
||||
The amount of video memory that is present determines the maximum resolution
|
||||
that the hardware can generate. The frame buffer is usually mapped
|
||||
into a region of the host CPU's address space allowing it to be accessed
|
||||
as if it were a portion of the main memory. For example, in the VGA,
|
||||
this memory is mapped into the lower 1M of the CPU address space, allowing
|
||||
it to be directly accessable to real mode applications, which cannot directly
|
||||
access the remaining memory. In the VGA, this memory is broken up
|
||||
into 4 separate color planes, which are recombined to produce the actual
|
||||
pixel values at the time of display generation.
|
||||
|
||||
<P><A NAME="graphics"></A><B>Graphics Controller</B>
|
||||
<BR> This is the video chipset's
|
||||
host interface to the frame buffer, and is part of the main graphics chip
|
||||
or chips. It allows the host CPU to manipulate the frame buffer in
|
||||
a fashion suited to the task of graphics operations. It allows certain
|
||||
methods of access that are designed to reduced the CPU requirements for
|
||||
performing standard video operations, particularly in accelerated chipsets,
|
||||
which can have a quite complicated set of access methods which can include
|
||||
line drawing, area and pattern fill, color conversion/expansion, and even
|
||||
3d rendering acceleration. For example, in the VGA the graphics controller
|
||||
allows one write by the CPU to its mapped memory region below 1M to affect
|
||||
all four color planes, as well as allowing faster transfers of video data
|
||||
from one region to another in video memory.
|
||||
|
||||
<P><A NAME="display generation"></A><B>Display Generation</B>
|
||||
<BR> This portion of the graphics
|
||||
hardware is involved in taking the data in the frame buffer, converting
|
||||
the pixel or character information stored by the graphics controller, and
|
||||
converting it into the analog signals required by the monitor or lcd display.
|
||||
The pixel data is first sequenced, or read serially from the frame buffer,
|
||||
then converted into analog color information, either by a palette look-up
|
||||
table, or by directly converting into red, green, and blue components.
|
||||
The CRT controller at the same time adds timing signals that allow the
|
||||
monitor to display the analog color information on the display. For
|
||||
example, in the VGA these components are made up of the sequencer, attribute
|
||||
controller, CRT controller, DAC, and palette table. The sequencer
|
||||
reads the information from the frame buffer, and converts it into pixel
|
||||
color information, as well as sends signals to the CRT controller such
|
||||
that it can provide the timing signals the monitor requires. This
|
||||
color information is formatted by the attribute controller in such a way
|
||||
that the pixel values can be submitted to the DAC. The DAC then looks
|
||||
up these values in its palette table which contains red, green, and blue
|
||||
intensities for each of the colors that the attribute controller generates,
|
||||
then converts it into an analog signal that is output to the VGA connector
|
||||
along with the timing signals generated by the CRT controller. If
|
||||
the display is an LCD panel such as found in laptops, the DAC and associated
|
||||
support hardware convert the pixel values to signals that the LCD panel
|
||||
displays directly.
|
||||
|
||||
<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>
|
||||
127
specs/freevga/hardrec.htm
Normal file
@@ -0,0 +1,127 @@
|
||||
<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>FreeVGA - Product Recommendations for Video Developers</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="home.htm">Home</A> <A HREF="#intro">Introduction</A> <A HREF="#monitors">Recommended</A>
|
||||
<A HREF="#failures">Failed</A> <A HREF="#test">Test</A> <A HREF="home.htm#product">Back</A>
|
||||
<HR WIDTH="100%"><B>Hardware Level VGA and SVGA Video Programming Information
|
||||
Page</B></CENTER>
|
||||
|
||||
<CENTER>Product Recommendations for Video Developers
|
||||
<HR WIDTH="100%"></CENTER>
|
||||
<A NAME="intro"></A><B>Introduction</B>
|
||||
<BR> This page is to provide
|
||||
hardware recommendations for those implementing the information on this
|
||||
site. There are no recommendations for video cards, as the goal is
|
||||
to increase programmer support for all cards, existing or otherwise, rather
|
||||
than try to influence people to buy a specific video card implementation.
|
||||
I will, however recommend hardware, other than the video cards themselves
|
||||
that are helpful in the development of software for video cards in general.
|
||||
Monitors are a strong issue to me, both for safety concerns, and financial
|
||||
concerns, as it is usually advantageous to buy an new, indestructable monitor
|
||||
than to burn through many cheap, expendable monitors.
|
||||
|
||||
<P><B> <A NAME="monitors"></A>Monitors Recommended</B>
|
||||
<BR> For a monitor to be recommended
|
||||
it must meet all of the following criteria:
|
||||
<UL>
|
||||
<LI>
|
||||
It should be able to tolerate improperly formed video inputs for an extended
|
||||
period of time without the possibility of being damaged. It should
|
||||
also be tolerant to extremely frequent mode changes. Damage due to
|
||||
this kind of operation should not be excluded by the standard manufacturer's
|
||||
warranty. This is critical due to the replacement cost of high-performance
|
||||
monitors, and due to the possible safety and fire hazards failing monitors
|
||||
may cause.</LI>
|
||||
|
||||
<LI>
|
||||
It should be able to synchronize to a wide variety of properly formed signals,
|
||||
including both standard and custom video timings. This important
|
||||
for developing the modes required for special applications.</LI>
|
||||
|
||||
<LI>
|
||||
It should handle the maximum frequencies/resolutions that can be generated
|
||||
by current and future (to a reasonable extent) video chipsets.</LI>
|
||||
|
||||
<LI>
|
||||
It should be compliant to all levels of display to host communication and
|
||||
power mamagement so code can be developed that implements these features
|
||||
of the video hardware.</LI>
|
||||
|
||||
<LI>
|
||||
If the monitor allows the picture controls to be saved/restored on changes
|
||||
in mode, it should be allowed to defeat this feature so that the generated
|
||||
video timings can be adjusted to minimize the visible effects of mode change.</LI>
|
||||
|
||||
<LI>
|
||||
It should be currently available on the market and covered by manufacturers
|
||||
warranty for the period of time required to develop the desired application.</LI>
|
||||
|
||||
<LI>
|
||||
It has been put through my own personal monitor torture tests, as well
|
||||
as operated for an extended period of time under conditions related to
|
||||
video software development.</LI>
|
||||
</UL>
|
||||
The following monitors have been evaluated by myself personally, and have
|
||||
been determined to meet all these criteria.
|
||||
<UL>
|
||||
<LI>
|
||||
At this time, there are no monitors that I have determined meet all these
|
||||
criteria.</LI>
|
||||
</UL>
|
||||
<A NAME="failures"></A><B>Monitor Failures</B>
|
||||
<BR> This section lists monitors
|
||||
that have either died for me while testing, or have died for others in
|
||||
a fashion that would imply that the programmer was responsible for their
|
||||
failure. This does not imply that the programmer was at fault, as
|
||||
these things naturally happen when developing drivers. I strongly
|
||||
recommend the purchase of one of the recommended monitors, to avoid damaging
|
||||
a valuable monitor
|
||||
|
||||
<P><B>Compaq VGA (not SVGA)</B> -- I do not know the model specifically.
|
||||
It was a fixed frequency model, and the horizontal circuitry was damaged.
|
||||
The problem was repeatable after repairs were made, so I believe that the
|
||||
monitor can be damaged by normal mode testing. I have met others who claim
|
||||
to have experienced this same problem. Not recommended.
|
||||
|
||||
<P><B>CTX CMS-1561LR</B> -- The problem with this monitor occured when
|
||||
driving the monitor at the high end of its frequency envelope. The
|
||||
monitor synced to the frequency, but may have been slightly overdriven.
|
||||
The horizontal output transistor and some capacitors were replaced and
|
||||
the monitor was restored to working order. The problem has not been
|
||||
repeated, so ordinary failure is likely.
|
||||
|
||||
<P><B>NCR MBR 2321</B> -- This one comes from a friend in Fayetteville,
|
||||
AR, whose monitor blew caps while writing a svgalib video driver.
|
||||
The explosion from the capacitors shattered the rear of the picture tube,
|
||||
damaging the monitor beyond repair. Not recommended due to the catastrophic
|
||||
nature of the failure. The operation being performed when the failure
|
||||
occurred was frequent mode changing.
|
||||
|
||||
<P><A NAME="test"></A><B>Test Equipment Recommended</B>
|
||||
<BR> There are certain pieces
|
||||
of test equipment that can come in handy when working with video cards.
|
||||
This can be especially important when verifying that the video signal being
|
||||
generated is, in fact the one intended by the programmer. Failure
|
||||
to do this can cause catastrophic failure when the driver is used in conjunction
|
||||
with a fixed-frequency or other monitor that can be damaged by improper
|
||||
inputs.
|
||||
<UL>
|
||||
<LI>
|
||||
At this time, I cannot recommend any test equipment other than a good frequency
|
||||
counter, as this is really not in my area of expertise. If you can
|
||||
help me in my research into this, I would be greatly appreciative.</LI>
|
||||
</UL>
|
||||
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>. <IMG SRC="http://www.goodnet.com/~tinara/cgi-bin/imgserv.cgi?logo3.gif" >
|
||||
</BODY>
|
||||
</HTML>
|
||||
486
specs/freevga/home.htm
Normal file
@@ -0,0 +1,486 @@
|
||||
<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>FreeVGA Project Home - Hardware level VGA and SVGA programming info</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="home.htm">Home</A> <A HREF="#news">News</A> <A HREF="#mirrors">Mirrors</A>
|
||||
<A HREF="#preface">Preface</A> <A HREF="#background">Background</A> <A HREF="#vga">VGA</A>
|
||||
<A HREF="#svga">SVGA</A> <A HREF="#tricks">Tricks</A> <A HREF="#references">Links</A>
|
||||
<A HREF="#warn">Disclaimer</A> <A HREF="#product">Products</A> <A HREF="#feedback">Feedback</A>
|
||||
<A HREF="home.htm">Back</A>
|
||||
<HR><B>Hardware Level VGA and SVGA Video Programming Information Page</B></CENTER>
|
||||
|
||||
<CENTER>Home
|
||||
<HR WIDTH="100%"></CENTER>
|
||||
|
||||
<CENTER> </CENTER>
|
||||
|
||||
<CENTER><TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"><FONT SIZE=+4>F</FONT></TD>
|
||||
|
||||
<TD WIDTH="75"><FONT SIZE=+4>R</FONT></TD>
|
||||
|
||||
<TD WIDTH="75"><FONT SIZE=+4>E</FONT></TD>
|
||||
|
||||
<TD WIDTH="75"><FONT SIZE=+4>E</FONT></TD>
|
||||
|
||||
<TD WIDTH="75"><FONT SIZE=+4> </FONT></TD>
|
||||
|
||||
<TD WIDTH="75"><FONT SIZE=+4>V</FONT></TD>
|
||||
|
||||
<TD WIDTH="75"><FONT SIZE=+4>G</FONT></TD>
|
||||
|
||||
<TD WIDTH="75"><FONT SIZE=+4>A</FONT></TD>
|
||||
</TR>
|
||||
</TABLE></CENTER>
|
||||
|
||||
<CENTER>This page is home to the <A HREF="freevga.htm">FreeVGA Project</A>
|
||||
-- dedicated to providing a totally FREE source of information about video
|
||||
hardware. <A HREF="freevga.htm">Additional goals/information are
|
||||
located here.</A></CENTER>
|
||||
|
||||
<CENTER>"Keep on rocking in the free world." - Neil Young</CENTER>
|
||||
|
||||
|
||||
<P><A NAME="news"></A><B>Latest News</B>
|
||||
<BR><B> 08/01/1998</B> -- More
|
||||
information is now up, including a large portion of the "standard" VGA
|
||||
reference. Some other minor changes have been made to other information.
|
||||
Expect more updates in the not too far future.
|
||||
|
||||
<P> <B>06/20/1998</B> -- The
|
||||
work contiues. Added three new mirrors. Some of the information
|
||||
that was located in the VGA reference, but really applies to video programming
|
||||
in general has been moved to the new Background Information (formerly Introduction)
|
||||
section of this page, and has been released. Also, a glossary has
|
||||
been added defining terms related to video programming, but is not very
|
||||
comprehensive at the moment, although this should improve over time. Many
|
||||
minor corrections have been made to the released material after being pointed
|
||||
out by the insightful people reading the information. Thank you!
|
||||
|
||||
<P><B> 06/08/1998</B> -- The
|
||||
mirror list has been updated with the new entries. Special thanks goes
|
||||
out to all those who have donated their personal resources to advance the
|
||||
project's goals. Also, the first section of *real* information is
|
||||
online, the low-level programming introduction. This section has
|
||||
been relatively stable for quite some time, and seems to be releasable.
|
||||
It is my goal to release the information after it stabilizes, and has been
|
||||
verified for accuracy.
|
||||
|
||||
<P><B> 06/04/1998</B> --<B> </B>If
|
||||
you are looking for the current work-in-progress, and have been given the
|
||||
passwords for the archive for review purposes, it can be downloaded <A HREF="http://www.goodnet.com/~tinara/wip.zip">here</A>.
|
||||
For those with current problems/questions that this page addresses, please
|
||||
feel free to use the <A HREF="#feedback">Feedback Form</A> to contact the
|
||||
author. If a link is marked with <B>(WIP)</B>, it is not posted online
|
||||
and at this time is available only for review, upon request, and under
|
||||
specific limitations.
|
||||
|
||||
<P><A NAME="mirrors"></A><B>Mirror Sites</B>
|
||||
<BR> At this time, the project
|
||||
is experimenting with the feasibility of maintaining mirror sites to make
|
||||
this information more widely available. The following mirror sites
|
||||
are provided for your convenience. If you are interested in hosting
|
||||
a mirror site of this information, please contact the author for more information.
|
||||
If you are experiencing problems with any of these mirrors please use the
|
||||
<A HREF="#feedback">Feedback Form</A> to contact the author, as it is likely
|
||||
my fault that the problem has arisen.
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="http://www.goodnet.com/~tinara/FreeVGA/home.htm">USA, Arizona,
|
||||
Phoenix</A> -- hosted by <A HREF="feedback.htm">Joshua Neal</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="http://sf.znet.com/~vhold/FreeVGA/home.htm">USA, California, San
|
||||
Francisco</A> -- hosted by <A HREF="http://sf.znet.com/~vhold/">Marty Price</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="http://hardware.doa.org/FreeVGA/home.htm">USA, Massachusetts,
|
||||
Boston</A> -- hosted by <A HREF="http://hardware.doa.org/">Leif Hardison</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="http://www.pacwest.net/byron13/FreeVGA/home.htm">USA, Oregon,
|
||||
Eugene</A> -- hosted by <A HREF="http://www.pacwest.net/byron13/">Byron
|
||||
Miller</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="http://hups.apana.org.au/~scuffer/FreeVGA/home.htm">Australia,
|
||||
Canberra</A> -- hosted by <A HREF="http://hups.apana.org.au/~scuffer/">David
|
||||
Murn</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="http://nightmare.euroweb.hu/~ytiddo/FreeVGA/home.htm">Hungary</A>
|
||||
-- hosted by <A HREF="http://nightmare.euroweb.hu/~ytiddo/">Justin Doiel</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="http://www.inter.uunet.nl/hcc/S.Weijgers/FreeVGA/home.htm">The
|
||||
Netherlands, Apeldoorn</A> -- hosted by <A HREF="http://web.inter.nl.net/hcc/S.Weijgers/">Simon
|
||||
Weijgers</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="http://n152.apeldoorn.telekabel.euronet.nl/FreeVGA/home.htm">The
|
||||
Netherlands, Nijmegen</A> -- hosted by <A HREF="http://web.inter.nl.net/hcc/S.Weijgers/">Simon
|
||||
Weijgers</A></LI>
|
||||
</UL>
|
||||
<A NAME="preface"></A><B>Preface</B>
|
||||
<BR> This page's purpose is to
|
||||
provide free low-level programming information to programmers interested
|
||||
in the low-level details of programming the VGA and Super VGA adapters,
|
||||
in a format independent of operating environment or programming language.
|
||||
This page is not intended to be a reference to graphics or game programming
|
||||
algorithms but rather a reference for those people attempting to implement
|
||||
such algorithms in whatever environment they are using. This page is not
|
||||
intended to be a showcase of web technology and thus will use HTML features
|
||||
and graphics only when it is necessary to convey information. For example,
|
||||
I have left the colors and fonts set to the default, so you can actually
|
||||
use the default preferences in your browser. I am continuously adding material
|
||||
to this page and have tried to incorporate links to other sites with valuable
|
||||
information.
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="#intro">Introduction</A> -- An introduction to low-level programming</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#vga">Standard VGA Chipset Reference</A> -- Documents the common
|
||||
functionality of all VGA and SVGA adapters.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#svga">Super VGA Hardware Chipset Reference</A> -- Documents the
|
||||
specifics of VGA and SVGA adapters.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#other">Other Video Hardware Reference</A> -- Documents video
|
||||
related hardware other than VGA and SVGA adapters.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#tricks">Tricks and Techniques</A> -- Articles detailing the use
|
||||
of low-level programming for optimization or special effects.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#references">Other References</A> -- Gives pointers to other related
|
||||
material.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#warn">Warnings and Disclaimer</A> -- Reading this section before
|
||||
utilizing any information contained within is both recommended and required.</LI>
|
||||
</UL>
|
||||
<A NAME="background"></A><B>Background Information</B>
|
||||
<BR> Foremost, this page is meant
|
||||
to be a place online where one can learn about low-level programming (If
|
||||
everyone knew all of this information then this page would be redundant!)
|
||||
This section contains general information that can be very helpful when
|
||||
attempting to use the programming information located on this site.
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="llintro.htm">Introduction to Low-level Programming</A> -- Answers
|
||||
general questions about the topic. <B>(Released 6/08/1998)</B></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="hardovr.htm">Overview of Video Hardware Functionality</A> -- Describes
|
||||
the job of the video hardware and what components it uses to perform that
|
||||
task. <B>(Released 6/15/1998)</B></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="vtiming.htm">Video Timing Information</A> -- Gives information
|
||||
about video timing that is useful for video programmers.<B> (Released 6/15/98)</B></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="glossary.htm">Video Programming Glossary</A> -- Defines terms
|
||||
that are related to video programming. <B>(Added 6/15/1998)</B></LI>
|
||||
</UL>
|
||||
<A NAME="vga"></A><B>Standard VGA Chipset Reference</B>
|
||||
<BR><B> </B>This section documents
|
||||
the subset of functionality present on nearly all computers today. The
|
||||
VGA BIOS utilizes only a fraction of the capability of the VGA hardware.
|
||||
By programming the hardware at the lowest level, one gains the flexibility
|
||||
to unleash the hardware's full potential.
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="vga/vga.htm">VGA Chipset Reference</A> -- Documentation of the
|
||||
"Standard" VGA implementation. <B>(Released 8/01/1998)</B></LI>
|
||||
</UL>
|
||||
<A NAME="svga"></A><B>Super VGA Hardware Chipset Reference</B>
|
||||
<BR> This section documents the
|
||||
known functionality of specific VGA/SVGA chipsets. Because developers of
|
||||
chipsets and video cards face incredible competition, they have added features
|
||||
and functionality far beyond the standard VGA hardware. Unfortunately to
|
||||
programmers, these features have been implemented differently in each particular
|
||||
chipset, and even differently between products by the same manufacturer.
|
||||
It is difficult to obtaining information on these chipsets and their implementations,
|
||||
particularly so if the chipset is considered "obsolete" by the manufacturer.
|
||||
Because of the open-ended nature of this topic (chipsets are under constant
|
||||
development) this page will be updated constantly as new information becomes
|
||||
available.
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="svga/svga.htm">SVGA Chipset Reference</A> -- Documentation of
|
||||
specific VGA/SVGA hardware implementations. <B>(WIP)</B></LI>
|
||||
</UL>
|
||||
<A NAME="other"></A><B>Other Video Hardware Reference</B>
|
||||
<BR><B> </B> This section is for
|
||||
video hardware that does not specifically fit into the category of VGA
|
||||
or SVGA, such as MPEG hardware, video capture hardware, non-integrated
|
||||
3D accelerators, virtual reality gear, digital video cameras, stereoscopic
|
||||
3D goggles, TV tuner cards, non-VGA compatible video adapters and the like.
|
||||
This is another open-ended topic but is not the primary focus of this page.
|
||||
|
||||
<P><A NAME="tricks"></A><B>Tricks and Techniques</B>
|
||||
<BR> This section contains useful
|
||||
information on how to utilize the VGA/SVGA hardware to optimize specific
|
||||
tasks or implement visual effects. Many of these techniques have been utilized
|
||||
by game and demo programmers alike to push the envelope of the hardware's
|
||||
capacity.
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="tricks/tricks.htm">Tricks and Techniques</A> -- Details on using
|
||||
the hardware to your advantage. <B>(WIP)</B></LI>
|
||||
</UL>
|
||||
<A NAME="references"></A><B>Other References:</B>
|
||||
<BR><B> </B>This section gives
|
||||
some pointers to other available VGA hardware information available. Note
|
||||
that they are listed here because
|
||||
<UL>
|
||||
<LI>
|
||||
<B>Online Information</B></LI>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
The <A HREF="http://www.heartlab.rri.uwo.ca/vidfaq/">COMP.SYS.IBM.PC.HARDWARE.VIDEO
|
||||
Frequently Asked Questions (FAQ)</A> document, although not programming
|
||||
oriented does contain much useful information about video hardware. The
|
||||
site also includes links to nearly every vendor of video cards and monitors,
|
||||
as well as links to pages covering monitor specifications. If you are looking
|
||||
for video hardware related information not covered by the FreeVGA Project's
|
||||
goals, you will likely find it or a link to it here.</LI>
|
||||
|
||||
<LI>
|
||||
Finn Thøgersen's <A HREF="http://www.datashopper.dk/~finth/">VGADOC
|
||||
& WHATVGA Homepage</A> -- An excellent collection of information for
|
||||
programming VGA and SVGA.</LI>
|
||||
|
||||
<LI>
|
||||
Boone's <A HREF="http://www.strangecreations.com/library/hardware/vgaregs.txt">Programming
|
||||
the VGA Registers</A> -- Contains a very sketchy "Documentation Over the
|
||||
I/O Registers for Standard VGA Cards" by "Shaggy of The Yellow One." It
|
||||
is free and distributable over the "Feel free to spread this to whoever
|
||||
wants it....." licensing agreement.</LI>
|
||||
|
||||
<LI>
|
||||
Andrew Scott's <I>VGA Programmers Master Reference Manual</I> (<A HREF="ftp://ftp.cdrom.com/pub/demos/code/hardware/video/vga-info.zip">click
|
||||
here to download from ftp.cdrom.com</A>) -- A dated ('91) document that
|
||||
is interesting if only because it attempts to document the VGA hardware
|
||||
(actually the Trident TVGA8900 hardware) in a form useful for "writing
|
||||
an applications specific BIOS." Begins with a very general description
|
||||
the topic (a wordy definition of computation in general) and ends with
|
||||
detailed register descriptions. Unfortunately, it lacks much material between
|
||||
these areas. Worse, far from being a free resource, it requires shareware
|
||||
registration fees that must be sent to the U.K. by means of a check drawn
|
||||
from a U.K. bank only!</LI>
|
||||
|
||||
<LI>
|
||||
Richard Wilton's <I>Programmer's Guide to PC and PS/2 Video Systems</I>
|
||||
(<A HREF="http://www.dc.ee/Files/Programm.Docs/videoprg.arj">click here
|
||||
to download from www.dc.ee</A>) An older reference, covers MDA, Hercules,
|
||||
CGA, MCGA, and VGA. Not much VGA material but does have some register documentation.</LI>
|
||||
|
||||
<LI>
|
||||
IBM's RS/6000 <I>CHRP I/O Device Reference</I> <A HREF="http://www.rs6000.ibm.com/resource/technology/chrpio/vga_app.mak.html">Appendix
|
||||
A: VGA Programming Model</A> -- A good VGA reference from the makers of
|
||||
the IBM VGA. Better than most on-line references as it contains programming
|
||||
information in addition to a register description of the hardware; however
|
||||
it is still vague in many areas. Especially interesting as it begins with
|
||||
an acknowledgment of the many "clones" of the VGA hardware.</LI>
|
||||
|
||||
<LI>
|
||||
Some brief VGA register info is available from the <A HREF="http://www.hitex.com/chipdir/reg/vga.txt">Chip
|
||||
Directory</A>, also mirrored at other sites (see <A HREF="http://www.hitex.com/chipdir/">Chip
|
||||
Directory home page</A>).</LI>
|
||||
|
||||
<LI>
|
||||
Eric S. Raymond's <A HREF="http://sunsite.unc.edu/LDP/HOWTO/XFree86-Video-Timings-HOWTO.html">The
|
||||
XFree86 Video Timings HOWTO</A> -- explains video mode and timing information
|
||||
used in configuring XFree86 to support a given monitor, intended to be
|
||||
used by the end user. Much of the information is not sepcific to
|
||||
XFree86, and can be used by a programmer as an example of how a low-level
|
||||
video routine can allow the end-users to setup video modes that pertain
|
||||
to their monitors, as well as being useful to an end-user of such a program
|
||||
attempting to configure such a routine to work with their monitors.</LI>
|
||||
|
||||
<LI>
|
||||
Tomi Engdahl's <A HREF="http://www.hut.fi/Misc/Electronics/docs/">electronics
|
||||
info page</A> has some information about video and vga timings, as well
|
||||
as a section on VGA to TV converters and homemade circuitry. The
|
||||
<A HREF="http://www.hut.fi/Misc/Electronics/circuits/vga2tv/cindex.html">VGA
|
||||
to TV converter page</A> contans much information that pertains to driving
|
||||
custom TV and monitors with a VGA or SVGA card that doesn't have the capability
|
||||
built-in.</LI>
|
||||
</UL>
|
||||
|
||||
<LI>
|
||||
<B>Offline Information</B></LI>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
Richard F. Ferraro's<B> </B><I>Programmer's Guide to the EGA, VGA, and
|
||||
Super VGA Cards, Third Edition</I> -- A good text, one of the few good
|
||||
books on a subject as broad and as complicated as low-level I/O.</LI>
|
||||
|
||||
<LI>
|
||||
Frank van Gilluwe's <I>The Undocumented PC, Second Edition -- A Programmer's
|
||||
Guide to I/O, CPUs and Fixed Memory Areas</I> -- An excellent book, which
|
||||
is the likely the most complete PC technical reference ever written, and
|
||||
includes 100+ pages of video programming information, although very little
|
||||
VGA register information.</LI>
|
||||
|
||||
<LI>
|
||||
Bertelsons, Rasch & Hoffman's PC Underground: Unconventional Programming
|
||||
Topics -- I bought this book on markdown, due to it having some VGA information
|
||||
in it. I was surprised to find that not only did it have a register
|
||||
description, but it also described some possible effects that can be done
|
||||
with that register.</LI>
|
||||
</UL>
|
||||
|
||||
<LI>
|
||||
<B>Miscellaneous Information (Information not specific to video hardware,
|
||||
but useful to video programmers.)</B></LI>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
Norman Walsh's <A HREF="http://nwalsh.com/comp.fonts/FAQ/index.html">The
|
||||
comp.fonts FAQ</A> -- An excellent resource on fonts, typefaces, and such.
|
||||
Particularly helpful is the section on intellectual property protection
|
||||
for fonts, as the copyright legality of fonts and typefaces is somewhat
|
||||
confusing. Note -- Norman Walsh has ceased maintaining the FAQ, however,
|
||||
this link will remain until a new version of the FAQ is produced.</LI>
|
||||
</UL>
|
||||
</UL>
|
||||
<A NAME="product"></A><B>Product Recommendations</B>
|
||||
<BR> The FreeVGA Project does
|
||||
not make hardware recommendations as pertains to hardware covered by the
|
||||
documentation, in an attempt to prevent any conflicts of interest.
|
||||
However, there are other products that can be extremely helpful when implementing
|
||||
the information found here, such as monitors, test equipment, and software.
|
||||
I will not refuse any request to list a product on this page, however I
|
||||
will categorize it depending upon its importance and suitability for video
|
||||
related software development using opinions of myself and others.
|
||||
If you disagree with the opinion here, please use the Feedback Form to
|
||||
voice that opinion, such that it can be taken into account.
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="hardrec.htm">Product Recommendations</A> -- Listing of products
|
||||
that can be beneficial to the target audience of this site.</LI>
|
||||
</UL>
|
||||
<A NAME="warn"></A><B>Warnings and Disclaimer</B>
|
||||
<UL>
|
||||
<LI>
|
||||
<B><U>Danger</U>: </B>Monitors are designed to operate within certain frequency
|
||||
ranges, or for fixed frequency monitors at certain frequencies.<B> <U>Driving
|
||||
a monitor at a frequency that it is not designed for is not recommended
|
||||
and may cause damage to the monitor's circuitry which can result in a fire
|
||||
and safety risk</U>. </B>It is wise to know and understand the specifications
|
||||
of the monitor(s) that you will be driving in order to prevent damage.
|
||||
Consult the manufacturers documentation for the monitor for the information,
|
||||
or if not available, contact the manufacturer directly. If the monitor
|
||||
makes unusual noises, or the internal temperature exceeds the rated temperature
|
||||
of its components, the monitor is likely to experience failure. This
|
||||
failure may not be immediate, but is under most circumstances inevitable. <B>
|
||||
<U>Monitor failures can be violent in nature, and can explode and produce
|
||||
shrapnel, as well as overheat and catch fire</U>. </B>In no circumstance
|
||||
should one leave a monitor unattended in an uncertain state. Furthermore,
|
||||
exceeding the rated maximum frequencies of a monitor may cause the phosphors
|
||||
to age prematurely, as well as<B> <U>increase the amount of harmful radiation
|
||||
projected towards the viewer beyond the specified maximums</U>.</B></LI>
|
||||
|
||||
<LI>
|
||||
<B><U>Warning</U>: </B>Clock chips and RAMDACs as well as other components
|
||||
of the video card are designed with a maximum frequency.<B> <U>Programming
|
||||
these chips to operate at a frequency greater than they were designed for
|
||||
causes the chips to run hotter than they were designed to operate, and
|
||||
may cause the component to fail</U>. </B>It is wise to know and understand
|
||||
the maximum operating frequency of the components of any video subsystem
|
||||
you will be programming. Do not assume that the component is safe to operate
|
||||
at a particular frequency because it can be programmed to operate at that
|
||||
frequency. The rated frequencies are rated and verified according
|
||||
to batch yield. As clock frequencies increase, the failure rate of
|
||||
the chips during manufacturing testing increases. It is impossible
|
||||
to predict the actual point at which a given semiconductor will fail, thus
|
||||
manufacturers monitor the failure rate statistically to determine the frequency
|
||||
that gives an acceptable batch yield. <B><U>These failures are typically
|
||||
unobservable and require a method of testing every gate on the chip, as
|
||||
many failures may only be observable under very specific circumstances,
|
||||
typically resulting in intermittent failures, although complete "meltdown"
|
||||
due to a newly formed short is also possible.</U></B> If they
|
||||
occur, the entire semiconductor must be rejected due to these failures
|
||||
being irrepairable. As you exceed the rated frequency you are taking
|
||||
a semiconductor that has passed a thourough test at its rated frequency
|
||||
and entering the realm of statistical probability. Attempting to
|
||||
find the maximum frequency is impossible, as by the time a failure is noticable
|
||||
the semiconductor has already been permanently damaged. Cooling the
|
||||
external package by using a heat sink and/or fan may increase the frequency
|
||||
at which a semiconductor can operate; however, there is still no way to
|
||||
determine the frequency at which a specific semiconductor will fail as
|
||||
it can only be done statistically and practically undetectable without
|
||||
being able to determine the proper operation of every gate on the semiconductor.
|
||||
Semiconductors such as fast CPU's are rated with the required heat sink
|
||||
and/or cooling fan in place. Aftermarket cooling devices are sold
|
||||
as "performance coolers" due to the inability to determine the statistical
|
||||
likelyhood of failure and the inability of the end user to simply reject
|
||||
failed semiconductors. <B><U>Under no circumstances should a programmer
|
||||
develop software that overclocks an end-user's hardware without the end
|
||||
user being warned of the statistical likelyhood of failure.</U></B>
|
||||
Making any claims about the safety of the software's operation can leave
|
||||
the programmer with legal liability that cannot be excluded by disclaimer.</LI>
|
||||
|
||||
<LI>
|
||||
<B><U>Disclaimer</U>: The author presents this information as-is without
|
||||
any warranty, including suitability for intended purpose. The author is
|
||||
not responsible for damages resulting by the use of the information, incidental
|
||||
or otherwise. By utilizing this information, you as the programmer take
|
||||
full liability for any damages caused by your use of this information.
|
||||
If you are not satisfied with these terms, then your only recourse is to
|
||||
not use this information. While every reasonable effort is made to ensure
|
||||
that this information is correct, the possibility exists for error and
|
||||
is not guaranteed for accuracy, and disclaims liability for any changes,
|
||||
errors or omissions and is not responsible for any damages that may arise
|
||||
from the use or misuse of this information. License to use this information
|
||||
is only granted where this disclaimer applies in whole.</B></LI>
|
||||
</UL>
|
||||
<A NAME="feedback"></A><B>Feedback</B>
|
||||
<BR> I can be reached online
|
||||
via the <A HREF="feedback.htm">Feedback Form</A>. Consider it your
|
||||
moral obligation to send feedback about the page, including inaccuracies,
|
||||
confusing parts, missing info, questions/answers and other feedback type
|
||||
thingies.
|
||||
<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>. <IMG SRC="http://www.goodnet.com/~tinara/cgi-bin/imgserv.cgi?logo.gif" >
|
||||
</BODY>
|
||||
</HTML>
|
||||
124
specs/freevga/license.htm
Normal file
@@ -0,0 +1,124 @@
|
||||
<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>FreeVGA Copyright License</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="home.htm">Home</A> <A HREF="home.htm#vga">Back</A>
|
||||
<HR><B>Hardware Level VGA and SVGA Video Programming Information Page</B></CENTER>
|
||||
|
||||
<CENTER>FreeVGA Project Copyright License
|
||||
<HR></CENTER>
|
||||
<B>Introduction</B>
|
||||
<BR> This document contains the
|
||||
FreeVGA Copyright License which states the conditions under which the FreeVGA
|
||||
Project's Copyrighted information may be used and distributed. The
|
||||
conditions of this license ensure that all parties with a need for this
|
||||
information have the same availability, to the maximum extent possible
|
||||
as well as ensure the integrity of the documentation.
|
||||
|
||||
<P><B>Disclaimer</B>
|
||||
<BR> The author presents this
|
||||
information as-is without any warranty, including suitability for intended
|
||||
purpose. The author is not responsible for damages resulting by the use
|
||||
of the information, incidental or otherwise. By utilizing this information,
|
||||
you as the programmer take full liability for any damages caused by your
|
||||
use of this information. If you are not satisfied with these terms, then
|
||||
your only recourse is to not use this information. While every reasonable
|
||||
effort is made to ensure that this information is correct, the possibility
|
||||
exists for error and is not guaranteed for accuracy, and disclaims liability
|
||||
for any changes, errors or omissions and is not responsible for any damages
|
||||
that may arise from the use or misuse of this information. License
|
||||
to use this information is only granted where this disclaimer applies in
|
||||
whole.
|
||||
|
||||
<P><B>License</B>
|
||||
<BR> The following copyright
|
||||
license applies to all works by the FreeVGA Project. All of the FreeVGA
|
||||
Project's documentation is copyrighted by its author, Joshua Neal.
|
||||
|
||||
<P>License to utilize the FreeVGA Project documentation is subject to the
|
||||
following conditions:
|
||||
<UL>
|
||||
<LI>
|
||||
The copyright notice and this permission notice must be preserved complete
|
||||
on all copies, complete or partial.</LI>
|
||||
|
||||
<LI>
|
||||
Duplication is permitted only for personal purposes. Reduplication
|
||||
is permitted only under the FreeVGA Project documentation's redistribution
|
||||
license.</LI>
|
||||
|
||||
<LI>
|
||||
The use of the FreeVGA Project documentation to produce translations or
|
||||
derivative works must be approved specifically by the author.</LI>
|
||||
|
||||
<LI>
|
||||
All warnings and disclaimers present in the complete documentation must
|
||||
apply to the licensee and may not be restricted by locality. These
|
||||
must be read before use, and determined to be applicable to the licensee
|
||||
before the material may be utilized.</LI>
|
||||
|
||||
<LI>
|
||||
It is forbidden to represent the FreeVGA Project or to use the FreeVGA
|
||||
Project's name to solicit or obtain information, services, product, or
|
||||
endorsements from another party, commercial or otherwise.</LI>
|
||||
</UL>
|
||||
If all of the previous conditions are not met, then permission to utilize
|
||||
the FreeVGA Project's documentation is not granted, and all rights are
|
||||
reserved.
|
||||
|
||||
<P>License to distribute the FreeVGA Project documentation is subject to
|
||||
the following conditions:
|
||||
<UL>
|
||||
<LI>
|
||||
The copyright notice and this permission notice must be preserved complete
|
||||
on all copies, complete or partial.</LI>
|
||||
|
||||
<LI>
|
||||
An archive of the FreeVGA Project documentation may be distributed in electronic
|
||||
form only in its entirety, without adding or removing any material, notices,
|
||||
advertisement, or other information. Only exact copies of archives
|
||||
produced or specifically approved by the author may be distributed, and
|
||||
at the time of distribution, the most recent archive must be distributed.
|
||||
The FreeVGA Project documentation must be excluded from any compilation
|
||||
copyright or other restrictions. No fee other than the cost of transmission
|
||||
or the physical media containing the archive may be charged without prior
|
||||
approval by the author. The documentation may not be distributed
|
||||
electronically in part, which includes mirroring in html format on the
|
||||
internet, unless specific permission is granted by the author.</LI>
|
||||
|
||||
<LI>
|
||||
The FreeVGA Project documentation may be distributed in non-electronic
|
||||
form to students or members of a programming team subject to the condition
|
||||
that it be provided free of charge. The documentation may not be
|
||||
included with or within other copyrighted works unless the other copyrighted
|
||||
works are also provided free of charge.</LI>
|
||||
|
||||
<LI>
|
||||
Small portions may be reproduced as illustrations for reviews or quotes
|
||||
in other works without this permission notice if proper citation is given
|
||||
(including URL if the work is online.)</LI>
|
||||
|
||||
<LI>
|
||||
Only the current documentation may be distributed. The URL of the
|
||||
FreeVGA project online documentation must be provided. The author
|
||||
reserves the right to limit distribution by any parties at any time.</LI>
|
||||
</UL>
|
||||
If all of the previous conditions are not met, then permission to redistribute
|
||||
the FreeVGA Project's documentation is not granted, and all distribution
|
||||
rights are reserved.
|
||||
|
||||
<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>
|
||||
<BR>
|
||||
</BODY>
|
||||
</HTML>
|
||||
246
specs/freevga/llintro.htm
Normal file
@@ -0,0 +1,246 @@
|
||||
<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>FreeVGA -- Introduction to Low-level Programming</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="home.htm">Home</A> <A HREF="#intro">Intro</A> <A HREF="#know">Know</A>
|
||||
<A HREF="#why">Why</A> <A HREF="#assembly">Assembly</A> <A HREF="#hex">Hex</A>
|
||||
<A HREF="#conventions">Conventions</A> <A HREF="#memory">Memory</A> <A HREF="#access">Accessing</A>
|
||||
<A HREF="home.htm#intro">Back</A>
|
||||
<HR WIDTH="100%"><B>Hardware Level VGA and SVGA Video Programming Information
|
||||
Page</B></CENTER>
|
||||
|
||||
<CENTER>Introduction to Low-level Programming
|
||||
<HR WIDTH="100%"></CENTER>
|
||||
|
||||
|
||||
<P><A NAME="intro"></A><B>Introduction</B>
|
||||
<BR> This section is intended
|
||||
to give one a general background in low-level programming, specifically
|
||||
related to video programming. It assumes that you already know how to program
|
||||
in your intended programming environment, and answers questions such as:
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="#know">What do I need to know?</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#why">Why write hardware-level code?</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#assembly">Do I need to know assembly language?</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#hex">What are hex and binary numbers?</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#conventions">What are the numerical conventions used in this
|
||||
reference?</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#memory">How do memory and I/O ports work?</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#access">How do I access these from my programming environment?</A></LI>
|
||||
</UL>
|
||||
<A NAME="know"></A><B>What do I need to know?</B>
|
||||
<BR><B> </B>To program video
|
||||
hardware at the lowest level you should have an understanding of hexadecimal
|
||||
and binary numbers, how the CPU accesses memory and I/O ports, and finally
|
||||
how to perform these operations in your particular programming environment.
|
||||
In addition you need detailed descriptions of the particular graphics chipset
|
||||
you are programming.
|
||||
|
||||
<P><A NAME="why"></A><B>Why write hardware-level code?</B>
|
||||
<BR> One reason for writing hardware-level
|
||||
code is to develop drivers for operating systems or applications. Another
|
||||
reason is when existing drivers do not provide the required performance
|
||||
or capabilities for your application, such as for programming games or
|
||||
multimedia. Finally, the most important reason is enjoyment. There is a
|
||||
whole programming scene dedicated to producing "demos" of what the VGA/SVGA
|
||||
can do.
|
||||
|
||||
<P><A NAME="assembly"></A><B>Do I need to know assembly language?</B>
|
||||
<BR> No, but it helps. Assembly
|
||||
language is the basis all CPU operations. All functions of the processor
|
||||
and computer are potentially accessible from assembly. With crafty use
|
||||
of assembly language, one can write software that exceeds greatly the potential
|
||||
of higher level languages. However, any programming environment that provides
|
||||
direct access to I/O and memory will work.
|
||||
|
||||
<P><A NAME="hex"></A><B>What are hex and binary numbers?</B>
|
||||
<BR> Humans use a number system
|
||||
using 10 different digits (0-9), probably because that is the number of
|
||||
fingers we have. Each digit represents part of a number with the rightmost
|
||||
digit being ones, the second to right being tens, then hundreds, thousands
|
||||
and so on. These represent the powers of 10 and is called "base 10" or
|
||||
"decimal."
|
||||
<BR> Computers are digital (and
|
||||
don't usually have fingers) and use two states, either on or off to represent
|
||||
numbers. The off state is represented by 0 and the on state is represented
|
||||
by 1. Each digit (called a bit, short for Binary digIT) here represents
|
||||
a power of 2, such as ones, twos, fours, and doubling each subsequent digit.
|
||||
Thus this number system is called "base 2" or "binary."
|
||||
<BR> Computer researchers realized
|
||||
that binary numbers are unwieldy for humans to deal with; for example,
|
||||
a 32-bit number would be represented in binary as 11101101010110100100010010001101.
|
||||
Converting decimal to binary or vice versa requires multiplication or division,
|
||||
something early computers performed very slowly, and researchers instead
|
||||
created a system where the numbers were broken into groups of 3 (such as
|
||||
11 101 101 010 110 100 100 010 010 001 101) and assigned a number from
|
||||
0-7 based on the triplet's decimal value. This number system is called
|
||||
"base 8" or "octal."
|
||||
<BR> Computers deal with numbers
|
||||
in groups of bits usually a length that is a power of 2, for example, four
|
||||
bits is called a "nibble", eight bits is called a "byte", 16 bits is a
|
||||
"word", and 32 bits is a "double word." These powers of two are not equally
|
||||
divisible by 3, so as you see in the divided example a "double word" is
|
||||
represented by 10 complete octal digits plus two-thirds of an octal digit.
|
||||
It was then realized that by grouping bits into groups of four, a byte
|
||||
could be accurately represented by two digits. Because a group of four
|
||||
bits can represent 16 decimal numbers, they could not be represented by
|
||||
simply using 0-9, so they simply created more digits, or rather re-used
|
||||
the letters A-F (or a-f) to represent 10-15. So for example the rightmost
|
||||
digits of our example binary number is 1101, which translates to 13 decimal
|
||||
or D in this system, which is called "base 16" or "hexadecimal."
|
||||
<BR> Computers nowadays usually
|
||||
speak decimal (multiplication and division is much faster now) but when
|
||||
it comes to low-level and hardware stuff, hexadecimal or binary is usually
|
||||
used instead. Programming environments require you to explicitly specify
|
||||
the base a number is in when overriding the default decimal. In most assembler
|
||||
packages this is accomplished by appending "h" for hex and "b" for binary
|
||||
to end of the number, such as 2A1Eh or 011001b. In addition, if the hex
|
||||
value starts with a letter, you have to add a "0" to the beginning of the
|
||||
number to allow it to distinguish it from a label or identifier, such as
|
||||
0BABEh. In C and many other languages the standard is to append "0x" to
|
||||
the beginning of the hex number and to append "%" to the beginning of a
|
||||
binary number. Consult your programming environment's documentation for
|
||||
how specifically to do this.
|
||||
<BR> Historical Note: Another
|
||||
possible explanation for the popularity of the octal system is that early
|
||||
computers used 12 bit addressing instead of the 16 or 32 bit addressing
|
||||
currently used by modern processors. Four octal digits conveniently covers
|
||||
this range exactly, thus the historical architecture of early computers
|
||||
may have been the cause for octal's popularity.
|
||||
|
||||
<P><A NAME="conventions"></A><B>What are the numerical conventions used
|
||||
in this reference?</B>
|
||||
<BR><B> </B>Decimal is used often
|
||||
in this reference, as it is conventional to specify certain details about
|
||||
the VGA's operation in decimal. Decimal numbers have no letter after them.
|
||||
An example you might see would be a video mode described as 640x480z256.
|
||||
This means that the video mode has 640 pixels across by 480 pixels down
|
||||
with 256 possible simultaneous colors. Similarly an 80x25 text mode means
|
||||
that the text mode has 80 characters wide (columns) by 25 characters high
|
||||
(rows.) Binary is frequently used to specify fields within a particular
|
||||
register and also for bitmap patterns, and has a trailing letter b (such
|
||||
as 10011100b) to distinguish it from a decimal number containing only 0's
|
||||
and 1's. Octal you are not likely to encounter in this reference, but if
|
||||
used has a trailing letter o (such as 145o) to distinguish it from a decimal.
|
||||
Hexadecimal is always used for addressing, such as when describing I/O
|
||||
ports, memory offsets, or indexes. It is also often used in fields longer
|
||||
than 3 bits, although in some cases it is conventional to utilize decimal
|
||||
instead (for example in a hypothetical screen-width field.)
|
||||
<BR> Note: Decimal numbers in
|
||||
the range 0-1 are also binary digits, and if only a single digit is present,
|
||||
the decimal and binary numbers are equivalent. Similarly, for octal the
|
||||
a single digit between 0-7 is equivalent to the decimal numbers in the
|
||||
same range. With hexadecimal, the single-digit numbers 0-9 are equivalent
|
||||
to decimal numbers 0-9. Under these circumstances, the number is often
|
||||
given as decimal where another format would be conventional, as the number
|
||||
is equivalent to the decimal value.
|
||||
<BR>
|
||||
|
||||
<P><A NAME="memory"></A><B>How do memory and I/O ports work?</B>
|
||||
<BR> 80x86 machines have both
|
||||
a memory address space and an input/output (I/O) address space. Most of
|
||||
the memory is provided as system RAM on the motherboard and most of the
|
||||
I/O devices are provided by cards (although the motherboard does provide
|
||||
quite a bit of I/O capability, varying on the motherboard design.) Also
|
||||
some cards also provide memory. The VGA and SVGA display adapters provide
|
||||
memory in the form of video memory, and they also handle I/O addresses
|
||||
for controlling the display, so you must learn to deal with both. An adapter
|
||||
card could perform all of its functions using solely memory or I/O (and
|
||||
some do), but I/O is usually used because the decoding circuitry is simpler
|
||||
and memory is used when higher performance is required.
|
||||
<BR> The original PC design was
|
||||
based upon the capabilities of the 8086/8088, which allowed for only 1
|
||||
MB of memory, of which a small range (64K) was allotted for graphics memory.
|
||||
Designers of high-resolution video cards needed to put more than 64K of
|
||||
memory on their video adapters to support higher resolution modes, and
|
||||
used a concept called "banking" which made the 64K available to the processor
|
||||
into a "window" which shows a 64K chunk of video memory at once. Later
|
||||
designs used multiple banks and other techniques to simplify programming.
|
||||
Since modern 32-bit processors have 4 gigabytes of address space, some
|
||||
designers allow you to map all of the video memory into a "linear frame
|
||||
buffer" allowing access to the entire video memory at once without having
|
||||
to change the current window pointer (which can be time consuming.) while
|
||||
still providing support for the windowed method.
|
||||
<BR> Memory can be accessed most
|
||||
flexibly as it can be the source and/or target of almost every machine
|
||||
language instruction the CPU is capable of executing, as opposed to a very
|
||||
limited set of I/O instructions. I/O space is divided into 65536 addresses
|
||||
in the range 0-65535. Most I/O devices are configured to use a limited
|
||||
set of addresses that cannot conflict with another device. The primary
|
||||
instructions for accessing I/O are the assembly instructions "IN" and "OUT",
|
||||
simply enough. Most programming environments provide similarly named instructions,
|
||||
functions, or procedures for accessing these.
|
||||
<BR> Memory can be a bit confusing
|
||||
though, because the CPU has two memory addressing modes, Real mode and
|
||||
Protected mode. Real mode was the only method available on the 8086 and
|
||||
is still the primary addressing mode used in DOS. Unfortunately, real mode
|
||||
only provides access to the first 1 MB of memory. Protected mode is used
|
||||
on the 80286 and up to allow access to more memory. (There are also other
|
||||
details such as protection, virtual memory, and other aspects not particularly
|
||||
applicable to this discussion.) Memory is accessed by the 80x86 processors
|
||||
using segments and offsets. Segments tell the memory management unit where
|
||||
in memory is located, and the offset is the displacement from that address.
|
||||
In real mode offsets are limited to 64K, because of the 16-bit nature of
|
||||
the 8086. In protected mode, segments can be any size up to the full address
|
||||
capability of the machine. Segments are accessed via special segment registers
|
||||
in the processor. In real mode, the segment address is shifted left four
|
||||
bits and added to the offset, allowing for a 20 bit address (20 bits =
|
||||
1 MB); in protected mode segments are offsets into a table in memory which
|
||||
tells where the segment is located. Your particular programming environment
|
||||
may create code for real and/or protected mode, and it is important to
|
||||
know which mode is being used. An added difficulty is the fact that protected
|
||||
mode provides for I/O and memory protection (hence protected mode), in
|
||||
order to allow multiple programs to share one processor and prevent them
|
||||
from corrupting other processes. This means that you may need to interact
|
||||
with the operating system to gain rights to access the hardware directly.
|
||||
If you write your own protected mode handler for DOS or are using a DOS
|
||||
extender, then this should be simple, but it is much more complicated under
|
||||
multi-tasking operating systems such as Windows or Linux.
|
||||
|
||||
<P><A NAME="access"></A><B>How do I access these from my programming environment?</B>
|
||||
<BR> That is a very important
|
||||
question, one that is very difficult to answer without knowing all of the
|
||||
details of your programming environment. The documentation that accompanies
|
||||
your particular development environment is best place to look for this
|
||||
information, in particular the compiler, operating system, and/or the chip
|
||||
specifications for the platform.
|
||||
|
||||
<P>Details for some common programming environments are given in:
|
||||
<UL>
|
||||
<LI>
|
||||
Eli Zaretskii's <A HREF="http://www.delorie.com/djgpp/v2faq/faq133.html#Low-level">DJGPP
|
||||
Frequently-Asked Questions List: Low-level DOS/BIOS and Hardware-oriented
|
||||
Programming</A> -- details on accessing hardware in DJGPP, a free 32-bit
|
||||
compiler and programming environment for MS-DOS.</LI>
|
||||
|
||||
<LI>
|
||||
There were more links here, but they expired. If anyone wants to write
|
||||
an article or has a link on this topic for their favorite environment,
|
||||
I will gladly and thankfully put it on this site.</LI>
|
||||
</UL>
|
||||
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>.
|
||||
</BODY>
|
||||
</HTML>
|
||||
BIN
specs/freevga/vga/256left.gif
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
20
specs/freevga/vga/256left.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
256-Color Shift Mode Diagram (Left)
|
||||
-----------------------------------
|
||||
|
||||
Plane 0 Plane 1 Plane 2 Plane 3
|
||||
Carried 7654 3210 7654 3210 7654 3210 7654 3210
|
||||
From Prev 0000 1111 0000 1111 0000 1111 0000 1111
|
||||
| | | | | | | | |
|
||||
| | | | | | | | |
|
||||
XXXX 0000 | | | | | | |
|
||||
0 0000 1111 | | | | | |
|
||||
1 1111 0000 | | | | |
|
||||
2 0000 1111 | | | |
|
||||
3 1111 0000 | | |
|
||||
4 0000 1111 | |
|
||||
5 1111 0000 |
|
||||
<----- Direction of Shift 6 0000 1111
|
||||
7 |
|
||||
v
|
||||
Carried
|
||||
To Next
|
||||
BIN
specs/freevga/vga/256right.gif
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
18
specs/freevga/vga/256right.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
256-Color Shift Mode Diagram (Right)
|
||||
-----------------------------------
|
||||
|
||||
Plane 3 Plane 2 Plane 1 Plane 0
|
||||
7654 3210 7654 3210 7654 3210 7654 3210 Carried
|
||||
0000 1111 0000 1111 0000 1111 0000 1111 From Prev
|
||||
| | | | | | | | |
|
||||
| | | | | | | 1111 XXXX
|
||||
| | | | | | 0000 1111 0
|
||||
| | | | | 1111 0000 1
|
||||
| | | | 0000 1111 2
|
||||
| | | 1111 0000 3
|
||||
| | 0000 1111 4
|
||||
| 1111 0000 5
|
||||
0000 1111 6
|
||||
| 7
|
||||
Carried
|
||||
To Next
|
||||
360
specs/freevga/vga/attrreg.htm
Normal file
@@ -0,0 +1,360 @@
|
||||
<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 other low-level stuff.)">
|
||||
<META NAME="KeyWords" CONTENT="VGA SVGA hardware video programming">
|
||||
<TITLE>VGA/SVGA Video Programming--Attribute Controller Registers</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="../home.htm">Home</A> <A HREF="vga.htm#register">Back</A>
|
||||
<HR WIDTH="100%"><B>Hardware Level VGA and SVGA Video Programming Information
|
||||
Page</B></CENTER>
|
||||
|
||||
<CENTER>Attribute Controller Registers
|
||||
<HR WIDTH="100%"></CENTER>
|
||||
|
||||
|
||||
<P> The Attribute Controller
|
||||
Registers are accessed via a pair of registers, the Attribute Address/Data
|
||||
Register and the Attribute Data Read Register. See the <A HREF="vgareg.htm">Accessing
|
||||
the VGA Registers</A> section for more detals. The Address/Data Register
|
||||
is located at port 3C0h and the Data Read Register is located at port 3C1h.
|
||||
<BR>
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION><A NAME="3C0"></A><B>Attribute Address Register(3C0h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75">PAS</TD>
|
||||
|
||||
<TD COLSPAN="5" WIDTH="375">Attribute Address</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL><B>PAS -- Palette Address Source<BR>
|
||||
</B>"<I>This bit is set to 0 to load color values to the registers in the
|
||||
internal palette. It is set to 1 for normal operation of the attribute
|
||||
controller. Note: Do not access the internal palette while this bit is
|
||||
set to 1. While this bit is 1, the Type 1 video subsystem disables accesses
|
||||
to the palette; however, the Type 2 does not, and the actual color value
|
||||
addressed cannot be ensured.</I>"
|
||||
<LI>
|
||||
<B>Attribute Address<BR>
|
||||
</B>This field specifies the index value of the attribute register to be
|
||||
read or written.</LI>
|
||||
</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="000F"></A><B>Palette Registers (Index 00-0Fh)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD COLSPAN="6" WIDTH="450">Internal Palette Index</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL><B>Internal Palette Index<BR>
|
||||
</B>"<I>These 6-bit registers allow a dynamic mapping between the text
|
||||
attribute or graphic color input value and the display color on the CRT
|
||||
screen. When set to 1, this bit selects the appropriate color. The Internal
|
||||
Palette registers should be modified only during the vertical retrace interval
|
||||
to avoid problems with the displayed image. These internal palette values
|
||||
are sent off-chip to the video DAC, where they serve as addresses into
|
||||
the DAC registers.</I>"</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="10"></A><B>Attribute Mode Control Register
|
||||
(Index 10h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">P54S</TD>
|
||||
|
||||
<TD WIDTH="75">8BIT</TD>
|
||||
|
||||
<TD WIDTH="75">PPM</TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75">BLINK</TD>
|
||||
|
||||
<TD WIDTH="75">LGE</TD>
|
||||
|
||||
<TD WIDTH="75">MONO</TD>
|
||||
|
||||
<TD WIDTH="75">ATGE</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL><B>P54S -- Palette Bits 5-4 Select<BR>
|
||||
</B>"<I>This bit selects the source for the P5 and P4 video bits that act
|
||||
as inputs to the video DAC. When this bit is set to 0, P5 and P4 are the
|
||||
outputs of the Internal Palette registers. When this bit is set to 1, P5
|
||||
and P4 are bits 1 and 0 of the Color Select register.</I>"
|
||||
<BR><B>8BIT -- 8-bit Color Enable<BR>
|
||||
</B>"<I>When this bit is set to 1, the video data is sampled so that eight
|
||||
bits are available to select a color in the 256-color mode (0x13). This
|
||||
bit is set to 0 in all other modes.</I>"
|
||||
<LI>
|
||||
<B>PPM -- Pixel Panning Mode</B></LI>
|
||||
|
||||
<BR>This field allows the upper half of the screen to pan independently
|
||||
of the lower screen. If this field is set to 0 then nothing special occurs
|
||||
during a successful line compare (see the <A HREF="crtcreg.htm#18">Line
|
||||
Compare</A> field.) If this field is set to 1, then upon a successful line
|
||||
compare, the bottom portion of the screen is displayed as if the <A HREF="attrreg.htm#13">Pixel
|
||||
Shift Count</A> and <A HREF="crtcreg.htm#08">Byte Panning</A> fields are
|
||||
set to 0.
|
||||
<BR><B>BLINK - Blink Enable<BR>
|
||||
</B>"<I>When this bit is set to 0, the most-significant bit of the attribute
|
||||
selects the background intensity (allows 16 colors for background). When
|
||||
set to 1, this bit enables blinking.</I>"
|
||||
<LI>
|
||||
<B>LGA - Line Graphics Enable</B></LI>
|
||||
|
||||
<BR>This field is used in 9 bit wide character modes to provide continuity
|
||||
for the horizontal line characters in the range C0h-DFh. If this field
|
||||
is set to 0, then the 9th column of these characters is replicated from
|
||||
the 8th column of the character. Otherwise, if it is set to 1 then the
|
||||
9th column is set to the background like the rest of the characters.
|
||||
<LI>
|
||||
<B>MONO - Monochrome Emulation</B></LI>
|
||||
|
||||
<BR>This field is used to store your favorite bit. According to IBM, "When
|
||||
this bit is set to 1, monochrome emulation mode is selected. When this
|
||||
bit is set to 0, color |emulation mode is selected." It is present and
|
||||
programmable in all of the hardware but it apparently does nothing. The
|
||||
internal palette is used to provide monochrome emulation instead.
|
||||
<LI>
|
||||
<B>ATGE - Attribute Controller Graphics Enable<BR>
|
||||
</B>"<I>When set to 1, this bit selects the graphics mode of operation.</I>"</LI>
|
||||
</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION><A NAME="11"></A><B>Overscan Color Register (Index 11h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD COLSPAN="8" WIDTH="600">Overscan Palette Index</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL><B>Overscan Palette Index<BR>
|
||||
</B>"<I>These bits select the border color used in the 80-column alphanumeric
|
||||
modes and in the graphics modes other than modes 4, 5, and D. (Selects
|
||||
a color from one of the DAC registers.)</I>"</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="12"></A><B>Color Plane Enable Register (Index
|
||||
12h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD COLSPAN="4" WIDTH="300">Color Plane Enable</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<B>Color Plane Enable<BR>
|
||||
</B>"<I>Setting a bit to 1, enables the corresponding display-memory color
|
||||
plane.</I>"</LI>
|
||||
</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="13"></A><B>Horizontal Pixel Panning Register
|
||||
(Index 13h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD COLSPAN="4" WIDTH="300">Pixel Shift Count</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL><B>Pixel Shift Count<BR>
|
||||
</B>"<I>These bits select the number of pels that the video data is shifted
|
||||
to the left. PEL panning is available in both alphanumeric and graphics
|
||||
modes.</I>"</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="14"></A><B>Color Select Register (Index 14h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD COLSPAN="2" WIDTH="150">Color Select 7-6</TD>
|
||||
|
||||
<TD COLSPAN="2" WIDTH="150">Color Select 5-4</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL><B>Color Select 7-6<BR>
|
||||
</B>"<I>In modes other than mode 13 hex, these are the two most-significant
|
||||
bits of the 8-bit digital color value to the video DAC. In mode 13 hex,
|
||||
the 8-bit attribute is the digital color value to the video DAC. These
|
||||
bits are used to rapidly switch between sets of colors in the video DAC.</I>"
|
||||
<BR><B>Color Select 5-4<BR>
|
||||
</B>"<I>These bits can be used in place of the P4 and P5 bits from the
|
||||
Internal Palette registers to form the 8-bit digital color value
|
||||
to the video DAC. Selecting these bits is done in the Attribute Mode Control
|
||||
register (index 0x10). These bits are used to rapidly switch between colors
|
||||
sets within the video DAC.</I>"</UL>
|
||||
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>.
|
||||
</BODY>
|
||||
</HTML>
|
||||
22
specs/freevga/vga/char.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
_____Examples_of_Text_Mode_Bitmap_Characters_____
|
||||
|
||||
7 8x8 0 ___Legend___ 7 8x16 0 7 9x16 0
|
||||
0--XX---- - Background 0-------- 0--------
|
||||
-XXXX--- X Foreground -------- --------
|
||||
XX--XX-- ? Undisplayed ---X---- XX----XX
|
||||
XX--XX-- --XXX--- XXX--XXX
|
||||
XXXXXX-- -XX-XX-- XXXXXXXX
|
||||
XX--XX-- XX---XX- XXXXXXXX
|
||||
XX--XX-- XX---XX- XX-XX-XX
|
||||
7-------- <------+ XXXXXXX- XX----XX
|
||||
8???????? | XX---XX- XX----XX
|
||||
???????? XX---XX- XX----XX
|
||||
???????? Maximum Scan XX---XX- XX----XX
|
||||
???????? Line XX---XX- XX----XX
|
||||
???????? -------- --------
|
||||
???????? | -------- --------
|
||||
???????? | -------- --------
|
||||
???????? +------> 15-------- 15--------
|
||||
???????? 16???????? 16????????
|
||||
... ... ...
|
||||
31???????? 31???????? 31????????
|
||||
253
specs/freevga/vga/colorreg.htm
Normal file
@@ -0,0 +1,253 @@
|
||||
<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 other low-level stuff.)">
|
||||
<META NAME="KeyWords" CONTENT="VGA SVGA hardware video programming">
|
||||
<TITLE>VGA/SVGA Video Programming--Color Regsters</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<UL>
|
||||
<CENTER><A HREF="../home.htm">Home</A> <A HREF="vga.htm#register">Back</A>
|
||||
<HR WIDTH="100%"><B>Hardware Level VGA and SVGA Video Programming Information
|
||||
Page</B></CENTER>
|
||||
|
||||
<CENTER>Color Registers</CENTER>
|
||||
|
||||
<CENTER>
|
||||
<HR WIDTH="100%"></CENTER>
|
||||
</UL>
|
||||
The Color Registers in the standard
|
||||
VGA provide a mapping between the palette of between 2 and 256 colors to
|
||||
a larger 18-bit color space. This capability allows for efficient use of
|
||||
video memory while providing greater flexibility in color choice. The standard
|
||||
VGA has 256 palette entries containing six bits each of red, green, and
|
||||
blue values. The palette RAM is accessed via a pair of address registers
|
||||
and a data register. To write a palette entry, output the palette entry's
|
||||
index value to the <A HREF="#3C8">DAC Address Write Mode Register</A> then
|
||||
perform 3 writes to the <A HREF="#3C9">DAC Data Register</A>, loading the
|
||||
red, green, then blue values into the palette RAM. The internal write address
|
||||
automatically advances allowing the next value's RGB values to be loaded
|
||||
without having to reprogram the <A HREF="#3C8">DAC Address Write Mode Register.
|
||||
This</A> allows the entire palette to be loaded in one write operation.
|
||||
To read a palette entry, output the palette entry's index to the <A HREF="#3C7W">DAC
|
||||
Address Read Mode Register</A>. Then perform 3 reads from the <A HREF="#3C9">DAC
|
||||
Data Register</A>, loading the red, green, then blue values from palette
|
||||
RAM. The internal write address automatically advances allowing the next
|
||||
RGB values to be written without having to reprogram the <A HREF="#3C7W">DAC
|
||||
Address Read Mode Register</A>.
|
||||
|
||||
<P><A NAME="note"></A>Note: I have noticed some great variance in the actual
|
||||
behavior of these registers on VGA chipsets. The best way to ensure compatibility
|
||||
with the widest range of cards is to start an operation by writing to the
|
||||
appropriate address register and performing reads and writes in groups
|
||||
of 3 color values. While the automatic increment works fine on all cards
|
||||
tested, reading back the value from the <A HREF="#3C8">DAC Address Write
|
||||
Mode Register</A> may not always produce the expected result. Also interleaving
|
||||
reads and writes to the <A HREF="#3C9">DAC Data Register</A> without first
|
||||
writing to the respected address register may produce unexpected results.
|
||||
In addition, writing values in anything other than groups of 3 to the <A HREF="#3C9">DAC
|
||||
Data Register</A> and then performing reads may produce unexpected results.
|
||||
I have found that some cards fail to perform the desired update until the
|
||||
third value is written.
|
||||
<UL>
|
||||
<LI>
|
||||
Port 3C8h -- <A HREF="#3C8">DAC Address Write Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Port 3C7h -- <A HREF="#3C7W">DAC Address Read Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Port 3C9h -- <A HREF="#3C9">DAC Data Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Port 3C7h -- <A HREF="#3C7R">DAC State Register</A></LI>
|
||||
</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="3C8"></A><B>DAC Address Write Mode Register
|
||||
(Read/Write at 3C8h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD COLSPAN="8" WIDTH="600">DAC Write Address</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<B>DAC Write Address</B></LI>
|
||||
|
||||
<BR>Writing to this register prepares the DAC hardware to accept writes
|
||||
of data to the <A HREF="#3C9">DAC Data Register</A>. The value written
|
||||
is the index of the first DAC entry to be written (multiple DAC entries
|
||||
may be written without having to reset the write address due to the auto-increment.)
|
||||
Reading this register returns the current index, or at least theoretically
|
||||
it should. However it is likely the value returned is not the one expected,
|
||||
and is dependent on the particular DAC implementation. (See <A HREF="#note">note</A>
|
||||
above)</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="3C7W"></A><B>DAC Address Read Mode Register
|
||||
(Write at 3C7h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD COLSPAN="8" WIDTH="600">DAC Read Address</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<B>DAC Read Address</B></LI>
|
||||
|
||||
<BR>Writing to this register prepares the DAC hardware to accept reads
|
||||
of data to the <A HREF="#3C9">DAC Data Register</A>. The value written
|
||||
is the index of the first DAC entry to be read (multiple DAC entries may
|
||||
be read without having to reset the write address due to the auto-increment.)</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="3C9"></A><B>DAC Data Register (Read/Write at
|
||||
3C9h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD COLSPAN="6" WIDTH="450">DAC Data</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<B>DAC Data</B></LI>
|
||||
|
||||
<BR>Reading or writing to this register returns a value from the DAC memory.
|
||||
Three successive I/O operations accesses three intensity values, first
|
||||
the red, then green, then blue intensity values. The index of the DAC entry
|
||||
accessed is initially specified by the <A HREF="#3C7W">DAC Address Read
|
||||
Mode Register</A> or the <A HREF="#3C8">DAC Address Write Mode Register</A>,
|
||||
depending on the I/O operation performed. After three I/O operations the
|
||||
index automatically increments to allow the next DAC entry to be read without
|
||||
having to reload the index. I/O operations to this port should always be
|
||||
performed in sets of three, otherwise the results are dependent on the
|
||||
DAC implementation. (See <A HREF="#note">note</A> above)</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="3C7R"></A><B>DAC State Register (Read at 3C7h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD COLSPAN="2" WIDTH="150">DAC State</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<B>DAC State</B></LI>
|
||||
|
||||
<BR>This field returns whether the DAC is prepared to accept reads or writes
|
||||
to the <A HREF="#3C9">DAC Data Register</A>. In practice, this field is
|
||||
seldom used due to the DAC state being known after the index has been written.
|
||||
This field can have the following values:
|
||||
<UL>
|
||||
<LI>
|
||||
00 -- DAC is prepared to accept reads from the <A HREF="#3C9">DAC Data
|
||||
Register</A>.</LI>
|
||||
|
||||
<LI>
|
||||
11 -- DAC is prepared to accept writes to the <A HREF="#3C9">DAC Data Register</A>.</LI>
|
||||
</UL>
|
||||
</UL>
|
||||
|
||||
|
||||
<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>.
|
||||
</BODY>
|
||||
</HTML>
|
||||
1355
specs/freevga/vga/crtcreg.htm
Normal file
282
specs/freevga/vga/extreg.htm
Normal file
@@ -0,0 +1,282 @@
|
||||
<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 other low-level stuff.)">
|
||||
<META NAME="KeyWords" CONTENT="VGA SVGA hardware video programming">
|
||||
<TITLE>VGA/SVGA Video Programming--External Regsters</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<UL>
|
||||
<CENTER><A HREF="../home.htm">Home</A> <A HREF="vga.htm#register">Back</A>
|
||||
<HR WIDTH="100%"><B>Hardware Level VGA and SVGA Video Programming Information
|
||||
Page</B></CENTER>
|
||||
|
||||
<CENTER>External Regsters</CENTER>
|
||||
|
||||
<CENTER>
|
||||
<HR WIDTH="100%"></CENTER>
|
||||
</UL>
|
||||
The External Registers (sometimes
|
||||
called the General Registers) each have their own unique I/O location in
|
||||
the VGA, although sometimes the Read Port differs from the Write port,
|
||||
and some are Read-only.. See the <A HREF="vgareg.htm">Accessing the VGA
|
||||
Registers</A> section for more detals.
|
||||
<UL>
|
||||
<LI>
|
||||
Port 3CCh/3C2h -- <I>Miscellaneous Output Register</I></LI>
|
||||
|
||||
<LI>
|
||||
Port 3CAh/3xAh -- <I>Feature Control Register</I></LI>
|
||||
|
||||
<LI>
|
||||
Port 3C2h -- <I>Input Status #0 Register</I></LI>
|
||||
|
||||
<LI>
|
||||
Port 3xAh -- <I>Input Status #1 Register</I></LI>
|
||||
</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="3CCR3C2W"></A><B>Miscellaneous Output Register
|
||||
(Read at 3CCh, Write at 3C2h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">VSYNCP</TD>
|
||||
|
||||
<TD WIDTH="75">HSYNCP</TD>
|
||||
|
||||
<TD WIDTH="75">O/E Page</TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD COLSPAN="2" WIDTH="150">Clock Select</TD>
|
||||
|
||||
<TD WIDTH="75">RAM En.</TD>
|
||||
|
||||
<TD WIDTH="75">I/OAS</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL><B>VSYNCP -- Vertical Sync Polarity<BR>
|
||||
</B>"<I>Determines the polarity of the vertical sync pulse and can be used
|
||||
(with HSP) to control the vertical size of the display by utilizing the
|
||||
autosynchronization feature of VGA displays.</I>
|
||||
<BR><I> = 0 selects a positive vertical retrace sync pulse.</I>"
|
||||
<BR><B>HSYNCP -- Horizontal Sync Polarity<BR>
|
||||
</B>"<I>Determines the polarity of the horizontal sync pulse.</I>
|
||||
<BR><I> = 0 selects a positive horizontal retrace sync pulse.</I>"
|
||||
<BR><B>O/E Page -- Odd/Even Page Select<BR>
|
||||
</B>"<I>Selects the upper/lower 64K page of memory when the system is in
|
||||
an eve/odd mode (modes 0,1,2,3,7).</I>
|
||||
<BR><I> = 0 selects the low page</I>
|
||||
<BR><I> = 1 selects the high page</I>"
|
||||
<LI>
|
||||
<B>Clock Select</B></LI>
|
||||
|
||||
<BR>This field controls the selection of the dot clocks used in driving
|
||||
the display timing. The standard hardware has 2 clocks available
|
||||
to it, nominally 25 Mhz and 28 Mhz. It is possible that there may
|
||||
be other "external" clocks that can be selected by programming this register
|
||||
with the undefined values. The possible valuse of this register are:
|
||||
<UL>
|
||||
<LI>
|
||||
00 -- select 25 Mhz clock (used for 320/640 pixel wide modes)</LI>
|
||||
|
||||
<LI>
|
||||
01 -- select 28 Mhz clock (used for 360/720 pixel wide modes)</LI>
|
||||
|
||||
<LI>
|
||||
10 -- undefined (possible external clock)</LI>
|
||||
|
||||
<LI>
|
||||
11 -- undefined (possible external clock)</LI>
|
||||
</UL>
|
||||
<B>RAM En. -- RAM Enable<BR>
|
||||
</B>"<I>Controls system access to the display buffer.</I>
|
||||
<BR><I> = 0 disables address decode for the display buffer from the
|
||||
system</I>
|
||||
<BR><I> = 1 enables address decode for the display buffer from the
|
||||
system</I>"
|
||||
<BR><B>I/OAS -- Input/Output Address Select<BR>
|
||||
</B>"<I>This bit selects the CRT controller addresses. When set to 0, this
|
||||
bit sets the CRT controller addresses to 0x03Bx and the address for the
|
||||
Input Status Register 1 to 0x03BA for compatibility withthe monochrome
|
||||
adapter. When set to 1, this bit sets CRT controller addresses to
|
||||
0x03Dx and the Input Status Register 1 address to 0x03DA for compatibility
|
||||
with the color/graphics adapter. The Write addresses to the Feature Control
|
||||
register are affected in the same manner.</I>"</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="3CAR3xAW"></A><B>Feature Control Register (Read
|
||||
at 3CAh, Write at 3BAh (mono) or 3DAh (color))</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75">FC1</TD>
|
||||
|
||||
<TD WIDTH="75">FC0</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<B>FC1 -- Feature Control bit 1<BR>
|
||||
</B>"<I>All bits are reserved.</I>"</LI>
|
||||
|
||||
<LI>
|
||||
<B>FC2 -- Feature Control bit 0<BR>
|
||||
</B>"<I>All bits are reserved.</I>"</LI>
|
||||
</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="3C2R"></A><B>Input Status #0 Register (Read-only
|
||||
at 3C2h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75">SS</TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL><B>SS - Switch Sense<BR>
|
||||
</B>"<I>Returns the status of the four sense switches as selected by the
|
||||
CS field of the Miscellaneous Output Register.</I>"</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="3xAR"></A><B>Input Status #1 Register (Read
|
||||
at 3BAh (mono) or 3DAh (color))</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75">VRetrace</TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75">DD</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL><B>VRetrace -- Vertical Retrace<BR>
|
||||
</B>"<I>When set to 1, this bit indicates that the display is in a vertical
|
||||
retrace interval.This bit can be programmed, through the Vertical Retrace
|
||||
End register, to generate an interrupt at the start of the vertical retrace.</I>"
|
||||
<BR><B>DD -- Display Disabled<BR>
|
||||
</B>"<I>When set to 1, this bit indicates a horizontal or vertical retrace
|
||||
interval. This bit is the real-time status of the inverted 'display enable'
|
||||
signal. Programs have used this status bit to restrict screen updates to
|
||||
the inactive display intervals in order to reduce screen flicker. The video
|
||||
subsystem is designed to eliminate this software requirement; screen updates
|
||||
may be made at any time without screen degradation.</I>"</UL>
|
||||
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>.
|
||||
</BODY>
|
||||
</HTML>
|
||||
585
specs/freevga/vga/graphreg.htm
Normal file
@@ -0,0 +1,585 @@
|
||||
<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 other low-level stuff.)">
|
||||
<META NAME="KeyWords" CONTENT="VGA SVGA hardware video programming">
|
||||
<TITLE>VGA/SVGA Video Programming--Graphics Registers</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="../home.htm">Home</A> <A HREF="vga.htm#register">Back</A>
|
||||
<HR WIDTH="100%"><B>Hardware Level VGA and SVGA Video Programming Information
|
||||
Page</B></CENTER>
|
||||
|
||||
<CENTER>Graphics Registers
|
||||
<HR WIDTH="100%"></CENTER>
|
||||
|
||||
|
||||
<P> The Graphics Registers are
|
||||
accessed via a pair of registers, the Graphics Address Register and the
|
||||
Graphics Data Register. See the <A HREF="vgareg.htm">Accessing the VGA
|
||||
Registers</A> section for more details. The Address Register is located
|
||||
at port 3CEh and the Data Register is located at port 3CFh.
|
||||
<UL>
|
||||
<LI>
|
||||
Index 00h -- Set/Reset Register</LI>
|
||||
|
||||
<LI>
|
||||
Index 01h -- Enable Set/Reset Register</LI>
|
||||
|
||||
<LI>
|
||||
Index 02h -- Color Compare Register</LI>
|
||||
|
||||
<LI>
|
||||
Index 03h -- Data Rotate Register</LI>
|
||||
|
||||
<LI>
|
||||
Index 04h -- Read Map Select Register</LI>
|
||||
|
||||
<LI>
|
||||
Index 05h -- <I>Graphics Mode Register</I></LI>
|
||||
|
||||
<LI>
|
||||
Index 06h -- <I>Miscellaneous Graphics Register</I></LI>
|
||||
|
||||
<LI>
|
||||
Index 07h -- Color Don't Care Register</LI>
|
||||
|
||||
<LI>
|
||||
Index 08h -- Bit Mask Register</LI>
|
||||
</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="00"></A><B>Set/Reset Register (Index 00h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD COLSPAN="4" WIDTH="300">Set/Reset</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<B>Set/Reset</B></LI>
|
||||
|
||||
<BR>Bits 3-0 of this field represent planes 3-0 of the VGA display memory.
|
||||
This field is used by Write Mode 0 and Write Mode 3 (See the <A HREF="#05">Write
|
||||
Mode</A> field.) In Write Mode 0, if the corresponding bit in the <A HREF="#01">Enable
|
||||
Set/Reset</A> field is set, and in Write Mode 3 regardless of the <A HREF="#01">Enable
|
||||
Set/Reset</A> field, the value of the bit in this field is expanded to
|
||||
8 bits and substituted for the data of the respective plane and passed
|
||||
to the next stage in the graphics pipeline, which for Write Mode 0 is the
|
||||
<A HREF="#03">Logical Operation</A> unit and for Write Mode 3 is the <A HREF="#08">Bit
|
||||
Mask</A> unit.</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="01"></A><B>Enable Set/Reset Register (Index
|
||||
01h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD COLSPAN="4" WIDTH="300">Enable Set/Reset</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<B>Enable Set/Reset</B></LI>
|
||||
|
||||
<BR>Bits 3-0 of this field represent planes 3-0 of the VGA display memory.
|
||||
This field is used in Write Mode 0 (See the <A HREF="#05">Write Mode</A>
|
||||
field) to select whether data for each plane is derived from host data
|
||||
or from expansion of the respective bit in the <A HREF="#00">Set/Reset</A>
|
||||
field.</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="02"></A><B>Color Compare Register (Index 02h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD COLSPAN="4" WIDTH="300">Color Compare</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<B>Color Compare</B></LI>
|
||||
|
||||
<BR>Bits 3-0 of this field represent planes 3-0 of the VGA display memory.
|
||||
This field holds a reference color that is used by Read Mode 1 (See the
|
||||
<A HREF="#05">Read Mode</A> field.) Read Mode 1 returns the result of the
|
||||
comparison between this value and a location of display memory, modified
|
||||
by the <A HREF="#07">Color Don't Care</A> field.</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="03"></A><B>Data Rotate Register (Index 03h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD COLSPAN="2" WIDTH="150">Logical Operation</TD>
|
||||
|
||||
<TD COLSPAN="3" WIDTH="225">Rotate Count</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<B>Logical Operation</B></LI>
|
||||
|
||||
<BR>This field is used in Write Mode 0 and Write Mode 2 (See the <A HREF="#05">Write
|
||||
Mode</A> field.) The logical operation stage of the graphics pipeline is
|
||||
32 bits wide (1 byte * 4 planes) and performs the operations on its inputs
|
||||
from the previous stage in the graphics pipeline and the latch register.
|
||||
The latch register remains unchanged and the result is passed on to the
|
||||
next stage in the pipeline. The results based on the value of this field
|
||||
are:
|
||||
<UL>
|
||||
<LI>
|
||||
00b - Result is input from previous stage unmodified.</LI>
|
||||
|
||||
<LI>
|
||||
01b - Result is input from previous stage logical ANDed with latch register.</LI>
|
||||
|
||||
<LI>
|
||||
10b - Result is input from previous stage logical ORed with latch register.</LI>
|
||||
|
||||
<LI>
|
||||
11b - Result is input from previous stage logical XORed with latch register.</LI>
|
||||
</UL>
|
||||
|
||||
<LI>
|
||||
<B>Rotate Count</B></LI>
|
||||
|
||||
<BR>This field is used in Write Mode 0 and Write Mode 3 (See the <A HREF="#05">Write
|
||||
Mode</A> field.) In these modes, the host data is rotated to the right
|
||||
by the value specified by the value of this field. A rotation operation
|
||||
consists of moving bits 7-1 right one position to bits 6-0, simultaneously
|
||||
wrapping bit 0 around to bit 7, and is repeated the number of times specified
|
||||
by this field.</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="04"></A><B>Read Map Select Register (Index
|
||||
04h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD COLSPAN="2" WIDTH="150">Read Map Select</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<B>Read Map Select</B></LI>
|
||||
|
||||
<BR>This value of this field is used in Read Mode 0 (see the <A HREF="#05">Read
|
||||
Mode</A> field) to specify the display memory plane to transfer data from.
|
||||
Due to the arrangement of video memory, this field must be modified four
|
||||
times to read one or more pixels values in the planar video modes.</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION><A NAME="05"></A><B>Graphics Mode Register (Index 05h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75">Shift256</TD>
|
||||
|
||||
<TD>Shift Reg.</TD>
|
||||
|
||||
<TD WIDTH="75">Host O/E</TD>
|
||||
|
||||
<TD WIDTH="75">Read Mode</TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD COLSPAN="2" WIDTH="150">Write Mode</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<B>Shift256 -- 256-Color Shift Mode<BR>
|
||||
</B>"<I>When set to 0, this bit allows bit 5 to control the loading of
|
||||
the shift registers. When set to 1, this bit causes the shift registers
|
||||
to be loaded in a manner that supports the 256-color mode.</I>"</LI>
|
||||
|
||||
<BR><B>Shift Reg. -- Shift Register Interleave Mode<BR>
|
||||
</B>"<I>When set to 1, this bit directs the shift registers in the graphics
|
||||
controller to format the serial data stream with even-numbered bits from
|
||||
both maps on even-numbered maps, and odd-numbered bits from both maps on
|
||||
the odd-numbered maps. This bit is used for modes 4 and 5.</I>"
|
||||
<BR><B>Host O/E -- Host Odd/Even Memory Read Addressing Enable<BR>
|
||||
</B>"<I>When set to 1, this bit selects the odd/even addressing mode used
|
||||
by the IBM Color/Graphics Monitor Adapter. Normally, the value here follows
|
||||
the value of Memory Mode register bit 2 in the sequencer.</I>"
|
||||
<LI>
|
||||
<B>Read Mode</B></LI>
|
||||
|
||||
<BR>This field selects between two read modes, simply known as Read Mode
|
||||
0, and Read Mode 1, based upon the value of this field:
|
||||
<UL>
|
||||
<LI>
|
||||
0b -- Read Mode 0: In this mode, a byte from one of the four planes is
|
||||
returned on read operations. The plane from which the data is returned
|
||||
is determined by the value of the <A HREF="#04">Read Map Select</A> field.</LI>
|
||||
</UL>
|
||||
|
||||
<LI>
|
||||
1b -- Read Mode 1: In this mode, a comparison is made between display memory
|
||||
and a reference color defined by the <A HREF="#02">Color Compare</A> field.
|
||||
Bit planes not set in the <A HREF="#07">Color Don't Care</A> field then
|
||||
the corresponding color plane is not considered in the comparison. Each
|
||||
bit in the returned result represents one comparison between the reference
|
||||
color, with the bit being set if the comparison is true.</LI>
|
||||
|
||||
<LI>
|
||||
<B>Write Mode</B></LI>
|
||||
|
||||
<BR>This field selects between four write modes, simply known as Write
|
||||
Modes 0-3, based upon the value of this field:
|
||||
<UL>
|
||||
<LI>
|
||||
00b -- Write Mode 0: In this mode, the host data is first rotated as per
|
||||
the <A HREF="#03">Rotate Count</A> field, then the <A HREF="#01">Enable
|
||||
Set/Reset</A> mechanism selects data from this or the <A HREF="#00">Set/Reset</A>
|
||||
field. Then the selected <A HREF="#03">Logical Operation</A> is performed
|
||||
on the resulting data and the data in the latch register. Then the <A HREF="#08">Bit
|
||||
Mask</A> field is used to select which bits come from the resulting data
|
||||
and which come from the latch register. Finally, only the bit planes enabled
|
||||
by the <A HREF="seqreg.htm#02">Memory Plane Write Enable</A> field are
|
||||
written to memory.</LI>
|
||||
|
||||
<LI>
|
||||
01b -- Write Mode 1: In this mode, data is transferred directly from the
|
||||
32 bit latch register to display memory, affected only by the <A HREF="seqreg.htm#02">Memory
|
||||
Plane Write Enable</A> field. The host data is not used in this mode.</LI>
|
||||
|
||||
<LI>
|
||||
10b -- Write Mode 2: In this mode, the bits 3-0 of the host data are replicated
|
||||
across all 8 bits of their respective planes. Then the selected <A HREF="#03">Logical
|
||||
Operation</A> is performed on the resulting data and the data in the latch
|
||||
register. Then the <A HREF="#08">Bit Mask</A> field is used to select which
|
||||
bits come from the resulting data and which come from the latch register.
|
||||
Finally, only the bit planes enabled by the <A HREF="seqreg.htm#02">Memory
|
||||
Plane Write Enable</A> field are written to memory.</LI>
|
||||
|
||||
<LI>
|
||||
11b -- Write Mode 3: In this mode, the data in the <A HREF="#00">Set/Reset</A>
|
||||
field is used as if the <A HREF="#01">Enable Set/Reset</A> field were set
|
||||
to 1111b. Then the host data is first rotated as per the <A HREF="#03">Rotate
|
||||
Count</A> field, then logical ANDed with the value of the <A HREF="#08">Bit
|
||||
Mask</A> field. The resulting value is used on the data obtained from the
|
||||
Set/Reset field in the same way that the <A HREF="#08">Bit Mask</A> field
|
||||
would ordinarily be used. to select which bits come from the expansion
|
||||
of the <A HREF="#00">Set/Reset</A> field and which come from the latch
|
||||
register. Finally, only the bit planes enabled by the <A HREF="seqreg.htm#02">Memory
|
||||
Plane Write Enable</A> field are written to memory.</LI>
|
||||
</UL>
|
||||
</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="06"></A><B>Miscellaneous Graphics Register
|
||||
(Index 06h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD COLSPAN="2" WIDTH="150">Memory Map Select</TD>
|
||||
|
||||
<TD WIDTH="75">Chain O/E</TD>
|
||||
|
||||
<TD WIDTH="75">Alpha Dis.</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<B>Memory Map Select<BR>
|
||||
</B>This field specifies the range of host memory addresses that is decoded
|
||||
by the VGA hardware and mapped into display memory accesses. The
|
||||
values of this field and their corresponding host memory ranges are:</LI>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
00b -- A0000h-BFFFFh (128K region)</LI>
|
||||
|
||||
<LI>
|
||||
01b -- A0000h-AFFFFh (64K region)</LI>
|
||||
|
||||
<LI>
|
||||
10b -- B0000h-B7FFFh (32K region)</LI>
|
||||
|
||||
<LI>
|
||||
11b -- B8000h-BFFFFh (32K region)</LI>
|
||||
</UL>
|
||||
<B>Chain O/E -- Chain Odd/Even Enable<BR>
|
||||
</B>"<I>When set to 1, this bit directs the system address bit, A0, to
|
||||
be replaced by a higher-order bit. The odd map is then selected when A0
|
||||
is 1, and the even map when A0 is 0.</I>"
|
||||
<BR><B>Alpha Dis. -- Alphanumeric Mode Disable<BR>
|
||||
</B>"<I>This bit controls alphanumeric mode addressing. When set to 1,
|
||||
this bit selects graphics modes, which also disables the character generator
|
||||
latches."</I></UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="07"></A><B>Color Don't Care Register (Index
|
||||
07h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD COLSPAN="4" WIDTH="300">Color Don't Care</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<B>Color Don't Care</B></LI>
|
||||
|
||||
<BR>Bits 3-0 of this field represent planes 3-0 of the VGA display memory.
|
||||
This field selects the planes that are used in the comparisons made by
|
||||
Read Mode 1 (See the <A HREF="#05">Read Mode</A> field.) Read Mode 1 returns
|
||||
the result of the comparison between the value of the <A HREF="#02">Color
|
||||
Compare</A> field and a location of display memory. If a bit in this field
|
||||
is set, then the corresponding display plane is considered in the comparison.
|
||||
If it is not set, then that plane is ignored for the results of the comparison.</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="08"></A><B>Bit Mask Register (Index 08h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD COLSPAN="8" WIDTH="600">Bit Mask</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<B>Bit Mask</B></LI>
|
||||
|
||||
<BR>This field is used in Write Modes 0, 2, and 3 (See the <A HREF="#05">Write
|
||||
Mode</A> field.) It it is applied to one byte of data in all four display
|
||||
planes. If a bit is set, then the value of corresponding bit from the previous
|
||||
stage in the graphics pipeline is selected; otherwise the value of the
|
||||
corresponding bit in the latch register is used instead. In Write Mode
|
||||
3, the incoming data byte, after being rotated is logical ANDed with this
|
||||
byte and the resulting value is used in the same way this field would normally
|
||||
be used by itself.</UL>
|
||||
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>.
|
||||
</BODY>
|
||||
</HTML>
|
||||
124
specs/freevga/vga/license.htm
Normal file
@@ -0,0 +1,124 @@
|
||||
<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>FreeVGA Copyright License</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="../home.htm">Home</A> <A HREF="vga.htm">Back</A>
|
||||
<HR><B>Hardware Level VGA and SVGA Video Programming Information Page</B></CENTER>
|
||||
|
||||
<CENTER>FreeVGA Project Copyright License
|
||||
<HR></CENTER>
|
||||
<B>Introduction</B>
|
||||
<BR> This document contains the
|
||||
FreeVGA Copyright License which states the conditions under which the FreeVGA
|
||||
Project's Copyrighted information may be used and distributed. The
|
||||
conditions of this license ensure that all parties with a need for this
|
||||
information have the same availability, to the maximum extent possible
|
||||
as well as ensure the integrity of the documentation.
|
||||
|
||||
<P><B>Disclaimer</B>
|
||||
<BR> The author presents this
|
||||
information as-is without any warranty, including suitability for intended
|
||||
purpose. The author is not responsible for damages resulting by the use
|
||||
of the information, incidental or otherwise. By utilizing this information,
|
||||
you as the programmer take full liability for any damages caused by your
|
||||
use of this information. If you are not satisfied with these terms, then
|
||||
your only recourse is to not use this information. While every reasonable
|
||||
effort is made to ensure that this information is correct, the possibility
|
||||
exists for error and is not guaranteed for accuracy, and disclaims liability
|
||||
for any changes, errors or omissions and is not responsible for any damages
|
||||
that may arise from the use or misuse of this information. License
|
||||
to use this information is only granted where this disclaimer applies in
|
||||
whole.
|
||||
|
||||
<P><B>License</B>
|
||||
<BR> The following copyright
|
||||
license applies to all works by the FreeVGA Project. All of the FreeVGA
|
||||
Project's documentation is copyrighted by its author, Joshua Neal.
|
||||
|
||||
<P>License to utilize the FreeVGA Project documentation is subject to the
|
||||
following conditions:
|
||||
<UL>
|
||||
<LI>
|
||||
The copyright notice and this permission notice must be preserved complete
|
||||
on all copies, complete or partial.</LI>
|
||||
|
||||
<LI>
|
||||
Duplication is permitted only for personal purposes. Reduplication
|
||||
is permitted only under the FreeVGA Project documentation's redistribution
|
||||
license.</LI>
|
||||
|
||||
<LI>
|
||||
The use of the FreeVGA Project documentation to produce translations or
|
||||
derivative works must be approved specifically by the author.</LI>
|
||||
|
||||
<LI>
|
||||
All warnings and disclaimers present in the complete documentation must
|
||||
apply to the licensee and may not be restricted by locality. These
|
||||
must be read before use, and determined to be applicable to the licensee
|
||||
before the material may be utilized.</LI>
|
||||
|
||||
<LI>
|
||||
It is forbidden to represent the FreeVGA Project or to use the FreeVGA
|
||||
Project's name to solicit or obtain information, services, product, or
|
||||
endorsements from another party, commercial or otherwise.</LI>
|
||||
</UL>
|
||||
If all of the previous conditions are not met, then permission to utilize
|
||||
the FreeVGA Project's documentation is not granted, and all rights are
|
||||
reserved.
|
||||
|
||||
<P>License to distribute the FreeVGA Project documentation is subject to
|
||||
the following conditions:
|
||||
<UL>
|
||||
<LI>
|
||||
The copyright notice and this permission notice must be preserved complete
|
||||
on all copies, complete or partial.</LI>
|
||||
|
||||
<LI>
|
||||
An archive of the FreeVGA Project documentation may be distributed in electronic
|
||||
form only in its entirety, without adding or removing any material, notices,
|
||||
advertisement, or other information. Only exact copies of archives
|
||||
produced or specifically approved by the author may be distributed, and
|
||||
at the time of distribution, the most recent archive must be distributed.
|
||||
The FreeVGA Project documentation must be excluded from any compilation
|
||||
copyright or other restrictions. No fee other than the cost of transmission
|
||||
or the physical media containing the archive may be charged without prior
|
||||
approval by the author. The documentation may not be distributed
|
||||
electronically in part, which includes mirroring in html format on the
|
||||
internet, unless specific permission is granted by the author.</LI>
|
||||
|
||||
<LI>
|
||||
The FreeVGA Project documentation may be distributed in non-electronic
|
||||
form to students or members of a programming team subject to the condition
|
||||
that it be provided free of charge. The documentation may not be
|
||||
included with or within other copyrighted works unless the other copyrighted
|
||||
works are also provided free of charge.</LI>
|
||||
|
||||
<LI>
|
||||
Small portions may be reproduced as illustrations for reviews or quotes
|
||||
in other works without this permission notice if proper citation is given
|
||||
(including URL if the work is online.)</LI>
|
||||
|
||||
<LI>
|
||||
Only the current documentation may be distributed. The URL of the
|
||||
FreeVGA project online documentation must be provided. The author
|
||||
reserves the right to limit distribution by any parties at any time.</LI>
|
||||
</UL>
|
||||
If all of the previous conditions are not met, then permission to redistribute
|
||||
the FreeVGA Project's documentation is not granted, and all distribution
|
||||
rights are reserved.
|
||||
|
||||
<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>
|
||||
<BR>
|
||||
</BODY>
|
||||
</HTML>
|
||||
BIN
specs/freevga/vga/paging.gif
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
29
specs/freevga/vga/paging.txt
Normal file
@@ -0,0 +1,29 @@
|
||||
Paging Memory Utilization Example
|
||||
---------------------------------
|
||||
|
||||
0 +-------------------------+ 79
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| PAGE 0 |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
1920 | | 1999
|
||||
+-------------------------+
|
||||
| 48 bytes unused |
|
||||
+-------------------------+
|
||||
2048 | | 2127
|
||||
| |
|
||||
| |
|
||||
| PAGE 1 |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
3968 | | 4047
|
||||
+-------------------------+
|
||||
| |
|
||||
+-------------------------+
|
||||
| |
|
||||
|_ __ __ __ _ _|
|
||||
-- --_- - --___-- --
|
||||
99
specs/freevga/vga/portidx.htm
Normal file
@@ -0,0 +1,99 @@
|
||||
<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>FreeVGA - VGA I/O Port Index</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="../home.htm">Home</A> <A HREF="../home.htm">Back</A>
|
||||
<HR><B>Hardware Level VGA and SVGA Video Programming Information Page</B></CENTER>
|
||||
|
||||
<CENTER>VGA I/O Port Index
|
||||
<HR></CENTER>
|
||||
Introduction
|
||||
<BR> This index lists the VGA's
|
||||
I/O ports in numerical order, making looking up a specific I/O port access
|
||||
simpler.
|
||||
<BR>
|
||||
<UL>
|
||||
<LI>
|
||||
3B4h -- <A HREF="crtcreg.htm">CRTC Controller Address Register</A></LI>
|
||||
|
||||
<LI>
|
||||
3B5h -- <A HREF="crtcreg.htm">CRTC Controller Data Register</A></LI>
|
||||
|
||||
<LI>
|
||||
3BAh Read -- <A HREF="extreg.htm#3xAR">Input Status #1 Register</A></LI>
|
||||
|
||||
<LI>
|
||||
3BAh Write -- <A HREF="extreg.htm#3CAR3xAW">Feature Control Register</A></LI>
|
||||
|
||||
<LI>
|
||||
3C0h -- <A HREF="attrreg.htm">Attribute Address/Data Register</A></LI>
|
||||
|
||||
<LI>
|
||||
3C1h -- <A HREF="attrreg.htm">Attribute Data Read Register</A></LI>
|
||||
|
||||
<LI>
|
||||
3C2h Read -- <A HREF="extreg.htm#3C2R">Input Status #0 Register</A></LI>
|
||||
|
||||
<LI>
|
||||
3C2h Write -- <A HREF="extreg.htm#3CCR3C2W">Miscellaneous Output Register</A></LI>
|
||||
|
||||
<LI>
|
||||
3C4h -- <A HREF="seqreg.htm">Sequencer Address Register</A></LI>
|
||||
|
||||
<LI>
|
||||
3C5h -- <A HREF="seqreg.htm">Sequencer Data Register</A></LI>
|
||||
|
||||
<LI>
|
||||
3C7h Read -- <A HREF="colorreg.htm#3C7R">DAC State Register</A></LI>
|
||||
|
||||
<LI>
|
||||
3C7h Write -- <A HREF="colorreg.htm#3C7W">DAC Address Read Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
3C8h -- <A HREF="colorreg.htm#3C8">DAC Address Write Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
3C9h -- <A HREF="colorreg.htm#3C9">DAC Data Register</A></LI>
|
||||
|
||||
<LI>
|
||||
3CAh Read -- <A HREF="extreg.htm#3CAR3xAW">Feature Control Register</A></LI>
|
||||
|
||||
<LI>
|
||||
3CCh Read -- <A HREF="extreg.htm#3CCR3C2W">Miscellaneous Output Register</A></LI>
|
||||
|
||||
<LI>
|
||||
3CEh -- <A HREF="graphreg.htm">Graphics Controller Address Register</A></LI>
|
||||
|
||||
<LI>
|
||||
3CFh -- <A HREF="graphreg.htm">Graphics Controller Data Register</A></LI>
|
||||
|
||||
<LI>
|
||||
3D4h -- <A HREF="crtcreg.htm">CRTC Controller Address Register</A></LI>
|
||||
|
||||
<LI>
|
||||
3D5h -- <A HREF="crtcreg.htm">CRTC Controller Data Register</A></LI>
|
||||
|
||||
<LI>
|
||||
3DAh Read -- <A HREF="extreg.htm#3xAR">Input Status #1 Register</A></LI>
|
||||
|
||||
<LI>
|
||||
3DAh Write -- <A HREF="extreg.htm#3CAR3xAW">Feature Control Register</A></LI>
|
||||
</UL>
|
||||
|
||||
|
||||
<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>
|
||||
<BR>
|
||||
<BR>
|
||||
</BODY>
|
||||
</HTML>
|
||||
BIN
specs/freevga/vga/seqpack.gif
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
25
specs/freevga/vga/seqpack.txt
Normal file
@@ -0,0 +1,25 @@
|
||||
Packed Shift Mode Diagram
|
||||
-------------------------
|
||||
|
||||
Plane 0 Plane 1
|
||||
/-----------------^-----------------\ /-----------------^-----------------\
|
||||
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
|
||||
+---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+
|
||||
| | | | | | | | | | | | | | | | | | | | | | | |
|
||||
+---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+
|
||||
| | | | | | | | | | | | | | | |
|
||||
\ | \ | \ | \ | \ | \ | \ | \ |
|
||||
3 2 | | 3 2 | | 3 2 | | 3 2 | | 3 2 | | 3 2 | | 3 2 | | 3 2 | |
|
||||
[][][][] [][][][] [][][][] [][][][] [][][][] [][][][] [][][][] [][][][]
|
||||
| | 1 0 | | 1 0 | | 1 0 | | 1 0 | | 1 0 | | 1 0 | | 1 0 | | 1 0
|
||||
| \ | \ | \ | \ | \ | \ | \ | \
|
||||
| | | | | | | | | | | | | | | |
|
||||
+---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+
|
||||
| | | | | | | | | | | | | | | | | | | | | | | |
|
||||
+---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+
|
||||
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
|
||||
\-----------------v-----------------/ \-----------------v-----------------/
|
||||
Plane 2 Plane 3
|
||||
|
||||
<------- Direction of Shift
|
||||
|
||||
BIN
specs/freevga/vga/seqplanr.gif
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
31
specs/freevga/vga/seqplanr.txt
Normal file
@@ -0,0 +1,31 @@
|
||||
Planar Shift Mode Diagram
|
||||
-------------------------
|
||||
|
||||
Pixel Value Display Memory
|
||||
|
||||
3 2 1 0 7 6 5 4 3 2 1 0
|
||||
+-----+-----+-----+-----+ +-----+-----+-----+-----+-----+-----+-----+-----+
|
||||
|.....|.....|.....|.....|___|.....|%%%%%|:::::|%%%%%|:::::|%%%%%|:::::|%%%%%|
|
||||
|.....|.....|.....|.....| |.....|%%%%%|:::::|%%%%%|:::::|%%%%%|:::::|%%%%%|
|
||||
+-----+-----+-----+-----+ +-----+-----+-----+-----+-----+-----+-----+-----+
|
||||
| | | Plane 0 | | | | | | | |
|
||||
| | | +-----+-----+-----+-----+-----+-----+-----+-----+
|
||||
| | |____________|.....|%%%%%|:::::|%%%%%|:::::|%%%%%|:::::|%%%%%|
|
||||
| | Plane 1|.....|%%%%%|:::::|%%%%%|:::::|%%%%%|:::::|%%%%%|
|
||||
| | +-----+-----+-----+-----+-----+-----+-----+-----+
|
||||
| | | | | | | | | |
|
||||
| | +-----+-----+-----+-----+-----+-----+-----+-----+
|
||||
| |__________________|.....|%%%%%|:::::|%%%%%|:::::|%%%%%|:::::|%%%%%|
|
||||
| Plane 2|.....|%%%%%|:::::|%%%%%|:::::|%%%%%|:::::|%%%%%|
|
||||
| +-----+-----+-----+-----+-----+-----+-----+-----+
|
||||
| | | | | | | | |
|
||||
| +-----+-----+-----+-----+-----+-----+-----+-----+
|
||||
|________________________|.....|%%%%%|:::::|%%%%%|:::::|%%%%%|:::::|%%%%%|
|
||||
Plane 3|.....|%%%%%|:::::|%%%%%|:::::|%%%%%|:::::|%%%%%|
|
||||
+-----+-----+-----+-----+-----+-----+-----+-----+
|
||||
| | | | | | | |
|
||||
|
||||
Pixel: 0 1 2 3 4 5 6 7
|
||||
|
||||
<-------- Direction of Shift
|
||||
|
||||
381
specs/freevga/vga/seqreg.htm
Normal file
@@ -0,0 +1,381 @@
|
||||
<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 other low-level stuff.)">
|
||||
<META NAME="KeyWords" CONTENT="VGA SVGA hardware video programming">
|
||||
<TITLE>VGA/SVGA Video Programming--Sequencer Registers</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="../home.htm">Home</A> <A HREF="vga.htm#register">Back</A>
|
||||
<HR WIDTH="100%"><B>Hardware Level VGA and SVGA Video Programming Information
|
||||
Page</B></CENTER>
|
||||
|
||||
<CENTER>Sequencer Registers
|
||||
<HR WIDTH="100%"></CENTER>
|
||||
|
||||
|
||||
<P> The Sequencer Registers are
|
||||
accessed via a pair of registers, the Sequencer Address Register and the
|
||||
Sequencer Data Register. See the <A HREF="vgareg.htm">Accessing the VGA
|
||||
Registers</A> section for more detals. The Address Register is located
|
||||
at port 3C4h and the Data Register is located at port 3C5h.
|
||||
<UL>
|
||||
<LI>
|
||||
Index 00h -- <I>Reset Register</I></LI>
|
||||
|
||||
<LI>
|
||||
Index 01h -- <I>Clocking Mode Register</I></LI>
|
||||
|
||||
<LI>
|
||||
Index 02h -- <I>Map Mask Register</I></LI>
|
||||
|
||||
<LI>
|
||||
Index 03h -- Character Map Select Register</LI>
|
||||
|
||||
<LI>
|
||||
Index 04h -- <I>Sequencer Memory Mode Register</I></LI>
|
||||
</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="00"></A><B>Reset Register (Index 00h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75">SR</TD>
|
||||
|
||||
<TD WIDTH="75">AR</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL><B>SR -- Sychnronous Reset</B>
|
||||
<BR>"<I>When set to 0, this bit commands the sequencer to synchronously
|
||||
clear and halt. Bits 1 and 0 must be 1 to allow the sequencer to operate.
|
||||
To prevent the loss of data, bit 1 must be set to 0 during the active display
|
||||
interval before changing the clock selection. The clock is changed through
|
||||
the Clocking Mode register or the Miscellaneous Output register.</I>"
|
||||
<BR><B>AR -- Asynchronous Reset</B>
|
||||
<BR>"<I>When set to 0, this bit commands the sequencer to asynchronously
|
||||
clear and halt. Resetting the sequencer with this bit can cause loss of
|
||||
video data</I>"</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="01"></A><B>Clocking Mode Register (Index 01h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75">SD</TD>
|
||||
|
||||
<TD WIDTH="75">S4</TD>
|
||||
|
||||
<TD WIDTH="75">DCR</TD>
|
||||
|
||||
<TD WIDTH="75">SLR</TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75">9/8DM</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL><B>SD -- Screen Disable</B>
|
||||
<BR>"<I>When set to 1, this bit turns off the display and assigns maximum
|
||||
memory bandwidth to the system. Although the display is blanked, the synchronization
|
||||
pulses are maintained. This bit can be used for rapid full-screen updates.</I>"
|
||||
<BR><B>S4 -- Shift Four Enable</B>
|
||||
<BR>"<I>When the Shift 4 field and the Shift Load Field are set to 0, the
|
||||
video serializers are loaded every character clock. When the Shift 4 field
|
||||
is set to 1, the video serializers are loaded every forth character clock,
|
||||
which is useful when 32 bits are fetched per cycle and chained together
|
||||
in the shift registers.</I>"
|
||||
<BR><B>DCR -- Dot Clock Rate</B>
|
||||
<BR>"<I>When set to 0, this bit selects the normal dot clocks derived from
|
||||
the sequencer master clock input. When this bit is set to 1, the master
|
||||
clock will be divided by 2 to generate the dot clock. All other timings
|
||||
are affected because they are derived from the dot clock. The dot clock
|
||||
divided by 2 is used for 320 and 360 horizontal PEL modes.</I>"
|
||||
<BR><B>SLR -- Shift/Load Rate</B>
|
||||
<BR>"<I>When this bit and bit 4 are set to 0, the video serializers are
|
||||
loaded every character clock. When this bit is set to 1, the video serializers
|
||||
are loaded every other character clock, which is useful when 16 bits are
|
||||
fetched per cycle and chained together in the shift registers. The Type
|
||||
2 video behaves as if this bit is set to 0; therefore, programs should
|
||||
set it to 0.</I>"
|
||||
<LI>
|
||||
<B>9/8DM -- 9/8 Dot Mode</B></LI>
|
||||
|
||||
<BR>This field is used to select whether a character is 8 or 9 dots wide.
|
||||
This can be used to select between 720 and 640 pixel modes (or 360 and
|
||||
320) and also is used to provide 9 bit wide character fonts in text mode.
|
||||
The possible values for this field are:
|
||||
<UL>
|
||||
<LI>
|
||||
0 - Selects 9 dots per character.</LI>
|
||||
|
||||
<LI>
|
||||
1 - Selects 8 dots per character.</LI>
|
||||
</UL>
|
||||
</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="02"></A><B>Map Mask Register (Index 02h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD COLSPAN="4" WIDTH="300">Memory Plane Write Enable</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<B>Memory Plane Write Enable</B></LI>
|
||||
|
||||
<BR>Bits 3-0 of this field correspond to planes 3-0 of the VGA display
|
||||
memory. If a bit is set, then write operations will modify the respective
|
||||
plane of display memory. If a bit is not set then write operations will
|
||||
not affect the respective plane of display memory.</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="03"></A><B>Character Map Select Register (Index
|
||||
03h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75">CSAS2</TD>
|
||||
|
||||
<TD WIDTH="75">CSBS2</TD>
|
||||
|
||||
<TD COLSPAN="2" WIDTH="150">Character Set A Select</TD>
|
||||
|
||||
<TD COLSPAN="2" WIDTH="150">Character Set B Select</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<B>CSAS2 -- Bit 2 of Character Set A Select</B></LI>
|
||||
|
||||
<BR>This is bit 2 of the Character Set A Select field. See <A HREF="#03">Character
|
||||
Set A Select</A> below.
|
||||
<LI>
|
||||
<B>CSBS2 -- Bit 2 of Character Set B Select</B></LI>
|
||||
|
||||
<BR>This is bit 2 of the Character Set B field. See <A HREF="#03">Character
|
||||
Set B Select</A> below.
|
||||
<LI>
|
||||
<B>Character Set A Select</B></LI>
|
||||
|
||||
<BR>This field is used to select the font that is used in text mode when
|
||||
bit 3 of the attribute byte for a character is set to 1. Note that this
|
||||
field is not contiguous in order to provide EGA compatibility. The font
|
||||
selected resides in plane 2 of display memory at the address specified
|
||||
by this field, as follows:
|
||||
<UL>
|
||||
<LI>
|
||||
000b -- Select font residing at 0000h - 1FFFh</LI>
|
||||
</UL>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
001b -- Select font residing at 4000h - 5FFFh</LI>
|
||||
|
||||
<LI>
|
||||
010b -- Select font residing at 8000h - 9FFFh</LI>
|
||||
|
||||
<LI>
|
||||
011b -- Select font residing at C000h - DFFFh</LI>
|
||||
|
||||
<LI>
|
||||
100b -- Select font residing at 2000h - 3FFFh</LI>
|
||||
|
||||
<LI>
|
||||
101b -- Select font residing at 6000h - 7FFFh</LI>
|
||||
|
||||
<LI>
|
||||
110b -- Select font residing at A000h - BFFFh</LI>
|
||||
|
||||
<LI>
|
||||
111b -- Select font residing at E000h - FFFFh</LI>
|
||||
</UL>
|
||||
|
||||
<LI>
|
||||
<B>Character Set B Select</B></LI>
|
||||
|
||||
<BR>This field is used to select the font that is used in text mode when
|
||||
bit 3 of the attribute byte for a character is set to 0. Note that this
|
||||
field is not contiguous in order to provide EGA compatibility. The font
|
||||
selected resides in plane 2 of display memory at the address specified
|
||||
by this field, identical to the mapping used by <A HREF="#03">Character
|
||||
Set A Select</A> above.</UL>
|
||||
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><A NAME="04"></A><B>Sequencer Memory Mode Register (Index
|
||||
04h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD WIDTH="75">Chain 4</TD>
|
||||
|
||||
<TD WIDTH="75">O/E Dis.</TD>
|
||||
|
||||
<TD WIDTH="75">Ext. Mem</TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<UL><B>Chain 4 -- Chain 4 Enable</B>
|
||||
<BR>"<I>This bit controls the map selected during system read operations.
|
||||
When set to 0, this bit enables system addresses to sequentially access
|
||||
data within a bit map by using the Map Mask register. When setto 1, this
|
||||
bit causes the two low-order bits to select the map accessed as shown below.</I>
|
||||
<BR><I>Address Bits</I>
|
||||
<BR><I> A0 A1
|
||||
Map Selected</I>
|
||||
<BR><I> 0 0
|
||||
0</I>
|
||||
<BR><I> 0 1
|
||||
1</I>
|
||||
<BR><I> 1 0
|
||||
2</I>
|
||||
<BR><I> 1 1
|
||||
3</I>"
|
||||
<BR><B>O/E Dis. -- Odd/Even Host Memory Write Adressing Disable<BR>
|
||||
</B>"<I>When this bit is set to 0, even system addresses access maps 0
|
||||
and 2, while odd system addresses access maps 1 and 3. When this bit is
|
||||
set to 1, system addresses sequentially access data within a bit map, and
|
||||
the maps are accessed according to the value in the Map Mask register (index
|
||||
0x02).</I>"
|
||||
<BR><B>Ext. Mem -- Extended Memory<BR>
|
||||
</B>"<I>When set to 1, this bit enables the video memory from 64KB to 256KB.
|
||||
This bit must be set to 1 to enable the character map selection described
|
||||
for the previous register.</I>"</UL>
|
||||
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>.
|
||||
</BODY>
|
||||
</HTML>
|
||||
137
specs/freevga/vga/textcur.htm
Normal file
@@ -0,0 +1,137 @@
|
||||
<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>
|
||||
226
specs/freevga/vga/vga.htm
Normal file
@@ -0,0 +1,226 @@
|
||||
<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--Standard VGA Chipset Reference</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="../home.htm">Home</A> <A HREF="#intro">Intro</A> <A HREF="#general">General</A>
|
||||
<A HREF="#register">Registers</A> <A HREF="#index">Index</A> <A HREF="../home.htm#vga">Back</A>
|
||||
<HR WIDTH="100%"><B>Hardware Level VGA and SVGA Video Programming Information
|
||||
Page</B></CENTER>
|
||||
|
||||
<CENTER>VGA Chipset Reference
|
||||
<HR WIDTH="100%"></CENTER>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="#intro">Introduction</A> -- introduction to the VGA reference</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#general">General Programming Information</A> -- details of the
|
||||
functional operation of the VGA hardware.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#register">Input/Output Register Information</A> -- details on
|
||||
the VGA registers themselves</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#index">Indices</A> -- convenient listings of fields and their
|
||||
locations alphabetically and by function</LI>
|
||||
</UL>
|
||||
<A NAME="intro"></A><B>Introduction</B>
|
||||
<BR> This section is intended
|
||||
to be a reference to the common functionality of the original IBM VGA and
|
||||
compatible adapters. If you are writing directly to hardware then this
|
||||
is the lowest common denominator of nearly all video cards in use today.
|
||||
Nearly all programs requiring the performance of low-level hardware access
|
||||
resort to this baseline capacity, so this information is still valuable
|
||||
to programmers. In addition most of the VGA functions apply to SVGA cards
|
||||
when operating in SVGA modes, so it is best to know how to use them even
|
||||
when programming more advanced hardware.
|
||||
<BR> Most VGA references I have
|
||||
seen document the VGA by describing its operation in the various BIOS modes.
|
||||
However, because BIOS was designed for use in MS-DOS real mode applications,
|
||||
its functionality is limited in other environments. This document is structured
|
||||
in a way that explains the VGA hardware and its operation independent of
|
||||
the VGA BIOS modes, which will allow for better understanding of the capabilities
|
||||
of the VGA hardware.
|
||||
<BR> This reference has grown
|
||||
out of my own notes and experimentation while learning to program the VGA
|
||||
hardware. During this process I have identified errors in various references
|
||||
that I have used and have attempted to document the VGA hardware's actual
|
||||
behavior as best as possible. If in your experience you find any of this
|
||||
information to be inaccurate, or even if you find this information to be
|
||||
misleading or inaccurate, please let me know!
|
||||
<BR> One of the reasons I started
|
||||
this reference was that I was using existing references and found myself
|
||||
wishing for a hypertext reference as almost every register is affected
|
||||
by the operation of another, and was constantly flipping pages. Here I
|
||||
simply use links for the register references, such as <A HREF="crtcreg.htm#13">Offset
|
||||
Register</A>, rather than stating something like: Offset Register (CRTC:
|
||||
Offset = 13h, bits 7-0). While the second method is more informative, using
|
||||
them for every reference to the register makes the text somewhat bogged
|
||||
down. HTML allows simply clicking on the register name and all of the details
|
||||
are provided. Another is that no single reference had all of the information
|
||||
I was looking for, and that I had penciled many corrections and clarifications
|
||||
into the references themselves. This makes it difficult to switch to a
|
||||
newer version of a book when another edition comes out -- I still use my
|
||||
heavily annotated second edition of Ferarro's book, rather than the more
|
||||
up-to-date third edition.
|
||||
|
||||
<P><A NAME="general"></A><B>General Programming Information</B>
|
||||
<BR><B> </B>This section is intended
|
||||
to provide functional information on various aspects of the VGA. If you
|
||||
are looking simply for VGA register descriptions look in the next section.
|
||||
The VGA hardware is complex and can be confusing to program. Rather than
|
||||
attempt to document the VGA better than existing references by using more
|
||||
words to describe the registers, this section breaks down the functionality
|
||||
of the VGA into specific categories of similar functions or by detailing
|
||||
procedures for performing certain operations.
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="vgamem.htm">Accessing the VGA Display Memory</A> -- details on
|
||||
the memory interface between the CPU and VGA frame buffer.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="vgaseq.htm">Sequencer Operation</A> -- details on how the VGA
|
||||
hardware rasterizes the display buffer</LI>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
Text-mode</LI>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="vgatext.htm">VGA Text Mode Operation</A> -- details concerning
|
||||
text mode operation, including attributes and fonts.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="textcur.htm">Manipulating the Text-mode Cursor</A> -- details
|
||||
controlling the appearance and location of the cursor.</LI>
|
||||
</UL>
|
||||
</UL>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="vgafx.htm">Special Effects Hardware</A> -- details on hardware
|
||||
support for windowing, paging, smooth scrolling and panning, and split-screen
|
||||
operation.</LI>
|
||||
</UL>
|
||||
|
||||
<LI>
|
||||
<A HREF="vgaattr.htm">Attribute Controller Operation</A> -- details on
|
||||
the conversion of sequenced display data into DAC input. <B>(WIP)</B></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="vgadac.htm">DAC Operation</A> -- details controlling the conversion
|
||||
of palette data into analog signals.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="vgacrtc.htm">Display Generation</A> -- details on formatting of
|
||||
the produced video signal for output to the display.</LI>
|
||||
</UL>
|
||||
<A NAME="register"></A><B>Input/Output Register Information</B>
|
||||
<BR> This section is intended
|
||||
to provide a detailed reference of the VGA's internal registers. It attempts
|
||||
to combine information from a variety of sources, including the references
|
||||
listed in the reference section of the home page; however, rather than
|
||||
attempting to condense this information into one reference, leaving out
|
||||
significant detail, I have attempted to expand upon the information available
|
||||
and provide an accurate, detailed reference that should be useful to any
|
||||
programmer of the VGA and SVGA. Only those registers that are present and
|
||||
functional on the VGA are given, so if you are seeking information specific
|
||||
to the CGA, EGA, MCGA, or MGA adapters try the Other References section
|
||||
on the home page.
|
||||
<BR> In some cases I have changed
|
||||
the name of the register, not to protect the innocent but simply to make
|
||||
it clearer to understand. One clarification is the use of "Enable" and
|
||||
"Disable". A the function of a field with the name ending with "Enable"
|
||||
is enabled when it is 1, and likewise a field with a name ending in Disable
|
||||
is disabled when it is 1. Another case is when two fields have similar
|
||||
or identical names, I have added more description to the name to differentiate
|
||||
them.
|
||||
<BR> It can be difficult to understand
|
||||
how to manipulate the VGA registers as many registers have been packed
|
||||
into a small number of I/O ports and accessing them can be non-intuituve,
|
||||
especially the Attribute Controller Registers, so I have provided a tutorial
|
||||
for doing this.
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="vgareg.htm">Accessing the VGA Registers</A> -- methods of
|
||||
manipulating the VGA registers</LI>
|
||||
</UL>
|
||||
In order to facilitate understanding
|
||||
of the registers, one should view them as groups of similar registers,
|
||||
based upon how they are accessed, as the VGA uses indexed registers to
|
||||
access most parameters. This also roughly places them in groups of similar
|
||||
functionality; however, in many cases the fields do not fit neatly into
|
||||
their category. In certain cases I have utilized quotes from the IBM VGA
|
||||
Programmer's Reference, this information is given in "<I>italic.</I>"
|
||||
This is meant to be a temporary placeholder until a better description
|
||||
can be written, it may not be applicable to a standard VGA implementation.
|
||||
Presented to roughly based upon their place in the graphics pipeline between
|
||||
the CPU and the video outputs are the:
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="graphreg.htm">Graphics Registers</A> -- control the way the CPU
|
||||
accesses video RAM.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="seqreg.htm">Sequencer Registers</A> -- control how video data
|
||||
is sent to the DAC.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="attrreg.htm">Attribute Controller Registers</A> -- selects the
|
||||
16 color and 64 color palettes used for EGA/CGA compatibility.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="crtcreg.htm">CRT Controller Registers</A> -- control how the video
|
||||
is output to the display.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="colorreg.htm">Color Registers</A> -- selects the 256 color palette
|
||||
from the maximum possible colors.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="extreg.htm">External Registers</A> -- miscellaneous registers
|
||||
used to control video operation.</LI>
|
||||
</UL>
|
||||
<A NAME="index"></A><B>Indices</B>
|
||||
<BR> In order to locate a particular
|
||||
register quickly, the following indexes are provided. The first is a listing
|
||||
of all of the register fields of the VGA hardware. This is especially useful
|
||||
for fields that are split among multiple registers, or for finding the
|
||||
location of a field that are packed in with other fields in one register.
|
||||
The second is indexed by function groups each pertaining to a particular
|
||||
part of the VGA hardware. This makes understanding and programming the
|
||||
VGA hardware easier by listing the fields by subsystem, as the VGA's fields
|
||||
are grouped in a somewhat haphazard fashion. The third is intended for
|
||||
matching a read or write to a particular I/O port address to the section
|
||||
where it is described.
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="vgargidx.htm">VGA Field Index</A> -- An alphabetical listing of
|
||||
all fields and links to their location.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="vgafunc.htm">VGA Functional Index</A> -- A listing of all fields
|
||||
and links to their location grouped by function.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="portidx.htm">VGA I/O Port Index</A> -- A listing of VGA I/O ports
|
||||
in numerical order.</LI>
|
||||
</UL>
|
||||
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>.
|
||||
|
||||
<P>
|
||||
</BODY>
|
||||
</HTML>
|
||||
210
specs/freevga/vga/vgacrtc.htm
Normal file
@@ -0,0 +1,210 @@
|
||||
<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>FreeVGA - VGA Display Generation</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="../home.htm">Home</A> <A HREF="#intro">Intro</A> <A HREF="#clocks">Clocks</A>
|
||||
<A HREF="#horiz">Horizontal</A> <A HREF="#vert">Vertical</A> <A HREF="#monitor">Monitoring</A>
|
||||
<A HREF="#misc">Misc</A> <A HREF="vga.htm#general">Back</A>
|
||||
<HR><B>Hardware Level VGA and SVGA Video Programming Information Page</B></CENTER>
|
||||
|
||||
<CENTER>VGA Display Generation
|
||||
<HR></CENTER>
|
||||
<A NAME="intro"></A><B>Introduction</B>
|
||||
<BR> This page documents the
|
||||
configuration of the VGA's CRTC registers which control the framing and
|
||||
timing of video signals sent to the display device, usually a monitor.
|
||||
|
||||
<P><A NAME="clocks"></A><B>Dot Clocks</B>
|
||||
<BR> The standard VGA has two
|
||||
"standard" dot clock frequencies available to it, as well as a possible
|
||||
"external" clock source, which is implementation dependent. The two
|
||||
standard clock frequencies are nominally 25 Mhz and 28 MHz. Some
|
||||
chipsets use 25.000 MHz and 28.000 MHz, while others use slightly greater
|
||||
clock frequencies. The IBM VGA chipset I have uses 25.1750 MHz
|
||||
Mhz and 28.3220 crystals. Some newer cards use the closest generated
|
||||
frequency produced by their clock chip. In most circumstances the
|
||||
IBM VGA timings can be assumed as the monitor should allow an amount of
|
||||
variance; however, if you know the actual frequencies used you should use
|
||||
them in your timing calculations.
|
||||
<BR> The dot clock source in
|
||||
the VGA hardware is selected using the <A HREF="extreg.htm#3CCR3C2W">Clock
|
||||
Select</A> field. For the VGA, two of the values are undefined; some
|
||||
SVGA chipsets use the undefined values for clock frequencies used for 132
|
||||
column mode and such. The 25 MHz clock is designed for 320 and 640
|
||||
pixel modes and the 28 MHz is designed for 360 and 720 pixel modes. The
|
||||
<A HREF="seqreg.htm#01">Dot Clock Rate</A> field specifies whether to use
|
||||
the dot clock source directly or to divide it in half before using it as
|
||||
the actual dot clock rate.
|
||||
|
||||
<P><A NAME="horiz"></A><B>Horizontal Timing</B>
|
||||
<BR> The VGA measures horizontal
|
||||
timing periods in terms of character clocks, which can either be 8 or 9
|
||||
dot clocks, as specified by the <A HREF="seqreg.htm#01">9/8 Dot Mode</A>
|
||||
field. The 9 dot clock mode was included for monochrome emulation
|
||||
and 9-dot wide character modes, and can be used to provide 360 and 720
|
||||
pixel wide modes that work on all standard VGA monitors, when combined
|
||||
with a 28 Mhz dot clock. The VGA uses a horizontal character counter which
|
||||
is incremented at each character, which the horizontal timing circuitry
|
||||
compares against the values of the horizontal timing fields to control
|
||||
the horizontal state. The horizontal periods that are controlled are the
|
||||
active display, overscan, blanking, and refresh periods.
|
||||
<BR> The start of the active
|
||||
display period coincides with the resetting of the horizontal character
|
||||
counter, thus is fixed at zero. The value at which the horizontal
|
||||
character is reset is controlled by the <A HREF="crtcreg.htm#00">Horizontal
|
||||
Total</A> field. Note, however, that the value programmed into the <A HREF="crtcreg.htm#00">Horizontal
|
||||
Total</A> field is actually 5 less than the actual value due to timing
|
||||
concerns.
|
||||
<BR> The end of the active display
|
||||
period is controlled by the <A HREF="crtcreg.htm#01">End Horizontal Display</A>
|
||||
field. When the horizontal character counter is equal to the value
|
||||
of this field, the sequencer begins outputting the color specified by the
|
||||
<A HREF="attrreg.htm#11">Overscan Palette Index</A> field. This continues
|
||||
until the active display begins at the beginning of the next scan line
|
||||
when the active display begins again. Note that the horizontal blanking
|
||||
takes precedence over the sequencer and attribute controller.
|
||||
<BR> The horizontal blanking
|
||||
period begins when the character clock equals the value of the <A HREF="crtcreg.htm#02">Start
|
||||
Horizontal Blanking</A> field. During the horizontal blanking period,
|
||||
the output voltages of the DAC signal the monitor to turn off the guns.
|
||||
Under normal conditions, this prevents the overscan color from being displayed
|
||||
during the horizontal retrace period. This period extends until the
|
||||
lower 6 bits of the <A HREF="crtcreg.htm#03">End Horizontal Blanking</A>
|
||||
field match the lower 6 bits of the horizontal character counter.
|
||||
This allows for a blanking period from 1 to 64 character clocks, although
|
||||
some implementations may treat 64 as 0 character clocks in length.
|
||||
The blanking period may occur anywhere in the scan line, active display
|
||||
or otherwise even though its meant to appear outside the active display
|
||||
period. It takes precedence over all other VGA output. There
|
||||
is also no requirement that blanking occur at all. If the <A HREF="crtcreg.htm#02">Start
|
||||
Horizontal Blanking</A> field falls outside the maximum value of the character
|
||||
clock determined by the <A HREF="crtcreg.htm#00">Horizontal Total</A> field,
|
||||
then no blanking will occur at all. Note that due to the setting
|
||||
of the <A HREF="crtcreg.htm#00">Horizontal Total</A> field, the first match
|
||||
for the <A HREF="crtcreg.htm#03">End Horizontal Blanking</A> field may
|
||||
be on the following scan line.
|
||||
<BR> Similar to the horizontal
|
||||
blanking period, the horizontal retrace period is specified by the <A HREF="crtcreg.htm#04">Start
|
||||
Horizontal Retrace</A> and <A HREF="crtcreg.htm#05">End Horizontal Retrace</A>
|
||||
fields. The horizontal retrace period begins when the character clock equals
|
||||
the value stored in the <A HREF="crtcreg.htm#04">Start Horizontal Retrace</A>
|
||||
field. The horizontal retrace ends when the lower 5 bits of the character
|
||||
clock match the bit pattern stored in the <A HREF="crtcreg.htm#05">End
|
||||
Horizontal Retrace</A> field, allowing a retrace period from 1 to 32 clocks;
|
||||
however, a particular implementation may treat 32 clocks as zero clocks
|
||||
in length. The operation of this is identical to that of the horizontal
|
||||
blanking mechanism with the exception of being a 5 bit comparison instead
|
||||
of 6, and affecting the horizontal retrace signal instead of the horizontal
|
||||
blanking.
|
||||
<BR> There are two horizontal
|
||||
timing fields that are described as being related to internal timings of
|
||||
the VGA, the <A HREF="crtcreg.htm#03">Display Enable Skew</A> and <A HREF="crtcreg.htm#05">Horizontal
|
||||
Retrace Skew</A> fields. In the VGA they do seem to affect the timing,
|
||||
but also do not seem to be necessary for the operation of the VGA and are
|
||||
pretty much unused. These registers were required by the IBM VGA
|
||||
implementations, so I'm assuming this was added in the early stages of
|
||||
the VGA design for EGA compatibility, but the internal timings were changed
|
||||
to more friendly ones making the use of these fields unnecessary.
|
||||
It seems to be totally safe to set these fields to 0 and ignore them.
|
||||
See the register descriptions for more details, if you have to deal with
|
||||
software that programs them.
|
||||
|
||||
<P><A NAME="vert"></A><B>Vertical Timing</B>
|
||||
<BR> The VGA maintains a scanline
|
||||
counter which is used to measure vertical timing periods. This counter
|
||||
begins at zero which coincides with the first scan line of the active display.
|
||||
This counter is set to zero before the beginning of the first scanline
|
||||
of the active display. Depending on the setting of the <A HREF="crtcreg.htm#17">Divide
|
||||
Scan Line Clock by 2</A> field, this counter is incremented either every
|
||||
scanline, or every second scanline. The vertical scanline counter
|
||||
is incremented before the beginning of each horizontal scan line, as all
|
||||
of the VGA's vertical timing values are measured at the beginning of the
|
||||
scan line, after the counter has ben set/incremented. The maximum
|
||||
value of the scanline counter is specified by the <A HREF="crtcreg.htm#06">Vertical
|
||||
Total</A> field. Note that, like the rest of the vertical timing
|
||||
values that "overflow" an 8-bit register, the most significant bits are
|
||||
located in the <A HREF="crtcreg.htm#07">Overflow Register</A>. The
|
||||
<A HREF="crtcreg.htm#06">Vertical Total</A> field is programmed with the
|
||||
value of the scanline counter at the beginning of the last scanline.
|
||||
<BR> The vertical active display
|
||||
period begins when the scanline counter is at zero, and extends up to the
|
||||
value specified by the <A HREF="crtcreg.htm#12">Vertical Display End</A>
|
||||
field. This field is set with the value of the scanline counter at
|
||||
the beginning of the first inactive scanline, telling the video hardware
|
||||
when to stop outputting scanlines of sequenced pixel data and outputs the
|
||||
attribute specified by the <A HREF="attrreg.htm#11">Overscan Palette Index</A>
|
||||
field in the horizontal active display period of those scanlines.
|
||||
This continues until the start of the next frame when the active display
|
||||
begins again.
|
||||
<BR> The <A HREF="crtcreg.htm#15">Start
|
||||
Vertical Blanking</A> and <A HREF="crtcreg.htm#16">End Vertical Blanking</A>
|
||||
fields control the vertical blanking interval. The <A HREF="crtcreg.htm#15">Start
|
||||
Vertical Blanking</A> field is programmed with the value of the scanline
|
||||
counter at the beginning of the scanline to begin blanking at. The
|
||||
value of the <A HREF="crtcreg.htm#16">End Vertical Blanking</A> field is
|
||||
set to the lower eight bits of the scanline counter at the beginning of
|
||||
the scanline after the last scanline of vertical blanking.
|
||||
<BR> The <A HREF="crtcreg.htm#10">Vertical
|
||||
Retrace Start</A> and <A HREF="crtcreg.htm#11">Vertical Retrace End</A>
|
||||
fields determine the length of the vertical retrace interval. The
|
||||
<A HREF="crtcreg.htm#10">Vertical Retrace Start</A> field contains the
|
||||
value of the scanline counter at the beginning of the first scanline where
|
||||
the vertical retrace signal is asserted. The <A HREF="crtcreg.htm#11">Vertical
|
||||
Retrace End</A> field is programmed with the value of the lower four bits
|
||||
of the scanline counter at the beginning of the scanline after the last
|
||||
scanline where the vertical retrace signal is asserted.
|
||||
|
||||
<P><A NAME="monitor"></A><B>Monitoring Timing</B>
|
||||
<BR> There are certain operations
|
||||
that should be performed during certain periods of the display cycle to
|
||||
minimize visual artifacts, such as attribute and DAC writes. There
|
||||
are two bit fields that return the current state of the VGA, the <A HREF="extreg.htm#3xAR">Display
|
||||
Disabled</A> and <A HREF="extreg.htm#3xAR">Vertical Retrace</A> fields.
|
||||
The <A HREF="extreg.htm#3xAR">Display Disabled</A> field is set to 1 when
|
||||
the display enable signal is not asserted, providing the programmer with
|
||||
a means to determine if the video hardware is currently refreshing the
|
||||
active display or it is currently outputting blanking.
|
||||
<BR> The <A HREF="extreg.htm#3xAR">Vertical
|
||||
Retrace</A> field signals whether or not the VGA is in a vertical retrace
|
||||
period. This is useful for determining the end of a display period,
|
||||
which can be used by applications that need to update the display every
|
||||
period such as when doing animation. Under normal conditions, when
|
||||
the blanking signal is asserted during the entire vertical retrace, this
|
||||
can also be used to detect this period of blanking, such that a large amount
|
||||
of register accesses can be performed, such as reloading the complete set
|
||||
of DAC entries.
|
||||
|
||||
<P><A NAME="misc"></A><B>Miscellaneous</B>
|
||||
<BR> There are a few registers
|
||||
that affect display generation, but don't fit neatly into the horizontal
|
||||
or vertical timing categories. The first is the <A HREF="crtcreg.htm#17">Sync
|
||||
Enable</A> field which controls whether the horizontal and vertical sync
|
||||
signals are sent to the display or masked off. The sync signals should
|
||||
be disabled while setting up a new mode to ensure that an improper signal
|
||||
that could damage the display is not being output. Keeping the sync
|
||||
disabled for a period of one or more frames helps the display determine
|
||||
that a mode change has occurred as well.
|
||||
<BR> The <A HREF="crtcreg.htm#11">Memory Refresh Bandwidth</A>
|
||||
field is used by the original IBM VGA hardware and some compatible VGA/SVGA
|
||||
chipsets to control how often the display memory is refreshed. This
|
||||
field controls whether the VGA hardware provides 3 or 5 memory refresh
|
||||
cycles per scanline. At or above VGA horizontal refresh rates, this
|
||||
field should be programmed for 3 memory refresh cycles per scanline.
|
||||
Below this rate, for compatibility's sake the 5 memory refresh cycles per
|
||||
scanline setting might be safer, see the <A HREF="crtcreg.htm#11">Memory
|
||||
Refresh Bandwidth</A> field for (slightly) more information.
|
||||
|
||||
<P>
|
||||
<BR>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>.
|
||||
</BODY>
|
||||
</HTML>
|
||||
190
specs/freevga/vga/vgadac.htm
Normal file
@@ -0,0 +1,190 @@
|
||||
<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--DAC Operation</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="../home.htm">Home</A> <A HREF="#intro">Intro</A> <A HREF="#DAC">DAC</A>
|
||||
<A HREF="#programming">Programming</A> <A HREF="#precautions">Precautions</A>
|
||||
<A HREF="#flicker">Flicker</A> <A HREF="#state">State</A> <A HREF="vga.htm#general">Back</A>
|
||||
<HR WIDTH="100%"><B>Hardware Level VGA and SVGA Video Programming Information
|
||||
Page</B></CENTER>
|
||||
|
||||
<CENTER>DAC Operation
|
||||
<HR WIDTH="100%"></CENTER>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="#intro">Introduction</A> -- details the standard VGA DAC capabilities.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#DAC">DAC Subsystem</A> -- gives a description of the DAC hardware.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#programming">Programming the DAC</A> -- details reading and writing
|
||||
to DAC memory.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#precautions">Programming Precautions</A> -- details potential
|
||||
problems that can be encountered with DAC hardware.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#flicker">Eliminating Flicker</A> -- details on how to manipulate
|
||||
DAC memory without causing visible side-effects.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#state">The DAC State</A> -- details one possible use for an otherwise
|
||||
useless field</LI>
|
||||
</UL>
|
||||
<A NAME="intro"></A><B>Introduction</B>
|
||||
<BR> One of the improvements
|
||||
the VGA has over the EGA hardware is in the amount of possible colors that
|
||||
can be generated, in addition to an increase in the amount of colors that
|
||||
can be displayed at once. The VGA hardware has provisions for up to 256
|
||||
colors to be displayed at once, selected from a range of 262,144 (256K)
|
||||
possible colors. This capability is provided by the DAC subsystem, which
|
||||
accepts attribute information for each pixel and converts it into an analog
|
||||
signal usable by VGA displays.
|
||||
|
||||
<P><A NAME="DAC"></A><B>DAC Subsystem</B>
|
||||
<BR> The VGA's DAC subsystem
|
||||
accepts an 8 bit input from the attribute subsystem and outputs an analog
|
||||
signal that is presented to the display circuitry. Internally it contains
|
||||
256 18-bit memory locations that store 6 bits each of red, blue, and green
|
||||
signal levels which have values ranging from 0 (minimum intensity) to 63
|
||||
(maximum intensity.) The DAC hardware takes the 8-bit value from the attribute
|
||||
subsystem and uses it as an index into the 256 memory locations and obtains
|
||||
a red, green, and blue triad and produces the necessary output.
|
||||
<BR> Note -- the DAC subsystem
|
||||
can be implemented in a number of ways, including discrete components,
|
||||
in a DAC chip which may or may not contain internal ram, or even integrated
|
||||
into the main chipset ASIC itself. Many modern DAC chipsets include additional
|
||||
functionality such as hardware cursor support, extended color mapping,
|
||||
video overlay, gamma correction, and other functions. Partly because of
|
||||
this it is difficult to generalize the DAC subsystem's exact behavior.
|
||||
This document focuses on the common functionality of all VGA DACs; functionality
|
||||
specific to a particular chipset are described elsewhere.
|
||||
|
||||
<P><A NAME="programming"></A><B>Programming the DAC</B>
|
||||
<BR> The DAC's primary host interface
|
||||
(there may be a secondary non-VGA compatible access method) is through
|
||||
a set of four external registers containing the <A HREF="colorreg.htm#3C8">DAC
|
||||
Write Address</A>, the <A HREF="colorreg.htm#3C7W">DAC Read Address</A>,
|
||||
the <A HREF="colorreg.htm#3C9">DAC Data</A>, and the <A HREF="colorreg.htm#3C7R">DAC
|
||||
State</A> fields. The DAC memory is accessed by writing an index value
|
||||
to the <A HREF="colorreg.htm#3C8">DAC Write Address</A> field for write
|
||||
operations, and to the <A HREF="colorreg.htm#3C7W">DAC Read Address</A>
|
||||
field for read operations. Then reading or writing the <A HREF="colorreg.htm#3C9">DAC
|
||||
Data</A> field, depending on the selected operation, three times in succession
|
||||
returns 3 bytes, each containing 6 bits of red, green, and blue intensity
|
||||
values, with red being the first value and blue being the last value read/written.
|
||||
The read or write index then automatically increments such that the next
|
||||
entry can be read without having to reprogramming the address. In this
|
||||
way, the entire DAC memory can be read or written in 768 consecutive I/O
|
||||
cycles to/from the <A HREF="colorreg.htm#3C9">DAC Data</A> field. The <A HREF="colorreg.htm#3C7R">DAC
|
||||
State</A> field reports whether the DAC is setup to accept reads or writes
|
||||
next.
|
||||
|
||||
<P><A NAME="precautions"></A><B>Programming Precautions</B>
|
||||
<BR> Due to the variances in
|
||||
the different implementations, programming the DAC takes extra care to
|
||||
ensure proper operation across the range of possible implementations. There
|
||||
are a number of things can cause undesired effects, but the simplest way
|
||||
to avoid problems is to ensure that you program the <A HREF="colorreg.htm#3C7W">DAC
|
||||
Read Address</A> field or the <A HREF="colorreg.htm#3C8">DAC Write Address</A>
|
||||
field before each read operation (note that a read operation may include
|
||||
reads/writes to multiple DAC memory entries.) And always perform writes
|
||||
and reads in groups of 3 color values. The DAC memory may not be updated
|
||||
properly otherwise. Reading the value of the <A HREF="colorreg.htm#3C8">DAC
|
||||
Write Address</A> field may not produce the expected result, as some implementations
|
||||
may return the current index and some may return the next index. This operation
|
||||
may even be dependent on whether a read or write operation is being performed.
|
||||
While it may seem that the DAC implements 2 separate indexes for read and
|
||||
write, this is often not the case, and interleaving read and write operations
|
||||
may not work properly without reprogramming the appropriate index.
|
||||
<UL>
|
||||
<LI>
|
||||
<B>Read Operation</B></LI>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
Disable interrupts (this will ensure that a interrupt service routine will
|
||||
not change the DAC's state)</LI>
|
||||
|
||||
<LI>
|
||||
Output beginning DAC memory index to the <A HREF="colorreg.htm#3C7W">DAC
|
||||
Read Address</A> register.</LI>
|
||||
|
||||
<LI>
|
||||
Input red, blue, and green values from the <A HREF="colorreg.htm#3C9">DAC
|
||||
Data</A> register, repeating for the desired number of entries to be read.</LI>
|
||||
|
||||
<LI>
|
||||
Enable interrupts</LI>
|
||||
</UL>
|
||||
|
||||
<LI>
|
||||
<B>Write Operation</B></LI>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
Disable interrupts (this will ensure that a interrupt service routine will
|
||||
not change the DAC's state)</LI>
|
||||
|
||||
<LI>
|
||||
Output beginning DAC memory index to the <A HREF="colorreg.htm#3C8">DAC
|
||||
Write Address</A> register.</LI>
|
||||
|
||||
<LI>
|
||||
Output red, blue, and green values to the <A HREF="colorreg.htm#3C9">DAC
|
||||
Data</A> register, repeating for the desired number of entries to be read.</LI>
|
||||
|
||||
<LI>
|
||||
Enable interrupts</LI>
|
||||
</UL>
|
||||
</UL>
|
||||
<A NAME="flicker"></A><B>Eliminating Flicker</B>
|
||||
<BR> An important consideration
|
||||
when programming the DAC memory is the possible effects on the display
|
||||
generation. If the DAC memory is accessed by the host CPU at the same time
|
||||
the DAC memory is being used by the DAC hardware, the resulting display
|
||||
output may experience side effects such as flicker or "snow". Note that
|
||||
both reading and writing to the DAC memory has the possibility of causing
|
||||
these effects. The exact effects, if any, are dependent on the specific
|
||||
DAC implementation. Unfortunately, it is not possible to detect when side-effects
|
||||
will occur in all circumstances. The best measure is to only access the
|
||||
DAC memory during periods of horizontal or vertical blanking. However,
|
||||
this puts a needless burden on programs run on chipsets that are not affected.
|
||||
If performance is an issue, then allowing the user to select between flicker-prone
|
||||
and flicker-free access methods could possibly improve performance.
|
||||
|
||||
<P><A NAME="state"></A><B>The DAC State</B>
|
||||
<BR> The <A HREF="colorreg.htm#3C7R">DAC
|
||||
State</A> field seems to be totally useless, as the DAC state is usually
|
||||
known by the programmer and it does not give enough information (about
|
||||
whether a red, green, or blue value is expected next) for a interrupt routine
|
||||
or such to determine the DAC state. However, I can think of one possible
|
||||
use for it. You can use the DAC state to allow an interrupt driven routine
|
||||
to access the palette (like for palette rotation effects or such) while
|
||||
still allowing the main thread to write to the DAC memory. When the interrupt
|
||||
routine executes it should check the DAC state. If the DAC state is in
|
||||
a write state, it should not access the DAC memory. If it is in a read
|
||||
state, the routine should perform the necessary DAC accesses then return
|
||||
the DAC to a read state. This means that the main thread use the DAC state
|
||||
to control the execution of the ISR. Also it means that it can perform
|
||||
writes to the DAC without having to disable interrupts or otherwise inhibit
|
||||
the ISR.
|
||||
<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>
|
||||
402
specs/freevga/vga/vgafunc.htm
Normal file
@@ -0,0 +1,402 @@
|
||||
<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--VGA Functional Index</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="../home.htm">Home</A> <A HREF="#register">Register</A>
|
||||
<A HREF="#memory">Memory</A> <A HREF="#sequencer">Sequencing</A> <A HREF="#cursor">Cursor</A>
|
||||
<A HREF="#attribute">Attribute</A> <A HREF="#DAC">DAC</A> <A HREF="#display">Display</A>
|
||||
<A HREF="#misc">Misc</A> <A HREF="vga.htm#index">Back</A>
|
||||
<HR WIDTH="100%"><B>Hardware Level VGA and SVGA Video Programming Information
|
||||
Page</B></CENTER>
|
||||
|
||||
<CENTER>VGA Functional Index
|
||||
<HR WIDTH="100%"></CENTER>
|
||||
|
||||
|
||||
<P><A NAME="register"></A><B>Register Access Functions</B>
|
||||
<BR> These fields control the
|
||||
acessability/inaccessability of the VGA registers. These registers are
|
||||
used for compatibiltiy with older programs that may attempt to program
|
||||
the VGA in a fashion suited only to an EGA, CGA, or monochrome card.
|
||||
<UL>
|
||||
<LI>
|
||||
CRTC Registers Protect Enable -- <A HREF="crtcreg.htm#11">Vertical Retrace
|
||||
End Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Enable Vertical Retrace Access -- <A HREF="crtcreg.htm#03">End Horizontal
|
||||
Blanking Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Input/Output Address Select -- <A HREF="extreg.htm#3CCR3C2W">Miscellaneous
|
||||
Output Register</A></LI>
|
||||
</UL>
|
||||
<A NAME="memory"></A><B>Display Memory Access Functions</B>
|
||||
<BR> These fields control the
|
||||
way the video RAM is mapped into the host CPU's address space and how memory
|
||||
reads/writes affect the display memory.
|
||||
<UL>
|
||||
<LI>
|
||||
Bit Mask -- <A HREF="graphreg.htm#08">Bit Mask Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Chain 4 Enable -- <A HREF="seqreg.htm#04">Sequencer Memory Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Chain Odd/Even Enable -- <A HREF="graphreg.htm#06">Miscellaneous Graphics
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Color Compare -- <A HREF="graphreg.htm#02">Color Compare Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Color Don't Care -- <A HREF="graphreg.htm#07">Color Don't Care Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Enable Set/Reset -- <A HREF="graphreg.htm#01">Enable Set/Reset Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Extended Memory -- <A HREF="seqreg.htm#04">Sequencer Memory Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Host Odd/Even Memory Read Addressing Enable -- <A HREF="graphreg.htm#05">Graphics
|
||||
Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Host Odd/Even Memory Write Addressing Enable -- <A HREF="seqreg.htm#04">Sequencer
|
||||
Memory Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Logical Operation -- <A HREF="graphreg.htm#03">Data Rotate Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Memory Map Select -- <A HREF="graphreg.htm#06">Miscellaneous Graphics Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Memory Plane Write Enable -- <A HREF="seqreg.htm#02">Map Mask Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Odd/Even Page Select -- <A HREF="extreg.htm#3CCR3C2W">Miscellaneous Output
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
RAM Enable -- <A HREF="extreg.htm#3CCR3C2W">Miscellaneous Output Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Read Map Select -- <A HREF="graphreg.htm#04">Read Map Select Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Read Mode - <A HREF="graphreg.htm#05">Graphics Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Rotate Count -- <A HREF="graphreg.htm#03">Data Rotate Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Set/Reset -- <A HREF="graphreg.htm#00">Set/Reset Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Write Mode -- <A HREF="graphreg.htm#05">Graphics Mode Register</A></LI>
|
||||
</UL>
|
||||
<A NAME="sequencer"></A><B>Display Sequencing Functions</B>
|
||||
<BR> These fields affect the
|
||||
way the video memory is serialized for display.
|
||||
<UL>
|
||||
<LI>
|
||||
256-Color Shift Mode -- <A HREF="graphreg.htm#05">Graphics Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
9/8 Dot Mode -- <A HREF="seqreg.htm#01">Clocking Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Address Wrap Select -- <A HREF="crtcreg.htm#17">CRTC Mode Control Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Alphanumeric Mode Disable -- <A HREF="graphreg.htm#06">Miscellaneous Graphics
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Asynchronous Reset -- <A HREF="seqreg.htm#00">Reset Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Byte Panning -- <A HREF="crtcreg.htm#08">Preset Row Scan Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Character Set A Select -- <A HREF="seqreg.htm#03">Character Map Select
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Character Set B Select -- <A HREF="seqreg.htm#03">Character Map Select
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Divide Memory Address Clock by 4 -- <A HREF="crtcreg.htm#14">Underline
|
||||
Location Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Double-Word Addressing -- <A HREF="crtcreg.htm#14">Underline Location Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Pixel Shift Count -- <A HREF="attrreg.htm#13">Horizontal Pixel Panning
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Line Compare -- bit 9: <A HREF="crtcreg.htm#09">Maximum Scan Line Register</A>,
|
||||
bit 8: <A HREF="crtcreg.htm#07">Overflow Register</A>, bits 7-0: <A HREF="crtcreg.htm#18">Line
|
||||
Compare Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Line Graphics Enable -- <A HREF="attrreg.htm#10">Attribute Mode Control
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Map Display Address 13 -- <A HREF="crtcreg.htm#17">CRTC Mode Control Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Map Display Address 14 -- <A HREF="crtcreg.htm#17">CRTC Mode Control Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Maximum Scan Line -- <A HREF="crtcreg.htm#09">Maximum Scan Line Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Offset -- <A HREF="crtcreg.htm#13">Offset Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Pixel Panning Mode -- <A HREF="attrreg.htm#10">Attribute Mode Control Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Preset Row Scan -- <A HREF="crtcreg.htm#08">Preset Row Scan Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Scan Doubling -- <A HREF="crtcreg.htm#09">Maximum Scan Line Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Screen Disable -- <A HREF="seqreg.htm#01">Clocking Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Shift Four Enable -- <A HREF="seqreg.htm#01">Clocking Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Shift/Load Rate -- <A HREF="seqreg.htm#01">Clocking Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Shift Register Interleave Mode -- <A HREF="graphreg.htm#05">Graphics Mode
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Start Address -- bits 15-8: <A HREF="crtcreg.htm#0C">Start Address High
|
||||
Register</A>, bits 7-0: <A HREF="crtcreg.htm#0D">Start Address Low Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Sycnchronous Reset -- <A HREF="seqreg.htm#00">Reset Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Word/Byte Mode Select -- <A HREF="crtcreg.htm#17">CRTC Mode Control Register</A></LI>
|
||||
</UL>
|
||||
<A NAME="cursor"></A><B>Cursor Functions</B>
|
||||
<BR> These fields affect the
|
||||
operation of the cursor displayed while the VGA hardware is in text mode.
|
||||
<UL>
|
||||
<LI>
|
||||
Cursor Disable -- <A HREF="crtcreg.htm#0A">Cursor Start Reguster</A></LI>
|
||||
|
||||
<LI>
|
||||
Cursor Location -- bits 15-8: <A HREF="crtcreg.htm#0E">Cursor Location
|
||||
High Register</A>, bits 7-0: <A HREF="crtcreg.htm#0F">Cursor Location Low
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Cursor Scan Line End -- <A HREF="crtcreg.htm#0B">Cursor End Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Cursor Scan Line Start -- <A HREF="crtcreg.htm#0A">Cursor Start Reguster</A></LI>
|
||||
|
||||
<LI>
|
||||
Cursor Skew -- <A HREF="crtcreg.htm#0B">Cursor End Register</A></LI>
|
||||
</UL>
|
||||
<A NAME="attribute"></A><B>Attribute Functions</B>
|
||||
<BR> These fields control the
|
||||
way the video data is submitted to the RAMDAC, providing color/blinking
|
||||
capability in text mode and facilitating the mapping of colors in graphics
|
||||
mode.
|
||||
<UL>
|
||||
<LI>
|
||||
8-bit Color Enable -- <A HREF="attrreg.htm#10">Attribute Mode Control Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Attribute Address -- <A HREF="attrreg.htm#3C0">Attribute Address Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Attribute Controller Graphics Enable -- <A HREF="attrreg.htm#10">Attribute
|
||||
Mode Control Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Blink Enable -- <A HREF="attrreg.htm#10">Attribute Mode Control Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Color Plane Enable -- <A HREF="attrreg.htm#12">Color Plane Enable Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Color Select 5-4 -- <A HREF="attrreg.htm#14">Color Select Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Color Select 7-6 -- <A HREF="attrreg.htm#14">Color Select Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Internal Palette Index -- <A HREF="attrreg.htm#000F">Palette Registers</A></LI>
|
||||
|
||||
<LI>
|
||||
Monochrome Emulation -- <A HREF="attrreg.htm#10">Attribute Mode Control
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Overscan Palette Index -- <A HREF="attrreg.htm#11">Overscan Color Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Underline Location -- <A HREF="crtcreg.htm#14">Underline Location Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Palette Address Source -- <A HREF="attrreg.htm#3C0">Attribute Address Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Palette Bits 5-4 Select -- <A HREF="attrreg.htm#10">Attribute Mode Control
|
||||
Register</A></LI>
|
||||
</UL>
|
||||
<A NAME="DAC"></A><B>DAC Functions</B>
|
||||
<BR> These fields allow control
|
||||
of the VGA's 256-color palette that is part of the RAMDAC.
|
||||
<UL>
|
||||
<LI>
|
||||
DAC Write Address -- <A HREF="colorreg.htm#3C8">DAC Address Write Mode
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
DAC Read Address -- <A HREF="colorreg.htm#3C7W">DAC Address Read Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
DAC Data -- <A HREF="colorreg.htm#3C9">DAC Data Register</A></LI>
|
||||
|
||||
<LI>
|
||||
DAC State -- <A HREF="colorreg.htm#3C7R">DAC State Register</A></LI>
|
||||
</UL>
|
||||
<A NAME="display"></A><B>Display Generation Functions</B>
|
||||
<BR> These fields control the
|
||||
formatting and timing of the VGA's video signal output.
|
||||
<UL>
|
||||
<LI>
|
||||
Clock Select -- <A HREF="extreg.htm#3CCR3C2W">Miscellaneous Output Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Display Disabled -- <A HREF="extreg.htm#3xAR">Input Status #1 Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Display Enable Skew -- <A HREF="crtcreg.htm#03">End Horizontal Blanking
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Divide Scan Line Clock by 2 -- <A HREF="crtcreg.htm#17">CRTC Mode Control
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Dot Clock Rate -- <A HREF="seqreg.htm#01">Clocking Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
End Horizontal Display -- <A HREF="crtcreg.htm#01">End Horizontal Display
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
End Horizontal Blanking -- bit 5: <A HREF="crtcreg.htm#05">End Horizontal
|
||||
Retrace Register</A>, bits 4-0: <A HREF="crtcreg.htm#03">End Horizontal
|
||||
Blanking Register</A>,</LI>
|
||||
|
||||
<LI>
|
||||
End Horizontal Retrace -- <A HREF="crtcreg.htm#05">End Horizontal Retrace
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
End Vertical Blanking -- <A HREF="crtcreg.htm#16">End Vertical Blanking
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Horizontal Retrace Skew -- <A HREF="crtcreg.htm#05">End Horizontal Retrace
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Horizontal Sync Polarity -- <A HREF="extreg.htm#3CCR3C2W">Miscellaneous
|
||||
Output Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Horizontal Total -- <A HREF="crtcreg.htm#00">Horizontal Total Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Memory Refresh Bandwidth -- <A HREF="crtcreg.htm#11">Vertical Retrace End
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Start Horizontal Blanking -- <A HREF="crtcreg.htm#02">Start Horizontal
|
||||
Blanking Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Start Horizontal Retrace -- <A HREF="crtcreg.htm#04">Start Horizontal Retrace
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Start Vertical Blanking -- bit 9: <A HREF="crtcreg.htm#09">Maximum Scan
|
||||
Line Register</A>, bit 8: <A HREF="crtcreg.htm#07">Overflow Register</A>,
|
||||
bits 7-0: <A HREF="crtcreg.htm#15">Start Vertical Blanking Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Sync Enable -- <A HREF="crtcreg.htm#17">CRTC Mode Control Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Vertical Display End -- bits 9-8: <A HREF="crtcreg.htm#07">Overflow Register</A>,
|
||||
bits 7-0: <A HREF="crtcreg.htm#12">Vertical Display End Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Vertical Retrace End -- <A HREF="crtcreg.htm#11">Vertical Retrace End Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Vertical Retrace -- <A HREF="extreg.htm#3xAR">Input Status #1 Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Vertical Retrace Start -- bits 9-8: <A HREF="crtcreg.htm#07">Overflow Register</A>,
|
||||
bits 7-0: <A HREF="crtcreg.htm#10">Vertical Retrace Start Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Vertical Sync Polarity -- <A HREF="extreg.htm#3CCR3C2W">Miscellaneous Output
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Vertical Total -- bits 9-8: <A HREF="crtcreg.htm#07">Overflow Register</A>,
|
||||
bits 7-0: <A HREF="crtcreg.htm#06">Vertical Total Register</A></LI>
|
||||
</UL>
|
||||
<A NAME="misc"></A><B>Miscellaneous Functions</B>
|
||||
<BR> These fields are used to
|
||||
detect the state of possible VGA hardware such as configuration switches/jumpers
|
||||
and feature connector inputs.
|
||||
<UL>
|
||||
<LI>
|
||||
Feature Control Bit 0 -- <A HREF="extreg.htm#3CAR3xAW">Feature Control
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Feature Control Bit 1 -- <A HREF="extreg.htm#3CAR3xAW">Feature Control
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Switch Sense -- <A HREF="extreg.htm#3C2R">Input Status #0 Register</A></LI>
|
||||
</UL>
|
||||
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>
|
||||
<BR>
|
||||
</BODY>
|
||||
</HTML>
|
||||
295
specs/freevga/vga/vgafx.htm
Normal file
@@ -0,0 +1,295 @@
|
||||
<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>FreeVGA--Special Effects Hardware</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="../home.htm">Home</A> <A HREF="#intro">Intro</A> <A HREF="#window">Windowing</A>
|
||||
<A HREF="#paging">Paging</A> <A HREF="#smooth">Smooth Scrolling</A> <A HREF="#split">Split-Screen</A>
|
||||
<A HREF="vga.htm#general">Back
|
||||
<HR WIDTH="100%"></A><B>Hardware Level VGA and SVGA Video Programming Information
|
||||
Page</B></CENTER>
|
||||
|
||||
<CENTER>Special Effects Hardware
|
||||
<HR WIDTH="100%"></CENTER>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="#intro">Introduction</A> -- describes the capabilities of the
|
||||
VGA special effects hardware.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#window">Windowing</A> -- provides rough panning and scrolling
|
||||
of a larger virtual image.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#paging">Paging</A> -- provides the ability to switch between
|
||||
multiple screens rapidly.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#smooth">Smooth Panning and Scrolling</A> -- provides more precise
|
||||
control when panning and scrolling.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#split">Split-Screen Operation</A> -- provides a horizontal division
|
||||
which allows independent scrolling and panning of the top window.</LI>
|
||||
</UL>
|
||||
<A NAME="intro"></A><B>Introduction</B>
|
||||
<BR> This section describes the
|
||||
capabilities of the VGA hardware that can be used to implement special
|
||||
effects such as windowing, paging, smooth panning and scrolling, and split
|
||||
screen operation.. These functions are probably the least utilized of all
|
||||
of the VGA's capabilities, possibly because most texts devoted to video
|
||||
hardware provide only brief documentation. Also, the video BIOS provides
|
||||
no support for these capabilities so the VGA card must be programmed at
|
||||
the hardware level in order to utilize these capabilities. Windowing allows
|
||||
a program to view a portion of an image in display memory larger than the
|
||||
current display resolution, providing rough panning and scrolling. Paging
|
||||
allows multiple display screens to be stored in the display memory allowing
|
||||
rapid switching between them. Smooth panning and scrolling works in conjunction
|
||||
with windowing to provide more precise control of window position. Split-screen
|
||||
operation allows the creation of a horizontal division on the screen that
|
||||
creates a window below that remains fixed in place independent of the panning
|
||||
and scrolling of the window above. These features can be combined to provide
|
||||
powerful control of the display with minimal demand on the host CPU.
|
||||
|
||||
<P><A NAME="window"></A><B>Windowing</B>
|
||||
<BR> The VGA hardware has the
|
||||
ability treat the display as a window which can pan and/or scroll across
|
||||
an image larger than the screen, which is used by some windowing systems
|
||||
to provide a virtual scrolling desktop, and by some games and assembly
|
||||
demos to provide scrolling. Some image viewers use this to allow viewing
|
||||
of images larger than the screen. This capability is not limited to graphics
|
||||
mode; some terminal programs use this capability to provide a scroll-back
|
||||
buffer, and some editors use this to provide an editing screen wider than
|
||||
80 columns.
|
||||
<BR> This feature can be implemented
|
||||
by brute force by simply copying the portion of the image to be displayed
|
||||
to the screen. Doing this, however takes significant processor horsepower.
|
||||
For example, scrolling a 256 color 320x200 display at 30 frames per second
|
||||
by brute force requires a data transfer rate of 1.92 megabytes/second.
|
||||
However, using the hardware capability of the VGA the same operation would
|
||||
require a data transfer rate of only 120 bytes/second. Obviously there
|
||||
is an advantage to using the VGA hardware. However, there are some limitations--one
|
||||
being that the entire screen must scroll (or the top portion of the screen
|
||||
if split-screen mode is used.) and the other being that the maximum size
|
||||
of the virtual image is limited to the amount of video memory accessible,
|
||||
although it is possible to redraw portions of the display memory to display
|
||||
larger virtual images.
|
||||
<BR> In text mode, windowing
|
||||
allows panning at the character resolution. In graphics mode, windowing
|
||||
allows panning at 8-bit resolution and scrolling at scan-line resolution.
|
||||
For more precise control, see <A HREF="#smooth">Smooth Panning and Scrolling</A>
|
||||
below. Because the VGA BIOS and most programming environment's graphics
|
||||
libraries do not support windowing, you must modify or write your own routines
|
||||
to write to the display for functions such as writing text or graphics.
|
||||
This section assumes that you have the ability to work with the custom
|
||||
resolutions possible when windowing is used.
|
||||
<BR> In order to understand virtual
|
||||
resolutions it is necessary to understand how the VGA's <A HREF="crtcreg.htm#0C">Start
|
||||
Address High Register</A>, <A HREF="crtcreg.htm#0D">Start Address Low Register</A>,
|
||||
and <A HREF="crtcreg.htm#13">Offset</A> field work. Because display memory
|
||||
in the VGA is accessed by a 32-bit bus, a 16-bit address is sufficient
|
||||
to uniquely identify any location in the VGA's 256K address space. The
|
||||
<A HREF="crtcreg.htm#0C">Start Address High Register</A> and <A HREF="crtcreg.htm#0D">Start
|
||||
Address Low Register</A> provide such an address. This address is used
|
||||
to specify either the location of the first character in text mode or the
|
||||
position of the first byte of pixels in graphics mode. At the end of the
|
||||
vertical retrace, the current line start address is loaded with this value.
|
||||
This causes one scan line of pixels or characters to be output starting
|
||||
at this address. At the beginning of the next scan-line (or character row
|
||||
in text mode) the value of the <A HREF="crtcreg.htm#13">Offset Register</A>
|
||||
multiplied by the current memory address size * 2 is added to the current
|
||||
line start address. The <A HREF="crtcreg.htm#14">Double-Word Addressing</A>
|
||||
field and the <A HREF="crtcreg.htm#17">Word/Byte</A> field specify the
|
||||
current memory address size. If the value of the <A HREF="crtcreg.htm#14">Double-Word
|
||||
Addressing</A> field is 1, then the current memory address size is four
|
||||
(double-word). Otherwise, the <A HREF="crtcreg.htm#17">Word/Byte</A> field
|
||||
specifies the current memory address size. If the value of the <A HREF="crtcreg.htm#17">Word/Byte</A>
|
||||
field is 0 then the current memory address size is 2 (word) otherwise,
|
||||
the current memory address size is 1 (byte).
|
||||
<BR> Normally in graphics modes,
|
||||
the offset register is programmed to represent (after multiplication) the
|
||||
number of bytes in a scan line. This means that (unless a CGA/MDA emulation
|
||||
mode is in effect) scan lines will be arranged sequentially in memory with
|
||||
no space in between, allowing for the most compact representation in display
|
||||
memory. However, this does not have to be the case--in fact, by increasing
|
||||
the value of the offset register we can leave "extra space" between lines.
|
||||
This is what provides for virtual widths. By programming the offset register
|
||||
to the value of the equation:
|
||||
|
||||
<P> <B>Offset = VirtualWidth
|
||||
/ ( PixelsPerAddress * MemoryAddressSize * 2 )</B>
|
||||
|
||||
<P>VirtualWidth is the width of the virtual resolution in pixels, and PixelsPerAddress
|
||||
is the number of pixels per display memory address (1, 2, 4 or 8) depending
|
||||
on the current video mode. For virtual text modes, the offset register
|
||||
is programmed with the value of the equation:
|
||||
|
||||
<P> <B>Offset = VirtualWidth
|
||||
/ ( MemoryAddressSize * 2 )</B>
|
||||
|
||||
<P>In text mode, there is always one character per display memory address.
|
||||
In standard CGA compatible text modes, MemoryAddressSize is 2 (word).
|
||||
<BR> After you have programmed
|
||||
the new offset, the screen will now display only a portion of a virtual
|
||||
display. The screen will display the number of scan-lines as specified
|
||||
by the current mode. If the screen reaches the last byte of memory, the
|
||||
next byte of memory will wrap around to the first byte of memory. Remember
|
||||
that the Start Address specifies the display memory address of the upper-left
|
||||
hand character or pixel. Thus the maximum height of a virtual screen depends
|
||||
on the width of the virtual screen. By increasing this by the number of
|
||||
bytes in a scan-line (or character row), the display will scroll one scan-line
|
||||
or character row vertically downwards. By increasing the Start Address
|
||||
by less than the number of bytes in a scan line, you can move the virtual
|
||||
window horizontally to the right. If the virtual width is the same as the
|
||||
actual width, one can create a vertical scrolling mode. This is used sometimes
|
||||
as an "elevator" mode or to provide rapid scrollback capability in text
|
||||
mode. If the virtual height is the same as the actual height, then only
|
||||
horizontal panning is possible, sometimes called "panoramic" mode. In any
|
||||
case, the equation for calculating the Start Address is:
|
||||
|
||||
<P><B> Start Address = StartingOffset
|
||||
+ Y * BytesPerVirtualRow + X</B>
|
||||
|
||||
<P>Y is the vertical position, from 0 to the value of the VitrualHeight
|
||||
- ActualHeight. X is the horizontal position, from 0 to the value of BytesPerVirtualRow
|
||||
- BytesPerActualRow . These ranges prevent wrapping around to the left
|
||||
side of the screen, although you may find it useful to use the wrap-around
|
||||
for whatever your purpose. Note that the wrap-around simply starts displaying
|
||||
the next row/scan-line rather than the current one, so is not that useful
|
||||
(except when using programming techniques that take this factor into account.)
|
||||
Normally StartingOffset is 0, but if paging or split-screen mode is being
|
||||
used, or even if you simply want to relocate the screen, you must change
|
||||
the starting offset to the address of the upper-left hand pixel of the
|
||||
virtual screen.
|
||||
<BR> For example, a 512x300 virtual
|
||||
screen in a 320x200 16-color 1 bit/pixel planar display would require 512
|
||||
pixels / 8 pixels/byte = 64 bytes per row and 64 bytes/row * 300 lines
|
||||
= 19200 bytes per screen. Assuming the VGA is in byte addressing mode,
|
||||
this means that we need to program the offset register <A HREF="crtcreg.htm#13">Offset</A>
|
||||
field with 512 pixels / (8 pixels/byte * 1 * 2) = 32 (20h). Adding one
|
||||
to the start address will move the display screen to the right eight pixels.
|
||||
More precise control is provided by the smooth scrolling mechanism. Adding
|
||||
64 to the start address will move the virtual screen down one scan line.
|
||||
See the following chart which shows the virtual screen when the start address
|
||||
is calculated with an X and Y of 0:
|
||||
<CENTER><A HREF="virtual.txt"><IMG SRC="virtual.gif" ALT="Click for Textified Virtual Screen Mode Example" HEIGHT=256 WIDTH=376></A></CENTER>
|
||||
|
||||
|
||||
<P><A NAME="paging"></A><B>Paging</B>
|
||||
<BR> The video display memory
|
||||
may be able to hold more than one screen of data (or virtual screen if
|
||||
virtual resolutions are used.) These multiple screens, called pages, allows
|
||||
rapid switching between them. As long as they both have the same actual
|
||||
(and virtual if applicable) resolution, simply changing the Start Address
|
||||
as given by the <A HREF="crtcreg.htm#0C">Start Address High Register</A>
|
||||
and <A HREF="crtcreg.htm#0D">Start Address Low Register</A> pair to point
|
||||
to the memory address of the first byte of the page (or set the StartingOffset
|
||||
term in the equation for virtual resolutions to the first memory address
|
||||
of the page.) If they have different virtual widths, then the <A HREF="crtcreg.htm#13">Offset</A>
|
||||
field must be reprogrammed. It is possible to store both graphics and text
|
||||
pages simultaneously in memory, in addition to different graphics mode
|
||||
pages. In this case, the video mode must be changed when changing pages.
|
||||
In addition, in text mode the Cursor Location must be reprogrammed for
|
||||
each page if it is to be displayed. Also paging allows for double buffering
|
||||
of the display -- the CPU can write to one page while the VGA hardware
|
||||
is displaying another. By switching between pages during the vertical retrace
|
||||
period, flicker free screen updates can be implemented.
|
||||
<BR> An example of paging is
|
||||
that used by the VGA BIOS in the 80x25 text mode. Each page of text takes
|
||||
up 2000 memory address locations, and the VGA uses a 32K memory aperture,
|
||||
with the Odd/Even addressing enabled. Because Odd/Even addressing is enabled,
|
||||
each page of text takes up 4000 bytes in host memory, thus 32768 / 4000
|
||||
= 8 (rounded down) pages can be provided and can be accessed at one time
|
||||
by the CPU. Each page starts at a multiple of 4096 (1000h). Because the
|
||||
display controller circuitry works independent of the host memory access
|
||||
mode, this means that each page starts at a display address that is a multiple
|
||||
of 2048 (800h), thus the Starting Address is programmed to the value obtained
|
||||
by multiplying the page to be displayed by 2048 (800h). See the following
|
||||
chart which shows the arrangement of these pages in display memory:
|
||||
<BR>
|
||||
<CENTER><A HREF="paging.txt"><IMG SRC="paging.gif" ALT="Click here to display a textified Paging Memory Utilization Example" HEIGHT=256 WIDTH=376></A></CENTER>
|
||||
|
||||
|
||||
<P><A NAME="smooth"></A><B>Smooth Panning and Scrolling</B>
|
||||
<BR> Because the Start Address
|
||||
field only provides for scrolling and panning at the memory address level,
|
||||
more precise panning and scrolling capability is needed to scroll at the
|
||||
pixel level as multiple pixels may reside at the same memory address especially
|
||||
in text mode where the Start Address field only allows panning and scrolling
|
||||
at the character level.
|
||||
<BR> Pixel level panning is controlled
|
||||
by the <A HREF="attrreg.htm#13">Pixel Shift Count</A> and <A HREF="crtcreg.htm#08">Byte
|
||||
Panning</A> fields. The <A HREF="attrreg.htm#13">Pixel Shift Count</A>
|
||||
field specifies the number of pixels to shift left. In all graphics modes
|
||||
and text modes except 9 dot text modes and 256 color graphics modes, the
|
||||
<A HREF="attrreg.htm#13">Pixel Shift Count</A> is defined for values 0-7.
|
||||
This provides the pixel level control not provided by the <A HREF="crtcreg.htm#0D">Start
|
||||
Address Register</A> or the <A HREF="crtcreg.htm#08">Byte Panning</A> fields.
|
||||
In 9 dot text modes the <A HREF="attrreg.htm#13">Pixel Shift Count</A>
|
||||
is field defined for values 8, and 0-7, with 8 being the minimum shift
|
||||
amount and 7 being the maximum. In 256 color graphics modes, due to the
|
||||
way the hardware makes a 256 color value by combining 2 16-bit values,
|
||||
the <A HREF="attrreg.htm#13">Pixel Shift Count</A> field is only defined
|
||||
for values 0, 2, 4, and 6. Values 1, 3, 5, and 7 cause the screen to be
|
||||
distorted due to the hardware combining 4 bits from each of 2 adjacent
|
||||
pixels. The <A HREF="crtcreg.htm#08">Byte Panning</A> field is added to
|
||||
the <A HREF="crtcreg.htm#0D">Start Address Register</A> when determining
|
||||
the address of the top-left hand corner of the screen, and has the value
|
||||
from 0-3. Combined, both panning fields allow a shift of 15, 31, or 35
|
||||
pixels, dependent upon the video mode. Note that programming the <A HREF="attrreg.htm#13">Pixel
|
||||
Shift Count</A> field to an undefined value may cause undesired effects
|
||||
and these effects are not guaranteed to be identical on all chipsets, so
|
||||
it is best to be avoided.
|
||||
<BR> Pixel level scrolling is
|
||||
controlled by the <A HREF="crtcreg.htm#08">Preset Row Scan</A> field. This
|
||||
field may take any value from 0 up to the value of the <A HREF="crtcreg.htm#09">Maximum
|
||||
Scan Line</A> field; anything greater causes interesting artifacts (there
|
||||
is no guarantee that the result will be the same for all VGA chipsets.)
|
||||
Incrementing this value will shift the screen upwards by one scan line,
|
||||
allowing for smooth scrolling in modes where the Offset field does not
|
||||
provide precise control.
|
||||
|
||||
<P><A NAME="split"></A><B>Split-screen Operation</B>
|
||||
<BR> The VGA hardware provides
|
||||
the ability to specify a horizontal division which divides the screen into
|
||||
two windows which can start at separate display memory addresses. In addition,
|
||||
it provides the facility for panning the top window independent of the
|
||||
bottom window. The hardware does not provide for split-screen modes where
|
||||
multiple video modes are possible in one display screen as provided by
|
||||
some non-VGA graphics controllers. In addition, there are some limitations,
|
||||
the first being that the bottom window's starting display memory address
|
||||
is fixed at 0. This means that (unless you are using split screen mode
|
||||
to duplicate memory on purpose) the bottom screen must be located first
|
||||
in memory and followed by the top. The second limitation is that either
|
||||
both windows are panned by the same amount, or only the top window pans,
|
||||
in which case, the bottom window's panning values are fixed at 0. Another
|
||||
limitation is that the <A HREF="crtcreg.htm#08">Preset Row Scan</A> field
|
||||
only applies to the top window -- the bottom window has an effective Preset
|
||||
Row Scan value of 0.
|
||||
<BR> The Line Compare field in
|
||||
the VGA, of which bit 9 is in the <A HREF="crtcreg.htm#09">Maximum Scan
|
||||
Line Register</A>, bit 8 is in the <A HREF="crtcreg.htm#07">Overflow Register</A>,
|
||||
and bits 7-0 are in the <A HREF="crtcreg.htm#18">Line Compare Register</A>,
|
||||
specifies the scan line address of the horizontal division. When the line
|
||||
counter reaches the value in the Line Compare Register, the current scan
|
||||
line start address is reset to 0. If the <A HREF="attrreg.htm#10">Pixel
|
||||
Panning Mode</A> field is set to 1 then the <A HREF="attrreg.htm#13">Pixel
|
||||
Shift Count</A> and <A HREF="crtcreg.htm#08">Byte Panning</A> fields are
|
||||
reset to 0 for the remainder of the display cycle allowing the top window
|
||||
to pan while the bottom window remains fixed. Otherwise, both windows pan
|
||||
by the same amount.
|
||||
<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>.
|
||||
</BODY>
|
||||
</HTML>
|
||||
334
specs/freevga/vga/vgamem.htm
Normal file
@@ -0,0 +1,334 @@
|
||||
<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--Accessing the VGA Display Memory</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="../home.htm">Home</A> <A HREF="#intro">Intro</A> <A HREF="#detect">Detecting</A>
|
||||
<A HREF="#mapping">Mapping</A> <A HREF="#address">Addressing</A> <A HREF="#manip">Manipulating</A>
|
||||
<A HREF="#read">Reading</A> <A HREF="#write">Writing</A> <A HREF="vga.htm#general">Back</A>
|
||||
<HR WIDTH="100%"><B>Hardware Level VGA and SVGA Video Programming Information
|
||||
Page</B></CENTER>
|
||||
|
||||
<CENTER>Accessing the VGA Display Memory
|
||||
<HR WIDTH="100%"></CENTER>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="#intro">Introduction</A> -- gives an overview of the VGA display
|
||||
memory.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#detect">Detecting the Amount of Display Memory on the Adapter</A>
|
||||
-- details how to determine the amount of memory present on the VGA.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#mapping">Mapping of Display Memory into CPU Address Space</A>
|
||||
-- details how to control the location and size of the memory aperture.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#address">Host Address to Display Address Translation</A> -- detail
|
||||
how the VGA hardware maps a host access to a display memory access</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#manip">Manipulating Display Memory</A> -- Details on reading
|
||||
and writing to VGA memory</LI>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="#read">Reading from Display Memory</A> -- Details the hardware
|
||||
mechanisms used when reading display memory.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#write">Writing to Display Memory</A> -- Details the hardware
|
||||
mechanisms used when writing display memory.</LI>
|
||||
</UL>
|
||||
</UL>
|
||||
<A NAME="intro"></A><B>Introduction</B>
|
||||
<BR> The standard VGA hardware
|
||||
contains up to 256K of onboard display memory. While it would seem logical
|
||||
that this memory would be directly available to the processor, this is
|
||||
not the case. The host CPU accesses the display memory through a window
|
||||
of up to 128K located in the high memory area. (Note that many SVGA chipsets
|
||||
provide an alternate method of accessing video memory directly, called
|
||||
a Linear Frame Buffer.) Thus in order to be able to access display memory
|
||||
you must deal with registers that control the mapping into host address
|
||||
space. To further complicate things, the VGA hardware provides support
|
||||
for memory models similar to that used by the monochrome, CGA, EGA, and
|
||||
MCGA adapters. In addition, due to the way the VGA handles 16 color modes,
|
||||
additional hardware is included that can speed access immensely. Also,
|
||||
hardware is present that allows the programer to rapidly copy data from
|
||||
one area of display memory to another. While it is quite complicated to
|
||||
understand, learning to utilize the VGA's hardware at a low level can vastly
|
||||
improve performance. Many game programmers utilize the BIOS mode 13h, simply
|
||||
because it offers the simplest memory model and doesn't require having
|
||||
to deal with the VGA's registers to draw pixels. However, this same decision
|
||||
limits them from being able to use the infamous X modes, or higher resolution
|
||||
modes.
|
||||
|
||||
<P><A NAME="detect"></A><B>Detecting the Amount of Display Memory on the
|
||||
Adapter</B>
|
||||
<BR><B> </B>Most VGA cards in
|
||||
existence have 256K on board; however there is the possibility that some
|
||||
VGA boards have less. To actually determine further if the card has 256K
|
||||
one must actually write to display memory and read back values. If RAM
|
||||
is not present in a location, then the value read back will not equal the
|
||||
value written. It is wise to utilize multiple values when doing this, as
|
||||
the undefined result may equal the value written. Also, the card may alias
|
||||
addresses, causing say the same 64K of RAM to appear 4 times in the 256K
|
||||
address space, thus it is wise to change an address and see if the change
|
||||
is reflected anywhere else in display memory. In addition, the card may
|
||||
buffer one location of video memory in the chipset, making it appear that
|
||||
there is RAM at an address where there is none present, so you may have
|
||||
to read or write to a second location to clear the buffer. Not that if
|
||||
the <A HREF="seqreg.htm#04">Extended Memory</A> field is not set to 1,
|
||||
the adapter appears to only have 64K onboard, thus this bit should be set
|
||||
to 1 before attempting to determine the memory size.
|
||||
|
||||
<P><A NAME="mapping"></A><B>Mapping of Display Memory into CPU Address
|
||||
Space</B>
|
||||
<BR> The first element that defines
|
||||
this mapping is whether or not the VGA decodes accesses from the CPU. This
|
||||
is controlled by the <A HREF="extreg.htm#3CCR3C2W">RAM Enable</A> field.
|
||||
If display memory decoding is disabled, then the VGA hardware ignores writes
|
||||
to its address space. The address range that the VGA hardware decodes is
|
||||
based upon the <A HREF="graphreg.htm#06">Memory Map Select</A> field. The
|
||||
following table shows the address ranges in absolute 32-bit form decoded
|
||||
for each value of this field:
|
||||
<UL>
|
||||
<LI>
|
||||
00 -- A0000h-BFFFFh -- 128K</LI>
|
||||
|
||||
<LI>
|
||||
01 -- A0000h-AFFFFh -- 64K</LI>
|
||||
|
||||
<LI>
|
||||
10 -- B0000h-B7FFFh -- 32K</LI>
|
||||
|
||||
<LI>
|
||||
11 -- B8000h-BFFFFh -- 32K</LI>
|
||||
</UL>
|
||||
Note -- It would seem that by setting the <A HREF="graphreg.htm#06">Memory
|
||||
Map Select</A> field to 00 and then using planar memory access that you
|
||||
could gain access to more than 256K of memory on an SVGA card. However,
|
||||
I have found that some cards simply mirror the first 64K twice within the
|
||||
128K address space. This memory map is intended for use in the Chain Odd/Even
|
||||
modes, eliminating the need to use the Odd/Even Page Select field. Also
|
||||
I have found that MS-DOS memory managers don't like this very much and
|
||||
are likely to lock up the system if configured to use the area from B0000h-B7FFFh
|
||||
for loading device drivers high.
|
||||
|
||||
<P><A NAME="address"></A><B>Host Address to Display Address Translation</B>
|
||||
<BR> The most complicated part
|
||||
of accessing display memory involves the translation between a host address
|
||||
and a display memory address. Internally, the VGA has a 64K 32-bit memory
|
||||
locations. These are divided into four 64K bit planes. Because the VGA
|
||||
was designed for 8 and 16 bit bus systems, and due to the way the Intel
|
||||
chips handle memory accesses, it is impossible for the host CPU to access
|
||||
the bit planes directly, instead relying on I/O registers to make part
|
||||
of the memory accessible. The most straightforward display translation
|
||||
is where a host access translates directly to a display memory address.
|
||||
What part of the particular 32-bit memory location is dependent on certain
|
||||
registers and is discussed in more detail in Manipulating Display Memory
|
||||
below. The VGA has three modes for addressing, Chain 4, Odd/Even mode,
|
||||
and normal mode:
|
||||
<UL>
|
||||
<LI>
|
||||
Chain 4: This mode is used for MCGA emulation in the 320x200 256-color
|
||||
mode. The address is mapped to memory MOD 4 (shifted right 2 places.)</LI>
|
||||
</UL>
|
||||
<B><More to be added here.></B>
|
||||
|
||||
<P><A NAME="manip"></A><B>Manipulating Display Memory</B>
|
||||
<BR> The VGA hardware contains
|
||||
hardware that can perform bit manipulation on data and allow the host to
|
||||
operate on all four display planes in a single operation. These features
|
||||
are fairly straightforward, yet complicated enough that most VGA programmers
|
||||
choose to ignore them. This is unfortunate, as properly utilization of
|
||||
these registers is crucial to programming the VGA's 16 color modes. Also,
|
||||
knowledge of this functionality can in many cases enhance performance in
|
||||
other modes including text and 256 color modes. In addition to normal read
|
||||
and write operations the VGA hardware provides enhanced operations such
|
||||
as the ability to perform rapid comparisons, to write to multiple planes
|
||||
simultaneously, and to rapidly move data from one area of display memory
|
||||
to another, faster logical operations (AND/OR/XOR) as well as bit rotation
|
||||
and masking.
|
||||
|
||||
<P><A NAME="read"></A><B>Reading from Display Memory</B>
|
||||
<BR> The VGA hardware has two
|
||||
read modes, selected by the <A HREF="graphreg.htm#05">Read Mode</A> field.
|
||||
The first is a straightforward read of one or more consecutive bytes (depending
|
||||
on whether a byte, word or dword operation is used) from one bit plane.
|
||||
The value of the <A HREF="graphreg.htm#04">Read Map Select</A> field is
|
||||
the page that will be read from. The second read mode returns the result
|
||||
of a comparison of the display memory and the <A HREF="graphreg.htm#02">Color
|
||||
Compare</A> field and masked by the <A HREF="graphreg.htm#07">Color Don't
|
||||
Care</A> field. This mode which can be used to rapidly perform up to 32
|
||||
pixel comparisons in one operation in the planar video modes, helpful for
|
||||
the implementation of fast flood-fill routines. A read from display memory
|
||||
also loads a 32 bit latch register, one byte from each plane. This latch
|
||||
register, is not directly accessible from the host CPU; rather it can be
|
||||
used as data for the various write operations. The latch register retains
|
||||
its value until the next read and thus may be used with more than one write
|
||||
operation.
|
||||
<BR> The two read modes, simply called
|
||||
Read Mode 0-1 based on the value of the <A HREF="graphreg.htm#05">Read
|
||||
Mode</A> field are:
|
||||
<UL>
|
||||
<LI>
|
||||
<B>Read Mode 0:</B></LI>
|
||||
|
||||
<BR> Read Mode 0 is used to read one
|
||||
byte from a single plane of display memory. The plane read is the value
|
||||
of the <A HREF="graphreg.htm#04">Read Map Select</A> field. In order to
|
||||
read a single pixel's value in planar modes, four read operations must
|
||||
be performed, one for each plane. If more than one bytes worth of data
|
||||
is being read from the screen it is recommended that you read it a plane
|
||||
at a time instead of having to perform four I/O operations to the <A HREF="graphreg.htm#04">Read
|
||||
Map Select</A> field for each byte, as this will allow the use of faster
|
||||
string copy instructions and reduce the number I/O operations performed.
|
||||
<LI>
|
||||
<B>Read Mode 1:</B></LI>
|
||||
|
||||
<BR> Read Mode 1 is used to perform
|
||||
comparisons against a reference color, specified by the <A HREF="graphreg.htm#02">Color
|
||||
Compare</A> field. If a bit is set in the <A HREF="graphreg.htm#07">Color
|
||||
Don't Care</A> field then the corresponding color plane is considered for
|
||||
by the comparison, otherwise it is ignored. Each bit in the returned result
|
||||
represents one comparison between the reference color from the <A HREF="graphreg.htm#02">Color
|
||||
Compare</A> field, with the bit being set if the comparison is true. This
|
||||
mode is mainly used by flood fill algorithms that fill an area of a specific
|
||||
color, as it requires 1/4 the number of reads to determine the area that
|
||||
needs to be filled in addition to the additional work done by the comparison.
|
||||
Also an efficient "search and replace" operation that replaces one color
|
||||
with another can be performed when this mode is combined with Write Mode
|
||||
3.</UL>
|
||||
<A NAME="write"></A><B>Writing to Display Memory</B>
|
||||
<BR> The VGA has four write modes,
|
||||
selected by the <A HREF="graphreg.htm#05">Write Mode</A> field. This controls
|
||||
how the write operation and host data affect the display memory. The VGA,
|
||||
depending on the <A HREF="graphreg.htm#05">Write Mode</A> field performs
|
||||
up to five distinct operations before the write affects display memory.
|
||||
Note that not all write modes use all of pipelined stages in the write
|
||||
hardware, and others use some of the pipelined stages in different ways.
|
||||
<BR> The first of these allows
|
||||
the VGA hardware to perform a bitwise rotation on the data written from
|
||||
the host. This is accomplished via a barrel rotator that rotates the bits
|
||||
to the right by the number of positions specified by the <A HREF="graphreg.htm#03">Rotate
|
||||
Count</A> field. This performs the same operation as the 8086 ROR instruction,
|
||||
shifting bits to the right (from bit 7 towards bit 0.) with the bit shifted
|
||||
out of position 0 being "rolled" into position 7. Note that if the rotate
|
||||
count field is zero then no rotation is performed.
|
||||
<BR> The second uses the <A HREF="graphreg.htm#01">Enable
|
||||
Set/Reset</A> and <A HREF="graphreg.htm#00">Set/Reset</A> fields. These
|
||||
fields can provide an additional data source in addition to the data written
|
||||
and the latched value from the last read operation performed. Normally,
|
||||
data from the host is replicated four times, one for each plane. In this
|
||||
stage, a 1 bit in the <A HREF="graphreg.htm#01">Enable Set/Reset</A> field
|
||||
will cause the corresponding bit plane to be replaced by the bit value
|
||||
in the corresponding <A HREF="graphreg.htm#00">Set/Reset</A> field location,
|
||||
replicated 8 times to fill the byte, giving it either the value 00000000b
|
||||
or 11111111b. If the <A HREF="graphreg.htm#01">Enable Set/Reset</A> field
|
||||
for a given plane is 0 then the host data byte is used instead. Note that
|
||||
in some write modes, the host data byte is used for other purposes, and
|
||||
the set/reset register is always used as data, and in other modes the set/reset
|
||||
mechanism is not used at all.
|
||||
<BR> The third stage performs logical operations
|
||||
between the host data, which has been split into four planes and is now
|
||||
32-bits wide, and the latch register, which provides a second 32-bit operand.
|
||||
The <A HREF="graphreg.htm#03">Logical Operation</A> field selects the operation
|
||||
that this stage performs. The four possibilities are: NOP (the host data
|
||||
is passed directly through, performing no operation), AND (the data is
|
||||
logically ANDed with the latched data.), OR (the data is logically ORed
|
||||
with the latched data), and XOR (the data is logically XORed with the latched
|
||||
data.) The result of this operation is then passed on. whilst the latched
|
||||
data remains unchanged, available for use in successive operations.
|
||||
<BR> In the fourth stage, individual
|
||||
bits may be selected from the result or copied from the latch register.
|
||||
Each bit of the <A HREF="graphreg.htm#08">Bit Mask</A> field determines
|
||||
whether the corresponding bits in each plane are the result of the previous
|
||||
step or are copied directly from the latch register. This allows the host
|
||||
CPU to modify only a single bit, by first performing a dummy read to fill
|
||||
the latch register
|
||||
<BR> The fifth stage allows specification
|
||||
of what planes, if any a write operation affects, via the <A HREF="seqreg.htm#02">Memory
|
||||
Plane Write Enable</A> field. The four bits in this field determine whether
|
||||
or not the write affects the corresponding plane If the a planes bit is
|
||||
1 then the data from the previous step will be written to display memory,
|
||||
otherwise the display buffer location in that plane will remain unchanged.
|
||||
<BR> The four write modes, of
|
||||
which the current one is set by writing to the <A HREF="graphreg.htm#05">Write
|
||||
Mode</A> field The four write modes, simply called write modes 0-3, based
|
||||
on the value of the <A HREF="graphreg.htm#05">Write Mode</A> field are:
|
||||
<UL>
|
||||
<LI>
|
||||
<B>Write Mode 0:</B></LI>
|
||||
|
||||
<BR> Write Mode 0 is the standard
|
||||
and most general write mode. While the other write modes are designed to
|
||||
perform a specific task, this mode can be used to perform most tasks as
|
||||
all five operations are performed on the data. The data byte from the host
|
||||
is first rotated as specified by the <A HREF="graphreg.htm#03">Rotate Count</A>
|
||||
field, then is replicated across all four planes. Then the <A HREF="graphreg.htm#01">Enable
|
||||
Set/Reset</A> field selects which planes will receive their values from
|
||||
the host data and which will receive their data from that plane's <A HREF="graphreg.htm#00">Set/Reset</A>
|
||||
field location. Then the operation specified by the <A HREF="graphreg.htm#03">Logical
|
||||
Operation</A> field is performed on the resulting data and the data in
|
||||
the read latches. The <A HREF="graphreg.htm#08">Bit Mask</A> field is then
|
||||
used to select between the resulting data and data from the latch register.
|
||||
Finally, the resulting data is written to the display memory planes enabled
|
||||
in the <A HREF="seqreg.htm#02">Memory Plane Write Enable</A> field.
|
||||
<LI>
|
||||
<B>Write Mode 1:</B></LI>
|
||||
|
||||
<BR> Write Mode 1 is used to
|
||||
transfer the data in the latches register directly to the screen, affected
|
||||
only by the <A HREF="seqreg.htm#02">Memory Plane Write Enable</A> field.
|
||||
This can facilitate rapid transfer of data on byte boundaries from one
|
||||
area of video memory to another or filling areas of the display with a
|
||||
pattern of 8 pixels. When Write Mode 0 is used with the <A HREF="graphreg.htm#08">Bit
|
||||
Mask</A> field set to 00000000b the operation of the hardware is identical
|
||||
to this mode, although it is entirely possible that this mode is faster
|
||||
on some cards.
|
||||
<LI>
|
||||
<B>Write Mode 2:</B></LI>
|
||||
|
||||
<BR> Write Mode 2 is used to
|
||||
unpack a pixel value packed into the lower 4 bits of the host data byte
|
||||
into the 4 display planes. In the byte from the host, the bit representing
|
||||
each plane will be replicated across all 8 bits of the corresponding planes.
|
||||
Then the operation specified by the <A HREF="graphreg.htm#03">Logical Operation</A>
|
||||
field is performed on the resulting data and the data in the read latches.
|
||||
The <A HREF="graphreg.htm#08">Bit Mask</A> field is then used to select
|
||||
between the resulting data and data from the latch register. Finally, the
|
||||
resulting data is written to the display memory planes enabled in the <A HREF="seqreg.htm#02">Memory
|
||||
Plane Write Enable</A> field.
|
||||
<LI>
|
||||
<B>Write Mode 3:</B></LI>
|
||||
|
||||
<BR><B> </B>Write Mode 3 is used
|
||||
when the color written is fairly constant but the <A HREF="graphreg.htm#08">Bit
|
||||
Mask</A> field needs to be changed frequently, such as when drawing single
|
||||
color lines or text. The value of the <A HREF="graphreg.htm#00">Set/Reset</A>
|
||||
field is expanded as if the <A HREF="graphreg.htm#01">Enable Set/Reset</A>
|
||||
field were set to 1111b, regardless of its actual value. The host data
|
||||
is first rotated as specified by the <A HREF="graphreg.htm#03">Rotate Count</A>
|
||||
field, then is ANDed with the <A HREF="graphreg.htm#08">Bit Mask</A> field.
|
||||
The resulting value is used where the <A HREF="graphreg.htm#08">Bit Mask</A>
|
||||
field normally would be used, selecting data from either the expansion
|
||||
of the <A HREF="graphreg.htm#00">Set/Reset</A> field or the latch register.
|
||||
Finally, the resulting data is written to the display memory planes enabled
|
||||
in the <A HREF="seqreg.htm#02">Memory Plane Write Enable</A> field.</UL>
|
||||
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>
|
||||
<BR>
|
||||
</BODY>
|
||||
</HTML>
|
||||
508
specs/freevga/vga/vgareg.htm
Normal file
@@ -0,0 +1,508 @@
|
||||
<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--Accessing the VGA Registers</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="../home.htm">Home</A> <A HREF="#general">Intro</A> <A HREF="#general">Advice</A>
|
||||
<A HREF="#fudge">Fudge</A> <A HREF="#paranoia">Paranoia</A> <A HREF="#external">External</A>
|
||||
<A HREF="#indexed">Indexed</A> <A HREF="#attribute">Attribute</A> <A HREF="#color">Color</A>
|
||||
<A HREF="#binary">Binary</A> <A HREF="#example">Example</A> <A HREF="#bitfields">Masking</A>
|
||||
<A HREF="vga.htm#register">Back</A>
|
||||
<HR WIDTH="100%"><B>Hardware Level VGA and SVGA Video Programming Information
|
||||
Page</B></CENTER>
|
||||
|
||||
<CENTER>Accessing the VGA Registers
|
||||
<HR WIDTH="100%"></CENTER>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="#intro">Introduction</A> -- provides a general overview of accessing
|
||||
the VGA registers.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#general">General Advice</A> -- basic guidelines for use when
|
||||
accessing VGA registers.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#fudge">I/O Fudge Factor</A> -- discusses delays between I/O accesses.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#paranoia">Paranoia</A> -- discusses making code more robust.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#external">Accessing the External Registers</A> -- details and
|
||||
guidelines for accessing these registers.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#indexed">Accessing the Sequencer, Graphics, and CRT Controller
|
||||
Registers</A> -- details and guidelines for accessing these registers,
|
||||
including step-by-step instructions.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#attribute">Accessing the Attribute Registers</A> -- details and
|
||||
guidelines for accessing this register, including step-by-step instructions.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#color">Accessing the Color Registers</A> -- details and guidelines
|
||||
for accessing this register, including step-by-step instructions.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#binary">Binary Operations</A> -- details on the operation of
|
||||
the logical operators OR, AND, and XOR.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#example">Example Register</A> -- an example register selected
|
||||
to demonstrate both the format they will be presented in and how fields
|
||||
work.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#bitfields">Masking Bit-Fields</A> -- details on changing specific
|
||||
fields within registers using the logical operators.</LI>
|
||||
</UL>
|
||||
<A NAME="intro"></A><B>Introduction</B>
|
||||
<BR> This section discusses methods
|
||||
of manipulating the particular registers present in VGA hardware. Depending
|
||||
upon which register one is accessing, the method of accessing them is different
|
||||
and sometimes difficult to understand. The VGA has many more registers
|
||||
than it has I/O ports, thus it must provide a way to re-use or multiplex
|
||||
many registers onto a relatively small number of ports. All of the VGA
|
||||
ports are accessed by inputting and outputting bytes to I/O ports; however,
|
||||
in many cases it is necessary to perform additional steps to ready the
|
||||
VGA adapter for reading and writing data. Port addresses are given at their
|
||||
hexadecimal address, such as 3C2h.
|
||||
|
||||
<P><A NAME="general"></A><B>General Advice</B>
|
||||
<BR><B> </B>If a program takes
|
||||
control of the video card and changes its state, it is considered good
|
||||
programming practice to keep track of the original values of any register
|
||||
it changes such that upon termination (normal or abnormal) it can write
|
||||
them back to the hardware to restore the state. Anyone who has seen a graphics
|
||||
application abort in the middle of a graphics screen knows how annoying
|
||||
this can be. Almost all of the VGA registers can be saved and restored
|
||||
in this fashion. In addition when changing only a particular field of a
|
||||
register, the value of the register should be read and the byte should
|
||||
be masked so that only the field one is trying to change is actually changed.
|
||||
|
||||
<P><A NAME="fudge"></A><B>I/O Fudge Factor</B>
|
||||
<BR> Often a hardware device
|
||||
is not capable handling I/O accesses as fast as the processor can issue
|
||||
them. In this case, a program must provide adequate delay between I/O accesses
|
||||
to the same device. While many modern chipsets provide this delay in hardware,
|
||||
there are still many implementations in existence that do not provide this
|
||||
delay. If you are attempting to write programs for the largest possible
|
||||
variety of hardware configurations, then it is necessary to know the amount
|
||||
of delay necessary. Unfortunately, this delay is not often specified, and
|
||||
varies from one VGA implementation to another. In the interest of performance
|
||||
it is ideal to keep this delay to the minimum necessary. In the interest
|
||||
of compatibility it is necessary to implement a delay independent of clock
|
||||
speed. (Faster processors are continuously being developed, and also a
|
||||
user may change clock speed dynamically via the Turbo button on their case.)
|
||||
|
||||
<P><A NAME="paranoia"></A><B>Paranoia</B>
|
||||
<BR> If one wishes to be extra
|
||||
cautious when writing to registers, after writing to a register one can
|
||||
read the value back and compare it with the original value. If they differ
|
||||
it may mean that the VGA hardware has a stuck bit in one its registers,
|
||||
that you are attempting to modify a locked or unsupported register, or
|
||||
that you are not providing enough delay between I/O accesses. As long as
|
||||
reading the register twice doesn't have any unintended side effects, when
|
||||
reading a registers value, one can read the register twice and compare
|
||||
the values read, after masking out any fields that may change without CPU
|
||||
intervention. If the values read back are different it may mean that you
|
||||
are not providing enough delay between I/O accesses, that the hardware
|
||||
is malfunctioning, or are reading the wrong register or field. Other problems
|
||||
that these techniques can address are noise on the I/O bus due to faulty
|
||||
hardware, dirty contacts, or even sunspots! When perform I/O operations
|
||||
and these checks fail, try repeating the operation, possibly with increased
|
||||
I/O delay time. By providing extra robustness, I have found that my own
|
||||
programs will work properly on hardware that causes less robust programs
|
||||
to fail.
|
||||
|
||||
<P><A NAME="external"></A><B>Accessing the External Registers</B>
|
||||
<BR> The external registers are
|
||||
the easiest to program, because they each have their own separate I/O address.
|
||||
Reading and writing to them is as simple as inputting and outputting bytes
|
||||
to their respective port address. Note, however some, such as the Miscellaneous
|
||||
Output Register is written at port 3C2h, but is read at port 3CCh. The
|
||||
reason for this is for backwards compatibility with the EGA and previous
|
||||
adapters. Many registers in the EGA were write only, and thus the designers
|
||||
placed read-only registers at the same location as write-only ones. However,
|
||||
the biggest complaint programmers had with the EGA was the inability to
|
||||
read the EGA's video state and thus in the design of the VGA most of these
|
||||
write-only registers were changed to read/write registers. However, for
|
||||
backwards compatibility, the read-only register had to remain at 3C2h,
|
||||
so they used a different port.
|
||||
|
||||
<P><A NAME="indexed"></A><B>Accessing the Sequencer, Graphics, and CRT
|
||||
Controller Registers</B>
|
||||
<BR> These registers are accessed
|
||||
in an indexed fashion. Each of the three have two unique read/write ports
|
||||
assigned to them. The first port is the Address Register for the group.
|
||||
The other is the Data Register for the group. By writing a byte to the
|
||||
Address Register equal to the index of the particular sub-register you
|
||||
wish to access, one can address the data pointed to by that index by reading
|
||||
and writing the Data Register. The current value of the index can be read
|
||||
by reading the Address Register. It is best to save this value and restore
|
||||
it after writing data, particularly so in an interrupt routine because
|
||||
the interrupted process may be in the middle of writing to the same register
|
||||
when the interrupt occurred. To read and write a data register in one of
|
||||
these register groups perform the following procedure:
|
||||
<OL>
|
||||
<LI>
|
||||
Input the value of the Address Register and save it for step 6</LI>
|
||||
|
||||
<LI>
|
||||
Output the index of the desired Data Register to the Address Register.</LI>
|
||||
|
||||
<LI>
|
||||
Read the value of the Data Register and save it for later restoration upon
|
||||
termination, if needed.</LI>
|
||||
|
||||
<LI>
|
||||
If writing, modify the value read in step 3, making sure to mask off bits
|
||||
not being modified.</LI>
|
||||
|
||||
<LI>
|
||||
If writing, write the new value from step 4 to the Data register.</LI>
|
||||
|
||||
<LI>
|
||||
Write the value of Address register saved in step 1 to the Address Register.</LI>
|
||||
</OL>
|
||||
If you are paranoid, then you
|
||||
might want to read back and compare the bytes written in step 2, 5, and
|
||||
6 as in the <A HREF="#paranoia">Paranoia</A> section above. Note that certain
|
||||
CRTC registers can be protected from read or write access for compatibility
|
||||
with programs written prior to the VGA's existence. This protection is
|
||||
controlled via the <A HREF="crtcreg.htm#03">Enable Vertical Retrace Access</A>
|
||||
and <A HREF="crtcreg.htm#11">CRTC Registers Protect Enable</A> fields.
|
||||
Ensuring that access is not prevented even if your card does not normally
|
||||
protect these registers makes your
|
||||
|
||||
<P><A NAME="attribute"></A><B>Accessing the Attribute Registers</B>
|
||||
<BR> The attribute registers
|
||||
are also accessed in an indexed fashion, albeit in a more confusing way.
|
||||
The address register is read and written via port 3C0h. The data register
|
||||
is written to port 3C0h and read from port 3C1h. The index and the data
|
||||
are written to the same port, one after another. A flip-flop inside the
|
||||
card keeps track of whether the next write will be handled is an index
|
||||
or data. Because there is no standard method of determining the state of
|
||||
this flip-flop, the ability to reset the flip-flop such that the next write
|
||||
will be handled as an index is provided. This is accomplished by reading
|
||||
the Input Status #1 Register (normally port 3DAh) (the data received is
|
||||
not important.) This can cause problems with interrupts because there is
|
||||
no standard way to find out what the state of the flip-flop is; therefore
|
||||
interrupt routines require special card when reading this register. (Especially
|
||||
since the Input Status #1 Register's purpose is to determine whether a
|
||||
horizontal or vertical retrace is in progress, something likely to be read
|
||||
by an interrupt routine that deals with the display.) If an interrupt were
|
||||
to read 3DAh in the middle of writing to an address/data pair, then the
|
||||
flip-flop would be reset and the data would be written to the address register
|
||||
instead. Any further writes would also be handled incorrectly and thus
|
||||
major corruption of the registers could occur. To read and write an data
|
||||
register in the attribute register group, perform the following procedure:
|
||||
<OL>
|
||||
<LI>
|
||||
Input a value from the Input Status #1 Register (normally port 3DAh) and
|
||||
discard it.</LI>
|
||||
|
||||
<LI>
|
||||
Read the value of the Address/Data Register and save it for step 7.</LI>
|
||||
|
||||
<LI>
|
||||
Output the index of the desired Data Register to the Address/Data Register</LI>
|
||||
|
||||
<LI>
|
||||
Read the value of the Data Register and save it for later restoration upon
|
||||
termination, if needed.</LI>
|
||||
|
||||
<LI>
|
||||
If writing, modify the value read in step 4, making sure to mask off bits
|
||||
not being modified.</LI>
|
||||
|
||||
<LI>
|
||||
If writing, write the new value from step 5 to the Address/Data register.</LI>
|
||||
|
||||
<LI>
|
||||
Write the value of Address register saved in step 1 to the Address/Data
|
||||
Register.</LI>
|
||||
|
||||
<LI>
|
||||
If you wish to leave the register waiting for an index, input a value from
|
||||
the Input Status #1 Register (normally port 3DAh) and discard it.</LI>
|
||||
</OL>
|
||||
If you have control over interrupts,
|
||||
then you can disable interrupts while in the middle of writing to the register.
|
||||
If not, then you may be able to implement a critical section where you
|
||||
use a byte in memory as a flag whether it is safe to modify the attribute
|
||||
registers and have your interrupt routine honor this. And again, it pays
|
||||
to be paranoid. Resetting the flip-flop even though it <B>should</B> be
|
||||
in the reset state already helps prevent catastrophic problems. Also, you
|
||||
might want to read back and compare the bytes written in step 3, 6, and
|
||||
7 as in the <A HREF="#paranoia">Paranoia</A> section above.
|
||||
<BR> On the IBM VGA implementation,
|
||||
an undocumented register (CRTC Index=24h, bit 7) can be read to determine
|
||||
the status of the flip-flop (0=address,1=data) and many VGA compatible
|
||||
chipsets duplicate this behavior, but it is not guaranteed. However, it
|
||||
is a simple matter to determine if this is the case. Also, some SVGA chipsets
|
||||
provide the ability to access the attribute registers in the same fashion
|
||||
as the CRT, Sequencer, and Graphics controllers. Because this functionality
|
||||
is vendor specific it is really only useful when programming for that particular
|
||||
chipset. To determine if this undocumented bit is supported, perform the
|
||||
following procedure:
|
||||
<OL>
|
||||
<LI>
|
||||
Input a value from the Input Status #1 Register (normally port 3DAh) and
|
||||
discard it.</LI>
|
||||
|
||||
<LI>
|
||||
Verify that the flip-flop status bit (CRTC Index 24, bit 7) is 0. If bit=1
|
||||
then feature is not supported, else continue to step 3.</LI>
|
||||
|
||||
<LI>
|
||||
Output an address value to the Attribute Address/Data register.</LI>
|
||||
|
||||
<LI>
|
||||
Verify that the flip-flop status bit (CRTC Index 24, bit 7) is 1. If bit=0
|
||||
then feature is not supported, else continue to step 5.</LI>
|
||||
|
||||
<LI>
|
||||
Input a value from the Input Status #1 Register (normally port 3DAh) and
|
||||
discard it.</LI>
|
||||
|
||||
<LI>
|
||||
Verify that the flip-flop status bit (CRTC Index 24, bit 7) is 0. If bit=1
|
||||
then feature is not supported, else feature is supported.</LI>
|
||||
</OL>
|
||||
<A NAME="color"></A><B>Accessing the Color Registers</B>
|
||||
<BR> The color registers require an altogether
|
||||
different technique; this is because the 256-color palette requires 3 bytes
|
||||
to store 18-bit color values. In addition the hardware supports the capability
|
||||
to load all or portions of the palette rapidly. To write to the palette,
|
||||
first you must output the value of the palette entry to the PEL Address
|
||||
Write Mode Register (port 3C8h.) Then you should output the component values
|
||||
to the PEL Data Register (port 3C9h), in the order red, green, then blue.
|
||||
The PEL Address Write Mode Register will then automatically increment,
|
||||
allowing the component values of the palette entry to be written to the
|
||||
PEL Data Register. Reading is performed similarly, except that the PEL
|
||||
Address Read Mode Register (port 3C7h) is used to specify the palette entry
|
||||
to be read, and the values are read from the PEL Data Register. Again,
|
||||
the PEL Address Read Mode Register auto-increments after each triplet is
|
||||
written. The current index for the current operation can be read from the
|
||||
PEL Address Write Mode Register. Reading port 3C7h gives the DAC State
|
||||
Register, which specifies whether a read operation or a write operation
|
||||
is in effect. As in the attribute registers, there is guaranteed way for
|
||||
an interrupt routine to access the color registers and return the color
|
||||
registers to the state they were in prior to access without some communication
|
||||
between the ISR and the main program. For some workarounds see the <A HREF="#attribute">Accessing
|
||||
the Attribute Registers</A> section above. To read the color registers:
|
||||
<OL>
|
||||
<LI>
|
||||
Read the DAC State Register and save the value for use in step 8.</LI>
|
||||
|
||||
<LI>
|
||||
Read the PEL Address Write Mode Register for use in step 8.</LI>
|
||||
|
||||
<LI>
|
||||
Output the value of the first color entry to be read to the PEL Address
|
||||
Read Mode Register.</LI>
|
||||
|
||||
<LI>
|
||||
Read the PEL Data Register to obtain the red component value.</LI>
|
||||
|
||||
<LI>
|
||||
Read the PEL Data Register to obtain the green component value.</LI>
|
||||
|
||||
<LI>
|
||||
Read the PEL Data Register to obtain the blue component value.</LI>
|
||||
|
||||
<LI>
|
||||
If more colors are to be read, repeat steps 4-6.</LI>
|
||||
|
||||
<LI>
|
||||
Based upon the DAC State from step 1, write the value saved in step 2 to
|
||||
either the PEL Address Write Mode Register or the PEL Address Read Mode
|
||||
Register.</LI>
|
||||
</OL>
|
||||
Note: Steps 1, 2, and 8 are hopelessly optimistic. This in no way guarantees
|
||||
that the state is preserved, and with some DAC implementations this may
|
||||
actually guarantee that the state is never preserved. See the <A HREF="vgadac.htm">DAC
|
||||
Operation</A> page for more details.
|
||||
|
||||
<P><A NAME="binary"></A><B>Binary Operations</B>
|
||||
<BR><B> </B>In order to better
|
||||
understand dealing with bit fields it is necessary to know a little bit
|
||||
about logical operations such as logical-and (AND), logical-or (OR), and
|
||||
exclusive-or(XOR.) These operations are performed on a bit by bit basis
|
||||
using the truth tables below. All of these operations are commutative,
|
||||
i.e. A OR B = B OR A, so you look up one bit in the left column and the
|
||||
other in the top row and consult the intersecting row and column for the
|
||||
answer.
|
||||
<BR>
|
||||
<CENTER><TABLE BORDER WIDTH="500" >
|
||||
<TR ALIGN=CENTER>
|
||||
<TD COLSPAN="3"><B>AND</B></TD>
|
||||
|
||||
<TD></TD>
|
||||
|
||||
<TD COLSPAN="3"><B>OR</B></TD>
|
||||
|
||||
<TD></TD>
|
||||
|
||||
<TD COLSPAN="3"><B>XOR</B></TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER>
|
||||
<TD WIDTH="10%"></TD>
|
||||
|
||||
<TD WIDTH="10%"><B>0</B></TD>
|
||||
|
||||
<TD WIDTH="10%"><B>1</B></TD>
|
||||
|
||||
<TD></TD>
|
||||
|
||||
<TD WIDTH="10%"></TD>
|
||||
|
||||
<TD WIDTH="10%"><B>0</B></TD>
|
||||
|
||||
<TD WIDTH="10%"><B>1</B></TD>
|
||||
|
||||
<TD></TD>
|
||||
|
||||
<TD WIDTH="10%"></TD>
|
||||
|
||||
<TD WIDTH="10%"><B>0</B></TD>
|
||||
|
||||
<TD WIDTH="10%"><B>1</B></TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER>
|
||||
<TD><B>0</B></TD>
|
||||
|
||||
<TD>0</TD>
|
||||
|
||||
<TD>0</TD>
|
||||
|
||||
<TD></TD>
|
||||
|
||||
<TD><B>0</B></TD>
|
||||
|
||||
<TD>0</TD>
|
||||
|
||||
<TD>1</TD>
|
||||
|
||||
<TD></TD>
|
||||
|
||||
<TD><B>0</B></TD>
|
||||
|
||||
<TD>0</TD>
|
||||
|
||||
<TD>1</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER>
|
||||
<TD><B>1</B></TD>
|
||||
|
||||
<TD>0</TD>
|
||||
|
||||
<TD>1</TD>
|
||||
|
||||
<TD></TD>
|
||||
|
||||
<TD><B>1</B></TD>
|
||||
|
||||
<TD>1</TD>
|
||||
|
||||
<TD>1</TD>
|
||||
|
||||
<TD></TD>
|
||||
|
||||
<TD><B>1</B></TD>
|
||||
|
||||
<TD>1</TD>
|
||||
|
||||
<TD>0</TD>
|
||||
</TR>
|
||||
</TABLE></CENTER>
|
||||
<BR>
|
||||
<A NAME="example"></A><B>Example Register</B>
|
||||
<BR> The following table is an
|
||||
example of one particular register, the Mode Register of the Graphics Register.
|
||||
Each number from 7-0 represents the bit position in the byte. Many registers
|
||||
contain more than one field, each of which performs a different function.
|
||||
This particular chart contains four fields, two of which are two bits in
|
||||
length. It also contains two bits which are not implemented (to the best
|
||||
of my knowledge) by the standard VGA hardware.
|
||||
<BR>
|
||||
<TABLE BORDER WIDTH="600" CELLPADING="2" >
|
||||
<CAPTION ALIGN=TOP><B>Mode Register (Index 05h)</B></CAPTION>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75">7</TD>
|
||||
|
||||
<TD WIDTH="75">6</TD>
|
||||
|
||||
<TD WIDTH="75">5</TD>
|
||||
|
||||
<TD WIDTH="75">4</TD>
|
||||
|
||||
<TD WIDTH="75">3</TD>
|
||||
|
||||
<TD WIDTH="75">2</TD>
|
||||
|
||||
<TD WIDTH="75">1</TD>
|
||||
|
||||
<TD WIDTH="75">0</TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN=CENTER VALIGN=CENTER>
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD COLSPAN="2" WIDTH="150">Shift Register</TD>
|
||||
|
||||
<TD WIDTH="75">Odd/Even</TD>
|
||||
|
||||
<TD WIDTH="75">RM</TD>
|
||||
|
||||
<TD WIDTH="75"></TD>
|
||||
|
||||
<TD COLSPAN="2" WIDTH="150">Write Mode</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<BR>
|
||||
<A NAME="bitfields"></A><B>Masking Bit-Fields</B>
|
||||
<BR> Your development environment
|
||||
may provide some assistance in dealing with bit fields. Consult your documentation
|
||||
for this. In addition it can be performed using the logical operators AND,
|
||||
OR, and XOR (for details on these operators see the <A HREF="#binary">Binary
|
||||
Operations</A> section above.) To change the value of the Shift Register
|
||||
field of the example register above, we would first mask out the bits we
|
||||
do not wish to change. This is accomplished by performing a logical AND
|
||||
of the value read from the register and a binary value in which all of
|
||||
the bits we wish to leave alone are set to 1, which would be 10011111b
|
||||
for our example. This leaves all of the bits except the Shift Register
|
||||
field alone and set the Shift Register field to zero. If this was our goal,
|
||||
then we would stop here and write the value back to the register. We then
|
||||
OR the value with a binary number in which the bits are shifted into position.
|
||||
To set this field to 10b we would OR the result of the AND with 01000000b.
|
||||
The resulting byte would then be written to the register. To set a bitfield
|
||||
to all ones the AND step is not necessary, similar to setting the bitfield
|
||||
to all zeros using AND. To toggle a bitfield you can XOR a value with a
|
||||
byte with a ones in the positions to toggle. For example XORing the value
|
||||
read with 01100000b would toggle the value of the Shift Register bitfield.
|
||||
By using these techniques you can assure that you do not cause any unwanted
|
||||
"side-effects" when modifying registers.
|
||||
|
||||
<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>
|
||||
<BR>
|
||||
</BODY>
|
||||
</HTML>
|
||||
385
specs/freevga/vga/vgargidx.htm
Normal file
@@ -0,0 +1,385 @@
|
||||
<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--VGA Field Index</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="../home.htm">Home</A> <A HREF="#A">A</A> <A HREF="#B">B</A>
|
||||
<A HREF="#C">C</A> <A HREF="#D">D</A> <A HREF="#E">E</A>
|
||||
<A HREF="#F">F</A> G <A HREF="#H">H</A> <A HREF="#I">I</A>
|
||||
J K <A HREF="#L">L</A> <A HREF="#M">M</A> N
|
||||
<A HREF="#O">O</A> <A HREF="#P">P</A> Q <A HREF="#R">R</A>
|
||||
<A HREF="#S">S</A> T <A HREF="#U">U</A> <A HREF="#V">V</A>
|
||||
<A HREF="#W">W</A> X Y Z <A HREF="vga.htm#index">Back</A>
|
||||
<HR WIDTH="100%"><B>Hardware Level VGA and SVGA Video Programming Information
|
||||
Page</B></CENTER>
|
||||
|
||||
<CENTER>VGA Field Index
|
||||
<HR WIDTH="100%"></CENTER>
|
||||
|
||||
<CENTER><A HREF="#A">A</A> | <A HREF="#B">B</A> | <A HREF="#C">C</A> |
|
||||
<A HREF="#D">D</A> | <A HREF="#E">E</A> | <A HREF="#F">F</A> | G | <A HREF="#H">H</A>
|
||||
| <A HREF="#I">I</A> | J | K | <A HREF="#L">L</A> | <A HREF="#M">M</A>
|
||||
| N | <A HREF="#O">O</A> | <A HREF="#P">P</A> | Q | <A HREF="#R">R</A>
|
||||
| <A HREF="#S">S</A> | T | <A HREF="#U">U</A> | <A HREF="#V">V</A> | <A HREF="#W">W</A>
|
||||
| X | Y | Z</CENTER>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
256-Color Shift Mode -- <A HREF="graphreg.htm#05">Graphics Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
8-bit Color Enable -- <A HREF="attrreg.htm#10">Attribute Mode Control Register</A></LI>
|
||||
|
||||
<LI>
|
||||
9/8 Dot Mode -- <A HREF="seqreg.htm#01">Clocking Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
<A NAME="A"></A>Address Wrap Select -- <A HREF="crtcreg.htm#17">CRTC Mode
|
||||
Control Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Alphanumeric Mode Disable -- <A HREF="graphreg.htm#06">Miscellaneous Graphics
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Asynchronous Reset -- <A HREF="seqreg.htm#00">Reset Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Attribute Address -- <A HREF="attrreg.htm#3C0">Attribute Address Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Attribute Controller Graphics Enable -- <A HREF="attrreg.htm#10">Attribute
|
||||
Mode Control Register</A></LI>
|
||||
|
||||
<LI>
|
||||
<A NAME="B"></A>Bit Mask -- <A HREF="graphreg.htm#08">Bit Mask Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Blink Enable -- <A HREF="attrreg.htm#10">Attribute Mode Control Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Byte Panning -- <A HREF="crtcreg.htm#08">Preset Row Scan Register</A></LI>
|
||||
|
||||
<LI>
|
||||
<A NAME="C"></A>Chain 4 Enable -- <A HREF="seqreg.htm#04">Sequencer Memory
|
||||
Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Clock Select -- <A HREF="extreg.htm#3CCR3C2W">Miscellaneous Output Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Chain Odd/Even Enable -- <A HREF="graphreg.htm#06">Miscellaneous Graphics
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Character Set A Select -- <A HREF="seqreg.htm#03">Character Map Select
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Character Set B Select -- <A HREF="seqreg.htm#03">Character Map Select
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Color Compare -- <A HREF="graphreg.htm#02">Color Compare Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Color Don't Care -- <A HREF="graphreg.htm#07">Color Don't Care Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Color Plane Enable -- <A HREF="attrreg.htm#12">Color Plane Enable Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Color Select 5-4 -- <A HREF="attrreg.htm#14">Color Select Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Color Select 7-6 -- <A HREF="attrreg.htm#14">Color Select Register</A></LI>
|
||||
|
||||
<LI>
|
||||
CRTC Registers Protect Enable -- <A HREF="crtcreg.htm#11">Vertical Retrace
|
||||
End Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Cursor Disable -- <A HREF="crtcreg.htm#0A">Cursor Start Reguster</A></LI>
|
||||
|
||||
<LI>
|
||||
Cursor Location -- bits 15-8: <A HREF="crtcreg.htm#0E">Cursor Location
|
||||
High Register</A>, bits 7-0: <A HREF="crtcreg.htm#0F">Cursor Location Low
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Cursor Scan Line End -- <A HREF="crtcreg.htm#0B">Cursor End Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Cursor Scan Line Start -- <A HREF="crtcreg.htm#0A">Cursor Start Reguster</A></LI>
|
||||
|
||||
<LI>
|
||||
Cursor Skew -- <A HREF="crtcreg.htm#0B">Cursor End Register</A></LI>
|
||||
|
||||
<LI>
|
||||
<A NAME="D"></A>DAC Data -- <A HREF="colorreg.htm#3C9">DAC Data Register</A></LI>
|
||||
|
||||
<LI>
|
||||
DAC Read Address -- <A HREF="colorreg.htm#3C7W">DAC Address Read Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
DAC State -- <A HREF="colorreg.htm#3C7R">DAC State Register</A></LI>
|
||||
|
||||
<LI>
|
||||
DAC Write Address -- <A HREF="colorreg.htm#3C8">DAC Address Write Mode
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Display Disabled -- <A HREF="extreg.htm#3xAR">Input Status #1 Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Display Enable Skew -- <A HREF="crtcreg.htm#03">End Horizontal Blanking
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Divide Memory Address Clock by 4 -- <A HREF="crtcreg.htm#14">Underline
|
||||
Location Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Divide Scan Line Clock by 2 -- <A HREF="crtcreg.htm#17">CRTC Mode Control
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Dot Clock Rate -- <A HREF="seqreg.htm#01">Clocking Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Double-Word Addressing -- <A HREF="crtcreg.htm#14">Underline Location Register</A></LI>
|
||||
|
||||
<LI>
|
||||
<A NAME="E"></A>Enable Set/Reset -- <A HREF="graphreg.htm#01">Enable Set/Reset
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Enable Vertical Retrace Access -- <A HREF="crtcreg.htm#03">End Horizontal
|
||||
Blanking Register</A></LI>
|
||||
|
||||
<LI>
|
||||
End Horizontal Display -- <A HREF="crtcreg.htm#01">End Horizontal Display
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
End Horizontal Blanking -- bit 5: <A HREF="crtcreg.htm#05">End Horizontal
|
||||
Retrace Register</A>, bits 4-0: <A HREF="crtcreg.htm#03">End Horizontal
|
||||
Blanking Register</A>,</LI>
|
||||
|
||||
<LI>
|
||||
End Horizontal Retrace -- <A HREF="crtcreg.htm#05">End Horizontal Retrace
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
End Vertical Blanking -- <A HREF="crtcreg.htm#16">End Vertical Blanking
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Extended Memory -- <A HREF="seqreg.htm#04">Sequencer Memory Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
<A NAME="F"></A>Feature Control Bit 0 -- <A HREF="extreg.htm#3CAR3xAW">Feature
|
||||
Control Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Feature Control Bit 1 -- <A HREF="extreg.htm#3CAR3xAW">Feature Control
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
<A NAME="H"></A>Horizontal Retrace Skew -- <A HREF="crtcreg.htm#05">End
|
||||
Horizontal Retrace Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Horizontal Sync Polarity -- <A HREF="extreg.htm#3CCR3C2W">Miscellaneous
|
||||
Output Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Horizontal Total -- <A HREF="crtcreg.htm#00">Horizontal Total Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Host Odd/Even Memory Read Addressing Enable -- <A HREF="graphreg.htm#05">Graphics
|
||||
Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Host Odd/Even Memory Write Addressing Enable -- <A HREF="seqreg.htm#04">Sequencer
|
||||
Memory Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
<A NAME="I"></A>Input/Output Address Select -- <A HREF="extreg.htm#3CCR3C2W">Miscellaneous
|
||||
Output Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Internal Palette Index -- <A HREF="attrreg.htm#000F">Palette Registers</A></LI>
|
||||
|
||||
<LI>
|
||||
<A NAME="L"></A>Line Compare -- bit 9: <A HREF="crtcreg.htm#09">Maximum
|
||||
Scan Line Register</A>, bit 8: <A HREF="crtcreg.htm#07">Overflow Register</A>,
|
||||
bits 7-0: <A HREF="crtcreg.htm#18">Line Compare Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Line Graphics Enable -- <A HREF="attrreg.htm#10">Attribute Mode Control
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Logical Operation -- <A HREF="graphreg.htm#03">Data Rotate Register</A></LI>
|
||||
|
||||
<LI>
|
||||
<A NAME="M"></A>Map Display Address 13 -- <A HREF="crtcreg.htm#17">CRTC
|
||||
Mode Control Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Map Display Address 14 -- <A HREF="crtcreg.htm#17">CRTC Mode Control Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Maximum Scan Line -- <A HREF="crtcreg.htm#09">Maximum Scan Line Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Memory Map Select -- <A HREF="graphreg.htm#06">Miscellaneous Graphics Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Memory Plane Write Enable -- <A HREF="seqreg.htm#02">Map Mask Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Memory Refresh Bandwidth -- <A HREF="crtcreg.htm#11">Vertical Retrace End
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Monochrome Emulation -- <A HREF="attrreg.htm#10">Attribute Mode Control
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
<A NAME="O"></A>Odd/Even Page Select -- <A HREF="extreg.htm#3CCR3C2W">Miscellaneous
|
||||
Output Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Offset -- <A HREF="crtcreg.htm#13">Offset Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Overscan Palette Index -- <A HREF="attrreg.htm#11">Overscan Color Register</A></LI>
|
||||
|
||||
<LI>
|
||||
<A NAME="P"></A>Palette Address Source -- <A HREF="attrreg.htm#3C0">Attribute
|
||||
Address Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Palette Bits 5-4 Select -- <A HREF="attrreg.htm#10">Attribute Mode Control
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Pixel Panning Mode -- <A HREF="attrreg.htm#10">Attribute Mode Control Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Pixel Shift Count -- <A HREF="attrreg.htm#13">Horizontal Pixel Panning
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Preset Row Scan -- <A HREF="crtcreg.htm#08">Preset Row Scan Register</A></LI>
|
||||
|
||||
<LI>
|
||||
<A NAME="R"></A>RAM Enable -- <A HREF="extreg.htm#3CCR3C2W">Miscellaneous
|
||||
Output Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Read Map Select -- <A HREF="graphreg.htm#04">Read Map Select Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Read Mode - <A HREF="graphreg.htm#05">Graphics Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Rotate Count -- <A HREF="graphreg.htm#03">Data Rotate Register</A></LI>
|
||||
|
||||
<LI>
|
||||
<A NAME="S"></A>Scan Doubling -- <A HREF="crtcreg.htm#09">Maximum Scan
|
||||
Line Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Screen Disable -- <A HREF="seqreg.htm#01">Clocking Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Set/Reset -- <A HREF="graphreg.htm#00">Set/Reset Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Shift Four Enable -- <A HREF="seqreg.htm#01">Clocking Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Shift/Load Rate -- <A HREF="seqreg.htm#01">Clocking Mode Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Shift Register Interleave Mode -- <A HREF="graphreg.htm#05">Graphics Mode
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Start Address -- bits 15-8: <A HREF="crtcreg.htm#0C">Start Address High
|
||||
Register</A>, bits 7-0: <A HREF="crtcreg.htm#0D">Start Address Low Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Start Horizontal Blanking -- <A HREF="crtcreg.htm#02">Start Horizontal
|
||||
Blanking Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Start Horizontal Retrace -- <A HREF="crtcreg.htm#04">Start Horizontal Retrace
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Start Vertical Blanking -- bit 9: <A HREF="crtcreg.htm#09">Maximum Scan
|
||||
Line Register</A>, bit 8: <A HREF="crtcreg.htm#07">Overflow Register</A>,
|
||||
bits 7-0: <A HREF="crtcreg.htm#15">Start Vertical Blanking Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Switch Sense -- <A HREF="extreg.htm#3C2R">Input Status #0 Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Sync Enable -- <A HREF="crtcreg.htm#17">CRTC Mode Control Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Sycnchronous Reset -- <A HREF="seqreg.htm#00">Reset Register</A></LI>
|
||||
|
||||
<LI>
|
||||
<A NAME="U"></A>Underline Location -- <A HREF="crtcreg.htm#14">Underline
|
||||
Location Register</A></LI>
|
||||
|
||||
<LI>
|
||||
<A NAME="V"></A>Vertical Display End -- bits 9-8: <A HREF="crtcreg.htm#07">Overflow
|
||||
Register</A>, bits 7-0: <A HREF="crtcreg.htm#12">Vertical Display End Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Vertical Retrace -- <A HREF="extreg.htm#3xAR">Input Status #1 Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Vertical Retrace End -- <A HREF="crtcreg.htm#11">Vertical Retrace End Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Vertical Retrace Start -- bits 9-8: <A HREF="crtcreg.htm#07">Overflow Register</A>,
|
||||
bits 7-0: <A HREF="crtcreg.htm#10">Vertical Retrace Start Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Vertical Sync Polarity -- <A HREF="extreg.htm#3CCR3C2W">Miscellaneous Output
|
||||
Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Vertical Total -- bits 9-8: <A HREF="crtcreg.htm#07">Overflow Register</A>,
|
||||
bits 7-0: <A HREF="crtcreg.htm#06">Vertical Total Register</A></LI>
|
||||
|
||||
<LI>
|
||||
<A NAME="W"></A>Word/Byte Mode Select -- <A HREF="crtcreg.htm#17">CRTC
|
||||
Mode Control Register</A></LI>
|
||||
|
||||
<LI>
|
||||
Write Mode -- <A HREF="graphreg.htm#05">Graphics Mode Register</A></LI>
|
||||
</UL>
|
||||
|
||||
|
||||
<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>
|
||||
<BR>
|
||||
</BODY>
|
||||
</HTML>
|
||||
206
specs/freevga/vga/vgaseq.htm
Normal file
@@ -0,0 +1,206 @@
|
||||
<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>FreeVGA - VGA Sequencer Operation</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="../home.htm">Home</A> <A HREF="vga.htm#general">Back</A>
|
||||
<HR><B>Hardware Level VGA and SVGA Video Programming Information Page</B></CENTER>
|
||||
|
||||
<CENTER>VGA Sequencer Operation
|
||||
<HR></CENTER>
|
||||
<B>Introduction</B>
|
||||
<BR> The sequencer portion of
|
||||
the VGA hardware reads the display memory and converts it into data that
|
||||
is sent to the attribute controller. This would normally be a simple
|
||||
part of the video hardware, but the VGA hardware was designed to provide
|
||||
a degree of software compatibility with monochrome, CGA, EGA, and MCGA
|
||||
adapters. For this reason, the sequencer has quite a few different
|
||||
modes of operation. Further complicating programming, the sequencer
|
||||
has been poorly documented, resulting in many variances between various
|
||||
VGA/SVGA implementations.
|
||||
<BR>
|
||||
<BR><B>Sequencer Memory Addressing</B>
|
||||
<BR> The sequencer operates by
|
||||
loading a display address into memory, then shifting it out pixel by pixel.
|
||||
The memory is organized internally as 64K addresses, 32 bits wide.
|
||||
The seqencer maintains an internal 16-bit counter that is used to calculate
|
||||
the actual index of the 32-bit location to be loaded and shifted out.
|
||||
There are several different mappings from this counter to actual memory
|
||||
addressing, some of which use other bits from other counters, as required
|
||||
to provide compatibility with older hardware that uses those addressing
|
||||
schemes.
|
||||
|
||||
<P><More to be added here>
|
||||
<BR>
|
||||
<BR><B>Graphics Shifting Modes</B>
|
||||
<BR> When the <A HREF="graphreg.htm#06">Alphanumeric
|
||||
Mode Disable</A> field is set to 1, the sequencer operates in graphics
|
||||
mode where data in memory references pixel values, as opposed to the character
|
||||
map based operation used for alphanumeric mode.
|
||||
<BR> The sequencer has three
|
||||
methods of taking the 32-bit memory location loaded and shifting it into
|
||||
4-bit pixel values suitable for graphics modes, one of which combines 2
|
||||
pixel values to form 8-bit pixel values. The first method is the
|
||||
one used for the VGA's 16 color modes. This mode is selected when
|
||||
both the <A HREF="graphreg.htm#05">256-Color Shift Mode</A> and <A HREF="graphreg.htm#05">Shift
|
||||
Register Interleave Mode</A> fields are set to 0. In this mode, one
|
||||
bit from each of the four 8-bit planes in the 32-bit memory is used to
|
||||
form a 16 color value. This is shown in the diagram below, where the most
|
||||
significant bit of each of the four planes is shifted out into a pixel
|
||||
value, which is then sent to the attribute controller to be converted into
|
||||
an index into the DAC palette. Following this, the remaining bits
|
||||
will be shifted out one bit at a time, from most to least significant bit,
|
||||
with the bits from planes 0-3 going to pixel bits 0-3.
|
||||
<BR>
|
||||
<BR>
|
||||
<CENTER><A HREF="seqplanr.txt"><IMG SRC="seqplanr.gif" ALT="Click here for Textified Planar Shift Mode Diagram" HEIGHT=256 WIDTH=376></A></CENTER>
|
||||
|
||||
|
||||
<P> The second shift mode is
|
||||
the packed shift mode, which is selected when both the <A HREF="graphreg.htm#05">256-Color
|
||||
Shift Mode</A> field is set to 0 and the <A HREF="graphreg.htm#05">Shift
|
||||
Register Interleave Mode</A> field is set to 1.This is used by the VGA
|
||||
bios to support video modes compatible with CGA video modes. However,
|
||||
the CGA only uses planes 0 and 1 providing for a 4 color packed mode; however,
|
||||
the VGA hardware actually uses bits from two different bit planes, providing
|
||||
for 16 color modes. The bits for the first four pixels shifted out
|
||||
for a given address are stored in planes 0 and 2. The second four
|
||||
are stored in planes 1 and 3. For each pixel, bits 3-2 are shifted
|
||||
out of the higher numbered plane and bits 1-0 are shifted out of the lower
|
||||
numbered plane. For example, bits 3-2 of the first pixel shifted
|
||||
out are located in bits 7-6 of plane 2; likewise, bits 1-0 of the same
|
||||
pixel are located in bits 7-6 of plane 0.
|
||||
<BR>
|
||||
<BR>
|
||||
<CENTER><A HREF="seqpack.txt"><IMG SRC="seqpack.gif" ALT="Click for Textified Packed Shift Mode Diagram" HEIGHT=256 WIDTH=376></A></CENTER>
|
||||
|
||||
|
||||
<P> The third shift mode is used for
|
||||
256-color modes, which is selected when the <A HREF="graphreg.htm#05">256-Color
|
||||
Shift Mode</A> field is set to 1 (this field takes precedence over the
|
||||
<A HREF="graphreg.htm#05">Shift Register Interleave Mode</A> field.)
|
||||
This behavior of this shift mode varies among VGA implementations, due
|
||||
to it normally being used in combination with the <A HREF="attrreg.htm#10">8-bit
|
||||
Color Enable</A> field of the attribute controller. Thus certain
|
||||
variances in the sequencing operations can be masked by similar variances
|
||||
in the attribute controller. However, the implementations I have
|
||||
experimented with seem to fall into one of two similar behaviors, and thus
|
||||
it is possible to describe both here. Note that one is essentially
|
||||
a mirror image of the other, leading me to believe that the designers knew
|
||||
how it should work to be 100% IBM VGA compatible, but managed to get it
|
||||
backwards in the actual implementation. Due to being very poorly documented
|
||||
and understood, it is very possible that there are other implementations
|
||||
that vary significantly from these two cases. I do, however, feel
|
||||
that attempting to specify each field's function as accurately possible
|
||||
can allow more powerful utilization of the hardware.
|
||||
<BR> When this shift mode is
|
||||
enabled, the VGA hardware shifts 4 bit pixel values out of the 32-bit memory
|
||||
location each dot clock. This 4-bit value is processed by the attribute
|
||||
controller, and the lower 4 bits of the resulting DAC index is combined
|
||||
with the lower 4 bits of the previous attribute lookup to produce an 8-bit
|
||||
index into the DAC palette. This is why, for example, a 320 pixel
|
||||
wide 256 color mode needs to be programmed with timing values for a 640
|
||||
pixel wide normal mode. In 256-color mode, each plane holds a 8-bit
|
||||
value which is intended to be the DAC palette index for that pixel.
|
||||
Every second 8-bit index generated should correspond to the values in planes
|
||||
0-3, appearing left to right on the display. This is masked by the
|
||||
attribute controller, which in 256 color mode latches every second 8-bit
|
||||
value as well. This means that the intermediate 8-bit values are
|
||||
not normally seen, and is where implementations can vary. Another
|
||||
variance is whether the even or odd pixel values generated are the intended
|
||||
data bytes. This also is masked by the attribute controller, which
|
||||
latches the appropriate even or odd pixel values.
|
||||
<BR> The first case is where
|
||||
the 8-bit values are formed by shifting the 4 8-bit planes left.
|
||||
This is shown in the diagram below. The first pixel value generated
|
||||
will be the value held in bits 7-4 of plane 0, which is then followed by
|
||||
bits 3-0 of plane 0. This continues, shifting out the upper four
|
||||
bits of each plane in sequence before the lower four bits, ending up with
|
||||
bits 3-0 of plane 3. Each pixel value is fed to the attribute controller,
|
||||
where a lookup operation is performed using the attribute table.
|
||||
The previous 8-bit DAC index is shifted left by four, moving from the lower
|
||||
four bits to the upper four bits of the DAC index, and the lower 4 bits
|
||||
of the attribute table entry for the current pixel is shifted into the
|
||||
lower 4 bits of the 8-bit value, producing a new 8-bit DAC index.
|
||||
Note how one 4-bit result carries over into the next display memory location
|
||||
sequenced.
|
||||
<BR> For example, assume planes
|
||||
0-3 hold 01h, 23h, 45h, and 67h respectively, and the lower 4 bits of the
|
||||
the attribute table entries hold the value of the index itself, essentially
|
||||
using the index value as the result, and the last 8-bit DAC index generated
|
||||
was FEh. The first cycle, the pixel value generated is 0h, which is fed
|
||||
to the attribute controller and looked up, producing the table entry 0h
|
||||
(surprise!) The previous DAC index, FEh, is shifted left by four bits,
|
||||
while the new value, 0h is shifted into the lower four bits. Thus,
|
||||
the new DAC index output for this pixel is E0h. The next pixel is
|
||||
1h, which produces 1h at the other end of the attribute controller.
|
||||
The previous DAC index, E0h is shifted again producing 01h. This
|
||||
process continues, producing the DAC indexes, in order, 12h, 23h, 34h,
|
||||
45h, 56h, and 67h. Note that every second DAC index is the appropriate
|
||||
8-bit value for a 256-color mode, while the values in between contain four
|
||||
bits of the previous and four bits of the next DAC index.
|
||||
<BR>
|
||||
<BR>
|
||||
<CENTER><A HREF="256left.txt"><IMG SRC="256left.gif" ALT="Click for Textified 256-Color Shift Mode Diagram (Left)" HEIGHT=256 WIDTH=376></A></CENTER>
|
||||
|
||||
|
||||
<P> The second case is where the 8-bit
|
||||
values are formed by shifting the 8-bit values right, as depicted in the
|
||||
diagram below. The first pixel value generated is the lower four
|
||||
bits of plane 0, followed by the upper four bits. This continues
|
||||
for planes 1-3 until the last pixel value produced, which is the upper
|
||||
four bits of Plane 3. These pixel values are fed to the attribute
|
||||
controller, where the corresponding entry in the attribute table is looked
|
||||
up. The previous 8-bit DAC index is shifted right 4 places. and the
|
||||
lower four bits of the attribute table entry generated is used as the upper
|
||||
four bits of the new DAC index.
|
||||
<BR> For example, assume planes
|
||||
0-3 hold 01h, 23h, 45h, and 67h respectively, and the lower 4 bits of the
|
||||
the attribute table entries hold the value of the index itself, essentially
|
||||
using the index value as the result, and the last 8-bit DAC index generated
|
||||
was FEh. The first cycle, the pixel value generated is 1h, which is fed
|
||||
to the attribute controller and looked up, producing the table entry 1h.
|
||||
The previous DAC index, FEh, is shifted right by four bits, while the new
|
||||
value, 1h is shifted into the upper four bits. Thus, the new DAC
|
||||
index output for this pixel is 1Fh. The next pixel is 0h, which produces
|
||||
0h at the other end of the attribute controller. The previous DAC
|
||||
index, 1Fh is shifted again producing 01h. This process continues,
|
||||
producing the DAC indexes, in order, 30h, 23h, 52h, 45h, 74h, and 67h.
|
||||
Again, note that every second DAC index is the appropriate 8-bit value
|
||||
for a 256-color mode, while the values in between contain four bits of
|
||||
the previous and four bits of the next DAC index.
|
||||
<BR>
|
||||
<BR>
|
||||
<CENTER><A HREF="256right.txt"><IMG SRC="256right.gif" ALT="Click for Textified 256-Color Shift Mode Diagram (Right)" HEIGHT=256 WIDTH=376></A></CENTER>
|
||||
|
||||
<BR>
|
||||
<BR> Another variance that can
|
||||
exist is whether the first or second DAC index generated at the beginning
|
||||
of a scan line is the appropriate 8-bit value. If it is the second,
|
||||
the first DAC index contains 4 bits from the contents of the DAC index
|
||||
prior to the start of the scan line. This could conceivably contain
|
||||
any value, as it is normally masked by the attribute controller when in
|
||||
256-color mode whcih would latch the odd pixel values. Likely this
|
||||
value will be either 00h or whatever the contents were at the end of the
|
||||
previous scan line. A similar circumstance arises where the last
|
||||
pixel value generated falls on a boundary between memory addresses.
|
||||
In this circumstance, however, the value generated is produced by sequencing
|
||||
the next display memory address as if the line continued, and is thus more
|
||||
predictable.
|
||||
<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>
|
||||
<BR>
|
||||
<BR>
|
||||
</BODY>
|
||||
</HTML>
|
||||
185
specs/freevga/vga/vgatext.htm
Normal file
@@ -0,0 +1,185 @@
|
||||
<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 other low-level stuff.)">
|
||||
<META NAME="KeyWords" CONTENT="VGA SVGA hardware video programming">
|
||||
<TITLE>VGA/SVGA Video Programming--VGA Text Mode Operation</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="../home.htm">Home</A> <A HREF="#intro">Intro</A> <A HREF="#memory">Memory</A>
|
||||
<A HREF="#attributes">Attributes</A> <A HREF="#fonts">Fonts</A> <A HREF="#cursor">Cursor</A>
|
||||
<A HREF="vga.htm#general">Back</A>
|
||||
<HR WIDTH="100%"><B>Hardware Level VGA and SVGA Video Programming Information
|
||||
Page</B></CENTER>
|
||||
|
||||
<CENTER>VGA Text Mode Operation
|
||||
<HR WIDTH="100%"></CENTER>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="#intro">Introduction</A> -- gives scope of this page.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#memory">Display Memory Organization</A> -- details how the VGA's
|
||||
planes are utilized when in text mode.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#attributes">Attributes</A> -- details the fields of the attribute
|
||||
byte.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#fonts">Fonts</A> -- details the operation of the character generation
|
||||
hardware.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#cursor">Cursor</A> -- details on manipulating the text-mode cursor.</LI>
|
||||
</UL>
|
||||
<A NAME="intro"></A><B>Introduction</B>
|
||||
<BR> This section is intended
|
||||
to document the VGA's operation when it is in the text modes, including
|
||||
attributes and fonts. While it would seem that the text modes are adequately
|
||||
supported by the VGA BIOS, there is actually much that can be done with
|
||||
the VGA text modes that can only be accomplished by going directly to the
|
||||
hardware. Furthermore, I have found no good reference on the VGA text modes;
|
||||
most VGA references take them for granted without delving into their operation.
|
||||
|
||||
<P><A NAME="memory"></A><B>Display Memory Organization</B>
|
||||
<BR> The four display memory
|
||||
planes are used for different purposes when the VGA is in text mode. Each
|
||||
byte in plane 0 is used to store an index into the character font map.
|
||||
The corresponding byte in plane 1 is used to specify the attributes of
|
||||
the character possibly including color, font select, blink, underline and
|
||||
reverse. For more details on attribute operation see the Attributes section
|
||||
below. Display plane 2 is used to store the bitmaps for the characters
|
||||
themselves. This is discussed in the Fonts section below. Normally, the
|
||||
odd/even read and write addressing mode is used to make planes 0 and 1
|
||||
accessible at interleaved host memory addresses.
|
||||
|
||||
<P><A NAME="attributes"></A><B>Attributes</B>
|
||||
<BR> The attribute byte is divided
|
||||
into two four bit fields. The field from 7-4 is used as an index into the
|
||||
palette registers for the background color which used when a font bit is
|
||||
0. The field from 3-0 is used as an index into the palette registers for
|
||||
the foreground which is used when a font bit is 1. Also the attribute can
|
||||
control several other aspects which may modify the way the character is
|
||||
displayed.
|
||||
<BR> If the <A HREF="attrreg.htm#10">Blink
|
||||
Enable</A> field is set to 1, character blinking is enabled. When blinking
|
||||
is enabled, bit 3 of the background color is forced to 0 for attribute
|
||||
generation purposes, and if bit 7 of the attribute byte for a character
|
||||
is set to 1, the foreground color alternates between the foreground and
|
||||
background, causing the character to blink. The blink rate is determined
|
||||
by the vertical sync rate divided by 32.
|
||||
<BR> If the bits 2-0 of the attribute
|
||||
byte is equal to 001b and bits 6-4 of the attribute byte is equal to 000b,
|
||||
then the line of the character specified by the <A HREF="crtcreg.htm#14">Underline
|
||||
Location</A> field is replaced with the foreground color. Note if the line
|
||||
specified by the <A HREF="crtcreg.htm#14">Underline Location</A> field
|
||||
is not normally displayed because it is greater than the maximum scan line
|
||||
of the characters displayed, then the underline capability is effectively
|
||||
disabled.
|
||||
<BR> Bit 3 of the attribute byte,
|
||||
as well as selecting the foreground color for its corresponding character,
|
||||
also is used to select between the two possible character sets (see <A HREF="#fonts">Fonts</A>
|
||||
below.) If both character sets are the same, then the bit effectively functions
|
||||
only to select the foreground color.
|
||||
|
||||
<P><A NAME="fonts"></A><B>Fonts</B>
|
||||
<BR> The VGA's text-mode hardware
|
||||
provides for a very fast text mode. While this mode is not used as often
|
||||
these days, it used to be the predominant mode of operation for applications.
|
||||
The reason that the text mode was fast, much faster than a graphics mode
|
||||
at the same resolution was that in text mode, the screen is partitioned
|
||||
into characters. A single character/attribute pair is written to screen,
|
||||
and the hardware uses a font table in video memory to map those character
|
||||
and attribute pairs into video output, as opposed to having to write all
|
||||
of the bits in a character, which could take over 16 operations to write
|
||||
to screen. As CPU display memory bandwidth is somewhat limited (particularly
|
||||
on on older cards), this made text mode the mode of choice for applications
|
||||
which did not require graphics.
|
||||
|
||||
<P> For each character
|
||||
position, bit 3 of the attribute byte selects which character set is used,
|
||||
and the character byte selects which of the 256 characters in that font
|
||||
are used. Up to eight sets of font bitmaps can be stored simultaneously
|
||||
in display memory plane 2. The VGA's hardware provides for two banks of
|
||||
256 character bitmaps to displayed simultaneously. Two fields, <A HREF="seqreg.htm#03">Character
|
||||
Set A Select</A> and <A HREF="seqreg.htm#03">Character Set B Select</A>
|
||||
field are used to determine which of the eight font bitmaps are currently
|
||||
displayed. If bit 3 of a character's attribute byte is set to 1, then the
|
||||
character set selected by <A HREF="seqreg.htm#03">Character Set A Select</A>
|
||||
field, otherwise the character set specified by <A HREF="seqreg.htm#03">Character
|
||||
Set B Select</A> field is used. Ordinarily, both character sets use the
|
||||
same map in memory, as utilizing 2 different character sets causes character
|
||||
set A to be limited to colors 0-7, and character set B to be limited to
|
||||
colors 8-15.
|
||||
<BR> Fonts are either 8 or 9
|
||||
pixels wide and can be from 1 to 32 pixels high. The width is determined
|
||||
by the <A HREF="seqreg.htm#01">9/8 Dot Mode</A> field. Characters normally
|
||||
have a line of blank pixels to the right and bottom of the character to
|
||||
separate the character from its neighbor. Normally this is included in
|
||||
the character's bitmap, leaving only 7 bit columns for the character. Characters
|
||||
such as the capital M have to be squished to fit this, and would look better
|
||||
if all 8 pixels in the bitmap could be used, as in 9 Dot mode where the
|
||||
characters have an extra ninth bit in width, which is displayed in the
|
||||
text background color, However, this causes the line drawing characters
|
||||
to be discontinuous due to the blank column. Fortunately, the <A HREF="attrreg.htm#10">Line
|
||||
Graphics Enable</A> field can be set to allow character codes C0h-DFh to
|
||||
have their ninth column be identical to their eighth column, providing
|
||||
for continuity between line drawing characters. The height is determined
|
||||
by the <A HREF="crtcreg.htm#09">Maximum Scan Line</A> field which is set
|
||||
to one less than the number of scan lines in the character.
|
||||
<BR> Display memory plane 2 is
|
||||
divided up into eight 8K banks of characters, each of which holds 256 character
|
||||
bitmaps. Each character is on a 32 byte boundary and is 32 bytes long.
|
||||
The offset in plane 2 of a character within a bank is determined by taking
|
||||
the character's value and multiplying it by 32. The first byte at this
|
||||
offset contains the 8 pixels of the top scan line of the characters. Each
|
||||
successive byte contains another scan line's worth of pixels. The best
|
||||
way to read and write fonts to display memory, assuming familiarity with
|
||||
the information from the <A HREF="vgamem.htm">Accessing the Display Memory</A>
|
||||
page, is to use standard (not Odd/Even) addressing and Read Mode 0 and
|
||||
Write Mode 0 with plane 2 selected for read or write.
|
||||
<BR> The following example shows
|
||||
three possible bitmap representations of text characters. In the left example
|
||||
an 8x8 character box is used. In this case, the <A HREF="crtcreg.htm#09">Maximum
|
||||
Scan Line</A> field is programmed to 7 and the <A HREF="seqreg.htm#01">9/8
|
||||
Dot Mode</A> field is programmed to 0. Note that the bottom row and right-most
|
||||
column is blank. This is used to provide inter-character spacing. The middle
|
||||
example shows an 8x16 character. In this case the <A HREF="crtcreg.htm#09">Maximum
|
||||
Scan Line</A> field is programmed to 15 and the <A HREF="seqreg.htm#01">9/8
|
||||
Dot Mode</A> field is programmed to 0. Note that the character has extra
|
||||
space at the bottom below the baseline of the character. This is used by
|
||||
characters with parts descending below the baseline, such as the lowercase
|
||||
letter "g". The right example shows a 9x16 character. In this case the
|
||||
<A HREF="crtcreg.htm#09">Maximum Scan Line</A> field is programmed to 15
|
||||
and the <A HREF="seqreg.htm#01">9/8 Dot Mode</A> field is programmed to
|
||||
1. Note that the rightmost column is used by the character, as the ninth
|
||||
column for 9-bit wide characters is assumed blank (excepting for the behavior
|
||||
of the the <A HREF="attrreg.htm#10">Line Graphics Enable</A> field.) allowing
|
||||
all eight bits of width to be used to specify the character, instead of
|
||||
having to devote an entire column for inter-character spacing.
|
||||
<CENTER><A HREF="char.txt"><IMG SRC="Char.gif" ALT="Click for Textified Examples of Text Mode Bitmap Characters" BORDER=0 HEIGHT=256 WIDTH=376></A></CENTER>
|
||||
|
||||
|
||||
<P>
|
||||
<BR><A NAME="cursor"></A><B>Cursor</B>
|
||||
<BR> The VGA has the hardware capability
|
||||
to display a cursor in the text modes. Further details on the text-mode
|
||||
cursor's operation can be found in the following section:
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="textcur.htm">Manipulating the Text-mode Cursor</A> -- details
|
||||
controlling the appearance and location of the cursor.</LI>
|
||||
</UL>
|
||||
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>
|
||||
<BR>
|
||||
</BODY>
|
||||
</HTML>
|
||||
BIN
specs/freevga/vga/virtual.gif
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
22
specs/freevga/vga/virtual.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
Virtual Screeen Mode Example
|
||||
----------------------------
|
||||
|
||||
0 319 320 512
|
||||
0 +----------------------------------------+---------------------+
|
||||
| | |
|
||||
| | |
|
||||
| | |
|
||||
| | |
|
||||
| Actual Resolution (Displayed) | |
|
||||
| 320x200 | |
|
||||
| | |
|
||||
| | |
|
||||
| | |
|
||||
199 +----------------------------------------+ |
|
||||
200 | |
|
||||
| |
|
||||
| Virtual Resolution (Not Displayed) |
|
||||
| 512x300 |
|
||||
| |
|
||||
299 +--------------------------------------------------------------+
|
||||
|
||||
226
specs/freevga/vtiming.htm
Normal file
@@ -0,0 +1,226 @@
|
||||
<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>FreeVGA - Video Timing Information</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<CENTER><A HREF="home.htm">Home</A> <A HREF="#intro">Intro</A> <A HREF="#basics">Basics</A>
|
||||
<A HREF="#measure">Measurements</A> <A HREF="#horiz">Horizontal</A> <A HREF="#vert">Vertical</A>
|
||||
<A HREF="#considerations">Considerations</A> <A HREF="home.htm#background">Back</A>
|
||||
<HR><B>Hardware Level VGA and SVGA Video Programming Information Page</B></CENTER>
|
||||
|
||||
<CENTER>Video Timing Information
|
||||
<HR></CENTER>
|
||||
<A NAME="intro"></A><B>Introduction</B>
|
||||
<BR> This page is written to give the
|
||||
necessary background on video timing that is useful for video programming.
|
||||
This is not a comprehensive reference on the subject, rather it just gives
|
||||
the minimum information needed to know to perform mode setting and the
|
||||
creation of custom video modes. It includes a small bit of information
|
||||
about the messy side of video adapters, the electrical output and how that
|
||||
is interpreted by the monitor. Much of this information pertains
|
||||
both to monitors and other CRT devices such as television displays, and
|
||||
is less applicable to LCD displays as they have different timing requirements.
|
||||
|
||||
<P><A NAME="basics"></A><B>Basic Description</B>
|
||||
<BR> The video hardware produces
|
||||
a continuous signal on its output connector, except when it is in reset
|
||||
mode, where the video outputs are held in a single state. The continuous
|
||||
signal is required because the pixel information is only displayed for
|
||||
a short period of time, and relies on the persistence of the phosphor glow
|
||||
on the monitor as well as the ability of eyesight to perform automatic
|
||||
averaging to appear to be a steady image. That signal is usually
|
||||
output on multiple pins of the monitor connector, although it could also
|
||||
be a TV compatible output. LCD displays use a similar technique,
|
||||
although the timing is more advanced and depends on the specific type of
|
||||
panel and its driver circuitry. The signal includes both the pixel
|
||||
data that the monitor displays, as well as timing and "framing" information
|
||||
that the video display uses to drive its internal circuitry.
|
||||
<BR> The image's pixels are "scanned"
|
||||
on to the screen from left to right, top to bottom, and is broken up into
|
||||
"dot periods" or pixels, which is controlled by the "dot clock" for the
|
||||
mode, which is the basis for all the other video timings. Each horizontal
|
||||
"scan line" of dot periods is called a horizontal refresh as it "refreshes"
|
||||
the information on the display in a horizontal line. Many of these
|
||||
scan lines (the amount depending on the video mode), scanning from top
|
||||
to bottom, make up a vertical refresh, also known as a "frame". There
|
||||
are many vertical refreshes per second, where a higher refresh rate produces
|
||||
an image with less flicker.
|
||||
|
||||
<P><A NAME="measure"></A><B>Timing Measurements</B>
|
||||
<BR> One of the important pieces
|
||||
of terminology to understand is how timing is measured. These include
|
||||
terms such as megahertz, kilohertz, and hertz. The first three are
|
||||
a measure of frequency which is based on the term hertz (abbreviated hz),
|
||||
which can be replaced by the term "Cycles per second." In video timing,
|
||||
hertz is used to describe the frequencies of the timing signals, such as
|
||||
when saying that the vertical refresh frequency is 60 hertz (or 60hz).
|
||||
This means that there are 60 cycles per second, which means that there
|
||||
are 60 vertical refreshes per second. Another case where hertz is
|
||||
used is when saying the horizontal refresh rate, such as when saying 31500
|
||||
hz, which means that there are 31,500 horizontal refresh cycles per second.
|
||||
One abbreviation frequently found is the term kilohertz (abbreviated Khz)
|
||||
which means 1,000 cycles/per second. For example, 31.5 kilohertz
|
||||
means 31.5 x 1000 hertz, or 31500 hz. This is used to save writing
|
||||
a few zeros and is a bit more concise. Similarly the term megahertz
|
||||
(abbreviated Mhz) is used, which means 1,000,000 cycles/per second.
|
||||
For example, instead of saying that a certain mode uses a 25,000,000 hz
|
||||
dot clock, or saying that it uses a 25,000 Khz clock, it can be concisely
|
||||
be stated by saying that it uses a 25 Mhz dot clock.
|
||||
<BR> Similarly, the periods of
|
||||
time involved in video timing are very short as they are typically small
|
||||
fractions of a second. The terms millisecond, microsecond, and nanosecond
|
||||
are useful for expressing these small periods of time. The term millisecond
|
||||
(abbreviated ms) means one thousandth of a second, or 0.001 seconds.
|
||||
In one second, there are 1,000 milliseconds. This is used to describe things,
|
||||
such as the length of time a vertical refresh takes, for example a 16.6
|
||||
millisecond vertical refresh means 16.6 thousands of a second, or 0.0166
|
||||
seconds. In one second, there are 1,000,000 microseconds. The
|
||||
term microsecond (abbreviated us) is used to describe something in terms
|
||||
of millionths of a second, or 0.000001 second. For example the length
|
||||
of a horizontal refresh could be 31.7 microseconds, or 31.7 millionths
|
||||
of a second, 0.0000317 second, or 0.0317 ms. The term nanosecond
|
||||
(abbreviated ns) is used to describe one billionth of a second, or 0.000000001
|
||||
seconds. There are 1,000,000,000 nanoseconds in one second.
|
||||
One circumstance where this is used, is to describe the period of time
|
||||
one dot period takes. For example, one dot period could be stated
|
||||
as 40 nanoseconds, 0.04 us, 0.00004 ms, or 0.00000004 seconds. In
|
||||
each case, the most concise term is used, to provide a shorter, more concise
|
||||
description.
|
||||
<BR> Because the unit hertz is
|
||||
defined using a unit of time (second), the period of one cycle can be determined
|
||||
by division. The simplest example is 1 hz, where the length of the
|
||||
cycle, by definition would be 1 second. For other values, it can be calculated
|
||||
according to the following formula:
|
||||
<UL>
|
||||
<LI>
|
||||
Period (in seconds) = 1 / frequency (in hertz)</LI>
|
||||
</UL>
|
||||
For example, a 60 hertz vertical
|
||||
refresh would last 1 / 60 second, which is approximately 0.0166 seconds,
|
||||
or 16.6 ms. Similarly, a 31.5 Khz horizontal refresh would be 1 /
|
||||
31500 second, which is approximately 0.000031 seconds, or 31.7 us.
|
||||
A 25 Mhz dot clock would produce a dot period of 1 / 25000000 second, which
|
||||
is 0.00000004 seconds, or 40 ns. If the period of a cycle is known,
|
||||
then the frequency can be calculated as:
|
||||
<UL>
|
||||
<LI>
|
||||
Frequency (in hertz) = 1 / Period (in seconds).</LI>
|
||||
</UL>
|
||||
For example, a 16.6 ms period
|
||||
would equate to 1 / 0.0166, which produces a frequency of approximately
|
||||
60 hz. Similarly a 31.7 us period would produce approximately a 31.5
|
||||
Khz frequency, and a 40 ns period would produce a 25 Mhz frequency.
|
||||
|
||||
<P><A NAME="horiz"></A><B>Horizontal Timing</B>
|
||||
<BR> From a monitor's standpoint,
|
||||
the timing is fairly simple. It detects the horizontal sync pulses
|
||||
on the hsync line, then based on the polarity, frequency, and/or duration
|
||||
of those pulses sets up its horizontal scan circuitry to scan across the
|
||||
screen at the desired rate. During this period it continuously displays
|
||||
the signal input on the analog RGB pins/connectors. It is important
|
||||
to to know the horizontal sync frequency ranges of the monitor, as well
|
||||
as the acceptable width of the sync pulse for those sync ranges.
|
||||
If the width of the sync pulse is incorrect, it can make the displayed
|
||||
information too large or too small, as well as possibly preventing the
|
||||
monitor from synchronizing to the generated signal. The acceptable
|
||||
range of sync pulse width and polarity for a given frequency should be
|
||||
given in the specifications for the monitor; however, this is frequently
|
||||
overlooked by the manufacturer. It is recommended to contact the
|
||||
manufacturer, otherwise the result has to be determined by trial and error
|
||||
which can be damaging to the monitor's circuitry.
|
||||
<BR> In addition to those that
|
||||
control horizontal sync frequency and width, there are other horizontal
|
||||
timing registers which tell the display generation hardware when to output
|
||||
the active display, when to output the overscan, and when to perform blanking.
|
||||
The active display is when pixel data from the frame buffer are being output
|
||||
and displayed. This could also be overlaid by data from another source,
|
||||
such as a TV or MPEG decoder, or a hardware cursor. The overscan
|
||||
is the border to the left and right of the screen. This was more
|
||||
important on older video hardware such as those monitors lacking horizontal
|
||||
and vertical picture controls, and is provided for compatibility reasons
|
||||
although current hardware typically reduces the need for this portion completely.
|
||||
The blanking period is used during the retrace portion of the horizontal
|
||||
display cycle which is the period in which the horizontal sweeps from the
|
||||
right of the screen back to the left. Outputting non-zero intensities
|
||||
during this period would end up being stretched, in reverse across the
|
||||
end of the current scan line to the beginning of the next scan line which,
|
||||
while interesting and possibly useful in a small number of circumstances.
|
||||
would add a bit of blurring to the image. Blanking is signaled to
|
||||
the monitor by sending zero intensities of the red, green, and blue components
|
||||
on the analog lines.
|
||||
<BR> In the display generator,
|
||||
horizontal timings are specified by the number of dot periods they take.
|
||||
The dot period is controlled by selecting the desired dot clock frequency
|
||||
by programming certain registers.
|
||||
|
||||
<P><A NAME="vert"></A><B>Vertical Timing</B>
|
||||
<BR> Vertical timing is nearly
|
||||
the same as the horizontal timing, except that it controls the vertical
|
||||
movement of the display scan, spacing the scan lines the right width apart
|
||||
so that they seem to form a rectangular image. The monitor detects
|
||||
the vertical sync pulses on the vsync line, then based on the polarity,
|
||||
frequency, and/or duration of those pulses sets up its vertical circuitry
|
||||
to scan down the screen at the desired rate. It is necessary to know
|
||||
the vertical sync frequency ranges for a given monitor, and the range of
|
||||
acceptable vertical sync widths and polarities for those ranges.
|
||||
The rage of vertical sync frequencies supported by the monitor are nearly
|
||||
always given my the monitor's specifications, but like the horizontal sync
|
||||
widths, the vertical sync widths are not commonly specified. Contact
|
||||
the manufacturer, as attempting to guess the correct vertical sync width
|
||||
can possibly cause the monitor to fail.
|
||||
<BR> As well as being programmed
|
||||
with the vertical sync frequency and pulse width, the display generation
|
||||
hardware has other registers which control when to output the active display,
|
||||
when to output the overscan, and when to perform blanking. In vertical
|
||||
terms, the active display is the scan lines which contain horizontal active
|
||||
display periods. The overscan is the border on top and bottom of
|
||||
the screen and, if present, consists of one or more entire scan lines in
|
||||
which the active display period is replaced with the overscan color.
|
||||
The blanking is used during the vertical retrace, and consists of one or
|
||||
more (usually more) scan lines in which the active display and overscan
|
||||
periods are replaced with blanking period, making the entire line effectively
|
||||
blanking. This prevents intensity from overlaying the screen during
|
||||
the vertical retrace where the monitor sweeps the vertical back to the
|
||||
top of the screen. Non-zero intensities output during this period
|
||||
would be written in a zig-zag pattern from the bottom to the top of the
|
||||
screen. In the display generator, the vertical timings are specified
|
||||
in terms of how many horizontal sync periods they take.
|
||||
<BR>
|
||||
<BR><A NAME="considerations"></A><B>Programming Considerations</B>
|
||||
<BR> For maximum flexibility,
|
||||
video timings should be configurable by the end users to allow for the
|
||||
specifications of their monitor. However, it is probably a wise idea
|
||||
to maintain a table of monitors and their rated specifications, to allow
|
||||
the users to select thieir monitor and determine whether or not the configured
|
||||
video timings are within the rated specifications of their monitor and
|
||||
warn the user about this. There is a distinct need for a comprehensive
|
||||
and accurate software-usable database of monitor specifications in a platform
|
||||
and video hardware independent form with sufficient information for a program
|
||||
to both select timings for a particular video mode, as well as verify that
|
||||
a given set of timings will function properly on the end-user's hardware.
|
||||
This database should contain a human readable description of the monitor
|
||||
make and model, as well as software parsable fields giving corresponding
|
||||
ranges of horizontal and vertical frequencies and sync polarities for those
|
||||
ranges if applicable, as well as a method of determining the acceptable
|
||||
widths of horizontal and vertical sync pulses for a given frequency in
|
||||
the corresponding rages. Framing information could be included in
|
||||
this table in a frequency independent fashion, although this is something
|
||||
that can be safely adjusted by the end user without risk of damage to the
|
||||
monitor, thus it is preferrable to provide a method or interface for the
|
||||
end-user to adjust these parameters to their preference.
|
||||
<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>
|
||||
<BR>
|
||||
</BODY>
|
||||
</HTML>
|
||||
88
specs/kbd/abnt-keypad.html
Normal file
@@ -0,0 +1,88 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>ABNT keypad</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<CENTER><H2>ABNT keyboard keypad layout</H2></CENTER>
|
||||
<CENTER>Key label and scancode (hex) and Linux keycode (decimal)
|
||||
for a Brazilian ABNT keyboard keypad.</CENTER>
|
||||
<p>
|
||||
<TABLE BORDER=1 ALIGN="CENTER"
|
||||
<TR>
|
||||
<TD ALIGN="Center" WIDTH=40>Num<br>Lock</TD>
|
||||
<TD ALIGN="Center" WIDTH=40> / </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> * </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> - </TD>
|
||||
<TD ALIGN="Center" WIDTH=60> </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> <B>45</B> </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> <B>e0 45</B> </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> <B>37</B> </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> <B>4a</B> </TD>
|
||||
<TD ALIGN="Center" WIDTH=60> </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> 69 </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> 98 </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> 55 </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> 74 </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD ALIGN="Center" WIDTH=40> 7<br>Home </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> 8<br>Up </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> 9<br>PgUp </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> + </TD>
|
||||
<TD ALIGN="Center" WIDTH=60> </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> <B>47</B> </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> <B>48</B> </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> <B>49</B> </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> <B>4e</B> </TD>
|
||||
<TD ALIGN="Center" WIDTH=60> </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> 71 </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> 72 </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> 73 </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> 78 </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD ALIGN="Center" WIDTH=40> 4<br>Left </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> 5 </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> 6<br>Right </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> . </TD>
|
||||
<TD ALIGN="Center" WIDTH=60> </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> <B>4b</B> </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> <B>4c</B> </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> <B>4d</B> </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> <B>7e</B> </TD>
|
||||
<TD ALIGN="Center" WIDTH=60> </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> 75 </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> 76 </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> 77 </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> 121 </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD ALIGN="Center" WIDTH=40> 1<br>End </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> 2<br>Down </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> 3<br>PgDn </TD>
|
||||
<TD ALIGN="Center" WIDTH=40 ROWSPAN=2> Enter </TD>
|
||||
<TD ALIGN="Center" WIDTH=60> </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> <B>4f</B> </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> <B>50</B> </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> <B>51</B> </TD>
|
||||
<TD ALIGN="Center" WIDTH=40 ROWSPAN=2> <B>e0 1c</B> </TD>
|
||||
<TD ALIGN="Center" WIDTH=60> </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> 79 </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> 80 </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> 81 </TD>
|
||||
<TD ALIGN="Center" WIDTH=40 ROWSPAN=2> 96 </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD ALIGN="Center" COLSPAN=2> 0<br>Ins </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> ,<br>Del </TD>
|
||||
<TD ALIGN="Center" WIDTH=60> </TD>
|
||||
<TD ALIGN="Center" COLSPAN=2> <B>52</B> </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> <B>53</B> </TD>
|
||||
<TD ALIGN="Center" WIDTH=60> </TD>
|
||||
<TD ALIGN="Center" COLSPAN=2> 82 </TD>
|
||||
<TD ALIGN="Center" WIDTH=40> 83 </TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</BODY>
|
||||
</HTML>
|
||||
BIN
specs/kbd/amstrad-s.jpg
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
specs/kbd/amstrad.jpg
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
specs/kbd/compaq_easy_access.jpg
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
specs/kbd/compaq_unkn-s.jpg
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
specs/kbd/compaq_unkn.jpg
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
specs/kbd/ibm_rapid_access.jpg
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
specs/kbd/ibm_rapid_access_II.jpg
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
specs/kbd/imb5576-2.jpg
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
specs/kbd/jp106-with-scancodes.jpg
Normal file
|
After Width: | Height: | Size: 82 KiB |
BIN
specs/kbd/jp106.jpg
Normal file
|
After Width: | Height: | Size: 107 KiB |
BIN
specs/kbd/jplaptop.jpg
Normal file
|
After Width: | Height: | Size: 110 KiB |
BIN
specs/kbd/lk201-k.gif
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
specs/kbd/lk411-left.jpg
Normal file
|
After Width: | Height: | Size: 78 KiB |
BIN
specs/kbd/lk411-right.jpg
Normal file
|
After Width: | Height: | Size: 129 KiB |
BIN
specs/kbd/lk411-s.jpg
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
specs/kbd/lk411.jpg
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
specs/kbd/logitech-access.jpg
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
specs/kbd/logitech-internet-s.jpg
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
BIN
specs/kbd/logitech-internet.jpg
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
specs/kbd/m24.jpg
Normal file
|
After Width: | Height: | Size: 126 KiB |
BIN
specs/kbd/m24kbd.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
specs/kbd/ms_office.jpg
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
specs/kbd/ncr-s.jpg
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
specs/kbd/nokia-left.jpg
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
specs/kbd/nokia-right.jpg
Normal file
|
After Width: | Height: | Size: 86 KiB |
BIN
specs/kbd/nokia-s.jpg
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
specs/kbd/nokia-top.jpg
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
specs/kbd/nokia.jpg
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
specs/kbd/samsung-s.jpg
Normal file
|
After Width: | Height: | Size: 9.7 KiB |
BIN
specs/kbd/samsung.jpg
Normal file
|
After Width: | Height: | Size: 118 KiB |
418
specs/kbd/scancodes-1.html
Normal file
@@ -0,0 +1,418 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
||||
<TITLE>Keyboard scancodes: Keyboard scancodes</TITLE>
|
||||
<LINK HREF="scancodes-2.html" REL=next>
|
||||
|
||||
<LINK HREF="scancodes.html#toc1" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="scancodes-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="scancodes.html#toc1">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s1">1. Keyboard scancodes</A></H2>
|
||||
|
||||
<P>The data from a keyboard comes mainly in the form of scancodes,
|
||||
produced by key presses or used in the protocol with the computer.
|
||||
(
|
||||
<A HREF="scancodes-9.html#scancodesets">Different codes</A> are used by the keyboard
|
||||
firmware internally, and there also exist several
|
||||
<A HREF="scancodes-9.html#scancodesets">sets of scancodes</A>.
|
||||
Here in this section we only talk about the default codes - those from
|
||||
translated scancode set 2. Less common modes are discussed
|
||||
<A HREF="scancodes-9.html#scancodesets">below</A>.)
|
||||
Each key press and key release produces between 0 and 6 scancodes.
|
||||
<P>
|
||||
<H2><A NAME="ss1.1">1.1 Key release</A>
|
||||
</H2>
|
||||
|
||||
<P>Below I'll only mention the scancode for key press (`make').
|
||||
The scancode for key release (`break') is obtained from it
|
||||
by setting the high order bit (adding 0x80 = 128).
|
||||
Thus, Esc press produces scancode <B>01</B>, Esc release
|
||||
scancode <B>81</B> (hex).
|
||||
For sequences things are similar: Keypad-/ gives <B>e0</B> <B>35</B>
|
||||
when pressed, <B>e0</B> <B>b5</B> when released. Most keyboards will
|
||||
repeat the make code (key down code) when the key repeats. Some will also
|
||||
fake Shift down and Shift up events during the repeat.
|
||||
<P>The keys PrtSc/SysRq and Pause/Break are special.
|
||||
The former produces scancode <B>e0</B> <B>2a</B> <B>e0</B> <B>37</B>
|
||||
when no modifier key is pressed simultaneously, <B>e0</B> <B>37</B>
|
||||
together with Shift or Ctrl, but <B>54</B> together with (left or right) Alt.
|
||||
(And one gets the expected sequences upon release. But see
|
||||
<A HREF="scancodes-5.html#mtek">below</A>.)
|
||||
The latter produces scancode sequence
|
||||
<B>e1</B> <B>1d</B> <B>45</B> <B>e1</B> <B>9d</B> <B>c5</B>
|
||||
when pressed (without modifier) and nothing at all upon release.
|
||||
However, together with (left or right) Ctrl, one gets
|
||||
<B>e0</B> <B>46</B> <B>e0</B> <B>c6</B>,
|
||||
and again nothing at release. It does not repeat.
|
||||
<P>See
|
||||
<A HREF="#dellnoup">below</A> for a report on keys
|
||||
with a different behaviour.
|
||||
<P>There are many reports of laptops with badly debounced key-up events.
|
||||
Thus, unexpected key-up events should probably be regarded as not
|
||||
unusual, and be ignored. Another source of key-up events without
|
||||
preceding key-down can be the
|
||||
<A HREF="#fakeshifts">fake shift</A>.
|
||||
<P>
|
||||
<H2><A NAME="ss1.2">1.2 Protocol scancodes</A>
|
||||
</H2>
|
||||
|
||||
<P>Most scancodes indicate a key press or release.
|
||||
Some are used in the communication protocol.
|
||||
<P>
|
||||
<P>
|
||||
<CENTER><TABLE BORDER><TR><TD>
|
||||
<B>00</B> </TD><TD> Keyboard error - see <B>ff</B> </TD></TR><TR><TD>
|
||||
<B>aa</B> </TD><TD> BAT (Basic Assurance Test) OK </TD></TR><TR><TD>
|
||||
<B>ee</B> </TD><TD> Result of echo command </TD></TR><TR><TD>
|
||||
<B>f1</B> </TD><TD> Some keyboards, as reply to command <B>a4</B>:Password not installed </TD></TR><TR><TD>
|
||||
<B>fa</B> </TD><TD> Acknowledge from kbd </TD></TR><TR><TD>
|
||||
<B>fc</B> </TD><TD> BAT error or Mouse transmit error </TD></TR><TR><TD>
|
||||
<B>fd</B> </TD><TD> Internal failure </TD></TR><TR><TD>
|
||||
<B>fe</B> </TD><TD> Keyboard fails to ack, please resend </TD></TR><TR><TD>
|
||||
<B>ff</B> </TD><TD> Keyboard error </TD></TR><TR><TD>
|
||||
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P>Three common causes for keyboard error are:
|
||||
(i) several keys pressed simultaneously,
|
||||
(ii) keyboard buffer overflow,
|
||||
(iii) parity error on the serial line used by keyboard
|
||||
and keyboard controller for communication.
|
||||
The error reported is <B>ff</B> in
|
||||
<A HREF="scancodes-9.html#scancodesets">scancode mode</A> 1,
|
||||
and <B>00</B> in scancode modes 2 and 3.
|
||||
If translation is on, both <B>00</B> and <B>ff</B>
|
||||
are translated as <B>ff</B>.
|
||||
<P>Usually these codes have the protocol meaning. However,
|
||||
they also occur as actual scancodes, especially when
|
||||
prefixed by <B>e0</B>.
|
||||
<P>
|
||||
<H2><A NAME="ss1.3">1.3 Escape scancodes</A>
|
||||
</H2>
|
||||
|
||||
<P>The codes <B>e0</B> and <B>e1</B> introduce scancode sequences,
|
||||
and are not usually used as isolated scancodes themselves
|
||||
(but see
|
||||
<A HREF="scancodes-6.html#e0_as_key">below</A>).
|
||||
<P>(The prefix <B>e0</B> was originally used for the grey duplicates
|
||||
of keys on the original PC/XT keyboard. These days <B>e0</B> is
|
||||
just used to expand code space. The prefix <B>e1</B> used for
|
||||
Pause/Break indicated that this key sends the make/break sequence
|
||||
at make time, and does nothing upon release.)
|
||||
<P>This, and the above, means that the values
|
||||
<B>00</B>, <B>60</B>, <B>61</B>, <B>6e</B>, <B>71</B>,
|
||||
<B>7a</B>, <B>7c</B>, <B>7e</B>, <B>7f</B>
|
||||
are unavailable to signify key presses (on a default keyboard).
|
||||
Nevertheless they also occur as scancodes, see for example the
|
||||
<A HREF="scancodes-2.html#telerate">Telerate</A> and
|
||||
<A HREF="scancodes-5.html#safeway23">Safeway SW23</A> keyboards below.
|
||||
<P>Also other prefixes occur, see
|
||||
<A HREF="scancodes-5.html#prefix_80">below</A>.
|
||||
<P>
|
||||
<A HREF="scancodes-9.html#logiteche2">Logitech</A> uses an <B>e2</B> prefix
|
||||
for the codes sent by a pointing device integrated on the keyboard.
|
||||
<P>
|
||||
<P>
|
||||
<H2><A NAME="ss1.4">1.4 Ordinary scancodes</A>
|
||||
</H2>
|
||||
|
||||
<P>The scancodes in translated scancode set 2 are given in hex.
|
||||
Between parentheses the keycap on a US keyboard.
|
||||
The scancodes are given in order, grouped according
|
||||
to groups of keys that are usually found next to each other.
|
||||
<P><B>00</B> is normally an error code
|
||||
<P><B>01</B> (Esc)
|
||||
<P><B>02</B> (1!), <B>03</B> (2@), <B>04</B> (3#), <B>05</B> (4$),
|
||||
<B>06</B> (5%E), <B>07</B> (6^), <B>08</B> (7&),
|
||||
<B>09</B> (8*), <B>0a</B> (9(), <B>0b</B> (0)), <B>0c</B> (-_),
|
||||
<B>0d</B> (=+), <B>0e</B> (Backspace)
|
||||
<P><B>0f</B> (Tab), <B>10</B> (Q), <B>11</B> (W), <B>12</B> (E),
|
||||
<B>13</B> (R), <B>14</B> (T), <B>15</B> (Y),
|
||||
<B>16</B> (U), <B>17</B> (I), <B>18</B> (O),
|
||||
<B>19</B> (P), <B>1a</B> ([{), <B>1b</B> (]})
|
||||
<P><B>1c</B> (Enter)
|
||||
<P><B>1d</B> (LCtrl)
|
||||
<P><B>1e</B> (A), <B>1f</B> (S), <B>20</B> (D), <B>21</B> (F),
|
||||
<B>22</B> (G), <B>23</B> (H), <B>24</B> (J), <B>25</B> (K),
|
||||
<B>26</B> (L), <B>27</B> (;:), <B>28</B> ('")
|
||||
<P><B>29</B> (`~)
|
||||
<P><B>2a</B> (LShift)
|
||||
<P><B>2b</B> (\|), on a 102-key keyboard
|
||||
<P><B>2c</B> (Z), <B>2d</B> (X), <B>2e</B> (C), <B>2f</B> (V),
|
||||
<B>30</B> (B), <B>31</B> (N), <B>32</B> (M), <B>33</B> (,<),
|
||||
<B>34</B> (.>), <B>35</B> (/?), <B>36</B> (RShift)
|
||||
<P><B>37</B> (Keypad-*) or (*/PrtScn) on a 83/84-key keyboard
|
||||
<P><B>38</B> (LAlt), <B>39</B> (Space bar),
|
||||
<P><B>3a</B> (CapsLock)
|
||||
<P><B>3b</B> (F1), <B>3c</B> (F2), <B>3d</B> (F3), <B>3e</B> (F4),
|
||||
<B>3f</B> (F5), <B>40</B> (F6), <B>41</B> (F7),
|
||||
<B>42</B> (F8), <B>43</B> (F9), <B>44</B> (F10)
|
||||
<P><B>45</B> (NumLock)
|
||||
<P><B>46</B> (ScrollLock)
|
||||
<P><B>47</B> (Keypad-7/Home), <B>48</B> (Keypad-8/Up),
|
||||
<B>49</B> (Keypad-9/PgUp)
|
||||
<P><B>4a</B> (Keypad--)
|
||||
<P><B>4b</B> (Keypad-4/Left), <B>4c</B> (Keypad-5),
|
||||
<B>4d</B> (Keypad-6/Right), <B>4e</B> (Keypad-+)
|
||||
<P><B>4f</B> (Keypad-1/End), <B>50</B> (Keypad-2/Down),
|
||||
<B>51</B> (Keypad-3/PgDn)
|
||||
<P><B>52</B> (Keypad-0/Ins), <B>53</B> (Keypad-./Del)
|
||||
<P><B>54</B> (Alt-SysRq) on a 84+ key keyboard
|
||||
<P><B>55</B> is less common; occurs e.g. as F11 on a Cherry G80-0777 keyboard,
|
||||
as F12 on a Telerate keyboard,
|
||||
as PF1 on a Focus 9000 keyboard, and as FN on an IBM ThinkPad.
|
||||
<P><B>56</B> mostly on non-US keyboards. It is often an unlabelled key
|
||||
<A HREF="laser.jpg">to the left</A>
|
||||
or
|
||||
<A HREF="toshiba.jpg">to the right</A>
|
||||
of the left Alt key.<BR>
|
||||
<FIGURE>
|
||||
<EPS FILE="absent">
|
||||
<IMG SRC="laser-s.jpg">
|
||||
</FIGURE>
|
||||
|
||||
<FIGURE>
|
||||
<EPS FILE="absent">
|
||||
<IMG SRC="toshiba-s.jpg">
|
||||
</FIGURE>
|
||||
<P><B>57</B> (F11), <B>58</B> (F12) both on a 101+ key keyboard
|
||||
<P><B>59</B>-<B>5a</B>-...-<B>7f</B> are less common.
|
||||
Assignment is essentially random.
|
||||
Scancodes <B>55</B>-<B>59</B> occur as F11-F15 on the
|
||||
<A HREF="scancodes-2.html#cherry80">Cherry G80-0777</A> keyboard.
|
||||
Scancodes <B>59</B>-<B>5c</B> occur on the
|
||||
<A HREF="scancodes-5.html#RC930">RC930</A> keyboard.
|
||||
X calls <B>5d</B> `KEY_Begin'.
|
||||
Scancodes <B>61</B>-<B>64</B> occur on a
|
||||
<A HREF="scancodes-2.html#telerate">Telerate</A> keyboard.
|
||||
Scancodes <B>55</B>, <B>6d</B>, <B>6f</B>, <B>73</B>, <B>74</B>,
|
||||
<B>77</B>, <B>78</B>, <B>79</B>, <B>7a</B>, <B>7b</B>,
|
||||
<B>7c</B>, <B>7e</B> occur on the
|
||||
<A HREF="scancodes-5.html#focus">Focus 9000</A> keyboard.
|
||||
Scancodes <B>65</B>, <B>67</B>, <B>69</B>, <B>6b</B>
|
||||
occur on a
|
||||
<A HREF="scancodes-5.html#armada">Compaq Armada</A> keyboard.
|
||||
Scancodes <B>66</B>-<B>68</B>, <B>73</B> occur on the
|
||||
<A HREF="scancodes-5.html#cherry81">Cherry G81-3000</A> keyboard.
|
||||
Scancodes <B>70</B>, <B>73</B>, <B>79</B>, <B>7b</B>, <B>7d</B>
|
||||
occur on a
|
||||
<A HREF="scancodes-7.html#japanese">Japanese 86/106 keyboard</A>.
|
||||
<P>Scancodes <B>f1</B> and <B>f2</B> occur on
|
||||
<A HREF="scancodes-8.html#korean">Korean keyboards</A>.
|
||||
<P>
|
||||
<H2><A NAME="ss1.5">1.5 Escaped scancodes</A>
|
||||
</H2>
|
||||
|
||||
<P>Apart from the Pause/Break key, that has an escaped sequence starting
|
||||
with <B>e1</B>, the escape used is <B>e0</B>. Often, the codes
|
||||
are chosen in such a way that something meaningful happens when
|
||||
the receiver just discards the <B>e0</B>.
|
||||
<P>
|
||||
<CENTER><TABLE BORDER><TR><TD>
|
||||
<B>e0</B> <B>1c</B> (Keypad Enter) </TD><TD></TD><TD> <B>1c</B> (Enter) </TD></TR><TR><TD>
|
||||
<B>e0</B> <B>1d</B> (RCtrl) </TD><TD></TD><TD> <B>1d</B> (LCtrl) </TD></TR><TR><TD>
|
||||
<B>e0</B> <B>2a</B> (fake LShift) </TD><TD></TD><TD> <B>2a</B> (LShift) </TD></TR><TR><TD>
|
||||
<B>e0</B> <B>35</B> (Keypad-/) </TD><TD></TD><TD> <B>35</B> (/?) </TD></TR><TR><TD>
|
||||
<B>e0</B> <B>36</B> (fake RShift) </TD><TD></TD><TD> <B>36</B> (RShift) </TD></TR><TR><TD>
|
||||
<B>e0</B> <B>37</B> (Ctrl-PrtScn) </TD><TD></TD><TD> <B>37</B> (*/PrtScn) </TD></TR><TR><TD>
|
||||
<B>e0</B> <B>38</B> (RAlt) </TD><TD></TD><TD> <B>38</B> (LAlt) </TD></TR><TR><TD>
|
||||
<B>e0</B> <B>46</B> (Ctrl-Break) </TD><TD></TD><TD> <B>46</B> (ScrollLock) </TD></TR><TR><TD>
|
||||
<B>e0</B> <B>47</B> (Grey Home) </TD><TD></TD><TD> <B>47</B> (Keypad-7/Home) </TD></TR><TR><TD>
|
||||
<B>e0</B> <B>48</B> (Grey Up) </TD><TD></TD><TD> <B>48</B> (Keypad-8/UpArrow) </TD></TR><TR><TD>
|
||||
<B>e0</B> <B>49</B> (Grey PgUp) </TD><TD></TD><TD> <B>49</B> (Keypad-9/PgUp) </TD></TR><TR><TD>
|
||||
<B>e0</B> <B>4b</B> (Grey Left) </TD><TD></TD><TD> <B>4b</B> (Keypad-4/Left) </TD></TR><TR><TD>
|
||||
<B>e0</B> <B>4d</B> (Grey Right) </TD><TD></TD><TD> <B>4d</B> (Keypad-6/Right) </TD></TR><TR><TD>
|
||||
<B>e0</B> <B>4f</B> (Grey End) </TD><TD></TD><TD> <B>4f</B> (Keypad-1/End) </TD></TR><TR><TD>
|
||||
<B>e0</B> <B>50</B> (Grey Down) </TD><TD></TD><TD> <B>50</B> (Keypad-2/DownArrow) </TD></TR><TR><TD>
|
||||
<B>e0</B> <B>51</B> (Grey PgDn) </TD><TD></TD><TD> <B>51</B> (Keypad-3/PgDn) </TD></TR><TR><TD>
|
||||
<B>e0</B> <B>52</B> (Grey Insert) </TD><TD></TD><TD> <B>52</B> (Keypad-0/Ins) </TD></TR><TR><TD>
|
||||
<B>e0</B> <B>53</B> (Grey Delete) </TD><TD></TD><TD> <B>53</B> (Keypad-./Del) </TD></TR><TR><TD>
|
||||
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P>These escaped scancodes occur only on 101+ key keyboards.
|
||||
The
|
||||
<A HREF="scancodes-5.html#microsoft">Microsoft keyboard</A> adds
|
||||
<P>
|
||||
<CENTER><TABLE BORDER><TR><TD>
|
||||
<B>e0</B> <B>5b</B> (LeftWindow) </TD></TR><TR><TD>
|
||||
<B>e0</B> <B>5c</B> (RightWindow) </TD></TR><TR><TD>
|
||||
<B>e0</B> <B>5d</B> (Menu) </TD></TR><TR><TD>
|
||||
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P>Other escaped scancodes occur - see below under the individual keyboards.
|
||||
<P>
|
||||
<H2><A NAME="fakeshifts"></A> <A NAME="ss1.6">1.6 Fake shifts</A>
|
||||
</H2>
|
||||
|
||||
<P>The ten grey keys Insert, Home, PgUp, Delete, End, PgDn,
|
||||
Up, Left, Down, Right are supposed to function regardless
|
||||
of the state of Shift and NumLock keys. But for an old AT keyboard
|
||||
the keypad keys would produce digits when Numlock was on or Shift
|
||||
was down. Therefore, in order to fool old programs,
|
||||
fake scancodes are sent: when LShift is down, and Insert is
|
||||
pressed, <B>e0</B> <B>aa</B> <B>e0</B> <B>52</B> is sent;
|
||||
upon release of Insert <B>e0</B> <B>d2</B> <B>e0</B> <B>2a</B>
|
||||
is sent. In other words, a fake LShift-up and
|
||||
fake LShift-down are inserted.
|
||||
<P>If the Shift key is released earlier than the repeated key,
|
||||
then a real Shift-up code occurs (without preceding fake Shift-down)
|
||||
so that a program ignoring <B>e0</B> would see one more Shift-up
|
||||
than Shift-down.
|
||||
<P>When NumLock is on, no fake Shifts are sent when Shift was down,
|
||||
but fake Shifts are sent when Shift was not down. Thus,
|
||||
with Numlock, if Insert is pressed,
|
||||
<B>e0</B> <B>2a</B> <B>e0</B> <B>52</B> is sent
|
||||
and upon release <B>e0</B> <B>d2</B> <B>e0</B> <B>aa</B> is sent.
|
||||
The keyboard maintains a private NumLock mode, toggled when
|
||||
NumLock is pressed, and set when the NumLock LED is set.
|
||||
<P>In the same way, when Shift is down, the Grey-/ key produces
|
||||
fake Shift-up and fake Shift-down sequences. However, it does
|
||||
not react to the state of NumLock. The purpose of course is to
|
||||
fool programs that identify Grey-/ with ordinary /, so that they
|
||||
don't treat Shift-Grey-/ like Shift-/, i.e., ?.
|
||||
<P>On a Toshiba notebook, the three Windows keys are treated like
|
||||
the group of ten keys mentioned, and get fake shifts when
|
||||
(left or right) Shift is down. They do not react to NumLock.
|
||||
<P>
|
||||
<H2><A NAME="ss1.7">1.7 Added non-fake shifts</A>
|
||||
</H2>
|
||||
|
||||
<P>On my 121-key
|
||||
<A HREF="scancodes-5.html#nokia">Nokia Data</A> keyboard there are
|
||||
function keys F1, ..., F24, where F1, ..., F12 send the expected codes
|
||||
<B>3b</B>, ..., <B>58</B>, and F13, ..., F24 send the same codes
|
||||
together with the LShift code <B>2a</B>.
|
||||
Thus, F13 gives <B>2a</B> <B>3b</B> on press,
|
||||
and <B>bb</B> <B>aa</B> on release.
|
||||
Similarly, there are keys with added LCtrl code <B>1d</B>.
|
||||
But there are also keys with added fake shifts <B>e0 2a</B>.
|
||||
<P>
|
||||
<A HREF="http://www.delorie.com/djgpp/doc/rbinter/it/06/0.html">Delorie</A>
|
||||
reports that <I>the "Preh Commander AT" keyboard with additional F11-F22 keys
|
||||
treats F11-F20 as Shift-F1..Shift-F10 and F21/F22 as Ctrl-F1/Ctrl-F2; the
|
||||
Eagle PC-2 keyboard with F11-F24 keys treats those additional keys
|
||||
in the same way</I>.
|
||||
<P>
|
||||
<H2><A NAME="ss1.8">1.8 Turbo Mode</A>
|
||||
</H2>
|
||||
|
||||
<P>On some motherboards the LCtrl-LAlt-GreyPlus and LCtrl-LAlt-GreyMinus
|
||||
switch Turbo mode on/off, respectively. For these, the motherboard
|
||||
may generate the same scancode sequence when the Turbo button is
|
||||
pushed: Turbo Switch (High->Low):
|
||||
<B>1d</B> <B>38</B> <B>4a</B> <B>ce</B> <B>b8</B> <B>9d</B>
|
||||
and Turbo Switch (Low->High):
|
||||
<B>1d</B> <B>38</B> <B>4e</B> <B>ce</B> <B>b8</B> <B>9d</B>.
|
||||
<P>Other peculiar combinations in this style include
|
||||
LCtrl-LAlt-LShift-GreyMinus and LCtrl-LAlt-LShift-GreyPlus to turn
|
||||
system cache off/on.
|
||||
<P>If Green PC system power saving mode is enabled in AMIBIOS Setup,
|
||||
the AMI MegaKey keyboard controller recognizes the combinations
|
||||
Ctrl-Alt-\ (put the system into immediate power down mode),
|
||||
Ctrl-Alt-[ (disable the Green PC power savings mode temporarily),
|
||||
Ctrl-Alt-] (enables the Green PC power down mode).
|
||||
<P>Thio Yu Jin <<CODE>jin@singmail.com</CODE>> complains that on his Toshiba 4010CDS
|
||||
the Ctrl-Alt-Shift-T key combination brings up the Toshiba user manual.
|
||||
(04 Mar 1999 - not April 1.)
|
||||
<P>
|
||||
<P>
|
||||
<H2><A NAME="power"></A> <A NAME="ss1.9">1.9 Power Saving</A>
|
||||
</H2>
|
||||
|
||||
<P>
|
||||
<A HREF="http://www.microsoft.com/hwdev/tech/input/Scancode.asp">Microsoft</A> recommends: "i8042-based keyboards should deploy the
|
||||
following scan codes for power management buttons, i.e., POWER and SLEEP
|
||||
buttons:
|
||||
<P>
|
||||
<CENTER><TABLE BORDER><TR><TD>
|
||||
</TD><TD> Set-1 make/break </TD><TD> Set-2 make/break </TD></TR><TR><TD>
|
||||
</TD></TR><TR><TD>
|
||||
Power </TD><TD> <B>e0</B> <B>5e</B> / <B>e0</B> <B>de</B> </TD><TD><B>e0</B> <B>37</B> / <B>e0</B> <B>f0</B> <B>37</B> </TD></TR><TR><TD>
|
||||
Sleep </TD><TD> <B>e0</B> <B>5f</B> / <B>e0</B> <B>df</B> </TD><TD><B>e0</B> <B>3f</B> / <B>e0</B> <B>f0</B> <B>3f</B> </TD></TR><TR><TD>
|
||||
Wake </TD><TD> <B>e0</B> <B>63</B> / <B>e0</B> <B>e3</B> </TD><TD><B>e0</B> <B>5e</B> / <B>e0</B> <B>f0</B> <B>5e</B> </TD></TR><TR><TD>
|
||||
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P>The Power, Sleep, and Wake event scan codes are the i8042 equivalents
|
||||
to the System Power Down, System Sleep, and System Wake Up HID usages".
|
||||
<P>Many keyboards have Power/Sleep/Wake keys that have to be
|
||||
activated by a fourth key (unlabeled, or labeled FN): pressing
|
||||
one of these four keys does not produce any scancodes, but
|
||||
when the FN key is pressed simultaneously, the Power/Sleep/Wake
|
||||
keys give the codes listed above.
|
||||
<P>
|
||||
<P>
|
||||
<H2><A NAME="ss1.10">1.10 Initializing special keyboards</A>
|
||||
</H2>
|
||||
|
||||
<P>Many keyboards have more keys and buttons than the standard ones.
|
||||
Sometimes these additional keys produce scancode combinations
|
||||
that were unused before. But on other keyboard such additional
|
||||
keys do not produce any code at all, until some initializing
|
||||
action is taken.
|
||||
<P>Sometimes that action consists of writing some bytes to keyboard
|
||||
registers. See, for example, the
|
||||
<A HREF="scancodes-5.html#rapidinit">IBM Rapid Access keyboard</A>, and the
|
||||
<A HREF="scancodes-5.html#omnibookinit">Omnibook keyboard</A>.
|
||||
<P>
|
||||
<H2><A NAME="LEDmanip"></A> <A NAME="ss1.11">1.11 Manipulating extra LEDs</A>
|
||||
</H2>
|
||||
|
||||
<P>Some keyboards have additional LEDs, and in a few cases we know
|
||||
how to manipulate those.
|
||||
<P>The
|
||||
<A HREF="scancodes-5.html#chicony">Chicony keyboard</A> needs command sequences
|
||||
<B>eb</B> <B>00</B> <I>xy</I>, with
|
||||
<I>xy</I> = <B>01</B> for the Moon LED and
|
||||
<I>xy</I> = <B>02</B> for the zzZ LED.
|
||||
<P>The
|
||||
<A HREF="scancodes-5.html#EZButton">IBM EZ Button keyboard</A> needs
|
||||
command sequences <B>eb</B> <B>00</B> <I>xy</I>, with
|
||||
<I>xy</I> = <B>01</B> for the Msg LED,
|
||||
<I>xy</I> = <B>02</B> for the CD LED,
|
||||
<I>xy</I> = <B>04</B> for the Power LED,
|
||||
<I>xy</I> = <B>10</B> for the Talk LED, and
|
||||
<I>xy</I> = <B>20</B> for the Message Waiting LED.
|
||||
<P>The
|
||||
<A HREF="scancodes-5.html#ibmrapidaccess">IBM Rapid Access keyboard</A> needs
|
||||
command sequences <B>eb</B> <B>00</B> <I>xy</I>, with
|
||||
<I>xy</I> = <B>04</B> for the Suspend LED and
|
||||
<I>xy</I> = <B>20</B> for the Mute LED.
|
||||
<P>The
|
||||
<A HREF="scancodes-5.html#ibmrapidaccessii">IBM Rapid Access keyboard II</A> needs
|
||||
the command sequences <B>eb</B> <B>71</B> and <B>eb</B> <B>70</B>
|
||||
to switch the Standby LED on and off.
|
||||
<P>The
|
||||
<A HREF="scancodes-5.html#logitechinternet">Logitech Internet Keyboard</A>
|
||||
has an additional amber LED. It is turned on by sending <B>eb</B>,
|
||||
and then blinks about once a second. It is turned off again by <B>ec</B>.
|
||||
<P>
|
||||
<H2><A NAME="ss1.12">1.12 The laptop FN key</A>
|
||||
</H2>
|
||||
|
||||
<P>Laptops have no room for all nonsensical keys one usually find
|
||||
on a regular keyboard. So, the number pad and other keys are
|
||||
folded into the main part of the keyboard. A key without label,
|
||||
or labelled FN is often used to modify the meaning of other keys.
|
||||
This FN does not produce scancodes itself, it only modifies the
|
||||
scancodes produced by other keys.
|
||||
<P>
|
||||
<A NAME="dellnoup"></A>
|
||||
Neil Brown reports about his Dell Latitude D800 laptop that it has
|
||||
five key combinations that do not produce proper break codes.
|
||||
The five combinations FN+F2, FN+F3, FN+F10, FN+Down, FN+Up
|
||||
(labelled Wireless, Brighter, Darker, Battery, CDEject)
|
||||
produce make codes <B>e0</B> <B>08</B>, <B>e0</B> <B>07</B>,
|
||||
<B>e0</B> <B>09</B>, <B>e0</B> <B>05</B>, <B>e0</B> <B>06</B>,
|
||||
respectively. The first three do not produce any break code.
|
||||
The last two have a break code that is identical to the make code.
|
||||
<P>
|
||||
<HR>
|
||||
<A HREF="scancodes-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="scancodes.html#toc1">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
805
specs/kbd/scancodes-10.html
Normal file
@@ -0,0 +1,805 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
||||
<TITLE>Keyboard scancodes: The AT keyboard controller</TITLE>
|
||||
<LINK HREF="scancodes-11.html" REL=next>
|
||||
<LINK HREF="scancodes-9.html" REL=previous>
|
||||
<LINK HREF="scancodes.html#toc10" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="scancodes-11.html">Next</A>
|
||||
<A HREF="scancodes-9.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc10">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s10">10. The AT keyboard controller</A></H2>
|
||||
|
||||
<P>A user program can talk to the keyboard controller on the motherboard.
|
||||
The keyboard controller can again talk to the keyboard.
|
||||
<P>When a key is pressed the keyboard sends the corresponding
|
||||
keyboard scancode to the keyboard controller, and the keyboard controller
|
||||
translates that and interrupts the CPU, allowing the CPU to read the result.
|
||||
<P>More detailed: when a key is pressed, the keyboard sends
|
||||
a start bit (low), followed by 8 data bits for the keyboard scancode
|
||||
of the key (least significant first), followed by an odd parity bit,
|
||||
followed by a stop bit (high).
|
||||
The keyboard controller reads the data and checks the parity.
|
||||
If incorrect, retransmission is requested. If incorrect again
|
||||
a parity error is reported.
|
||||
If the time between request to send and start of transmission is greater
|
||||
than 15 ms, or if the eleven bits are not received within 2ms,
|
||||
a timeout is reported.
|
||||
In both cases (parity error or timeout), the data byte is set to 0xff.
|
||||
<P>The keyboard controller has three 8-bit registers involved in
|
||||
communication with the CPU: its input buffer, that can be written
|
||||
by the CPU by writing port 0x60 or port 0x64; its output buffer,
|
||||
that can be read by the CPU by reading from port 0x60; and the
|
||||
status register, that can be read by the CPU by reading from port 0x64.
|
||||
<P>If the CPU writes to port 0x64, the byte is interpreted as a command byte.
|
||||
If the CPU writes to port 0x60, the byte is interpreted as a data byte.
|
||||
<P>The keyboard controller has two 8-bit I/O ports involved in
|
||||
communication with the keyboard: the
|
||||
<A HREF="#inputport">input port</A> P1 (receiving input from the keyboard)
|
||||
and the
|
||||
<A HREF="#outputport">output port</A> P2 (for sending output
|
||||
to the keyboard).
|
||||
<P>
|
||||
<H2><A NAME="ss10.1">10.1 The keyboard controller status register</A>
|
||||
</H2>
|
||||
|
||||
<P>The keyboard controller has an 8-bit status register.
|
||||
It can be inspected by the CPU by reading port 0x64.
|
||||
<P>(Typically, it has the value 0x14: keyboard not locked, self-test completed.)
|
||||
<P>
|
||||
<CENTER><TABLE BORDER><TR><TD>
|
||||
<A HREF="#kcPARE">PARE</A> </TD><TD>
|
||||
<A HREF="#kcTIM">TIM</A> </TD><TD>
|
||||
<A HREF="#kcAUXB">AUXB</A> </TD><TD>
|
||||
<A HREF="#kcKEYL">KEYL</A> </TD><TD>
|
||||
<A HREF="#kcCD">C/D</A> </TD><TD>
|
||||
<A HREF="#kcSYSF">SYSF</A> </TD><TD>
|
||||
<A HREF="#kcINPB">INPB</A> </TD><TD>
|
||||
<A HREF="#kcOUTB">OUTB</A> </TD></TR><TR><TD>
|
||||
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P><I>Bit 7:
|
||||
<A NAME="kcPARE"></A> Parity error</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
0: OK.
|
||||
1: Parity error with last byte.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Bit 6:
|
||||
<A NAME="kcTIM"></A> Timeout</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
0: OK.
|
||||
1: Timeout.
|
||||
On PS/2 systems: General timeout.
|
||||
On AT systems: Timeout on transmission from keyboard to keyboard controller.
|
||||
Possibly parity error (in which case both bits 6 and 7 are set).
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Bit 5:
|
||||
<A NAME="kcAUXB"></A> Auxiliary output buffer full</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
On PS/2 systems:
|
||||
Bit 0 tells whether a read from port 0x60 will be valid.
|
||||
If it is valid, this bit 5 tells what data will be read from port 0x60.
|
||||
0: Keyboard data. 1: Mouse data.
|
||||
<P>On AT systems:
|
||||
0: OK.
|
||||
1: Timeout on transmission from keyboard controller to keyboard.
|
||||
This may indicate that no keyboard is present.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Bit 4:
|
||||
<A NAME="kcKEYL"></A> Keyboard lock</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
0: Locked.
|
||||
1: Not locked.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Bit 3:
|
||||
<A NAME="kcCD"></A> Command/Data</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
0: Last write to input buffer was data (written via port 0x60).
|
||||
1: Last write to input buffer was a command (written via port 0x64).
|
||||
(This bit is also referred to as Address Line A2.)
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Bit 2:
|
||||
<A NAME="kcSYSF"></A> System flag</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Set to 0 after power on reset.
|
||||
Set to 1 after successful completion of the keyboard controller self-test
|
||||
(Basic Assurance Test, BAT).
|
||||
Can also be set by command (see
|
||||
<A HREF="#kccb2">below</A>).
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Bit 1:
|
||||
<A NAME="kcINPB"></A> Input buffer status</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
0: Input buffer empty, can be written.
|
||||
1: Input buffer full, don't write yet.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Bit 0:
|
||||
<A NAME="kcOUTB"></A> Output buffer status</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
0: Output buffer empty, don't read yet.
|
||||
1: Output buffer full, can be read.
|
||||
(In the PS/2 situation bit 5 tells whether the available data is
|
||||
from keyboard or mouse.)
|
||||
This bit is cleared when port 0x60 is read.
|
||||
</BLOCKQUOTE>
|
||||
<P>
|
||||
<H2><A NAME="commandbyte"></A> <A NAME="ss10.2">10.2 The keyboard controller command byte</A>
|
||||
</H2>
|
||||
|
||||
<P>The keyboard controller is provided with some RAM, for example 32 bytes,
|
||||
that can be accessed by the CPU. The most important part of this RAM is
|
||||
byte 0, the Controller Command Byte (CCB). It can be read/written by
|
||||
writing 0x20/0x60 to port 0x64 and then reading/writing a data byte
|
||||
from/to port 0x60.
|
||||
<P>This byte has the following layout.
|
||||
<P>
|
||||
<CENTER><TABLE BORDER><TR><TD>
|
||||
<A HREF="#kccb7">0</A> </TD><TD>
|
||||
<A HREF="#kccb6">XLATE</A> </TD><TD>
|
||||
<A HREF="#kccb5">ME</A> </TD><TD>
|
||||
<A HREF="#kccb4">KE</A> </TD><TD>
|
||||
<A HREF="#kccb3">IGNLK</A> </TD><TD>
|
||||
<A HREF="#kccb2">SYSF</A> </TD><TD>
|
||||
<A HREF="#kccb1">MIE</A> </TD><TD>
|
||||
<A HREF="#kccb0">KIE</A> </TD></TR><TR><TD>
|
||||
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P><I>Bit 7:
|
||||
<A NAME="kccb7"></A> Unused</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Always 0.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Bit 6:
|
||||
<A NAME="kccb6"></A> Translate</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
0: No translation.
|
||||
1: Translate keyboard scancodes, using the
|
||||
<A HREF="scancodes-9.html#translationtable">translation table</A> given above.
|
||||
MCA type 2 controllers cannot set this bit to 1. In this case
|
||||
scan code conversion is set using keyboard command 0xf0 to port 0x60.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Bit 5:
|
||||
<A NAME="kccb5"></A> Mouse enable</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
On an EISA or PS/2 system: 0: Enable mouse. 1: Disable mouse
|
||||
by driving the clock line low.
|
||||
On an ISA system: "PC Mode": 0: use 11-bit codes, check parity and do
|
||||
scan conversion.
|
||||
1: use 8086 codes, don't check parity and don't do scan conversion.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Bit 4:
|
||||
<A NAME="kccb4"></A> Keyboard enable</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
0: Enable keyboard. 1: Disable keyboard
|
||||
by driving the clock line low.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Bit 3:
|
||||
<A NAME="kccb3"></A> Ignore keyboard lock</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
For PS/2: Unused, always 0.
|
||||
For AT:
|
||||
0: No action. 1: Force
|
||||
<A HREF="#kcKEYL">bit 4</A> of the status register
|
||||
to 1, "not locked". This is used for keyboard testing after power on.
|
||||
Maybe only on older motherboards.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Bit 2:
|
||||
<A NAME="kccb2"></A> System flag</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
This bit is shown in
|
||||
<A HREF="#kcSYSF">bit 2</A> of the status register.
|
||||
A "cold reboot" is one with this bit set to zero.
|
||||
A "warm reboot" is one with this bit set to one (BAT already completed).
|
||||
This will influence the tests and initializations done by the POST.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Bit 1:
|
||||
<A NAME="kccb1"></A> Mouse interrupt enable</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
On an ISA system: unused, always 0. On an EISA or PS/2 system:
|
||||
0: Do not use mouse interrupts.
|
||||
1: Send interrupt request IRQ12 when the mouse output buffer is full.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Bit 0:
|
||||
<A NAME="kccb0"></A> Keyboard interrupt enable</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
0: Do not use keyboard interrupts.
|
||||
1: Send interrupt request IRQ1 when the keyboard output buffer is full.
|
||||
<P>When no interrupts are used, the CPU has to poll bits 0 (and 5)
|
||||
of the status register.
|
||||
</BLOCKQUOTE>
|
||||
<P>
|
||||
<H2><A NAME="ss10.3">10.3 Keyboard controller commands</A>
|
||||
</H2>
|
||||
|
||||
<P>The CPU can command the keyboard controller by writing port 0x64.
|
||||
Useful, generally available, keyboard commands are:
|
||||
<P>
|
||||
<P>
|
||||
<CENTER><TABLE BORDER><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kcc20">20</A></B> </TD><TD> Read keyboard controller command byte </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kcc60">60</A></B> </TD><TD> Write keyboard controller command byte </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kccaa">aa</A></B> </TD><TD> Self test </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kccab">ab</A></B> </TD><TD> Interface test </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kccad">ad</A></B> </TD><TD> Disable keyboard </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kccae">ae</A></B> </TD><TD> Enable keyboard </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kccc0">c0</A></B> </TD><TD> Read input port </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kccd0">d0</A></B> </TD><TD> Read output port </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kccd1">d1</A></B> </TD><TD> Write output port </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kcce0">e0</A></B> </TD><TD> Read test inputs </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kccfe">fe</A></B> </TD><TD> System reset </TD></TR><TR><TD>
|
||||
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P>Useful, generally available, mouse commands are:
|
||||
<P>
|
||||
<P>
|
||||
<CENTER><TABLE BORDER><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kcca7">a7</A></B> </TD><TD> Disable mouse port </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kcca8">a8</A></B> </TD><TD> Enable mouse port </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kcca9">a9</A></B> </TD><TD> Test mouse port </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kccd4">d4</A></B> </TD><TD> Write to mouse </TD></TR><TR><TD>
|
||||
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P>Obscure, probably obsolete, commands:
|
||||
<P>
|
||||
<P>
|
||||
<CENTER><TABLE BORDER><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kcc00">00-1f</A></B> </TD><TD> Read keyboard controller RAM </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kcc20">20-3f</A></B> </TD><TD> Read keyboard controller RAM </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kcc40">40-5f</A></B> </TD><TD> Write keyboard controller RAM </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kcc60">60-7f</A></B> </TD><TD> Write keyboard controller RAM </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kcc90">90-93</A></B> </TD><TD> Synaptics multiplexer prefix </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kcc90via">90-9f</A></B> </TD><TD> Write Port13-Port10 </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kcca0">a0</A></B> </TD><TD> Read copyright </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kcca1">a1</A></B> </TD><TD> Read firmware version </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kcca2">a2</A></B> </TD><TD> Switch speed </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kcca3">a3</A></B> </TD><TD> Switch speed </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kcca4">a4</A></B> </TD><TD> Check if password installed </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kcca5">a5</A></B> </TD><TD> Load password </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kcca6">a6</A></B> </TD><TD> Check password </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kccac">ac</A></B> </TD><TD> Diagnostic dump </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kccaf">af</A></B> </TD><TD> Read keyboard version </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kccb0">b0-b5</A></B> </TD><TD> Reset keyboard controller line </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kccb8">b8-bd</A></B> </TD><TD> Set keyboard controller line </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kccc1">c1</A></B> </TD><TD> Continuous input port poll, low </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kccc2">c2</A></B> </TD><TD> Continuous input port poll, high </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kccc8">c8</A></B> </TD><TD> Unblock lines P22 and P23 </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kccc9">c9</A></B> </TD><TD> Block lines P22 and P23 </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kccca">ca</A></B> </TD><TD> Read keyboard controller mode </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kcccb">cb</A></B> </TD><TD> Write keyboard controller mode </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kccd2">d2</A></B> </TD><TD> Write keyboard output buffer </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kccd3">d3</A></B> </TD><TD> Write mouse output buffer </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kccdd">dd</A></B> </TD><TD> Disable A20 address line </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kccdf">df</A></B> </TD><TD> Enable A20 address line </TD></TR><TR><TD>
|
||||
<B>
|
||||
<A HREF="#kccf0">f0-ff</A></B> </TD><TD> Pulse output bit </TD></TR><TR><TD>
|
||||
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P><I>Command 0x00-0x1f:
|
||||
<A NAME="kcc00"></A> Read keyboard controller RAM</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
(AMIBIOS only) Aliases for 0x20-0x3f.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0x20-0x3f:
|
||||
<A NAME="kcc20"></A> Read keyboard controller RAM</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
The last six bits of the command specify the RAM address to read.
|
||||
The read data is placed into the output buffer, and can be read
|
||||
by reading port 0x60.
|
||||
On MCA systems, type 1 controllers can access all 32 locations;
|
||||
type 2 controllers can only access locations 0, 0x13-0x17, 0x1d, 0x1f.
|
||||
<P>Location 0 is the
|
||||
<A HREF="#commandbyte">Command byte</A>, see above.
|
||||
<P>Location 0x13 (on MCA) is nonzero when a password is enabled.
|
||||
<P>Location 0x14 (on MCA) is nonzero when the password was matched.
|
||||
<P>Locations 0x16-0x17 (on MCA) give two make codes to be discarded
|
||||
during password matching.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0x40-0x5f:
|
||||
<A NAME="kcc40"></A> Write keyboard controller RAM</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
(AMIBIOS only) Aliases for 0x40-0x5f.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0x60-0x7f:
|
||||
<A NAME="kcc60"></A> Write keyboard controller RAM</I>
|
||||
<P>
|
||||
<P><I>Command 0x90-0x93:
|
||||
<A NAME="kcc90"></A> Synaptics routing prefixes</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Prefix a PS/2 mouse command with one of these to talk to one of at most four
|
||||
multiplexed devices. See also the
|
||||
<A HREF="#multiplexing">multiplexing handshake</A> below.
|
||||
<P>Unfortunately, VIA also uses this command:
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0x90-0x9f:
|
||||
<A NAME="kcc90via"></A> Write Port13-Port10</I>
|
||||
<BLOCKQUOTE>
|
||||
(VIA VT82C42) Write low nibble to Port13-Port10.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xa0:
|
||||
<A NAME="kcca0"></A> Read copyright</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
On some keyboard controllers: an ASCIZ copyright string
|
||||
(possibly just NUL) is made available for reading via port 0x60.
|
||||
On other systems: no effect, the command is ignored.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xa1:
|
||||
<A NAME="kcca1"></A> Read controller firmware version</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
On some keyboard controllers: a single ASCII byte is made available
|
||||
for reading via port 0x60.
|
||||
On other systems: no effect, the command is ignored.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xa2:
|
||||
<A NAME="kcca2"></A> Switch speed</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
(On ISA/EISA systems with AMI BIOS)
|
||||
Reset keyboard controller lines P22 and P23 low.
|
||||
These lines can be used for speed switching via the keyboard controller.
|
||||
When done, the keyboard controller sends one garbage byte to the system.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xa3:
|
||||
<A NAME="kcca3"></A> Switch speed</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
(On ISA/EISA systems with AMI BIOS)
|
||||
Set keyboard controller lines P22 and P23 high.
|
||||
These lines can be used for speed switching via the keyboard controller.
|
||||
When done, the keyboard controller sends one garbage byte to the system.
|
||||
<P>(Compaq BIOS: Enable system speed control.)
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xa4:
|
||||
<A NAME="kcca4"></A> Check if password installed</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
On MCA systems:
|
||||
Return 0xf1 (via port 0x60) when no password is installed,
|
||||
return 0xfa when a password has been installed.
|
||||
Some systems without password facility always return 0xf1.
|
||||
<P>(On ISA/EISA systems with AMI BIOS)
|
||||
Write Clock = Low.
|
||||
<P>(Compaq BIOS: toggle speed.)
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xa5:
|
||||
<A NAME="kcca5"></A> Load password</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
On MCA systems:
|
||||
Load a password by writing a NUL-terminated string to port 0x60.
|
||||
The string is in scancode format.
|
||||
<P>(On ISA/EISA systems with AMI BIOS)
|
||||
Write Clock = High.
|
||||
<P>(Compaq BIOS: special read of P2, with bits 4 and 5 replaced:
|
||||
Bit 5: 0: 9-bit keyboard, 1: 11-bit keyboard.
|
||||
Bit 4: 0: outp-buff-full interrupt disabled, 1: enabled.)
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xa6:
|
||||
<A NAME="kcca6"></A> Check password</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
On MCA systems:
|
||||
When a password is installed:
|
||||
Check password by matching keystrokes with the stored password.
|
||||
Enable keyboard upon successful match.
|
||||
<P>(On ISA/EISA systems with AMI BIOS)
|
||||
Read Clock. 0: Low. 1: High.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xa7:
|
||||
<A NAME="kcca7"></A> Disable mouse port</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
On MCA systems: disable the mouse (auxiliary device)
|
||||
by setting its clock line low, and set
|
||||
<A HREF="#kccb5">bit 5</A>
|
||||
of the
|
||||
<A HREF="#commandbyte">Command byte</A>. Now P23 = 1.
|
||||
<P>(On ISA/EISA systems with AMI BIOS)
|
||||
Write Cache Bad.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xa8:
|
||||
<A NAME="kcca8"></A> Enable mouse port</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
On MCA systems: enable the mouse (auxiliary device),
|
||||
clear
|
||||
<A HREF="#kccb5">bit 5</A> of the
|
||||
<A HREF="#commandbyte">Command byte</A>. Now P23 = 0.
|
||||
<P>(On ISA/EISA systems with AMI BIOS)
|
||||
Write Cache Good.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xa9:
|
||||
<A NAME="kcca9"></A> Test mouse port</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
On MCA and other systems: test the serial<61>link between
|
||||
keyboard controller and mouse. The result can be read from port 0x60.
|
||||
0: OK.
|
||||
1: Mouse clock line stuck low.
|
||||
2: Mouse clock line stuck high.
|
||||
3: Mouse data line stuck low.
|
||||
4: Mouse data line stuck high.
|
||||
0xff: No mouse.
|
||||
<P>(On ISA/EISA systems with AMI BIOS)
|
||||
Read Cache Bad or Good. 0: Bad. 1: Good.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xaa:
|
||||
<A NAME="kccaa"></A> Self test</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Perform self-test. Return 0x55 if OK, 0xfc if NOK.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xab:
|
||||
<A NAME="kccab"></A> Interface test</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Test the serial link between keyboard controller and keyboard.
|
||||
The result can be read from port 0x60.
|
||||
0: OK.
|
||||
1: Keyboard clock line stuck low.
|
||||
2: Keyboard clock line stuck high.
|
||||
3: Keyboard data line stuck low.
|
||||
4: Keyboard data line stuck high.
|
||||
0xff: General error.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xac:
|
||||
<A NAME="kccac"></A> Diagnostic dump</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
(On some systems)
|
||||
Read from port 0x60 sixteen bytes of keyboard controller RAM,
|
||||
and the output and input ports and the controller's program status word.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xad:
|
||||
<A NAME="kccad"></A> Disable keyboard</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Disable the keyboard clock line and set
|
||||
<A HREF="#kccb5">bit 4</A>
|
||||
of the
|
||||
<A HREF="#commandbyte">Command byte</A>.
|
||||
Any keyboard command enables the keyboard again.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xae:
|
||||
<A NAME="kccae"></A> Enable keyboard</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Enable the keyboard clock line and clear
|
||||
<A HREF="#kccb5">bit 4</A>
|
||||
of the
|
||||
<A HREF="#commandbyte">Command byte</A>.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xaf:
|
||||
<A NAME="kccaf"></A> Read keyboard version</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
(Award BIOS, VIA)
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xb0-0xb5,0xb8-0xbd:
|
||||
<A NAME="kccb0"></A> <A NAME="kccb8"></A> Reset/set keyboard controller line</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
AMI BIOS:
|
||||
Commands 0xb0-0xb5 reset a keyboard controller line low.
|
||||
Commands 0xb8-0xbd set the corresponding keyboard controller line high.
|
||||
The lines are P10, P11, P12, P13, P22 and P23, respectively.
|
||||
(In the case of the lines P10, P11, P22, P23 this is on ISA/EISA systems only.)
|
||||
When done, the keyboard controller sends one garbage byte to the system.
|
||||
<P>VIA BIOS:
|
||||
Commands 0xb0-0xb7 write 0 to lines P10, P11, P12, P13, P22, P23, P14, P15.
|
||||
Commands 0xb8-0xbf write 1 to lines P10, P11, P12, P13, P22, P23, P14, P15.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xc0:
|
||||
<A NAME="kccc0"></A> Read input port</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Read the
|
||||
<A HREF="#inputport">input port</A> (P1),
|
||||
and make the resulting byte available to be read from port 0x60.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xc1:
|
||||
<A NAME="kccc1"></A> Continuous input port poll, low</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
(MCA systems with type 1 controller only)
|
||||
Continuously copy bits 3-0 of the input port to be read from bits 7-4
|
||||
of port 0x64, until another keyboard controller command is received.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xc2:
|
||||
<A NAME="kccc2"></A> Continuous input port poll, high</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
(MCA systems with type 1 controller only)
|
||||
Continuously copy bits 7-4 of the input port to be read from bits 7-4
|
||||
of port 0x64, until another keyboard controller command is received.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xc8:
|
||||
<A NAME="kccc8"></A> Unblock keyboard controller lines P22 and P23</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
(On ISA/EISA systems with AMI BIOS)
|
||||
After this command, the system can make lines P22 and P23 low/high
|
||||
using
|
||||
<A HREF="#kccd1">command 0xd1</A>.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xc9:
|
||||
<A NAME="kccc9"></A> Block keyboard controller lines P22 and P23</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
(On ISA/EISA systems with AMI BIOS)
|
||||
After this command, the system cannot make lines P22 and P23 low/high
|
||||
using
|
||||
<A HREF="#kccd1">command 0xd1</A>.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xca:
|
||||
<A NAME="kccca"></A> Read keyboard controller mode</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
(AMI BIOS, VIA)
|
||||
Read keyboard controller mode to bit 0 of port 0x60.
|
||||
0: ISA (AT) interface.
|
||||
1: PS/2 (MCA)interface.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xcb:
|
||||
<A NAME="kcccb"></A> Write keyboard controller mode</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
(AMI BIOS)
|
||||
Write keyboard controller mode to bit 0 of port 0x60.
|
||||
0: ISA (AT) interface.
|
||||
1: PS/2 (MCA)interface.
|
||||
(First read the mode using command 0xca, then modify only
|
||||
the last bit, then write the mode using this command.)
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xd0:
|
||||
<A NAME="kccd0"></A> Read output port</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Read the
|
||||
<A HREF="#outputport">output port</A> (P2)
|
||||
and place the result in the output buffer.
|
||||
Use only when output buffer is empty.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xd1:
|
||||
<A NAME="kccd1"></A> Write output port</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Write the
|
||||
<A HREF="#outputport">output port</A> (P2).
|
||||
Note that writing a 0 in bit 0 will cause a hardware reset.
|
||||
<P>(Compaq: the system speed bits are not set. Use commands 0xa1-0xa6 for that.)
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xd2:
|
||||
<A NAME="kccd2"></A> Write keyboard output buffer</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
(MCA)
|
||||
Write the keyboard controllers output buffer with the byte
|
||||
next written to port 0x60, and act as if this was keyboard data.
|
||||
(In particular, raise IRQ1 when
|
||||
<A HREF="#kccb0">bit 0</A>
|
||||
of the
|
||||
<A HREF="#commandbyte">Command byte</A> says so.)
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xd3:
|
||||
<A NAME="kccd3"></A> Write mouse output buffer</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
(MCA)
|
||||
Write the keyboard controllers output buffer with the byte
|
||||
next written to port 0x60, and act as if this was mouse data.
|
||||
(In particular, raise IRQ12 when
|
||||
<A HREF="#kccb1">bit 1</A>
|
||||
of the
|
||||
<A HREF="#commandbyte">Command byte</A> says so.)
|
||||
<P>Not all systems support this.
|
||||
<P><B>
|
||||
<A NAME="multiplexing"></A> Synaptics multiplexing</B>
|
||||
On the other hand, Synaptics (see
|
||||
<A HREF="http://www.synaptics-uk.com/decaf/utilities/ps2-mux.PDF">ps2-mux.PDF</A>)
|
||||
uses this command as a handshake between driver and controller:
|
||||
if the driver gives this command three times, with data bytes
|
||||
0xf0, 0x56, 0xa4 respectively, and reads 0xf0, 0x56, but not 0xa4
|
||||
back from the mouse output buffer, then the driver knows that the
|
||||
controller supports Synaptics AUX port multiplexing, and the controller
|
||||
knows that it does not have to do the usual data faking and goes
|
||||
into multiplexed mode. The third byte read is the version of the
|
||||
Synaptics standard.
|
||||
<P>There is a corresponding deactivation sequence, namely
|
||||
0xf0, 0x56, 0xa5. (And again the last byte is changed to the
|
||||
version number of the standard supported.)
|
||||
This latter sequence works both in multiplexed mode and in legacy mode
|
||||
and can thus be used to determine whether this feature is present
|
||||
without activating it.
|
||||
<P>See also the multiplexer commands
|
||||
<A HREF="#kcc90">0x90-0x93</A>.
|
||||
<P>For some laptops it has been reported that bit 3 of every third
|
||||
mouse byte is forced to 1 (as it would be with the standard
|
||||
3-byte mouse packets). This may turn 0xf0, 0x56, 0xa4 into
|
||||
0xf0, 0x56, 0xac and cause misdetection of Synaptics multiplexing
|
||||
(for version 10.12).
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xd4:
|
||||
<A NAME="kccd4"></A> Write to mouse</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
(MCA)
|
||||
The byte next written to port 0x60 is transmitted to the mouse.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xdd:
|
||||
<A NAME="kccdd"></A> Disable A20 address line</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
(HP Vectra)
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xdf:
|
||||
<A NAME="kccdf"></A> Enable A20 address line</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
(HP Vectra)
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xe0:
|
||||
<A NAME="kcce0"></A> Read test inputs</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
This command makes the status of the
|
||||
<A HREF="#testinputs">Test inputs</A> T0 and T1 available
|
||||
to be read via port 0x60 in bits 0 and 1, respectively.
|
||||
Use only when the output port is empty.
|
||||
</BLOCKQUOTE>
|
||||
<P>
|
||||
<P><I>Command 0xf0-0xff:
|
||||
<A NAME="kccf0"></A> Pulse output bit</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Bits 3-0 of the
|
||||
<A HREF="#outputport">output port</A> P2
|
||||
of the keyboard controller may be pulsed low for approximately 6 <20>seconds.
|
||||
Bits 3-0 of this command specify the output port bits to be pulsed.
|
||||
0: Bit should be pulsed.
|
||||
1: Bit should not be modified.
|
||||
The only useful version of this command is Command 0xfe.
|
||||
(For MCA, replace 3-0 by 1-0 in the above.)
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command 0xfe:
|
||||
<A NAME="kccfe"></A> System reset</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Pulse bit 0 of the
|
||||
<A HREF="#outputport">output port</A> P2
|
||||
of the keyboard controller. This will reset the CPU.
|
||||
</BLOCKQUOTE>
|
||||
<P>
|
||||
<H2><A NAME="inputport"></A> <A NAME="ss10.4">10.4 The input port P1</A>
|
||||
</H2>
|
||||
|
||||
<P>This has the following layout.
|
||||
<P>
|
||||
<CENTER><TABLE BORDER><TR><TD>
|
||||
bit 7 </TD><TD> Keyboard lock </TD><TD> 0: locked, 1: not locked </TD></TR><TR><TD>
|
||||
bit 6 </TD><TD> Display </TD><TD> 0: CGA, 1: MDA </TD></TR><TR><TD>
|
||||
bit 5 </TD><TD> Manufacturing jumper </TD><TD> 0: installed, 1: not installed </TD></TR><TR><TD>
|
||||
</TD><TD> </TD><TD> with jumper the BIOS runs an infinite diagnostic loop </TD></TR><TR><TD>
|
||||
bit 4 </TD><TD> RAM on motherboard </TD><TD> 0: 512 KB, 1: 256 KB </TD></TR><TR><TD>
|
||||
bit 3 </TD><TD> </TD><TD> Unused in ISA, EISA, PS/2 systems </TD></TR><TR><TD>
|
||||
</TD><TD> </TD><TD> Can be configured for clock switching </TD></TR><TR><TD>
|
||||
bit 2 </TD><TD> </TD><TD> Unused in ISA, EISA, PS/2 systems </TD></TR><TR><TD>
|
||||
</TD><TD> </TD><TD> Can be configured for clock switching </TD></TR><TR><TD>
|
||||
</TD><TD> Keyboard power </TD><TD> PS/2 MCA: 0: keyboard power normal, 1: no power </TD></TR><TR><TD>
|
||||
bit 1 </TD><TD> Mouse data in </TD><TD> Unused in ISA </TD></TR><TR><TD>
|
||||
bit 0 </TD><TD> Keyboard data in </TD><TD> Unused in ISA </TD></TR><TR><TD>
|
||||
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P>Clearly only bits 1-0 are input bits.
|
||||
Of the above, the original IBM AT used bits 7-4, while PS/2 MCA systems
|
||||
use only bits 2-0.
|
||||
<P>Where in the above lines P10, P11, etc are used, these refer to the pins
|
||||
corresponding to bit 0, bit 1, etc of port P1.
|
||||
<P>
|
||||
<H2><A NAME="outputport"></A> <A NAME="ss10.5">10.5 The output port P2</A>
|
||||
</H2>
|
||||
|
||||
<P>This has the following layout.
|
||||
<P>
|
||||
<CENTER><TABLE BORDER><TR><TD>
|
||||
bit 7 </TD><TD> Keyboard data </TD><TD> data to keyboard </TD></TR><TR><TD>
|
||||
bit 6 </TD><TD> Keyboard clock </TD></TR><TR><TD>
|
||||
bit 5 </TD><TD> IRQ12 </TD><TD> 0: IRQ12 not active, 1: active </TD></TR><TR><TD>
|
||||
bit 4 </TD><TD> IRQ1 </TD><TD> 0: IRQ1 not active, 1: active </TD></TR><TR><TD>
|
||||
bit 3 </TD><TD> Mouse clock </TD><TD> Unused in ISA </TD></TR><TR><TD>
|
||||
bit 2 </TD><TD> Mouse data </TD><TD> Unused in ISA. Data to mouse </TD></TR><TR><TD>
|
||||
bit 1 </TD><TD> A20 </TD><TD> 0: A20 line is forced 0, 1: A20 enabled </TD></TR><TR><TD>
|
||||
bit 0 </TD><TD> Reset </TD><TD> 0: reset CPU, 1: normal </TD></TR><TR><TD>
|
||||
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P>Where in the above lines P20, P21, etc are used, these refer to the pins
|
||||
corresponding to bit 0, bit 1, etc of port P2.
|
||||
<P>
|
||||
<H2><A NAME="testinputs"></A> <A NAME="ss10.6">10.6 The test port T</A>
|
||||
</H2>
|
||||
|
||||
<P><I>bit 0</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Keyboard clock (input).
|
||||
</BLOCKQUOTE>
|
||||
<P><I>bit 1</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
(AT) Keyboard data (input).
|
||||
(PS/2) Mouse clock (input).
|
||||
</BLOCKQUOTE>
|
||||
<P>
|
||||
<HR>
|
||||
<A HREF="scancodes-11.html">Next</A>
|
||||
<A HREF="scancodes-9.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc10">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
280
specs/kbd/scancodes-11.html
Normal file
@@ -0,0 +1,280 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
||||
<TITLE>Keyboard scancodes: Keyboard commands</TITLE>
|
||||
<LINK HREF="scancodes-12.html" REL=next>
|
||||
<LINK HREF="scancodes-10.html" REL=previous>
|
||||
<LINK HREF="scancodes.html#toc11" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="scancodes-12.html">Next</A>
|
||||
<A HREF="scancodes-10.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc11">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s11">11. Keyboard commands</A></H2>
|
||||
|
||||
<P>One can not only talk to the keyboard controller (by writing to
|
||||
port 0x64), but also to the keyboard (by writing to port 0x60).
|
||||
<P>In order to avoid interference between scancode sequences or
|
||||
mouse packets and the reponses given to commands, the keyboard
|
||||
or mouse should always be disabled before giving a command that
|
||||
requires a response, and probably enabled afterwards.
|
||||
Some keyboards or mice do the disable automatically in this
|
||||
situation, but still require an explicit enable afterwards.
|
||||
<P>Each command (other than 0xfe) is ACKed by 0xfa.
|
||||
Each unknown command is NACKed by 0xfe.
|
||||
Some mice expect a corrected byte as reply to the 0xfe,
|
||||
and will double-NACK with 0xfc when also that is wrong.
|
||||
<P>Here a list with the common commands.
|
||||
<P>
|
||||
<P>
|
||||
<CENTER><TABLE BORDER><TR><TD>
|
||||
<A HREF="#kced">0xed</A> </TD><TD> Write LEDs </TD></TR><TR><TD>
|
||||
<A HREF="#kcee">0xee</A> </TD><TD> Diagnostic echo </TD></TR><TR><TD>
|
||||
<A HREF="#kcf0">0xf0</A> </TD><TD> Set/Get scancode set </TD></TR><TR><TD>
|
||||
<A HREF="#kcf2">0xf2</A> </TD><TD> Read keyboard ID </TD></TR><TR><TD>
|
||||
<A HREF="#kcf3">0xf3</A> </TD><TD> Set repeat rate and delay </TD></TR><TR><TD>
|
||||
<A HREF="#kcf4">0xf4</A> </TD><TD> Keyboard enable </TD></TR><TR><TD>
|
||||
<A HREF="#kcf5">0xf5</A> </TD><TD> Set defaults and disable keyboard </TD></TR><TR><TD>
|
||||
<A HREF="#kcf6">0xf6</A> </TD><TD> Set defaults </TD></TR><TR><TD>
|
||||
<A HREF="#kcf7">0xf7</A> </TD><TD> Set all keys to repeat </TD></TR><TR><TD>
|
||||
<A HREF="#kcf8">0xf8</A> </TD><TD> Set all keys to give make/break codes </TD></TR><TR><TD>
|
||||
<A HREF="#kcf9">0xf9</A> </TD><TD> Set all keys to give make codes only </TD></TR><TR><TD>
|
||||
<A HREF="#kcfa">0xfa</A> </TD><TD> Set all keys to repeat and give make/break codes </TD></TR><TR><TD>
|
||||
<A HREF="#kcfb">0xfb</A> </TD><TD> Set a single key to repeat </TD></TR><TR><TD>
|
||||
<A HREF="#kcfc">0xfc</A> </TD><TD> Set a single key to give make/break codes </TD></TR><TR><TD>
|
||||
<A HREF="#kcfd">0xfd</A> </TD><TD> Set a single key to give make codes only </TD></TR><TR><TD>
|
||||
<A HREF="#kcfe">0xfe</A> </TD><TD> Resend </TD></TR><TR><TD>
|
||||
<A HREF="#kcff">0xff</A> </TD><TD> Keyboard reset </TD></TR><TR><TD>
|
||||
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P>If the command is preceded by writing 0xd4 to port 0x64, then
|
||||
it goes to the mouse instead of the keyboard. Common commands:
|
||||
<P>
|
||||
<P>
|
||||
<CENTER><TABLE BORDER><TR><TD>
|
||||
<A HREF="scancodes-12.html#mce6">0xe6</A> </TD><TD> Set mouse scaling to 1:1 </TD></TR><TR><TD>
|
||||
<A HREF="scancodes-12.html#mce7">0xe7</A> </TD><TD> Set mouse scaling to 2:1 </TD></TR><TR><TD>
|
||||
<A HREF="scancodes-12.html#mce8">0xe8</A> </TD><TD> Set mouse resolution </TD></TR><TR><TD>
|
||||
<A HREF="scancodes-12.html#mce9">0xe9</A> </TD><TD> Get mouse information </TD></TR><TR><TD>
|
||||
<A HREF="scancodes-12.html#mcf2">0xf2</A> </TD><TD> Read mouse ID </TD></TR><TR><TD>
|
||||
<A HREF="scancodes-12.html#mcf3">0xf3</A> </TD><TD> Set mouse sample rate </TD></TR><TR><TD>
|
||||
<A HREF="scancodes-12.html#mcf4">0xf4</A> </TD><TD> Mouse enable </TD></TR><TR><TD>
|
||||
<A HREF="scancodes-12.html#mcf5">0xf5</A> </TD><TD> Mouse disable </TD></TR><TR><TD>
|
||||
<A HREF="scancodes-12.html#mcf6">0xf6</A> </TD><TD> Set defaults </TD></TR><TR><TD>
|
||||
<A HREF="scancodes-12.html#mcff">0xff</A> </TD><TD> Mouse reset </TD></TR><TR><TD>
|
||||
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P>
|
||||
<H2><A NAME="ss11.1">11.1 Keyboard command details</A>
|
||||
</H2>
|
||||
|
||||
<P>
|
||||
<P><I>Command <B>e8</B></I>: Nonstandard. Reported to give a
|
||||
2-byte ID on an
|
||||
<A HREF="scancodes-5.html#omnikey">OmniKey</A> keyboard.
|
||||
<P><I>Command <B>ea</B></I>: Nonstandard. The sequences
|
||||
<B>ea</B> <B>70</B> and <B>ea</B> <B>71</B> are
|
||||
used by some IBM keyboards to disable and enable extra keys.
|
||||
<P><I>Command <B>eb</B></I>: Nonstandard. Sequences involving <B>eb</B>
|
||||
are often used for
|
||||
<A HREF="scancodes-1.html#LEDmanip">manipulating extra LEDs</A>.
|
||||
<P><I>Command <B>ec</B></I>: Nonstandard. On the
|
||||
<A HREF="scancodes-5.html#ibmrapidaccess">IBM Rapid Access keyboard</A>
|
||||
this command yields a 2-byte ID.
|
||||
<P><I>Command <B>ed</B>:
|
||||
<A NAME="kced"></A> Write LEDs</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
This command is followed by a byte indicating the desired LEDs setting.
|
||||
Bits 7-3: unused, 0.
|
||||
Bit 2: 1: CapsLock LED on.
|
||||
Bit 1: 1: NumLock LED on.
|
||||
Bit 0: 1: ScrollLock LED on.
|
||||
When OK, both bytes are ACKed. If the second byte is recognized as a
|
||||
command, that command is ACKed and done instead. Otherwise a NACK is
|
||||
returned (and a keyboard enable may be needed).
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>ee</B>:
|
||||
<A NAME="kcee"></A> Diagnostic echo</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
This command returns a single byte, again <B>ee</B>.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>f0</B>:
|
||||
<A NAME="kcf0"></A> Set/Get scancode set</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Many, but not all, keyboards can be switched to three different
|
||||
<A HREF="scancodes-9.html#scancodesets">scancode sets</A>.
|
||||
This command, followed by a byte <B>01</B>, <B>02</B>, or <B>03</B>
|
||||
selects the corresponding scancode set. This command, followed by
|
||||
a zero byte, reads the current scancode set. The reply (translated)
|
||||
is <B>43</B>, <B>41</B> or <B>3f</B>, from untranslated 1, 2 or 3.
|
||||
Note that scancode set 1 should not be translated, while sets
|
||||
2 and 3 should be translated.
|
||||
<P>Set 2 was introduced by the AT. Set 3 by the PS/2.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>f2</B>:
|
||||
<A NAME="kcf2"></A> Read keyboard ID</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
This command reads a 2-byte
|
||||
<A HREF="scancodes-9.html#keyboardid">keyboard ID</A>.
|
||||
XT keyboards do not answer at all (of course),
|
||||
AT keyboards reply with an ACK (<B>fa</B>) only,
|
||||
MF2 and other keyboards reply with a 2-byte ID.
|
||||
Wait at least 10ms after issuing this command.
|
||||
<P>For the mouse reply, see
|
||||
<A HREF="scancodes-12.html#mcf2">below</A>.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>f3</B>:
|
||||
<A NAME="kcf3"></A> Set repeat rate and delay</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
A following byte gives the desired delay before a pressed key
|
||||
starts repeating, and the repeat rate.
|
||||
<P>Bit 7: unused, 0.
|
||||
<P>Bits 6-5: 0, 1, 2, 3: 250, 500, 750, 1000 ms delay.
|
||||
Default after reset is 500 ms.
|
||||
<P>Bits 4-0: inter-character delay. The number of characters per second
|
||||
is given by
|
||||
<P>
|
||||
<CENTER><TABLE BORDER><TR><TD>
|
||||
</TD><TD> 0 </TD><TD> 1 </TD><TD> 2 </TD><TD> 3 </TD><TD> 4 </TD><TD> 5 </TD><TD> 6 </TD><TD> 7 </TD></TR><TR><TD>
|
||||
0 </TD><TD> 30.0 </TD><TD> 26.7 </TD><TD> 24.0 </TD><TD> 21.8 </TD><TD> 20.0 </TD><TD> 18.5 </TD><TD> 17.1 </TD><TD> 16.0 </TD></TR><TR><TD>
|
||||
8 </TD><TD> 15.0 </TD><TD> 13.3 </TD><TD> 12.0 </TD><TD> 10.9 </TD><TD> 10.0 </TD><TD> 9.2 </TD><TD> 8.6 </TD><TD> 8.0 </TD></TR><TR><TD>
|
||||
16</TD><TD> 7.5 </TD><TD> 6.7 </TD><TD> 6.0 </TD><TD> 5.5 </TD><TD> 5.0 </TD><TD> 4.6 </TD><TD> 4.3 </TD><TD> 4.0 </TD></TR><TR><TD>
|
||||
24</TD><TD> 3.7 </TD><TD> 3.3 </TD><TD> 3.0 </TD><TD> 2.7 </TD><TD> 2.5 </TD><TD> 2.3 </TD><TD> 2.1 </TD><TD> 2.0 </TD></TR><TR><TD>
|
||||
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P>(that is, the inter-character delay is (2 ^ B) * (D + 8) / 240 sec,
|
||||
where B gives Bits 4-3 and D gives Bits 2-0).
|
||||
<P>Default after reset is 10.9 characters per second.
|
||||
<P><B>Logitech extended commands</B>
|
||||
Logitech uses escape sequences involving <B>f3</B> for extended commands.
|
||||
A Logitech extended command looks like
|
||||
<B>f3</B> <B>7f</B> <B>f3</B> <B>00</B> <B>f3</B> <I>xx</I>
|
||||
(for varying 7-bit values of <I>xx</I>). For example:
|
||||
<P><I>xx</I> = <B>01</B>: SendStatus: send the E1 XX codes for SubDeviceType,
|
||||
BatteryStatus, (Channel if relevant) KbdStatus (=wireless status).
|
||||
<P><I>xx</I> = <B>02</B>: OpenLocking
|
||||
<P><I>xx</I> = <B>03</B>: CloseLocking
|
||||
<P><I>xx</I> = <B>06</B> <B>f3</B> <I>aa</I>:
|
||||
Read byte at address <I>aa</I> (in 0x01-0x1e).
|
||||
<P><I>xx</I> = <B>07</B> <B>F3</B> <I>aa</I> <B>f3</B> <I>dd</I>:
|
||||
Write <I>dd</I> at address <I>aa</I> (in 0x01-0x1e).
|
||||
<P><I>xx</I> = <B>10</B> or <B>11</B>: Clear all device-related data
|
||||
in EEPROM and RAM. Now device is disconnected.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>f4</B>:
|
||||
<A NAME="kcf4"></A> Keyboard enable</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
If a transmit error occurs, the keyboard is automatically disabled.
|
||||
This command re-enables the keyboard and clears its internal 16-byte
|
||||
buffer.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>f5</B>:
|
||||
<A NAME="kcf5"></A> Set defaults and
|
||||
disable keyboard</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Reset keyboard, clear output buffer, switch off LEDs, reset
|
||||
repeat rate and delay to defaults. Disable the keyboard scan.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>f6</B>:
|
||||
<A NAME="kcf6"></A> Set defaults</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Reset keyboard, clear output buffer, switch off LEDs, reset
|
||||
repeat rate and delay to defaults.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>f7</B>:
|
||||
<A NAME="kcf7"></A> Set all keys to repeat</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Keyboards that support scancode Set 3 keep for each key two bits:
|
||||
does it repeat? does it generate a break code?
|
||||
This command sets the "repeat" bit for all keys.
|
||||
It does not influence keyboard operation when the scancode set is not Set 3.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>f8</B>:
|
||||
<A NAME="kcf8"></A> Set all keys to give make/break
|
||||
codes</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
This command sets the "generate break code" bit for all keys.
|
||||
It does not influence keyboard operation when the scancode set is not Set 3.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>f9</B>:
|
||||
<A NAME="kcf9"></A> Set all keys to give
|
||||
make codes only</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
This command clears the "generate break code" bit for all keys.
|
||||
It does not influence keyboard operation when the scancode set is not Set 3.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>fa</B>:
|
||||
<A NAME="kcfa"></A> Set all keys to repeat
|
||||
and give make/break codes</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
This command sets the "repeat" and "generate break code" bits for all keys.
|
||||
It does not influence keyboard operation when the scancode set is not Set 3.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>fb</B>:
|
||||
<A NAME="kcfb"></A> Set some keys to repeat</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
This command sets the "repeat" bits for the indicated keys.
|
||||
It is followed by the untranslated Set 3 scancodes of the keys
|
||||
for which this bit must be set. The sequence is ended by a command
|
||||
code (<B>ed</B>, <B>ee</B>, <B>f0</B>, <B>f2</B>-<B>ff</B>).
|
||||
Afterwards, a "keyboard enable" <B>f4</B> is required.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>fc</B>:
|
||||
<A NAME="kcfc"></A> Set some keys to give make/break
|
||||
codes</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
This command sets the "generate break code" bits for the indicated keys.
|
||||
It is followed by the untranslated Set 3 scancodes of the keys
|
||||
for which this bit must be set. The sequence is ended by a command
|
||||
code (<B>ed</B>, <B>ee</B>, <B>f0</B>, <B>f2</B>-<B>ff</B>).
|
||||
Afterwards, a "keyboard enable" <B>f4</B> is required.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>fd</B>:
|
||||
<A NAME="kcfd"></A> Set some keys to give make codes
|
||||
only</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
This command clears the "generate break code" bits for the indicated keys.
|
||||
It is followed by the untranslated Set 3 scancodes of the keys for which
|
||||
this bit must be set. The sequence is ended by a recognized command code
|
||||
(such as <B>ed</B>, <B>ee</B>, <B>f0</B>, <B>f2</B>-<B>ff</B>).
|
||||
Afterwards, a "keyboard enable" <B>f4</B> is required.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>fe</B>:
|
||||
<A NAME="kcfe"></A> Resend</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Meant for use by the keyboard controller after a transmission error.
|
||||
Not for use by the CPU.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>ff</B>:
|
||||
<A NAME="kcff"></A> Keyboard reset</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Reset and self-test.
|
||||
The self-test (BAT) will return <B>aa</B> when OK, and <B>fc</B> otherwise.
|
||||
As part of the self-test, all LEDs are flashed.
|
||||
</BLOCKQUOTE>
|
||||
<P>
|
||||
<HR>
|
||||
<A HREF="scancodes-12.html">Next</A>
|
||||
<A HREF="scancodes-10.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc11">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
502
specs/kbd/scancodes-12.html
Normal file
@@ -0,0 +1,502 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
||||
<TITLE>Keyboard scancodes: The PS/2 Mouse</TITLE>
|
||||
<LINK HREF="scancodes-13.html" REL=next>
|
||||
<LINK HREF="scancodes-11.html" REL=previous>
|
||||
<LINK HREF="scancodes.html#toc12" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="scancodes-13.html">Next</A>
|
||||
<A HREF="scancodes-11.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc12">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s12">12. The PS/2 Mouse</A></H2>
|
||||
|
||||
<P>
|
||||
<P>Mice come in various flavours - serial mice, PS/2 mice, busmice, USB mice.
|
||||
Below a little about mice using the PS/2 protocol, since these also use
|
||||
the keyboard controller.
|
||||
<P>A mouse has a number of buttons (1-5 is common) and must report
|
||||
button presses. It has some way of detecting motion, and must report
|
||||
the amount of movement in the X and Y direction, usually as differences
|
||||
with the previously reported position, in a (dx,dy) pair.
|
||||
Touchpads can also report absolute position.
|
||||
<P>Reports come in the form of mouse packets of between 1 and 8 bytes.
|
||||
Various protocols are in use.
|
||||
<P>
|
||||
<H2><A NAME="mousemodes"></A> <A NAME="ss12.1">12.1 Modes</A>
|
||||
</H2>
|
||||
|
||||
<P>A PS/2 mouse can be in <I>stream mode</I> (the default).
|
||||
In this mode it produces a stream of packets indicating mouse movements
|
||||
and button presses. Or it can be in <I>remote mode</I>.
|
||||
In this mode the mouse only sends a packet when the host
|
||||
requests one, using the <B>
|
||||
<A HREF="#mceb">eb</A></B> command.
|
||||
Finally, it can be in <I>echo</I> ("wrap") <I>mode</I>,
|
||||
in which everything the host sends is echoed back, until
|
||||
either a reset (<B>ff</B>) or clear echo mode (<B>ec</B>)
|
||||
is received.
|
||||
<P>
|
||||
<H2><A NAME="ss12.2">12.2 Scaling</A>
|
||||
</H2>
|
||||
|
||||
<P>Scaling can be set to 1:1 or 2:1. This affects stream mode only.
|
||||
In 2:1 scaling: If the unscaled absolute value of dx or dy is 6 or more,
|
||||
it is doubled. Otherwise, for the unscaled value 0,1,2,3,4,5,6, the
|
||||
scaled value 0,1,1,3,6,9,12 is sent.
|
||||
<P>
|
||||
<H2><A NAME="ss12.3">12.3 PS/2 mouse protocol</A>
|
||||
</H2>
|
||||
|
||||
<P>
|
||||
<H3>The default protocol</H3>
|
||||
|
||||
<P>The standard PS/2 protocol uses 3-byte packets, as follows:
|
||||
<P>
|
||||
<CENTER><TABLE BORDER><TR><TD>
|
||||
Yovfl </TD><TD> Xovfl </TD><TD> dy8 </TD><TD> dx8 </TD><TD> 1 </TD><TD> Middle Btn </TD><TD> Right Btn </TD><TD> Left Btn </TD></TR><TR><TD>
|
||||
dx7 </TD><TD> dx6 </TD><TD> dx5 </TD><TD> dx4 </TD><TD> dx3 </TD><TD> dx2 </TD><TD> dx1 </TD><TD> dx0 </TD></TR><TR><TD>
|
||||
dy7 </TD><TD> dy6 </TD><TD> dy5 </TD><TD> dy4 </TD><TD> dy3 </TD><TD> dy2 </TD><TD> dy1 </TD><TD> dy0 </TD></TR><TR><TD>
|
||||
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P>It gives the movement in the X and Y direction in 9-bit two's complement
|
||||
notation (range -256 to +255) and an overflow indicator.
|
||||
It also gives the status of the three mouse buttons.
|
||||
When this protocol is used, the <B>f2</B> Read mouse ID command
|
||||
is answered by <B>00</B>.
|
||||
<P>
|
||||
<H3>Intellimouse</H3>
|
||||
|
||||
<P>The Microsoft Intellimouse uses the above protocol until scrolling wheel
|
||||
mode is activated by sending the magic sequence
|
||||
<B>f3</B> <B>c8</B> <B>f3</B> <B>64</B> <B>f3</B> <B>50</B>
|
||||
(set sample rate 200, 100, 80). In this mode, the Read mouse ID command
|
||||
returns <B>03</B>, and 4-byte packets are used:
|
||||
<P>
|
||||
<CENTER><TABLE BORDER><TR><TD>
|
||||
Yovfl </TD><TD> Xovfl </TD><TD> dy8 </TD><TD> dx8 </TD><TD> 1 </TD><TD> Middle Btn </TD><TD> Right Btn </TD><TD> Left Btn </TD></TR><TR><TD>
|
||||
dx7 </TD><TD> dx6 </TD><TD> dx5 </TD><TD> dx4 </TD><TD> dx3 </TD><TD> dx2 </TD><TD> dx1 </TD><TD> dx0 </TD></TR><TR><TD>
|
||||
dy7 </TD><TD> dy6 </TD><TD> dy5 </TD><TD> dy4 </TD><TD> dy3 </TD><TD> dy2 </TD><TD> dy1 </TD><TD> dy0 </TD></TR><TR><TD>
|
||||
dz3 </TD><TD> dz3 </TD><TD> dz3 </TD><TD> dz3 </TD><TD> dz3 </TD><TD> dz2 </TD><TD> dz1 </TD><TD> dz0 </TD></TR><TR><TD>
|
||||
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P>Here the last byte gives the movement of the scrolling wheel in
|
||||
4-bit two's complement notation (range -8 to +7) and the leading
|
||||
four bits are just copies of the sign bit.
|
||||
<P>
|
||||
<H3>Intellimouse Explorer mouse</H3>
|
||||
|
||||
<P>The Explorer mouse protocol allows for scrolling wheel and five buttons.
|
||||
It is activated by first sending the magic sequence for Intellimouse,
|
||||
and then, when the Intellimouse ID has been seen, sending the magic sequence
|
||||
<B>f3</B> <B>c8</B> <B>f3</B> <B>c8</B> <B>f3</B> <B>50</B>
|
||||
(set sample rate 200, 200, 80). In this mode, the Read mouse ID command
|
||||
returns <B>04</B>, and 4-byte packets are used:
|
||||
<P>
|
||||
<CENTER><TABLE BORDER><TR><TD>
|
||||
Yovfl </TD><TD> Xovfl </TD><TD> dy8 </TD><TD> dx8 </TD><TD> 1 </TD><TD> Middle Btn </TD><TD> Right Btn </TD><TD> Left Btn </TD></TR><TR><TD>
|
||||
dx7 </TD><TD> dx6 </TD><TD> dx5 </TD><TD> dx4 </TD><TD> dx3 </TD><TD> dx2 </TD><TD> dx1 </TD><TD> dx0 </TD></TR><TR><TD>
|
||||
dy7 </TD><TD> dy6 </TD><TD> dy5 </TD><TD> dy4 </TD><TD> dy3 </TD><TD> dy2 </TD><TD> dy1 </TD><TD> dy0 </TD></TR><TR><TD>
|
||||
0 </TD><TD> 0 </TD><TD> 5th Btn </TD><TD> 4th Btn </TD><TD> dz3 </TD><TD> dz2 </TD><TD> dz1 </TD><TD> dz0 </TD></TR><TR><TD>
|
||||
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P>Lots of other protocols occur, and only incomplete data is known
|
||||
about most of them. Some examples.
|
||||
<P>
|
||||
<H3>Typhoon mouse</H3>
|
||||
|
||||
<P>The Typhoon optical mouse is reported to send 6-byte packets.
|
||||
Bytes 1-3 are as for the default PS/2 protocol.
|
||||
Byte 4 equals byte 1. Byte 5 gives the Z axis movement, one of
|
||||
<B>ff</B>, <B>00</B>, <B>01</B>. Byte 6 is 0.
|
||||
Of course the idea is that this packet looks like two ordinary packets
|
||||
and ordinary PS/2 mouse drivers will handle it.
|
||||
The 6-byte mode is activated by sending the magic sequence
|
||||
<B>f3</B> <B>c8</B> <B>f3</B> <B>64</B> <B>f3</B> <B>50</B>
|
||||
<B>f3</B> <B>3c</B> <B>f3</B> <B>28</B> <B>f3</B> <B>14</B>
|
||||
(set sample rate 200, 100, 80, 60, 40, 20).
|
||||
It is recognized by the ID <B>08</B>.
|
||||
<P>
|
||||
<H2><A NAME="ss12.4">12.4 Mouse Commands</A>
|
||||
</H2>
|
||||
|
||||
<P>Every command or data byte sent to the mouse (except for the
|
||||
resend command <B>fe</B>) is ACKed with <B>fa</B>.
|
||||
If the command or data is invalid, it is NACKed with <B>fe</B>.
|
||||
If the next byte is again invalid, the reply is ERROR: <B>fc</B>.
|
||||
<P>
|
||||
<P><I>Command <B>d0</B>: Read extended ID</I>
|
||||
<P>Read up to 256 bytes.
|
||||
<P><I>Commands <B>d1</B>-<B>df</B>: Vendor unique commands</I>
|
||||
<P>
|
||||
<P><I>Command <B>d1</B>: Logitech PS/2++ command</I>
|
||||
<P>This command was to be used, followed by an arbitrary data sequence.
|
||||
Now replaced by the
|
||||
<A HREF="#sliced">sliced commands</A> using
|
||||
<B>e8</B>.
|
||||
<P><I>Command <B>e1</B>: Read secondary ID</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Replies with two bytes.
|
||||
An IBM TrackPoint returns <B>01</B> as first byte,
|
||||
and a second byte depending on the model.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>e2</B>: IBM TrackPoint command</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Followed by several parameter bytes. For details, see
|
||||
<A HREF="http://trackpoint.almaden.ibm.com/files/ykt3dext.pdf">ykt3dext.pdf</A>.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>e6</B>:
|
||||
<A NAME="mce6"></A> Set mouse scaling to 1:1</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Often ingredient in magic sequences.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>e7</B>:
|
||||
<A NAME="mce7"></A> Set mouse scaling to 2:1</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Often ingredient in magic sequences.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>e8</B>:
|
||||
<A NAME="mce8"></A> Set mouse resolution</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
This command is followed by a byte indicating the resolution
|
||||
(0, 1, 2, 3: 1, 2, 4, 8 units per mm, respectively).
|
||||
It is used in magic sequences to transport two bits,
|
||||
so that four of these are needed to send a byte to the mouse.
|
||||
See
|
||||
<A HREF="#sliced">below</A>.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>e9</B>:
|
||||
<A NAME="mce9"></A> Status request</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
This command returns three bytes:
|
||||
<P>First a status byte:
|
||||
Bit 7: unused, 0.
|
||||
Bit 6: 0:
|
||||
<A HREF="#mousemodes">stream mode</A>,
|
||||
1:
|
||||
<A HREF="#mousemodes">remote mode</A>.
|
||||
Bit 5: 0: disabled, 1: enabled.
|
||||
Bit 4: 0: scaling set to 1:1, 1: scaling set to 2:1.
|
||||
Bit 3: unused, 0.
|
||||
Bit 2: 1: left button pressed.
|
||||
Bit 1: 1: middle button pressed.
|
||||
Bit 0: 1: right button pressed.
|
||||
<P>Then a resolution byte:
|
||||
0, 1, 2, 3: 1, 2, 4, 8 units per mm, respectively.
|
||||
<P>Finally a sample rate (in Hz).
|
||||
<P>See below for special
|
||||
<A HREF="#synaptics">Synaptics Touchpad</A> handling.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>ea</B>: Set
|
||||
<A HREF="#mousemodes">stream mode</A></I>
|
||||
<P>
|
||||
<P><I>Command <B>eb</B>:
|
||||
<A NAME="mceb"></A> Read data</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
Read a mouse packet.
|
||||
Needed in
|
||||
<A HREF="#mousemodes">remote mode</A> to ask the mouse for data.
|
||||
Also functions in
|
||||
<A HREF="#mousemodes">stream mode</A>.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>ec</B>: Clear
|
||||
<A HREF="#mousemodes">echo mode</A></I>
|
||||
<P>
|
||||
<P><I>Command <B>ee</B>: Set
|
||||
<A HREF="#mousemodes">echo mode</A></I>
|
||||
<P>
|
||||
<P><I>Command <B>f0</B>: Set
|
||||
<A HREF="#mousemodes">remote mode</A></I>
|
||||
<P>
|
||||
<P><I>Command <B>f2</B>:
|
||||
<A NAME="mcf2"></A> Read mouse ID</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
(Only supported on some systems.)
|
||||
This command reads a 1-byte mouse ID. The reply is a single byte <B>00</B>.
|
||||
Wait at least 10ms after issuing this command.
|
||||
<P>For the keyboard reply, see
|
||||
<A HREF="scancodes-11.html#kcf2">above</A>.
|
||||
<P>BallPoint (trackball) devices return a single byte <B>02</B>,
|
||||
Intellimouse returns <B>03</B>,
|
||||
Explorer Mouse returns <B>04</B>,
|
||||
4d Mouse returns <B>06</B>,
|
||||
4dplus Mouse returns <B>08</B>,as does the Typhoon mouse.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>f3</B>:
|
||||
<A NAME="mcf3"></A> Set mouse sample rate</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
(Only supported on some systems.)
|
||||
Set mouse sample rate in Hz.
|
||||
If the given sampling rate is acceptable the ACK is <B>fa</B>.
|
||||
Otherwise the NACK is <B>fe</B>, and the host can correct.
|
||||
If it is incorrect again <B>fc</B> is sent.
|
||||
Correct values are, e.g., 10, 20, 40, 60, 80, 100, 200.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>f4</B>:
|
||||
<A NAME="mcf4"></A> Mouse enable</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
The stream mode mouse data reporting is disabled after a reset and after
|
||||
the
|
||||
<A HREF="#mcf5">disable</A> command. This command enables it again.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>f5</B>:
|
||||
<A NAME="mcf5"></A> Mouse disable</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
This stops mouse data reporting in
|
||||
<A HREF="#mousemodes">stream mode</A>.
|
||||
In stream mode, this command should be sent before sending any other commands.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>f6</B>:
|
||||
<A NAME="mcf6"></A> Set defaults</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
If this command is recognized, a reset is done (set sampling rate 100 Hz,
|
||||
resolution 4 counts/mm,
|
||||
<A HREF="#mousemodes">stream mode</A>,
|
||||
disabled, scaling 1:1), but no diagnostics are performed.
|
||||
For some enhanced mice that require a magic sequence to get into
|
||||
enhanced mode, this command will reset them to default PS/2 mode.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>fe</B>: Resend</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
If this command is recognized, the last mouse packet (possibly several bytes)
|
||||
is resent. There is no ACK to this command, but if the last reply was ACK,
|
||||
it is sent.
|
||||
</BLOCKQUOTE>
|
||||
<P><I>Command <B>ff</B>:
|
||||
<A NAME="mcff"></A> Mouse reset</I>
|
||||
<P>
|
||||
<BLOCKQUOTE>
|
||||
A self-test is performed. When OK, the response is <B>aa</B> <B>00</B>.
|
||||
On error, the response is <B>fc</B> <B>00</B>.
|
||||
The mouse is reset to default PS/2 mode.
|
||||
</BLOCKQUOTE>
|
||||
<P>
|
||||
<H2><A NAME="sliced"></A> <A NAME="ss12.5">12.5 Sliced parameters</A>
|
||||
</H2>
|
||||
|
||||
<P>For more advanced mouse modes it is necessary to send data to the mouse.
|
||||
There is now a commonly accepted way.
|
||||
<P>First Logitech tried to use the <B>d1</B> command followed by an
|
||||
arbitrary data sequence.
|
||||
While the IBM specs reserve <B>d1</B>-<B>df</B> for vendor unique commands,
|
||||
it turns out that not all BIOSes will transmit such codes.
|
||||
So Logitech drops the <B>d1</B> and uses the sequence
|
||||
<B>e8</B> <I>aa</I> <B>e8</B> <I>bb</I> <B>e8</B> <I>cc</I>
|
||||
<B>e8</B> <I>dd</I> to transmit the byte <I>aabbccdd</I>, where
|
||||
<I>aa</I>, <I>bb</I>, <I>cc</I>, <I>dd</I> are 2-bit quantities.
|
||||
In this way an arbitrarily long sequence of bytes can be transmitted.
|
||||
<P>For synchronization purposes it is possible to separate such groups
|
||||
of four <B>e8</B> commands by an <B>e6</B> command.
|
||||
Indeed, such separation may be required: Synaptics Touchpads react to
|
||||
<B>e9</B> or <B>f3</B> commands preceded by precisely four
|
||||
<B>e8</B> commands.
|
||||
<P>
|
||||
<H3>Magic knock</H3>
|
||||
|
||||
<P>For example, the "magic knock" <B>d1</B> <B>39</B> <B>db</B>
|
||||
that sets a device that understands it in PS/2++ mode,
|
||||
becomes <B>e8</B> <B>00</B> <B>e8</B> <B>03</B>
|
||||
<B>e8</B> <B>02</B> <B>e8</B> <B>01</B> <B>e6</B>
|
||||
<B>e8</B> <B>03</B> <B>e8</B> <B>01</B>
|
||||
<B>e8</B> <B>02</B> <B>e8</B> <B>03</B>,
|
||||
abbreviated {E8}0321 {E6} {E8}3123.
|
||||
Note that 0321 and 3123 do not have repeated symbols. If they had,
|
||||
too intelligent intermediate hardware transmitting these sequences
|
||||
might see a superfluous command and suppress it.
|
||||
<P>
|
||||
<H3>Magic unknock</H3>
|
||||
|
||||
<P>PS/2++ mode is cleared again by the "magic unknock"
|
||||
{E8} 0323 or D1 3B from an external device, and
|
||||
{E8} 0321 or D1 39 from an internal device.
|
||||
(These commands differ so that in setups where the same commands are
|
||||
sent to internal and external devices, they can be commanded separately.)
|
||||
<P>For a decription of the PS/2++ format, see
|
||||
<A HREF="http://www.dqcs.com/logitech/ps2ppspec.htm">ps2ppspec.htm</A>.
|
||||
<P>
|
||||
<H2><A NAME="synaptics"></A> <A NAME="ss12.6">12.6 Synaptics Touchpad</A>
|
||||
</H2>
|
||||
|
||||
<P>A few sketchy details. For nice precise information, get
|
||||
the
|
||||
<A HREF="http://www.synaptics.com/decaf/utilities/ACF126.pdf">Synaptics interfacing guide</A>.
|
||||
<P>
|
||||
<H3>Status request</H3>
|
||||
|
||||
<P>When preceded by an 8-bit request number encoded via four
|
||||
<B>
|
||||
<A HREF="#mce8">e8</A></B>
|
||||
commands, the <B>
|
||||
<A HREF="#mce9">e9</A></B> status request
|
||||
returns modified output, somewhat dependent on the Touchpad model.
|
||||
<P>
|
||||
<P><I>Request <B>00</B>: Identify Touchpad</I>
|
||||
<P>This request returns three bytes, of which the middle one
|
||||
is the constant <B>47</B>. This is the way to recognize
|
||||
a Touchpad. The low order four bits of the third word contain
|
||||
the major model version number, the first word contains the
|
||||
minor version number, and the high order four bits of the
|
||||
third word contain the (obsolete) model code.
|
||||
<P>
|
||||
<P><I>Request <B>01</B>: Read Touchpad Modes</I>
|
||||
<P>This request returns three bytes, of which the first two
|
||||
are the constants <B>3b</B> and <B>47</B>.
|
||||
The last byte is the mode byte
|
||||
<P>
|
||||
<CENTER><TABLE BORDER><TR><TD>
|
||||
ABS </TD><TD> Rate </TD><TD> - </TD><TD> - </TD><TD> Baud/Sleep </TD><TD> DisGest </TD><TD> PackSize </TD><TD> Wmode </TD></TR><TR><TD>
|
||||
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P>Here ABS indicates <I>absolute mode</I> (instead of the default
|
||||
relative mode).
|
||||
<P>Rate is 0 for 40 packets/sec, 1 for 80 packets/sec.
|
||||
The PS/2 sampling rate value is ignored.
|
||||
<P>Baud/Sleep indicates the baud rate when used with a serial protocol
|
||||
(0: 1200 baud, 1: 9600 baud). It must be set whenever ABS or Rate is set.
|
||||
When used with the PS/2 protocol this bit indicates <I>sleep mode</I> -
|
||||
a low power mode in which finger activity is ignored and only button
|
||||
presses are reported.
|
||||
<P>DisGest is the "disable gestures" bit. When set, we have classical
|
||||
mouse behaviour. When cleared, "tap" and "drag" processing is enabled.
|
||||
<P>PackSize is used for the serial protocol only (and then chooses between
|
||||
6-, 7- and 8-byte packets, also depending on the Wmode bit).
|
||||
<P>Wmode is used in absolute mode only. When set the packets also
|
||||
contain the W value. (This value indicates the amount of contact:
|
||||
0: two-finger contact, 1: three-finger contact, 2: pen contact,
|
||||
3: reserved, 4-7: ordinary finger contact, 8-15: wide finger or palm contact.)
|
||||
<P>This described Touchpad 4.x. Earlier models had up to four mode bytes.
|
||||
This request would return mode bytes 1 and 2 in the first and last result byte,
|
||||
and request <B>02</B> would return mode bytes 3 and 4.
|
||||
<P>
|
||||
<P><I>Request <B>02</B>: Read Capabilities</I>
|
||||
<P>This request returns three bytes, of which the middle one is
|
||||
the constant <B>47</B>. The first and third byte are the high-order
|
||||
and low-order parts of the capability word.
|
||||
(Thus on Touchpad 4.x. On earlier models mode bytes 3 and 4 are returned.)
|
||||
<P>This capability word has 16 bits. Bit 15 indicates that capabilities
|
||||
are supported. Bit 4 indicates that Sleep is supported (for the PS/2
|
||||
protocol). Bit 3 indicates that four buttons (Left, Right, Up, Down)
|
||||
are supported. Bit 1 indicates that multi-finger detection is supported.
|
||||
Bit 0 indicates that palm detection is supported.
|
||||
<P>
|
||||
<P><I>Request <B>03</B>: Read Model ID</I>
|
||||
<P>
|
||||
<P><I>Request <B>06</B>: Read Serial Number Prefix</I>
|
||||
<P>
|
||||
<P><I>Request <B>07</B>: Read Serial Number Suffix</I>
|
||||
<P>
|
||||
<P><I>Request <B>08</B>: Read Resolution</I>
|
||||
<P>
|
||||
<P>
|
||||
<H3>Mode setting</H3>
|
||||
|
||||
<P>When preceded by an 8-bit request number encoded via four <B>e8</B>
|
||||
commands, the <B>
|
||||
<A HREF="#mcf3">f3</A></B> <B>14</B>
|
||||
(set sample rate 20) command sets the mode byte to the
|
||||
encoded number. (Thus on Touchpads 4.x. Older models have more mode
|
||||
bytes and several such commands.)
|
||||
<P>
|
||||
<P>
|
||||
<H2><A NAME="ss12.7">12.7 Vendor extensions</A>
|
||||
</H2>
|
||||
|
||||
<P>There is a complicated forest of "magic sequences" that enable
|
||||
vendor extensions. Recognizing all of these is a very obscure activity.
|
||||
<P>(Moreover, recognizing these may be counterproductive:
|
||||
if the mouse has special capabilities which are activated
|
||||
by a special sequence, and it is connected to the computer
|
||||
via a KVM switch that does not know about this special protocol,
|
||||
then switching away and back will leave the mouse in the non-special
|
||||
state. This leads to non-functioning mice.)
|
||||
<P>A 2002 Logitech file describes the following procedure for recognizing
|
||||
the mouse type:
|
||||
<P>Stage 1: Send <B>ff</B>: reset.
|
||||
The reply is ignored. (Most common is <B>aa</B> <B>00</B>.)
|
||||
<P>Stage 2: Send <B>f3</B> <B>0a</B> <B>f2</B>: set sample rate
|
||||
and ask for ID. If the reply is <B>02</B>, we have a trackball -
|
||||
it has its own protocol. (The usual reply is <B>00</B>.)
|
||||
<P>Stage 3: Send <B>e8</B> <B>00</B> <B>e6</B> <B>e6</B> <B>e6</B>
|
||||
<B>e9</B>: set resolution and scaling (three times), and request status.
|
||||
The reply consists of three bytes <I>s1</I> <I>s2</I> <I>s3</I>.
|
||||
An old-fashioned mouse would report 0 in the second status byte <I>s2</I>
|
||||
(since that is the resolution and we just set it).
|
||||
<P>If <I>s2</I> is nonzero then: <I>s2</I> is the number of buttons,
|
||||
<I>s3</I> is the firmware revision,
|
||||
<I>s1</I> has the firmware ID (device type) bits 6-0 in bits 3-0,6-4,
|
||||
while bit 7 of s1 indicates support for the
|
||||
<B>e7</B> <B>e7</B> <B>e7</B> <B>e9</B> command.
|
||||
<P>If <I>s1</I>=<B>d0</B> and <I>s2</I>=<B>03</B> and
|
||||
<I>s3</I>=<B>c8</B>, suspect Synaptics.
|
||||
<P>If <I>s1</I> and <I>s2</I> are zero but <I>s3</I> equals <B>0a</B>,
|
||||
suspect Alps. (<I>s3</I>=<B>0a</B> is as expected, but <I>s1</I>=0
|
||||
is not)
|
||||
<P>Stage 4: If bit 7 of <I>s1</I> is set, or if we suspect Alps,
|
||||
send <B>e8</B> <B>00</B> <B>e7</B> <B>e7</B> <B>e7</B> <B>e9</B>:
|
||||
set resolution and scaling (three times), and request status.
|
||||
The reply consists of three bytes <I>t1</I> <I>t2</I> <I>t3</I>.
|
||||
Of course, we already know that this is not an old-fashioned mouse.
|
||||
<P>If <I>t2</I>=<B>01</B> and FirmwareID < 0x10 and
|
||||
<I>t1</I> >> 6 = 1, then conclude that we have a
|
||||
Cordless MouseMan (RA12).
|
||||
<P>If <I>t2</I>=<B>01</B> and FirmwareID < 0x10 and
|
||||
<I>t1</I> >> 6 = 3, then conclude that we have a
|
||||
Cordless MouseMan (RB24).
|
||||
<P>Other cases with <I>t2</I>=<B>01</B> are for new cordless mice.
|
||||
<P>If we suspect Synaptics and <I>t2</I>=0 and <I>t3</I>=<B>0a</B>,
|
||||
then conclude that we have a Synaptics touchpad.
|
||||
<P>If we suspect Alps and <I>t1</I>=<B>33</B>, then conclude that
|
||||
we have an Alps touchpad.
|
||||
<P>Stage 5: If we don't know the type yet, send <B>f3</B> <B>c8</B>
|
||||
<B>f3</B> <B>64</B> <B>f3</B> <B>50</B> <B>f2</B>:
|
||||
Set sampling rate to 200, 100, 80 Hz, and ask for ID.
|
||||
The reply is a single byte.
|
||||
If we get 3, conclude that we have an IntelliMouse.
|
||||
(And this sequence is the initialization sequence for the IntelliMouse.)
|
||||
<P>Stage 6: Send <B>ff</B>: reset. Now the device is no longer in any
|
||||
special state.
|
||||
<P>Stage 7: If we don't know the type yet, send <B>e8</B> <B>00</B>
|
||||
<B>e8</B> <B>00</B> <B>e8</B> <B>00</B> <B>e8</B> <B>00</B>
|
||||
<B>e9</B>: set resolution to 0 (four times), and ask for status.
|
||||
The reply consists of three bytes <I>u1</I> <I>u2</I> <I>u3</I>.
|
||||
If <I>u2</I>=<B>47</B> and <I>u3</I>=<B>13</B>, then conclude
|
||||
that we have a new Synaptics touchpad.
|
||||
<P>Stage 7a: At this point we can narrow down to model type.
|
||||
If the thing is Synaptics or Alps, then Logitech is no longer interested.
|
||||
If it has 3 buttons, FirmwareID 1 and firmware revision <B>50</B>,
|
||||
then conclude that it is a Logitech Mouseman.
|
||||
<P>Stage 8: If we think it is a touchpad, detect whether it has programmable RAM.
|
||||
Send <B>e6</B> <B>e8</B> <B>00</B> <B>e8</B> <B>00</B> <B>e8</B>
|
||||
<B>00</B> <B>e8</B> <B>00</B> <B>e9</B>. The reply consists of three
|
||||
bytes <I>v1</I> <I>v2</I> <I>v3</I>.
|
||||
If <I>v1</I>=<B>06</B> and <I>v2</I>=<B>00</B>, then conclude
|
||||
that we have a Touchpad TP3 with programmable RAM.
|
||||
<P>Stage 9: Test whether the device understands the Logitech PS/2++ protocol.
|
||||
Send the "magic knock" <B>f5</B> <B>e8</B> <B>00</B> <B>e8</B>
|
||||
<B>03</B> <B>e8</B> <B>02</B> <B>e8</B> <B>01</B> <B>e6</B>
|
||||
<B>e8</B> <B>03</B> <B>e8</B> <B>01</B> <B>e8</B> <B>02</B>
|
||||
<B>e8</B> <B>03</B> <B>f4</B>.
|
||||
Check whether the device replies with an extended report.
|
||||
<P>
|
||||
<HR>
|
||||
<A HREF="scancodes-13.html">Next</A>
|
||||
<A HREF="scancodes-11.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc12">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
79
specs/kbd/scancodes-13.html
Normal file
@@ -0,0 +1,79 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
||||
<TITLE>Keyboard scancodes: USB</TITLE>
|
||||
<LINK HREF="scancodes-14.html" REL=next>
|
||||
<LINK HREF="scancodes-12.html" REL=previous>
|
||||
<LINK HREF="scancodes.html#toc13" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="scancodes-14.html">Next</A>
|
||||
<A HREF="scancodes-12.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc13">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s13">13. USB</A></H2>
|
||||
|
||||
<P>The USB specification prescribes 16-bit keycodes for keyboard positions,
|
||||
identified with key captions for the usual US layout.
|
||||
Below the values are given in decimal. 0-3 are protocol values,
|
||||
namely NoEvent, ErrorRollOver, POSTFail, ErrorUndefined, respectively.
|
||||
The values 224-231 are for modifier keys.
|
||||
<P>
|
||||
<P>
|
||||
<CENTER><TABLE BORDER><TR><TD>
|
||||
</TD><TD> 1 </TD><TD> 2 </TD><TD> 3 </TD><TD> 4 </TD><TD> 5 </TD><TD> 6 </TD><TD> 7 </TD><TD> 8 </TD><TD> 9 </TD><TD> 10 </TD><TD> 11 </TD></TR><TR><TD>
|
||||
- </TD><TD> err </TD><TD> err </TD><TD> err </TD><TD> A </TD><TD> B </TD><TD> C </TD><TD> D </TD><TD> E </TD><TD> F </TD><TD> G </TD><TD> H </TD></TR><TR><TD>
|
||||
</TD></TR><TR><TD>
|
||||
12 </TD><TD> 13 </TD><TD> 14 </TD><TD> 15 </TD><TD> 16 </TD><TD> 17 </TD><TD> 18 </TD><TD> 19 </TD><TD> 20 </TD><TD> 21 </TD><TD> 22 </TD><TD> 23 </TD></TR><TR><TD>
|
||||
I </TD><TD> J </TD><TD> K </TD><TD> L </TD><TD> M </TD><TD> N </TD><TD> O </TD><TD> P </TD><TD> Q </TD><TD> R </TD><TD> S </TD><TD> T </TD></TR><TR><TD>
|
||||
</TD></TR><TR><TD>
|
||||
24 </TD><TD> 25 </TD><TD> 26 </TD><TD> 27 </TD><TD> 28 </TD><TD> 29 </TD><TD> 30 </TD><TD> 31 </TD><TD> 32 </TD><TD> 33 </TD><TD> 34 </TD><TD> 35 </TD></TR><TR><TD>
|
||||
U </TD><TD> V </TD><TD> W </TD><TD> X </TD><TD> Y </TD><TD> Z </TD><TD> 1 </TD><TD> 2 </TD><TD> 3 </TD><TD> 4 </TD><TD> 5 </TD><TD> 6 </TD></TR><TR><TD>
|
||||
</TD></TR><TR><TD>
|
||||
36 </TD><TD> 37 </TD><TD> 38 </TD><TD> 39 </TD><TD> 40 </TD><TD> 41 </TD><TD> 42 </TD><TD> 43 </TD><TD> 44 </TD><TD> 45 </TD><TD> 46 </TD><TD> 47 </TD></TR><TR><TD>
|
||||
7 </TD><TD> 8 </TD><TD> 9 </TD><TD> 0 </TD><TD> Enter </TD><TD> Esc </TD><TD> BSp </TD><TD> Tab </TD><TD> Space </TD><TD> - / _ </TD><TD> = / + </TD><TD> [ / { </TD></TR><TR><TD>
|
||||
</TD></TR><TR><TD>
|
||||
48 </TD><TD> 49 </TD><TD> 50 </TD><TD> 51 </TD><TD> 52 </TD><TD> 53 </TD><TD>54 </TD><TD> 55 </TD><TD> 56 </TD><TD> 57 </TD><TD> 58 </TD><TD> 59 </TD></TR><TR><TD>
|
||||
] / } </TD><TD> \ / | </TD><TD> ... </TD><TD> ; / : </TD><TD> ' / " </TD><TD> ` / ~ </TD><TD>, / < </TD><TD> . / > </TD><TD> / / ? </TD><TD> Caps Lock </TD><TD> F1 </TD><TD> F2 </TD></TR><TR><TD>
|
||||
</TD></TR><TR><TD>
|
||||
60 </TD><TD> 61 </TD><TD> 62 </TD><TD> 63 </TD><TD> 64 </TD><TD> 65 </TD><TD> 66 </TD><TD> 67 </TD><TD> 68 </TD><TD> 69 </TD><TD> 70 </TD><TD> 71 </TD></TR><TR><TD>
|
||||
F3 </TD><TD> F4 </TD><TD> F5 </TD><TD> F6 </TD><TD> F7 </TD><TD> F8 </TD><TD> F9 </TD><TD> F10 </TD><TD> F11 </TD><TD> F12 </TD><TD> PrtScr </TD><TD> Scroll Lock </TD></TR><TR><TD>
|
||||
</TD></TR><TR><TD>
|
||||
72 </TD><TD> 73 </TD><TD> 74 </TD><TD> 75 </TD><TD> 76 </TD><TD> 77 </TD><TD>78 </TD><TD> 79 </TD><TD> 80 </TD><TD> 81 </TD><TD> 82 </TD><TD> 83 </TD></TR><TR><TD>
|
||||
Pause </TD><TD> Insert </TD><TD> Home </TD><TD> PgUp </TD><TD> Delete </TD><TD> End </TD><TD>PgDn </TD><TD> Right </TD><TD> Left </TD><TD> Down </TD><TD> Up </TD><TD> Num Lock </TD></TR><TR><TD>
|
||||
</TD></TR><TR><TD>
|
||||
84 </TD><TD> 85 </TD><TD> 86 </TD><TD> 87 </TD><TD> 88 </TD><TD> 89 </TD><TD>90 </TD><TD> 91 </TD><TD> 92 </TD><TD> 93 </TD><TD> 94 </TD><TD> 95 </TD></TR><TR><TD>
|
||||
KP / </TD><TD> KP * </TD><TD> KP - </TD><TD> KP + </TD><TD> KP Enter </TD><TD> KP 1 / End </TD><TD>KP 2 / Down </TD><TD> KP 3 / PgDn </TD><TD> KP 4 / Left </TD><TD> KP 5 </TD><TD> KP 6 / Right </TD><TD> KP 7 / Home </TD></TR><TR><TD>
|
||||
</TD></TR><TR><TD>
|
||||
96 </TD><TD> 97 </TD><TD> 98 </TD><TD> 99 </TD><TD> 100 </TD><TD> 101 </TD><TD>102 </TD><TD> 103 </TD><TD> 104 </TD><TD> 105 </TD><TD> 106 </TD><TD> 107 </TD></TR><TR><TD>
|
||||
KP 8 / Up </TD><TD> KP 9 / PgUp </TD><TD> KP 0 / Ins </TD><TD> KP . / Del </TD><TD> ... </TD><TD> Applic </TD><TD>Power </TD><TD> KP = </TD><TD> F13 </TD><TD> F14 </TD><TD> F15 </TD><TD> F16 </TD></TR><TR><TD>
|
||||
</TD></TR><TR><TD>
|
||||
108 </TD><TD> 109 </TD><TD> 110 </TD><TD> 111 </TD><TD> 112 </TD><TD> 113 </TD><TD> 114 </TD><TD> 115 </TD><TD> 116 </TD><TD> 117 </TD><TD> 118 </TD><TD> 119 </TD></TR><TR><TD>
|
||||
F17 </TD><TD> F18 </TD><TD> F19 </TD><TD> F20 </TD><TD> F21 </TD><TD> F22 </TD><TD> F23 </TD><TD> F24 </TD><TD> Execute </TD><TD> Help </TD><TD> Menu </TD><TD> Select </TD></TR><TR><TD>
|
||||
</TD></TR><TR><TD>
|
||||
120 </TD><TD> 121 </TD><TD> 122 </TD><TD> 123 </TD><TD> 124 </TD><TD> 125 </TD><TD>126 </TD><TD> 127 </TD><TD> 128 </TD><TD> 129 </TD><TD> 130 </TD><TD> 131 </TD></TR><TR><TD>
|
||||
Stop </TD><TD> Again </TD><TD> Undo </TD><TD> Cut </TD><TD> Copy </TD><TD> Paste </TD><TD>Find </TD><TD> Mute </TD><TD> Volume Up </TD><TD> Volume Down </TD><TD> Locking Caps Lock </TD><TD> Locking Num Lock </TD></TR><TR><TD>
|
||||
</TD></TR><TR><TD>
|
||||
132 </TD><TD> 133 </TD><TD> 134 </TD><TD> 135 </TD><TD> 136 </TD><TD> 137 </TD><TD>138 </TD><TD> 139 </TD><TD> 140 </TD><TD> 141 </TD><TD> 142 </TD><TD> 143 </TD></TR><TR><TD>
|
||||
Locking Scroll Lock </TD><TD> KP , </TD><TD> KP = </TD><TD> Internat </TD><TD> Internat </TD><TD> Internat </TD><TD>Internat </TD><TD> Internat </TD><TD> Internat </TD><TD> Internat </TD><TD> Internat </TD><TD> Internat </TD></TR><TR><TD>
|
||||
</TD></TR><TR><TD>
|
||||
144 </TD><TD> 145 </TD><TD> 146 </TD><TD> 147 </TD><TD> 148 </TD><TD> 149 </TD><TD> 150 </TD><TD> 151 </TD><TD> 152 </TD><TD> 153 </TD><TD> 154 </TD><TD> 155 </TD></TR><TR><TD>
|
||||
LANG </TD><TD> LANG </TD><TD> LANG </TD><TD> LANG </TD><TD> LANG </TD><TD> LANG </TD><TD> LANG </TD><TD> LANG </TD><TD> LANG </TD><TD> Alt Erase </TD><TD> SysRq </TD><TD> Cancel </TD></TR><TR><TD>
|
||||
</TD></TR><TR><TD>
|
||||
156 </TD><TD> 157 </TD><TD> 158 </TD><TD> 159 </TD><TD> 160 </TD><TD> 161 </TD><TD> 162 </TD><TD> 163 </TD><TD> 164 </TD><TD>165</TD><TD>166</TD><TD>167 </TD></TR><TR><TD>
|
||||
Clear </TD><TD> Prior </TD><TD> Return </TD><TD> Separ </TD><TD> Out </TD><TD> Oper </TD><TD> Clear / Again </TD><TD> CrSel / Props </TD><TD> ExSel </TD><TD> </TD><TD> </TD></TR><TR><TD>
|
||||
</TD></TR><TR><TD>
|
||||
</TD></TR><TR><TD>
|
||||
224 </TD><TD> 225 </TD><TD> 226 </TD><TD> 227 </TD><TD> 228 </TD><TD> 229 </TD><TD> 230 </TD><TD> 231 </TD></TR><TR><TD>
|
||||
LCtrl </TD><TD> LShift </TD><TD> LAlt </TD><TD> LGUI </TD><TD> RCtrl </TD><TD> RShift </TD><TD> RAlt </TD><TD> RGUI </TD></TR><TR><TD>
|
||||
</TD></TR><TR><TD>
|
||||
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P>
|
||||
<HR>
|
||||
<A HREF="scancodes-14.html">Next</A>
|
||||
<A HREF="scancodes-12.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc13">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
26
specs/kbd/scancodes-14.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
||||
<TITLE>Keyboard scancodes: Reporting</TITLE>
|
||||
<LINK HREF="scancodes-13.html" REL=previous>
|
||||
<LINK HREF="scancodes.html#toc14" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
Next
|
||||
<A HREF="scancodes-13.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc14">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s14">14. Reporting</A></H2>
|
||||
|
||||
<P>Additions and corrections are welcome.
|
||||
Use <CODE>showkey -s</CODE> to get the scancodes.
|
||||
Mention keyboard manufacturer and type, and the keycaps.
|
||||
<P>Andries Brouwer - <CODE>aeb@cwi.nl</CODE>
|
||||
<P>
|
||||
<HR>
|
||||
Next
|
||||
<A HREF="scancodes-13.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc14">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
182
specs/kbd/scancodes-2.html
Normal file
@@ -0,0 +1,182 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
||||
<TITLE>Keyboard scancodes: Special keyboards - XT keyboards</TITLE>
|
||||
<LINK HREF="scancodes-3.html" REL=next>
|
||||
<LINK HREF="scancodes-1.html" REL=previous>
|
||||
<LINK HREF="scancodes.html#toc2" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="scancodes-3.html">Next</A>
|
||||
<A HREF="scancodes-1.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc2">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s2">2. Special keyboards - XT keyboards</A></H2>
|
||||
|
||||
<P><I>First keyboards with an XT interface.
|
||||
There is no keyboard controller, no commands to the keyboard.
|
||||
On a modern computer these will usually yield "keyboard error"
|
||||
or "KB/interface error" or some such, but sometimes they can be
|
||||
used nevertheless.</I>
|
||||
<P>The IBM PC (all models) and the IBM XT (models 68, 78, 86, 87, 88,
|
||||
267, 277) came with this 83-key keyboard.
|
||||
The IBM AT (models 68, 99, 239, 319) came with an 84-key keyboard.
|
||||
The IBM XT (models 89, 268, 278, 286) and the IBM AT model 339
|
||||
came with a 101-key keyboard.
|
||||
<P>The original IBM 83-key PC/XT keyboard did not have LEDs.
|
||||
The original IBM 84-key AT keyboard has LEDs, separates the
|
||||
keypad from the main area, moves the Esc key to the right,
|
||||
and adds the SysReq key.
|
||||
The original IBM 101-key keyboard moves the ten function keys
|
||||
from the left to the top row and adds two more. The Esc key is moved
|
||||
in front of this row of function keys. The "number" and "cursor"
|
||||
functions of the keypad are separated. There are duplicate Ctrl and Alt
|
||||
keys.
|
||||
<P>
|
||||
<H2><A NAME="ss2.1">2.1 XT keyboard</A>
|
||||
</H2>
|
||||
|
||||
<P>The
|
||||
<A HREF="xtkbd.jpg">XT keyboard</A>
|
||||
has 83 keys, nicely numbered 1-83, that is, with scancodes
|
||||
<B>01</B>-<B>53</B>. No escaped scancodes.
|
||||
<P>
|
||||
<FIGURE>
|
||||
<EPS FILE="absent">
|
||||
<IMG SRC="xtkbd-s.jpg">
|
||||
</FIGURE>
|
||||
<P>
|
||||
<H2><A NAME="ss2.2">2.2 Victor keyboard</A>
|
||||
</H2>
|
||||
|
||||
<P>This
|
||||
<A HREF="victor.jpg">Victor keyboard</A>
|
||||
is very similar. The keypad is separated here, and the Esc key
|
||||
has been moved to the keypad. The frontside of the ScrollLock key
|
||||
says Break. It resembles an AT keyboard but has only 83 keys,
|
||||
the SysRq is still missing.
|
||||
<P>
|
||||
<FIGURE>
|
||||
<EPS FILE="absent">
|
||||
<IMG SRC="victor-s.jpg">
|
||||
</FIGURE>
|
||||
<P>
|
||||
<H2><A NAME="ss2.3">2.3 Olivetti M24 keyboard</A>
|
||||
</H2>
|
||||
|
||||
<P>
|
||||
<FIGURE>
|
||||
<EPS FILE="absent">
|
||||
<IMG SRC="m24.jpg">
|
||||
</FIGURE>
|
||||
|
||||
The Olivetti M24 (also sold under the names Logabax 1600 and
|
||||
ATT PC-6300) was an IBM compatible manufactured in 1984.
|
||||
<P>John Elliott writes:
|
||||
The Olivetti M24 is an XT sort-of clone. It
|
||||
has two possible keyboards - the normal (83-key) IBM one,
|
||||
and a "deluxe" one (102 keys) with 18 function keys.
|
||||
<P>Unlike a normal XT keyboard, it is possible to send commands to it.
|
||||
The BIOS does this twice:
|
||||
(1) Command 01h makes the keyboard perform a self-test.
|
||||
(2) Command 05h makes the keyboard return a 1-byte ID. The least signficant
|
||||
bit is set for a "deluxe" layout.
|
||||
<P>The keyboard connector is DE-9 rather than DIN. Pins are:
|
||||
<PRE>
|
||||
1 KBDATA
|
||||
2 KBCLOCK
|
||||
3 GND
|
||||
4 GND
|
||||
5 +12V
|
||||
6 -RESET1
|
||||
7 Keyboard/-Typewriter
|
||||
8 TEST0
|
||||
9 +5V
|
||||
</PRE>
|
||||
|
||||
(pins 6-9 are not used by the supplied keyboards).
|
||||
<P>Attached
|
||||
<A HREF="m24kbd.png">the diagram</A>
|
||||
of the 'deluxe' keyboard, which shows its scancodes in decimal.
|
||||
<P>A mouse can be attached to the keyboard. The following is based
|
||||
on disassembling attmouse.drv from Windows 1.0.
|
||||
<P>Windows initialises the mouse by sending the following bytes to the
|
||||
keyboard: 0x12, 0x77, 0x78, 0x79, 0x00.
|
||||
The 0x12 is almost certainly a command byte; 0x77, 0x78 and 0x79 are the
|
||||
scancodes to be returned by the three mouse buttons. I don't know what the
|
||||
0x00 is for.
|
||||
<P>It then handles the following scancodes:
|
||||
0xFE -- mouse movement. The next two scancodes are delta X, then delta Y,
|
||||
in ones' complement.
|
||||
0x77, 0x78, 0x79 (and 0xF7, 0xF8, 0xF9) -- button presses / releases.
|
||||
<P>When shutting down the mouse, it sends these bytes to the keyboard:
|
||||
0x11, 0x1C, 0x53, 0x01, 0x4B, 0x4D, 0x48, 0x50, 0x02, 0x04.
|
||||
My guesses here are:
|
||||
0x11: Mouse movement becomes simulated keypresses.
|
||||
0x1C, 0x53, 0x01: Scancodes to be returned by mouse button presses.
|
||||
0x4B, 0x4D, 0x48, 0x50: Scancodes to be returned by mouse movement.
|
||||
0x02, 0x04: Don't know.
|
||||
<P>
|
||||
<H2><A NAME="telerate"></A> <A NAME="ss2.4">2.4 Telerate keyboard</A>
|
||||
</H2>
|
||||
|
||||
<P>The
|
||||
<A HREF="telerate.jpg">Telerate keyboard</A> was used
|
||||
for financial applications, as is clear from the keycaps.
|
||||
This keyboard (in the old XT version, without <B>e0</B> prefixes)
|
||||
has four additional keys, with scancodes <B>61</B>,
|
||||
<B>62</B>, <B>63</B>, <B>64</B>. The F11 and F12 keys have
|
||||
scancodes <B>54</B> and <B>55</B> (instead of the common <B>57</B>
|
||||
and <B>58</B>). There are two LEDs (for CapsLock and NumLock).
|
||||
<P>
|
||||
<FIGURE>
|
||||
<EPS FILE="absent">
|
||||
<IMG SRC="telerate-s.jpg">
|
||||
</FIGURE>
|
||||
<P>
|
||||
<H2><A NAME="ss2.5">2.5 NCR keyboard</A>
|
||||
</H2>
|
||||
|
||||
<P>Also with an XT interface this
|
||||
<A HREF="ncr.jpg">NCR keyboard</A>,
|
||||
still with ten function keys on the left, but already with a separate
|
||||
block of keys between the ordinary keys and the numeric keypad.
|
||||
This middle block has on top five keys
|
||||
Ctrl (<B>1d</B>, same as the Ctrl on the left),
|
||||
Del (<B>53</B>, same as Keypad-Del/.),
|
||||
PgUp (<B>49</B>, same as Keypad-9/PgUp),
|
||||
End (<B>4f</B>, same as Keypad-1/End),
|
||||
PgDn (<B>51</B>, same as Keypad-3/PgDn), and below five cursor keys
|
||||
(<B>48</B>, same as Keypad-8/Up;
|
||||
<B>4b</B>, same as Keypad-4/Left;
|
||||
<B>47</B>, same as Keypad-7/Home;
|
||||
<B>4d</B>, same as Keypad-6/Right;
|
||||
<B>50</B>, same as Keypad-2/Down).
|
||||
Enter and Keypad-enter are both <B>1c</B>.
|
||||
Below the Enter key PrtScn/* (<B>37</B>), and below that again
|
||||
Ins (<B>52</B>, same as Keypad-0/Ins).
|
||||
CapsLock and NumLock have a built-in LED.
|
||||
<P>
|
||||
<FIGURE>
|
||||
<EPS FILE="absent">
|
||||
<IMG SRC="ncr-s.jpg">
|
||||
</FIGURE>
|
||||
<P>
|
||||
<P>
|
||||
<H2><A NAME="cherry80"></A> <A NAME="ss2.6">2.6 Cherry G80-0777</A>
|
||||
</H2>
|
||||
|
||||
<P>According to
|
||||
<A HREF="http://titan.informatik.uni-bonn.de/~frinke/FreeKEYB/kbdinfo.html">FreeKEYB/kbdinfo.html</A>
|
||||
this keyboard has five additional keys with scancodes
|
||||
<B>55</B> (F11), <B>56</B> (F12),
|
||||
<B>57</B> (F13), <B>58</B> (F14), <B>59</B> (F15).
|
||||
<P>
|
||||
<P>
|
||||
<HR>
|
||||
<A HREF="scancodes-3.html">Next</A>
|
||||
<A HREF="scancodes-1.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc2">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
64
specs/kbd/scancodes-3.html
Normal file
@@ -0,0 +1,64 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
||||
<TITLE>Keyboard scancodes: Special keyboards - Amstrad/Schneider keyboards</TITLE>
|
||||
<LINK HREF="scancodes-4.html" REL=next>
|
||||
<LINK HREF="scancodes-2.html" REL=previous>
|
||||
<LINK HREF="scancodes.html#toc3" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="scancodes-4.html">Next</A>
|
||||
<A HREF="scancodes-2.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc3">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s3">3. Special keyboards - Amstrad/Schneider keyboards</A></H2>
|
||||
|
||||
<P><I>Since IBM had patented their keyboard design,
|
||||
Amstrad developed an entirely different keyboard.</I>
|
||||
<P>
|
||||
<H2><A NAME="ss3.1">3.1 Amstrad/Schneider PC1512</A>
|
||||
</H2>
|
||||
|
||||
<P>The
|
||||
<A HREF="amstrad.jpg">Amstrad keyboard</A>
|
||||
is entirely incompatible with XT and AT keyboards, and can be used only
|
||||
on an Amstrad; conversely, no other keyboard will work on an older Amstrad.
|
||||
This keyboard has a Del key on the keypad, and both Del-> and Del<- keys
|
||||
above the Enter key. The Del-> key has scancode <B>70</B>.
|
||||
Left of the Enter key a PrtSc/* key.
|
||||
There is an additional Enter key with scancode <B>74</B>.
|
||||
It is possible to connect a mouse and/or joystick to the keyboard,
|
||||
and then these devices also yield scancodes:
|
||||
<B>77</B> (joystick button 1), <B>78</B> (joystick button 2),
|
||||
<B>79</B> (joystick right), <B>7a</B> (joystick left),
|
||||
<B>7b</B> (joystick up), <B>7c</B> (joystick down),
|
||||
<B>7d</B> (mouse right), <B>7e</B> (mouse left).
|
||||
<P>
|
||||
<FIGURE>
|
||||
<EPS FILE="absent">
|
||||
<IMG SRC="amstrad-s.jpg">
|
||||
</FIGURE>
|
||||
<P>
|
||||
<H2><A NAME="ss3.2">3.2 Amstrad/Schneider other models</A>
|
||||
</H2>
|
||||
|
||||
<P>John Elliott adds:
|
||||
<P>The above only mentions the PC1512/PC1640 style of keyboard.
|
||||
Later Amstrad XTs (PPC512, PPC640, PC20, PC200, PC2086, PC3086) used a
|
||||
102-key keyboard with the same layout and scancodes as a normal 102-key XT
|
||||
keyboard. This design is not only incompatible with normal XT and AT
|
||||
keyboards, it's also incompatible with the PC1512 keyboard. The joystick
|
||||
socket is no longer present, but mouse button clicks are still handled by
|
||||
the keyboard, with the same scancodes <B>7d</B> (right button) and
|
||||
<B>7e</B> (left button).
|
||||
<P>On the PPC512, PPC640, PC20 and PC200, the keyboard is in the same box as
|
||||
the motherboard, and is connected directly to it by ribbon cable.
|
||||
<P>
|
||||
<P>
|
||||
<HR>
|
||||
<A HREF="scancodes-4.html">Next</A>
|
||||
<A HREF="scancodes-2.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc3">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
41
specs/kbd/scancodes-4.html
Normal file
@@ -0,0 +1,41 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
||||
<TITLE>Keyboard scancodes: Special keyboards - AT keyboards</TITLE>
|
||||
<LINK HREF="scancodes-5.html" REL=next>
|
||||
<LINK HREF="scancodes-3.html" REL=previous>
|
||||
<LINK HREF="scancodes.html#toc4" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="scancodes-5.html">Next</A>
|
||||
<A HREF="scancodes-3.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc4">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s4">4. Special keyboards - AT keyboards</A></H2>
|
||||
|
||||
<P><I>The AT keyboard adds a keyboard controller.
|
||||
The numeric keypad is now separated from the main keyboard.
|
||||
There is a single new key, with scancode 84 = <B>54</B>,
|
||||
namely SysRq.</I>
|
||||
<P>The protocol for AT and later keyboards differs from that for
|
||||
XT keyboards. Some old keyboards have an XT/AT switch on the
|
||||
backside that selects the appropriate protocol.
|
||||
Other keyboard autodetect XT or AT mode.
|
||||
<P>
|
||||
<FIGURE>
|
||||
<EPS FILE="absent">
|
||||
<IMG SRC="xt-at-switch.jpg">
|
||||
</FIGURE>
|
||||
<P>
|
||||
<P>The KeyTronic KB101-1 keyboard has four switches of which the first two
|
||||
indicate the desired behaviour (00 - autodetect, 01 - unused,
|
||||
10 - PC/XT, 11 - AT). Autodetect does not always work.
|
||||
<P>
|
||||
<P>
|
||||
<HR>
|
||||
<A HREF="scancodes-5.html">Next</A>
|
||||
<A HREF="scancodes-3.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc4">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
1411
specs/kbd/scancodes-5.html
Normal file
304
specs/kbd/scancodes-6.html
Normal file
@@ -0,0 +1,304 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
||||
<TITLE>Keyboard scancodes: NCD keyboards</TITLE>
|
||||
<LINK HREF="scancodes-7.html" REL=next>
|
||||
<LINK HREF="scancodes-5.html" REL=previous>
|
||||
<LINK HREF="scancodes.html#toc6" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="scancodes-7.html">Next</A>
|
||||
<A HREF="scancodes-5.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc6">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="NCD"></A> <A NAME="s6">6. NCD keyboards</A></H2>
|
||||
|
||||
<P>Some keyboards natively produce
|
||||
<A HREF="scancodes-9.html#scancodesets">Set 3</A> scancodes.
|
||||
When connected to a PC one will by default see translated Set 3 scancodes.
|
||||
This means that the F9 and F10 keys have make codes <B>60</B> and <B>61</B>
|
||||
and break codes <B>e0</B> and <B>e1</B>. Thus, these latter codes are
|
||||
ordinary key release codes here, not protocol codes.
|
||||
<P>The N-nnn type numbers indicate the number nnn of keys the keyboard has.
|
||||
<P>
|
||||
<H2><A NAME="e0_as_key"></A> <A NAME="ss6.1">6.1 A Japanese keyboard using e0 as ordinary scancode</A>
|
||||
</H2>
|
||||
|
||||
<P>Benjamin Carter <<CODE>bcarter@ultra5.cs.umr.edu</CODE>> reports:
|
||||
<P><I>I recently came into possession of a 97-key keyboard with Japanese
|
||||
markings on the keys. (The keys also have the standard
|
||||
qwerty-characters on them, with the exception of some of the meta-keys
|
||||
(there are 3 keys near the Alt keys on either side of the spacebar with
|
||||
only Japanese characters on them so I don't know what they are).
|
||||
In any case, the keyboard sends out scancodes that work for all the main
|
||||
keys (backspace, letters and numbers, enter, shift), but the numeric
|
||||
keypad, Alt keys, and function keys don't work.
|
||||
I have run the board through <CODE>showkey -s</CODE>, so I know what
|
||||
scancodes this keyboard sends out.
|
||||
However, the F9 and F10 keys send out <B>60</B> and <B>61</B>,
|
||||
respectively, so their key release events send out <B>e0</B>
|
||||
and <B>e1</B>, confusing the keyboard driver.</I>
|
||||
<P>(Compare this with the
|
||||
<A HREF="scancodes-9.html#correspondence">table</A>
|
||||
giving the translated Set 3 scancodes. The reported codes are
|
||||
almost identical.)
|
||||
<P># These are across the top of the keyboard.
|
||||
<P><B>58</B> (F1), <B>59</B> (F2), <B>5a</B> (F3),
|
||||
<B>5b</B> (F4), <B>5c</B> (F5), <B>5d</B> (F6),
|
||||
<B>5e</B> (F7), <B>5f</B> (F8), <B>60</B> (F9),
|
||||
<B>61</B> (F10), <B>62</B> (F11), <B>63</B> (F12)
|
||||
<P>
|
||||
<B>76</B> (Break), <B>77</B> (Setup).
|
||||
<P>
|
||||
# top row
|
||||
<P><B>64</B> (Esc),
|
||||
<B>02</B> (1), <B>03</B> (2), <B>04</B> (3),
|
||||
<B>05</B> (4), <B>06</B> (5), <B>07</B> (6),
|
||||
<B>08</B> (7), <B>09</B> (8), <B>0a</B> (9),
|
||||
<B>0b</B> (0), <B>0c</B> (-), <B>0d</B> (=),
|
||||
<B>29</B> (`), <B>0e</B> (Backspace)
|
||||
<P>
|
||||
<P># 2nd row
|
||||
<P><B>0f</B> (Tab),
|
||||
<B>10</B> (Q), <B>11</B> (W), <B>12</B> (E),
|
||||
<B>13</B> (R), <B>14</B> (T), <B>15</B> (Y),
|
||||
<B>16</B> (U), <B>17</B> (I), <B>18</B> (O),
|
||||
<B>19</B> (P), <B>1a</B> ([), <B>1b</B> (]),
|
||||
<B>79</B> (Del), <B>6e</B> (Line Feed)
|
||||
<P>
|
||||
<P># 3rd row
|
||||
<P><B>38</B> (Ctrl),
|
||||
<B>1e</B> (A), <B>1f</B> (S), <B>20</B> (D),
|
||||
<B>21</B> (F), <B>22</B> (G), <B>23</B> (H),
|
||||
<B>24</B> (J), <B>25</B> (K), <B>26</B> (L),
|
||||
<B>27</B> (;), <B>28</B> ('), <B>75</B> (\),
|
||||
<B>1c</B> (Return)
|
||||
<P>
|
||||
<P># 4th row
|
||||
<P><B>2a</B> (Shift_L),
|
||||
<B>2c</B> (Z), <B>2d</B> (X), <B>2e</B> (C),
|
||||
<B>2f</B> (V), <B>30</B> (B), <B>31</B> (N),
|
||||
<B>32</B> (M), <B>33</B> (,), <B>34</B> (.),
|
||||
<B>35</B> (/),
|
||||
<B>3a</B> ((unknown)),
|
||||
<B>36</B> (Shift_R)
|
||||
<P>
|
||||
<P># bottom row
|
||||
<P><B>1d</B> (Caps Lock), <B>71</B> (Alt_L),
|
||||
<B>01</B> ((unknown)),
|
||||
<B>39</B> (Space),
|
||||
<B>45</B> ((unknown)),
|
||||
<B>72</B> (Alt_R),
|
||||
<B>46</B> ((unknown))
|
||||
<P>
|
||||
<P># numeric keypad. No "grey" section on the keyboard.
|
||||
<P><B>47</B> (7), <B>48</B> (8), <B>49</B> (9),
|
||||
<B>54</B> (Keypad -),
|
||||
<B>4b</B> (4), <B>4c</B> (5), <B>4d</B> (6),
|
||||
<B>37</B> (Keypad +),
|
||||
<B>4f</B> (1), <B>50</B> (2), <B>51</B> (3),
|
||||
<B>4e</B> (Keypad Enter),
|
||||
<B>52</B> (0),
|
||||
<B>78</B> (Up),
|
||||
<B>53</B> (Keypad .),
|
||||
<B>56</B> (Left),
|
||||
<B>55</B> (Down),
|
||||
<B>7d</B> (Right),
|
||||
<B>7e</B> (Keypad ,).
|
||||
<P>
|
||||
<P>
|
||||
<H2><A NAME="ss6.2">6.2 The NCD N-123NA keyboard</A>
|
||||
</H2>
|
||||
|
||||
<P>
|
||||
<FIGURE>
|
||||
<EPS FILE="absent">
|
||||
<IMG SRC="sun-type5.gif">
|
||||
</FIGURE>
|
||||
<P>There are more keyboards that do not use <B>e0</B> as escape code.
|
||||
For example, Paul Schulz <<CODE>pauls@caemrad.com.au</CODE>>
|
||||
reports the same for Sun Type 5 Keyboard with PS/2 connector,
|
||||
NCD model N-123NA. The scancodes are very similar to those given above:
|
||||
<P># Sun Keys (far left)
|
||||
<P><B>44</B> (Help),
|
||||
<B>42</B> (Stop),
|
||||
<B>40</B> (Again),
|
||||
<B>3e</B> (Props),
|
||||
<B>65</B> (Undo),
|
||||
<B>70</B> (Front),
|
||||
<B>66</B> (Copy),
|
||||
<B>67</B> (Open),
|
||||
<B>68</B> (Paste),
|
||||
<B>69</B> (Find),
|
||||
<B>6a</B> (Cut),
|
||||
<P># Top row
|
||||
<P><B>64</B> (ESC),
|
||||
<B>58</B> (F1),
|
||||
<B>59</B> (F2),
|
||||
<B>5a</B> (F3),
|
||||
<B>5b</B> (F4),
|
||||
<B>5c</B> (F5),
|
||||
<B>5d</B> (F6),
|
||||
<B>5e</B> (F7),
|
||||
<B>5f</B> (F8),
|
||||
<B>60</B> (F9),
|
||||
<B>61</B> (F10),
|
||||
<B>62</B> (F11),
|
||||
<B>63</B> (F12),
|
||||
<P># 1st row
|
||||
<P><B>29</B> (~/`),
|
||||
<B>02</B> (!/1),
|
||||
<B>03</B> (@/2),
|
||||
<B>04</B> (#/3),
|
||||
<B>05</B> ($/4),
|
||||
<B>06</B> (%/5),
|
||||
<B>07</B> (^/6),
|
||||
<B>08</B> (&/7),
|
||||
<B>09</B> (*/8),
|
||||
<B>0a</B> ((/9),
|
||||
<B>0b</B> ()/0),
|
||||
<B>0c</B> (_/-),
|
||||
<B>0d</B> (+/=),
|
||||
<B>0e</B> (BS),
|
||||
<P># 2nd row
|
||||
<P><B>0f</B> (TAB),
|
||||
<B>10</B> (Q),
|
||||
<B>11</B> (W),
|
||||
<B>12</B> (E),
|
||||
<B>13</B> (R),
|
||||
<B>14</B> (T),
|
||||
<B>15</B> (Y),
|
||||
<B>16</B> (U),
|
||||
<B>17</B> (I),
|
||||
<B>18</B> (O),
|
||||
<B>19</B> (P),
|
||||
<B>1a</B> ({/[),
|
||||
<B>1b</B> (}/]),
|
||||
<B>75</B> (|/\),
|
||||
<P># 3rd row
|
||||
<P><B>29</B> (CAPS),
|
||||
<B>30</B> (A),
|
||||
<B>31</B> (S),
|
||||
<B>32</B> (D),
|
||||
<B>33</B> (F),
|
||||
<B>34</B> (G),
|
||||
<B>35</B> (H),
|
||||
<B>36</B> (J),
|
||||
<B>37</B> (K),
|
||||
<B>38</B> (L),
|
||||
<B>39</B> (:/;),
|
||||
<B>40</B> ("/'),
|
||||
<B>28</B> (Enter),
|
||||
<P># 4th row
|
||||
<P><B>2a</B> (Shift),
|
||||
<B>2c</B> (Z),
|
||||
<B>2d</B> (X),
|
||||
<B>2e</B> (C),
|
||||
<B>2f</B> (V),
|
||||
<B>30</B> (B),
|
||||
<B>31</B> (N),
|
||||
<B>32</B> (M),
|
||||
<B>33</B> (</,),
|
||||
<B>34</B> (>/.),
|
||||
<B>35</B> (?//),
|
||||
<B>36</B> (Shift),
|
||||
<P># Bottom row
|
||||
<P><B>38</B> (Ctrl),
|
||||
<B>71</B> (Alt),
|
||||
<B>66</B> (Meta),
|
||||
<B>39</B> (Space),
|
||||
<B>6c</B> (Meta),
|
||||
<B>72</B> (Compose),
|
||||
<B>3a</B> (Alt),
|
||||
<P># To the right
|
||||
<P><B>6e</B> (PrintScreen/SysRq),
|
||||
<B>76</B> (ScrollLock),
|
||||
<B>77</B> (Pause/Break),
|
||||
<P><B>76</B> (Insert),
|
||||
<B>7f</B> (Home),
|
||||
<B>6f</B> (PageUp),
|
||||
<P><B>79</B> (Del),
|
||||
<B>7a</B> (End),
|
||||
<B>7e</B> (PageDown),
|
||||
<P><B>80</B> (.),
|
||||
<B>81</B> (.),
|
||||
<B>82</B> (.),
|
||||
<P><B>d4</B> (.),
|
||||
<B>78</B> (Up),
|
||||
<B>41</B> (.),
|
||||
<P><B>56</B> (Left),
|
||||
<B>55</B> (Down),
|
||||
<B>7d</B> (Right),
|
||||
<P># Keypad
|
||||
<P><B>6d</B> (Mute),
|
||||
<B>73</B> (Brightness/Vol Down),
|
||||
<B>74</B> (Brightness/Vol Up),
|
||||
<B>53</B> (Setup),
|
||||
<P><B>01</B> (NumLock),
|
||||
<B>45</B> (/),
|
||||
<B>46</B> (*),
|
||||
<B>54</B> (-),
|
||||
<P><B>47</B> (7/Home),
|
||||
<B>48</B> (8/Up),
|
||||
<B>4d</B> (9/PgUp),
|
||||
<B>37</B> (+),
|
||||
<P><B>4b</B> (4/Left),
|
||||
<B>4c</B> (5),
|
||||
<B>4d</B> (6/Right),
|
||||
<P><B>4f</B> (1/End),
|
||||
<B>50</B> (2/Down),
|
||||
<B>51</B> (3/PgDn),
|
||||
<B>4e</B> (Enter),
|
||||
<P><B>52</B> (0/Ins),
|
||||
<B>53</B> (./Del).
|
||||
<P>
|
||||
<H2><A NAME="ss6.3">6.3 The NCD N-123UX keyboard</A>
|
||||
</H2>
|
||||
|
||||
<P>Don Christensen reports that his NCD N-123UX keyboard
|
||||
returns scancode Set 3.
|
||||
<P>
|
||||
<H2><A NAME="NCD97"></A> <A NAME="ss6.4">6.4 The NCD N-97 keyboard</A>
|
||||
</H2>
|
||||
|
||||
<P>David Monro reports: I have a PS/2 keyboard, an NCD N-97,
|
||||
which shipped with some NCD X terminals and also with some Mips
|
||||
workstations IIRC. This keyboard returns Set 3 keycodes
|
||||
even when its told to be in Set 2. In particular, the release
|
||||
codes for F9 and F10 are <B>e0</B> and <B>e1</B>.
|
||||
The
|
||||
<A HREF="scancodes-9.html#keyboardid">keyboard ID</A> is <B>ab</B> <B>85</B>.
|
||||
<P>
|
||||
<P>
|
||||
<H2><A NAME="ss6.5">6.5 NCD X terminals</A>
|
||||
</H2>
|
||||
|
||||
<P>NCD keyboards are often used with NCD X terminals.
|
||||
Here the key combinations to get into the boot monitor.
|
||||
<P>
|
||||
<P>
|
||||
<CENTER><TABLE BORDER><TR><TD>
|
||||
N-101 </TD><TD> LCtrl-LAlt-Setup </TD></TR><TR><TD>
|
||||
N-102 or Windows compatible </TD><TD> LAlt-CapsLock-Setup </TD></TR><TR><TD>
|
||||
VT220-compatible </TD><TD> Ctrl-Compose-F3 </TD></TR><TR><TD>
|
||||
N-108LK </TD><TD> Ctrl-LAlt-F3 </TD></TR><TR><TD>
|
||||
N-97 </TD><TD> LAlt-CapsLock-Setup </TD></TR><TR><TD>
|
||||
N-97 Kana and Hitachi Kana </TD><TD> LAlt-CapsLock-Setup </TD></TR><TR><TD>
|
||||
N-107 Sun type 4 compatible </TD><TD> Stop A (L1-A) </TD></TR><TR><TD>
|
||||
N-123 Sun type 5 compatible </TD><TD> Stop-A (L1-A) </TD></TR><TR><TD>
|
||||
Nokia 122 </TD><TD> </TD></TR><TR><TD>
|
||||
3270 (122-key Lexmark) </TD><TD> LShift LAlt Setup </TD></TR><TR><TD>
|
||||
</TD><TD> (on the left keypad) </TD></TR><TR><TD>
|
||||
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P>
|
||||
<P>
|
||||
<P>
|
||||
<P>
|
||||
<HR>
|
||||
<A HREF="scancodes-7.html">Next</A>
|
||||
<A HREF="scancodes-5.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc6">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
164
specs/kbd/scancodes-7.html
Normal file
@@ -0,0 +1,164 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
||||
<META http-equiv=Content-Type content="text/html; charset=shift_jis">
|
||||
<TITLE>Keyboard scancodes: Japanese keyboards</TITLE>
|
||||
<LINK HREF="scancodes-8.html" REL=next>
|
||||
<LINK HREF="scancodes-6.html" REL=previous>
|
||||
<LINK HREF="scancodes.html#toc7" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="scancodes-8.html">Next</A>
|
||||
<A HREF="scancodes-6.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc7">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="japanese"></A> <A NAME="s7">7. Japanese keyboards</A></H2>
|
||||
|
||||
<P>
|
||||
<P>
|
||||
<P>
|
||||
<FIGURE>
|
||||
<EPS FILE="absent">
|
||||
<IMG SRC="jp106.jpg">
|
||||
</FIGURE>
|
||||
|
||||
<FIGURE>
|
||||
<EPS FILE="absent">
|
||||
<IMG SRC="jp106-with-scancodes.jpg">
|
||||
</FIGURE>
|
||||
<P>
|
||||
<H2><A NAME="ss7.1">7.1 Japanese 86/106 keyboards</A>
|
||||
</H2>
|
||||
|
||||
<P>(Information from Barry Yip <<CODE>g609296@cc.win.or.jp</CODE>>,
|
||||
Norman Diamond, NIIBE Yutaka and H. Peter Anvin, who
|
||||
contributed the photographs of his
|
||||
JP106 keyboard above and of his
|
||||
<A HREF="jplaptop.jpg">Japanese laptop</A>.)
|
||||
<P>Common Japanese keyboards have five additional keys
|
||||
(106-key, or 86-key for a notebook; these days there may also
|
||||
be 3 extra Windows keys). These keys have scancodes
|
||||
<B>70</B> (hiragana/katakana),
|
||||
<B>73</B> (backslash/underscore),
|
||||
<B>79</B> (henkan/zenkouho),
|
||||
<B>7b</B> (muhenkan),
|
||||
<B>7d</B> (yen/vertical bar).
|
||||
<P>
|
||||
<A NAME="japusdiffs"></A>
|
||||
Different keycaps:
|
||||
<P>
|
||||
<CENTER><TABLE BORDER><TR><TD>
|
||||
USB</TD><TD> Scancode </TD><TD>Japanese </TD><TD>US </TD><TD></TD><TD>USB</TD><TD> Scancode </TD><TD> Japanese </TD><TD>US </TD></TR><TR><TD>
|
||||
53</TD><TD><B>29</B></TD><TD>(hankaku/zenkaku)</TD><TD>(` / ~)</TD><TD></TD><TD> 47</TD><TD><B>1a</B></TD><TD>(@ / `)</TD><TD>([ / {) </TD></TR><TR><TD>
|
||||
31</TD><TD><B>03</B> </TD><TD> (2 / ") </TD><TD> (2 / @)</TD><TD></TD><TD> 48</TD><TD><B>1b</B></TD><TD>([ / {) </TD><TD>(] / }) </TD></TR><TR><TD>
|
||||
35</TD><TD><B>07</B> </TD><TD> (6 / &) </TD><TD> (6 / ^) </TD><TD></TD><TD> 51</TD><TD><B>27</B></TD><TD>(; / +) </TD><TD> (; / :) </TD></TR><TR><TD>
|
||||
36</TD><TD><B>08</B> </TD><TD> (7 / ') </TD><TD> (7 / &) </TD><TD></TD><TD> 52</TD><TD><B>28</B></TD><TD>(: / *) </TD><TD> (' / ") </TD></TR><TR><TD>
|
||||
37</TD><TD><B>09</B> </TD><TD> (8 / () </TD><TD> (8 / *) </TD><TD></TD><TD> 29</TD><TD><B>2b</B></TD><TD>(] / }) </TD><TD> (backslash / |) </TD></TR><TR><TD>
|
||||
38</TD><TD><B>0a</B> </TD><TD> (9 / )) </TD><TD> (9 / () </TD><TD></TD><TD>135</TD><TD><B>73</B></TD><TD>(backslash / _)</TD><TD> </TD></TR><TR><TD>
|
||||
39</TD><TD><B>0b</B> </TD><TD> (0 / ~)</TD><TD> (0 / )) </TD><TD></TD><TD>139</TD><TD><B>7b</B></TD><TD>(muhenkan) </TD><TD> </TD></TR><TR><TD>
|
||||
45</TD><TD><B>0c</B> </TD><TD> (- / =) </TD><TD> (- / _)</TD><TD></TD><TD>138</TD><TD><B>79</B></TD><TD>(henkan/zenkouho)</TD><TD> </TD></TR><TR><TD>
|
||||
46</TD><TD><B>0d</B> </TD><TD> (^ / overbar)</TD><TD> (= / +) </TD><TD></TD><TD>136</TD><TD><B>70</B></TD><TD>(hiragana/katakana) </TD><TD> </TD></TR><TR><TD>
|
||||
137</TD><TD><B>7d</B> </TD><TD> (\ / |) </TD><TD> </TD></TR><TR><TD>
|
||||
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P>ASCII and JIS-Roman differ in two or three points: the code positions
|
||||
where ASCII has backslash, tilde, broken bar,
|
||||
JIS-Roman uses yen, overbar and vertical bar, respectively.
|
||||
<P>Some keyboards have the tilde printed on the keycap for the 0 key, some don't.
|
||||
Similarly, some keyboards have the backslash printed on the keycap for the _ key
|
||||
and some don't, but in all cases you need Shift to get _.
|
||||
<P>
|
||||
<H2><A NAME="ss7.2">7.2 Description of the all-Japanese keys</A>
|
||||
</H2>
|
||||
|
||||
<P>Norman Diamond adds to the previous section:
|
||||
<P><I>To the left of the spacebar,</I>
|
||||
(Shift-JIS) <20><><EFBFBD>ϊ<EFBFBD>
|
||||
<I>(muhenkan) means no conversion
|
||||
from kana to kanji. To the right of the spacebar,
|
||||
<EFBFBD>ϊ<EFBFBD>
|
||||
(henkan) means conversion from kana to kanji. In Microsoft systems
|
||||
it converts the most recently input sequence of kana to the system's
|
||||
first guess at a string of kanji/kana/etc. with the correct pronunciation
|
||||
and a guess at the meaning. Repeated keypresses change it to other
|
||||
possible guesses which are either less common or less recently used,
|
||||
depending on the situation. The shifted version of this key is
|
||||
<EFBFBD>O<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
(zenkouho) which means "previous candidate" -- "zen" means "previous",
|
||||
while "kouho" means "candidate"</I> (explanation courtesy of NIIBE Yutaka)
|
||||
<I>-- it rotates back to earlier guesses for kanji conversion.
|
||||
The alt version of this key is
|
||||
<EFBFBD>S<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
also pronounced (zenkouho), which means "all candidates" -- here,
|
||||
"zen" means "all" -- it displays a menu of all known guesses.
|
||||
I never use the latter two functions of the key, because after
|
||||
pushing the henkan key about three times and not getting the desired guess,
|
||||
it displays a menu of all known guesses anyway.</I>
|
||||
<P><I>Next on the right,
|
||||
<EFBFBD>Ђ炪<EFBFBD><EFBFBD>
|
||||
(hiragana) means that
|
||||
phonetic input uses one conventional Japanese phonetic alphabet,
|
||||
which of course can be converted to kanji by pressing the henkan key later.
|
||||
The shifted version is
|
||||
<EFBFBD>J<EFBFBD>^<5E>J<EFBFBD>i
|
||||
(katakana) which means the other Japanese phonetic alphabet,
|
||||
and the alt version is
|
||||
<EFBFBD><EFBFBD><EFBFBD>[<5B>}<7D><>
|
||||
(ro-maji) which means the Roman alphabet.</I>
|
||||
<P><I>Near the upper left,
|
||||
<EFBFBD><EFBFBD>/<2F>S
|
||||
(han/zen) means switch between hankaku
|
||||
(half-size, the same size as an ASCII character) and zenkaku
|
||||
(full-size, since the amount of space occupied by a kanji
|
||||
is approximately a square, twice as fat as an ASCII character).
|
||||
It only affects katakana and a few other characters
|
||||
(for example there's a full-width copy of each ASCII character
|
||||
in addition to the single-byte half-width encodings).
|
||||
The alt version of this is
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
(kanji) which
|
||||
actually causes typed Roman phonetic keys to be displayed as Japanese
|
||||
phonetic kana (either hiragana or katakana depending on one of the other
|
||||
keys described above) and doesn't cause conversion to kanji.</I>
|
||||
<P>
|
||||
<H2><A NAME="bradford"></A> <A NAME="ss7.3">7.3 A Japanese keyboard that imitates a US one</A>
|
||||
</H2>
|
||||
|
||||
<P>John Bradford reports that he has a Japanese keyboard
|
||||
(an IBM 5576 KEYBOARD-2, part number 94X1110) that by default
|
||||
simulates US key layout. Thus, pressing the @ key yields scancodes
|
||||
<B>2a</B> <B>03</B> (fake shift followed by digit 2),
|
||||
pressing Shift - yields scancodes <B>b6</B> <B>0d</B>
|
||||
(fake shift down, =) with release <B>8d</B> <B>36</B>, etc.
|
||||
<P>Thus, the (translated Set 2) scancodes can be read off the
|
||||
<A HREF="#japusdiffs">table</A> with differences between the
|
||||
Japanese and the US layout.
|
||||
<P>In this state the non-ASCII keys (Yen and overline) yield an error
|
||||
(<B>ff</B>). The Japanese keys hankaku, kanji/katakana, muhenkan,
|
||||
zenkoho/henkan, hiragana, zenmen ki, yield the codes expected from
|
||||
keys in that position on a US keyboard: <B>29</B> (`/~),
|
||||
<B>38</B> (LAlt), <B>39</B> (space), <B>39</B> (space),
|
||||
<B>39</B> (space), <B>e0</B> <B>38</B> (RAlt), respectively.
|
||||
<P>Switching the keyboard to Set 3 enables the Japanese keys.
|
||||
In untranslated Set 3 these give codes: hankaku <B>0e</B>,
|
||||
Yen <B>13</B>, overline (shift ^), kanji/katakana <B>19</B>,
|
||||
muhenkan <B>85</B>, zenkoho/henkan <B>86</B>,
|
||||
hiragana <B>87</B>, zenmen ki <B>39</B>.
|
||||
(Also: backslash/underscore <B>5c</B>, bracketright/braceright <B>53</B>.)
|
||||
<P>This is the only keyboard I know that gives more information in Set 3
|
||||
than in Set 2. It reports
|
||||
<A HREF="scancodes-9.html#keyboardid">keyboard ID</A>
|
||||
<B>ab</B> <B>90</B>.
|
||||
<P>
|
||||
<FIGURE>
|
||||
<EPS FILE="absent">
|
||||
<IMG SRC="imb5576-2.jpg">
|
||||
</FIGURE>
|
||||
<P>
|
||||
<HR>
|
||||
<A HREF="scancodes-8.html">Next</A>
|
||||
<A HREF="scancodes-6.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc7">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
75
specs/kbd/scancodes-8.html
Normal file
@@ -0,0 +1,75 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
||||
<TITLE>Keyboard scancodes: Korean keyboards</TITLE>
|
||||
<LINK HREF="scancodes-9.html" REL=next>
|
||||
<LINK HREF="scancodes-7.html" REL=previous>
|
||||
<LINK HREF="scancodes.html#toc8" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="scancodes-9.html">Next</A>
|
||||
<A HREF="scancodes-7.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc8">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="korean"></A> <A NAME="s8">8. Korean keyboards</A></H2>
|
||||
|
||||
<P>The Korean keyboard has two keys, the Korean/Chinese
|
||||
and the Korean/English toggles, that generate scancodes
|
||||
<B>f1</B> and <B>f2</B> (respectively) when pressed,
|
||||
and nothing when released. They do not repeat.
|
||||
The keycaps are "hancha" and "han/yong" (written in Hangul).
|
||||
Hancha (hanja) means Chinese character, and Han/Yong is short for
|
||||
Hangul/Yongcha (Korean/English).
|
||||
They are located left and right of the space bar.
|
||||
<P>
|
||||
<P>
|
||||
<H2><A NAME="ss8.1">8.1 An A4tech keyboard</A>
|
||||
</H2>
|
||||
|
||||
<P>Dave Willis reports on his A4tech keyboard:
|
||||
<P>Apart from the Korean Hancha and Han/Yong keys, there are on the top row:
|
||||
<P><B>e0</B> <B>5f</B> (Moon),
|
||||
<B>e0</B> <B>6c</B> (Mail),
|
||||
<B>e0</B> <B>6b</B> (Computer),
|
||||
<B>e0</B> <B>21</B> (Calculator),
|
||||
<B>e0</B> <B>6d</B> (Notes),
|
||||
<B>e0</B> <B>10</B> (Previous),
|
||||
<B>e0</B> <B>19</B> (Next),
|
||||
<B>e0</B> <B>2e</B> (Minus),
|
||||
<B>e0</B> <B>20</B> (Mute),
|
||||
<B>e0</B> <B>30</B> (Plus),
|
||||
<B>e0</B> <B>22</B> (Play/Pause),
|
||||
<B>e0</B> <B>24</B> (Stop),
|
||||
<B>e0</B> <B>65</B> (Magnifier),
|
||||
<B>e0</B> <B>32</B> (Home),
|
||||
<B>e0</B> <B>66</B> (Folder),
|
||||
<B>e0</B> <B>67</B> (recycle-style arrows),
|
||||
<B>e0</B> <B>68</B> (x).
|
||||
<P>Below mute:
|
||||
<B>e0</B> <B>62</B> (Office).
|
||||
<P>On the right hand side:
|
||||
<B>e0</B> <B>6a</B> (arrow up left),
|
||||
<B>e0</B> <B>69</B> (arrow down right),
|
||||
<B>e0</B> <B>0b</B> (wheel up),
|
||||
<B>e0</B> <B>2c</B> (wheel down),
|
||||
<B>e0</B> <B>64</B> (wheel in).
|
||||
<P>Wheel up and wheel down have no release code, only the plus and minus keys
|
||||
will repeat themselves when held down.
|
||||
<P>
|
||||
<H2><A NAME="ss8.2">8.2 The DEC LK201-K</A>
|
||||
</H2>
|
||||
|
||||
<P>
|
||||
<FIGURE>
|
||||
<EPS FILE="absent">
|
||||
<IMG SRC="lk201-k.gif">
|
||||
</FIGURE>
|
||||
<P>
|
||||
<P>
|
||||
<HR>
|
||||
<A HREF="scancodes-9.html">Next</A>
|
||||
<A HREF="scancodes-7.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc8">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
403
specs/kbd/scancodes-9.html
Normal file
@@ -0,0 +1,403 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
||||
<TITLE>Keyboard scancodes: Keyboard-internal scancodes</TITLE>
|
||||
<LINK HREF="scancodes-10.html" REL=next>
|
||||
<LINK HREF="scancodes-8.html" REL=previous>
|
||||
<LINK HREF="scancodes.html#toc9" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="scancodes-10.html">Next</A>
|
||||
<A HREF="scancodes-8.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc9">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="scancodesets"></A> <A NAME="s9">9. Keyboard-internal scancodes</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="ss9.1">9.1 Three scancode sets</A>
|
||||
</H2>
|
||||
|
||||
<P>The usual PC keyboards are capable of producing three sets of scancodes.
|
||||
Writing 0xf0 followed by 1, 2 or 3 to port 0x60 will put the keyboard
|
||||
in scancode mode 1, 2 or 3. Writing 0xf0 followed by 0 queries the mode,
|
||||
resulting in a scancode byte <B>43</B>, <B>41</B> or <B>3f</B>
|
||||
from the keyboard.
|
||||
<P>Set 1 contains the values that the XT keyboard (with only one set
|
||||
of scancodes) produced, with extensions for new keys. Someone
|
||||
decided that another numbering was more logical and invented
|
||||
scancode Set 2. However, it was realized that new scancodes
|
||||
would break old programs, so the keyboard output was fed to a
|
||||
8042 microprocessor on the motherboard that could translate Set 2
|
||||
back into Set 1. Indeed a smart construction. This is the default today.
|
||||
Finally there is the PS/2 version, Set 3, more regular, but used by
|
||||
almost nobody.
|
||||
<P>(I wrote this long ago. Nowadays Linux 2.5 may try to use Set 3.
|
||||
Also certain HP machines, like the PS/2 version of the HP9000
|
||||
workstation, have used Set 3.)
|
||||
<P>Sets 2 and 3 are designed to be translated by the 8042.
|
||||
Set 1 should not be translated.
|
||||
<P>Not all keyboards support all scancode sets. For example, my MyCom
|
||||
laptop only supports scancode Set 2, and its keyboard does not react
|
||||
at all when in mode 1 or 3.
|
||||
<P>
|
||||
<H2><A NAME="ss9.2">9.2 Make and Break codes</A>
|
||||
</H2>
|
||||
|
||||
<P>The key press / key release is coded as follows:
|
||||
<P>For Set 1, if the make code of a key is <I>c</I>, the break code
|
||||
will be <I>c</I>+0x80. If the make code is <B>e0</B> <I>c</I>,
|
||||
the break code will be <B>e0</B> <I>c</I>+0x80.
|
||||
The Pause key has make code <B>e1</B> <B>1d</B> <B>45</B>
|
||||
<B>e1</B> <B>9d</B> <B>c5</B> and does not generate a break code.
|
||||
<P>For Set 2, if the make code of a key is <I>c</I>, the break code
|
||||
will be <B>f0</B> <I>c</I>. If the make code is <B>e0</B> <I>c</I>,
|
||||
the break code will be <B>e0</B> <B>f0</B> <I>c</I>.
|
||||
The Pause key has the 8-byte make code <B>e1</B> <B>14</B> <B>77</B>
|
||||
<B>e1</B> <B>f0</B> <B>14</B> <B>f0</B> <B>77</B>.
|
||||
<P>For Set 3, by default most keys do not generate a break code - only CapsLock,
|
||||
LShift, RShift, LCtrl and LAlt do. However, by default all non-traditional
|
||||
keys do generate a break code - thus, LWin, RWin, Menu do, and for example
|
||||
on the Microsoft Internet keyboard, so do Back, Forward, Stop,
|
||||
Mail, Search, Favorites, Web/Home, MyComputer, Calculator, Sleep.
|
||||
On my BTC keyboard, also the Macro key does.
|
||||
<P>In Scancode Mode 3 it is possible to enable or disable key repeat
|
||||
and the production of break codes either on a key-by-key basis
|
||||
or for all keys at once.
|
||||
And just like for Set 2, key release is indicated by a <B>f0</B> prefix
|
||||
in those cases where it is indicated.
|
||||
There is nothing special with the Pause key in scancode mode 3.
|
||||
<P>
|
||||
<H2><A NAME="ss9.3">9.3 Translation</A>
|
||||
</H2>
|
||||
|
||||
<P>The 8042 microprocessor translates the incoming byte stream produced
|
||||
by the keyboard, and turns an <B>f0</B> prefix into an OR with
|
||||
<B>80</B> for the next byte.
|
||||
<A NAME="contagious"></A>
|
||||
(Some implementations do this for the next byte that does not have
|
||||
this bit set already. A consequence is that in Set 3 the keys with Set-3
|
||||
value 0x80 or more are broken in a peculiar way: hitting such a key and
|
||||
then some other key turns the make code for this last key into a break code.
|
||||
For example the Sleep key on a Microsoft Internet keyboard generates
|
||||
<B>54</B> / <B>d4</B> for press/release. But pressing and
|
||||
releasing first Menu and then Sleep produces
|
||||
<B>8d</B> <B>8d</B> <B>d4</B> <B>d4</B> as translation of
|
||||
<B>8d</B> <B>f0</B> <B>8d</B> <B>54</B> <B>f0</B> <B>54</B>.
|
||||
Other implementations are OK.)
|
||||
<P>
|
||||
<A NAME="translationtable"></A>
|
||||
Unless told not to translate, the keyboard controller translates
|
||||
keyboard scancodes into the scancodes it returns to the CPU
|
||||
using the following table (in hex):
|
||||
<P>
|
||||
<P>
|
||||
<CENTER><TABLE BORDER><TR><TD>
|
||||
</TD><TD> 00 </TD><TD> 01 </TD><TD> 02 </TD><TD> 03 </TD><TD> 04 </TD><TD> 05 </TD><TD> 06 </TD><TD> 07 </TD><TD> 08 </TD><TD> 09 </TD><TD> 0a </TD><TD> 0b </TD><TD> 0c </TD><TD> 0d </TD><TD> 0e </TD><TD> 0f </TD></TR><TR><TD>
|
||||
</TD></TR><TR><TD>
|
||||
00 </TD><TD> ff </TD><TD> 43 </TD><TD> 41 </TD><TD> 3f </TD><TD> 3d </TD><TD> 3b </TD><TD> 3c </TD><TD> 58 </TD><TD> 64 </TD><TD> 44 </TD><TD> 42 </TD><TD> 40 </TD><TD> 3e </TD><TD> 0f </TD><TD> 29 </TD><TD> 59 </TD></TR><TR><TD>
|
||||
10 </TD><TD> 65 </TD><TD> 38 </TD><TD> 2a </TD><TD> 70 </TD><TD> 1d </TD><TD> 10 </TD><TD> 02 </TD><TD> 5a </TD><TD> 66 </TD><TD> 71 </TD><TD> 2c </TD><TD> 1f </TD><TD> 1e </TD><TD> 11 </TD><TD> 03 </TD><TD> 5b </TD></TR><TR><TD>
|
||||
20 </TD><TD> 67 </TD><TD> 2e </TD><TD> 2d </TD><TD> 20 </TD><TD> 12 </TD><TD> 05 </TD><TD> 04 </TD><TD> 5c </TD><TD> 68 </TD><TD> 39 </TD><TD> 2f </TD><TD> 21 </TD><TD> 14 </TD><TD> 13 </TD><TD> 06 </TD><TD> 5d </TD></TR><TR><TD>
|
||||
30 </TD><TD> 69 </TD><TD> 31 </TD><TD> 30 </TD><TD> 23 </TD><TD> 22 </TD><TD> 15 </TD><TD> 07 </TD><TD> 5e </TD><TD> 6a </TD><TD> 72 </TD><TD> 32 </TD><TD> 24 </TD><TD> 16 </TD><TD> 08 </TD><TD> 09 </TD><TD> 5f </TD></TR><TR><TD>
|
||||
40 </TD><TD> 6b </TD><TD> 33 </TD><TD> 25 </TD><TD> 17 </TD><TD> 18 </TD><TD> 0b </TD><TD> 0a </TD><TD> 60 </TD><TD> 6c </TD><TD> 34 </TD><TD> 35 </TD><TD> 26 </TD><TD> 27 </TD><TD> 19 </TD><TD> 0c </TD><TD> 61 </TD></TR><TR><TD>
|
||||
50 </TD><TD> 6d </TD><TD> 73 </TD><TD> 28 </TD><TD> 74 </TD><TD> 1a </TD><TD> 0d </TD><TD> 62 </TD><TD> 6e </TD><TD> 3a </TD><TD> 36 </TD><TD> 1c </TD><TD> 1b </TD><TD> 75 </TD><TD> 2b </TD><TD> 63 </TD><TD> 76 </TD></TR><TR><TD>
|
||||
60 </TD><TD> 55 </TD><TD> 56 </TD><TD> 77 </TD><TD> 78 </TD><TD> 79 </TD><TD> 7a </TD><TD> 0e </TD><TD> 7b </TD><TD> 7c </TD><TD> 4f </TD><TD> 7d </TD><TD> 4b </TD><TD> 47 </TD><TD> 7e </TD><TD> 7f </TD><TD> 6f </TD></TR><TR><TD>
|
||||
70 </TD><TD> 52 </TD><TD> 53 </TD><TD> 50 </TD><TD> 4c </TD><TD> 4d </TD><TD> 48 </TD><TD> 01 </TD><TD> 45 </TD><TD> 57 </TD><TD> 4e </TD><TD> 51 </TD><TD> 4a </TD><TD> 37 </TD><TD> 49 </TD><TD> 46 </TD><TD> 54 </TD></TR><TR><TD>
|
||||
80 </TD><TD> 80?</TD><TD> 81 </TD><TD> 82 </TD><TD> 41 </TD><TD> 54 </TD><TD> 85 </TD><TD> 86 </TD><TD> 87 </TD><TD> 88 </TD><TD> 89 </TD><TD> 8a </TD><TD> 8b </TD><TD> 8c </TD><TD> 8d </TD><TD> 8e </TD><TD> 8f </TD></TR><TR><TD>
|
||||
90 </TD><TD> 90 </TD><TD> 91 </TD><TD> 92 </TD><TD> 93 </TD><TD> 94 </TD><TD> 95 </TD><TD> 96 </TD><TD> 97 </TD><TD> 98 </TD><TD> 99 </TD><TD> 9a </TD><TD> 9b </TD><TD> 9c </TD><TD> 9d </TD><TD> 9e </TD><TD> 9f </TD></TR><TR><TD>
|
||||
a0 </TD><TD> a0 </TD><TD> a1 </TD><TD> a2 </TD><TD> a3 </TD><TD> a4 </TD><TD> a5 </TD><TD> a6 </TD><TD> a7 </TD><TD> a8 </TD><TD> a9 </TD><TD> aa </TD><TD> ab </TD><TD> ac </TD><TD> ad </TD><TD> ae </TD><TD> af </TD></TR><TR><TD>
|
||||
b0 </TD><TD> b0 </TD><TD> b1 </TD><TD> b2 </TD><TD> b3 </TD><TD> b4 </TD><TD> b5 </TD><TD> b6 </TD><TD> b7 </TD><TD> b8 </TD><TD> b9 </TD><TD> ba </TD><TD> bb </TD><TD> bc </TD><TD> bd </TD><TD> be </TD><TD> bf </TD></TR><TR><TD>
|
||||
c0 </TD><TD> c0 </TD><TD> c1 </TD><TD> c2 </TD><TD> c3 </TD><TD> c4 </TD><TD> c5 </TD><TD> c6 </TD><TD> c7 </TD><TD> c8 </TD><TD> c9 </TD><TD> ca </TD><TD> cb </TD><TD> cc </TD><TD> cd </TD><TD> ce </TD><TD> cf </TD></TR><TR><TD>
|
||||
d0 </TD><TD> d0 </TD><TD> d1 </TD><TD> d2 </TD><TD> d3 </TD><TD> d4 </TD><TD> d5?</TD><TD> d6 </TD><TD> d7 </TD><TD> d8 </TD><TD> d9?</TD><TD> da?</TD><TD> db </TD><TD> dc </TD><TD> dd </TD><TD> de </TD><TD> df </TD></TR><TR><TD>
|
||||
e0 </TD><TD> e0 </TD><TD> e1 </TD><TD> e2 </TD><TD> e3 </TD><TD> e4 </TD><TD> e5 </TD><TD> e6 </TD><TD> e7 </TD><TD> e8 </TD><TD> e9 </TD><TD> ea </TD><TD> eb </TD><TD> ec </TD><TD> ed </TD><TD> ee </TD><TD> ef?</TD></TR><TR><TD>
|
||||
f0 </TD><TD> - </TD><TD> f1?</TD><TD> f2?</TD><TD> f3?</TD><TD> f4?</TD><TD> f5?</TD><TD> f6?</TD><TD> f7?</TD><TD> f8?</TD><TD> f9?</TD><TD> fa?</TD><TD> fb?</TD><TD> fc?</TD><TD> fd?</TD><TD> fe?</TD><TD> ff </TD></TR><TR><TD>
|
||||
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P>A reference for the first half of this table is the book by Gary J Konzak
|
||||
<I>PC 8042 Controller</I>, ISBN 0-929392-21-3.
|
||||
(Report by <CODE>vojtech@suse.cz</CODE>.)
|
||||
<P>A way to check this table is: (i) put the keyboard in untranslated modes
|
||||
1, 2, 3 and look at the
|
||||
<A HREF="table.h">resulting values</A>,
|
||||
and (ii) put the keyboard in translated scancode modes 1, 2, 3. Now compare
|
||||
the values. The entries with question marks were not checked in this way.
|
||||
<P>Note that the range <B>01</B>-<B>7f</B> of this table is 1-1.
|
||||
In the second half of the table, translated and untranslated values
|
||||
are equal in all known cases, with the two exceptions <B>83</B> and <B>84</B>.
|
||||
<P>One asks the controller to transmit untranslated scancodes by writing
|
||||
a keyboard controller command with bit 5 set and bit 6 cleared.
|
||||
E.g., use the command byte <B>45</B> to get translated codes,
|
||||
and <B>24</B> to get untranslated codes that do not cause interrupts.
|
||||
<P>
|
||||
<H3>Effects of translation</H3>
|
||||
|
||||
<P>
|
||||
<H3>Origin of strange scan code set values</H3>
|
||||
|
||||
<P>The keyboard command <B>f0</B> with argument 1, 2 or 3
|
||||
sets the current scancode set, and this same command
|
||||
with argument 0 asks for the current scancode set.
|
||||
The reply is <B>43</B>, <B>41</B> or <B>3f</B>
|
||||
for sets 1, 2, 3. Why? Because in reality the reply is 1, 2 or 3,
|
||||
and that is what one sees when translation is off. But translation
|
||||
turns these into <B>43</B>, <B>41</B>, <B>3f</B>.
|
||||
<P>
|
||||
<H3><A NAME="keyboardid"></A> Keyboard IDs</H3>
|
||||
|
||||
<P>Keyboards do report an ID as a reply to the command
|
||||
<B>
|
||||
<A HREF="scancodes-11.html#kcf2">f2</A></B>.
|
||||
(An XT keyboard does not reply, an AT keyboard only replies with an ACK.)
|
||||
An MF2 AT keyboard reports ID <B>ab</B> <B>83</B>.
|
||||
Translation turns this into <B>ab</B> <B>41</B>.
|
||||
<P>Many short keyboards, like IBM ThinkPads, and Spacesaver keyboards,
|
||||
send <B>ab</B> <B>84</B> untranslated,
|
||||
which becomes <B>ab</B> <B>54</B> translated.
|
||||
(The netbsd source has a misunderstanding here, and seems to associate
|
||||
the <B>54</B> and <B>84</B> to the ThinkPad model - cf. the defines
|
||||
KEYB_R_MF2ID2TP75X, KEYB_R_MF2ID2TP76X.)
|
||||
<P>Several 122-key keyboards are reported to send <B>ab</B> <B>86</B>.
|
||||
Here translated and untranslated values coincide.
|
||||
(Reports mention "122-Key Enhanced Keyboard", "standard 122-key keyboard",
|
||||
"122 Key Mainframe Interactive (MFI) Keyboard".)
|
||||
<P>David Monro reports <B>ab</B> <B>85</B> for a
|
||||
<A HREF="scancodes-6.html#NCD97">NCD N-97</A> keyboard.
|
||||
Tim Clarke reports <B>ab</B> <B>85</B> for the
|
||||
"122-Key Host Connect(ed) Keyboard".
|
||||
<P>He also reports
|
||||
<I>Also, when playing with my KVM problems Belkin gave me a
|
||||
105-key Windows keyboard which Id.s itself as 18ABh</I>.
|
||||
<P>Linux 2.5.25 kernel source has 0xaca1 for a
|
||||
"NCD Sun layout keyboard". It also mentions 0xab02 and 0xab7f,
|
||||
but these arise as (mistaken) back translations from
|
||||
<B>ab</B> <B>41</B> and <B>ab</B> <B>54</B>.
|
||||
<P>Ralph Brown's Interrupt list mentions "old Japanese 'G', 'P', 'A' keyboards",
|
||||
with keyboard IDs <B>ab</B> <B>90</B>, <B>ab</B> <B>91</B>,
|
||||
<B>ab</B> <B>92</B>. Here translated and untranslated versions
|
||||
coincide. ID <B>ab</B> <B>90</B> was also mentioned
|
||||
<A HREF="scancodes-7.html#bradford">above</A>.
|
||||
<P>
|
||||
<P>
|
||||
<H2><A NAME="ss9.4">9.4 Correspondence</A>
|
||||
</H2>
|
||||
|
||||
<P>For the traditional keys the correspondence is fairly clear:
|
||||
above we saw the
|
||||
<A HREF="#translationtable">translation table</A>,
|
||||
and Set 1 equals translated Set 2, and Set 3 equals Set 2 in most cases
|
||||
where Set 2 has a single (non-escaped) scancode,
|
||||
and in any case the correspondence is constant (and given
|
||||
<A HREF="#correspondence">below</A>).
|
||||
<P>On the other hand, modern keyboards have all kinds of multimedia
|
||||
and other additional keys, and what happens for them is completely
|
||||
random, and varies from keyboard to keyboard.
|
||||
<P>Let us look at an example.
|
||||
<P>The
|
||||
<A HREF="scancodes-5.html#msinternet">Microsoft Internet keyboard</A>
|
||||
has keys Search, Favorites, Stop, Forward, Back, My Computer,
|
||||
Mail, Web / Home, Calculator with translated Set 3 scancodes
|
||||
<B>65</B>, <B>66</B>, <B>68</B>, <B>69</B>, <B>6a</B>,
|
||||
<B>6b</B>, <B>6c</B>, <B>97</B>, <B>99</B>, respectively,
|
||||
and translated Set 2 scancodes <B>e0</B> <I>xx</I>, with
|
||||
<I>xx</I> = <B>65</B>, <B>66</B>, <B>68</B>, <B>69</B>,
|
||||
<B>6a</B>, <B>6b</B>, <B>6c</B>, <B>32</B>, <B>21</B>.
|
||||
<P>On the other hand, the
|
||||
<A HREF="scancodes-5.html#ibmrapidaccessii">IBM Rapid Access II keyboard</A>
|
||||
has keys CD stop, CD play, Volume D, Volume U, CD back, CD fwd
|
||||
with translated Set 3 scancodes
|
||||
<B>69</B>, <B>6a</B>, <B>6b</B>, <B>6c</B>, <B>6d</B>, <B>44</B>,
|
||||
and translated Set 2 scancodes <B>e0</B> <I>xx</I>, with
|
||||
<I>xx</I> = <B>20</B>, <B>22</B>, <B>21</B>, <B>23</B>,
|
||||
<B>24</B>, <B>12</B>.
|
||||
<P>Thus, different keyboards have different mappings between Set 2
|
||||
and Set 3 codes.
|
||||
<P>
|
||||
<H2><A NAME="ss9.5">9.5 Use</A>
|
||||
</H2>
|
||||
|
||||
<P>Can these other scancode sets be used? Probably not.
|
||||
<P>() Translated scancode Set 1 has weird codes that nobody wants to use.
|
||||
<P>(i) My MyCom laptop does not support scancode sets 1 and 3 at all.
|
||||
<P>(ii) Some laptops have special key combinations that bring one
|
||||
into a setup or configuration utility. It is impossible to do
|
||||
anything useful, or to get out of it again, when the scancode mode
|
||||
is not translated Set 2.
|
||||
<P>(iii) Many keyboards have bugs in scancode sets 1 and/or 3 but
|
||||
are fine in scancode Set 2.
|
||||
Vojtech Pavlik reports that his BTC keyboard has the same codes
|
||||
for the '1' and '2' keys in Set3, both having the code for '1').
|
||||
On my BTC keyboard the key up value for Esc and 1 are both <B>ff</B>
|
||||
in scancode Set 1. My Safeway keyboard has untranslated Set 1 equal
|
||||
to translated Set 2, except for the multimedia keys, where
|
||||
untranslated Set 1 equals untranslated Set 2.
|
||||
<P>(iv) A big advantage of Set 3 is that each key generates a unique code
|
||||
so that one does not need to parse sequences. However, the BTC keyboard
|
||||
mentioned
|
||||
<A HREF="scancodes-5.html#BTC">above</A> generates <B>e0</B> <B>6f</B>
|
||||
for its Macro key also in scancode mode 3. The Safeway keyboard mentioned
|
||||
<A HREF="scancodes-5.html#safeway23">above</A> does not generate any codes
|
||||
for its multimedia keys in scancode mode 3.
|
||||
<P>(v) Some keyboard controllers cannot handle Set 3 values that are
|
||||
larger than 0x7f, and give
|
||||
<A HREF="#contagious">peculiar results</A>
|
||||
for e.g. the Windows keys in translated scancode mode 3.
|
||||
The result is that the following key is "eaten": the key down action
|
||||
turns into a key up.
|
||||
<P>(vi) The USB legacy support only supports translated Set 2.
|
||||
<P>(vii) The
|
||||
<A HREF="http://www.microsoft.com/hwdev/download/desinit/scancode.zip">Microsoft Keyboard Scan Code Specification</A> writes:
|
||||
<I>In the very early days of Windows NT, an attempt was made
|
||||
to use the much more orthogonal Scan Code Set 3, but due to bugs
|
||||
in the implementation of this Scan Code Set on numerous OEM
|
||||
keyboards, the idea was abandoned.</I>
|
||||
And also: <I>Scan Code Set 3 is not used or required for operation
|
||||
of Microsoft operating systems.</I>
|
||||
<P>(viii) Others also tried Set 3. The PS/2 version of the HP9000
|
||||
workstation uses it. This is fine with HP's keyboards but causes
|
||||
some problems with foreign keyboards.
|
||||
<P>(ix) It is said that Hal Snyder of Mark Williams, Co remarked:
|
||||
"We find that about 10% of cheap no-name keyboards do not work
|
||||
in scan code set 3".
|
||||
<P>(x) These days Linux probes the keyboard, and may try to enable Set 3.
|
||||
This is good for learning a lot about strange keyboards.
|
||||
It is bad for having a stable system that just works.
|
||||
<P>
|
||||
<H2><A NAME="correspondence"></A> <A NAME="ss9.6">9.6 A table</A>
|
||||
</H2>
|
||||
|
||||
<P>(USB codes in decimal, scancodes in hex.)
|
||||
<P>
|
||||
<P>
|
||||
<CENTER><TABLE BORDER><TR><TD>
|
||||
# </TD><TD> USB </TD><TD> Set 1 </TD><TD> X(Set 1) </TD><TD> Set 2 </TD><TD> X(Set 2) </TD><TD> Set 3 </TD><TD> X(Set 3) </TD><TD> keycap </TD></TR><TR><TD>
|
||||
1 </TD><TD> 53 </TD><TD> 29 </TD><TD> 39 </TD><TD> 0e </TD><TD> 29 </TD><TD> 0e </TD><TD> 29 </TD><TD> ` ~ </TD></TR><TR><TD>
|
||||
2 </TD><TD> 30 </TD><TD> 02 </TD><TD> 41 </TD><TD> 16 </TD><TD> 02 </TD><TD> 16 </TD><TD> 02 </TD><TD> 1 ! </TD></TR><TR><TD>
|
||||
3 </TD><TD> 31 </TD><TD> 03 </TD><TD> 3f </TD><TD> 1e </TD><TD> 03 </TD><TD> 1e </TD><TD> 03 </TD><TD> 2 @ </TD></TR><TR><TD>
|
||||
4 </TD><TD> 32 </TD><TD> 04 </TD><TD> 3d </TD><TD> 26 </TD><TD> 04 </TD><TD> 26 </TD><TD> 04 </TD><TD> 3 # </TD></TR><TR><TD>
|
||||
5 </TD><TD> 33 </TD><TD> 05 </TD><TD> 3b </TD><TD> 25 </TD><TD> 05 </TD><TD> 25 </TD><TD> 05 </TD><TD> 4 $ </TD></TR><TR><TD>
|
||||
6 </TD><TD> 34 </TD><TD> 06 </TD><TD> 3c </TD><TD> 2e </TD><TD> 06 </TD><TD> 2e </TD><TD> 06 </TD><TD> 5 % E </TD></TR><TR><TD>
|
||||
7 </TD><TD> 35 </TD><TD> 07 </TD><TD> 58 </TD><TD> 36 </TD><TD> 07 </TD><TD> 36 </TD><TD> 07 </TD><TD> 6 ^ </TD></TR><TR><TD>
|
||||
8 </TD><TD> 36 </TD><TD> 08 </TD><TD> 64 </TD><TD> 3d </TD><TD> 08 </TD><TD> 3d </TD><TD> 08 </TD><TD> 7 & </TD></TR><TR><TD>
|
||||
9 </TD><TD> 37 </TD><TD> 09 </TD><TD> 44 </TD><TD> 3e </TD><TD> 09 </TD><TD> 3e </TD><TD> 09 </TD><TD> 8 * </TD></TR><TR><TD>
|
||||
10 </TD><TD> 38 </TD><TD> 0a </TD><TD> 42 </TD><TD> 46 </TD><TD> 0a </TD><TD> 46 </TD><TD> 0a </TD><TD> 9 ( </TD></TR><TR><TD>
|
||||
11 </TD><TD> 39 </TD><TD> 0b </TD><TD> 40 </TD><TD> 45 </TD><TD> 0b </TD><TD> 45 </TD><TD> 0b </TD><TD> 0 ) </TD></TR><TR><TD>
|
||||
12 </TD><TD> 45 </TD><TD> 0c </TD><TD> 3e </TD><TD> 4e </TD><TD> 0c </TD><TD> 4e </TD><TD> 0c </TD><TD> - _ </TD></TR><TR><TD>
|
||||
13 </TD><TD> 46 </TD><TD> 0d </TD><TD> 0f </TD><TD> 55 </TD><TD> 0d </TD><TD> 55 </TD><TD> 0d </TD><TD> = + </TD></TR><TR><TD>
|
||||
15 </TD><TD> 42 </TD><TD> 0e </TD><TD> 29 </TD><TD> 66 </TD><TD> 0e </TD><TD> 66 </TD><TD> 0e </TD><TD> Backspace </TD></TR><TR><TD>
|
||||
16 </TD><TD> 43 </TD><TD> 0f </TD><TD> 59 </TD><TD> 0d </TD><TD> 0f </TD><TD> 0d </TD><TD> 0f </TD><TD> Tab </TD></TR><TR><TD>
|
||||
17 </TD><TD> 20 </TD><TD> 10 </TD><TD> 65 </TD><TD> 15 </TD><TD> 10 </TD><TD> 15 </TD><TD> 10 </TD><TD> Q </TD></TR><TR><TD>
|
||||
18 </TD><TD> 26 </TD><TD> 11 </TD><TD> 38 </TD><TD> 1d </TD><TD> 11 </TD><TD> 1d </TD><TD> 11 </TD><TD> W </TD></TR><TR><TD>
|
||||
19 </TD><TD> 8 </TD><TD> 12 </TD><TD> 2a </TD><TD> 24 </TD><TD> 12 </TD><TD> 24 </TD><TD> 12 </TD><TD> E </TD></TR><TR><TD>
|
||||
20 </TD><TD> 21 </TD><TD> 13 </TD><TD> 70 </TD><TD> 2d </TD><TD> 13 </TD><TD> 2d </TD><TD> 13 </TD><TD> R </TD></TR><TR><TD>
|
||||
21 </TD><TD> 23 </TD><TD> 14 </TD><TD> 1d </TD><TD> 2c </TD><TD> 14 </TD><TD> 2c </TD><TD> 14 </TD><TD> T </TD></TR><TR><TD>
|
||||
22 </TD><TD> 28 </TD><TD> 15 </TD><TD> 10 </TD><TD> 35 </TD><TD> 15 </TD><TD> 35 </TD><TD> 15 </TD><TD> Y </TD></TR><TR><TD>
|
||||
23 </TD><TD> 24 </TD><TD> 16 </TD><TD> 02 </TD><TD> 3c </TD><TD> 16 </TD><TD> 3c </TD><TD> 16 </TD><TD> U </TD></TR><TR><TD>
|
||||
24 </TD><TD> 12 </TD><TD> 17 </TD><TD> 5a </TD><TD> 43 </TD><TD> 17 </TD><TD> 43 </TD><TD> 17 </TD><TD> I </TD></TR><TR><TD>
|
||||
25 </TD><TD> 18 </TD><TD> 18 </TD><TD> 66 </TD><TD> 44 </TD><TD> 18 </TD><TD> 44 </TD><TD> 18 </TD><TD> O </TD></TR><TR><TD>
|
||||
26 </TD><TD> 19 </TD><TD> 19 </TD><TD> 71 </TD><TD> 4d </TD><TD> 19 </TD><TD> 4d </TD><TD> 19 </TD><TD> P </TD></TR><TR><TD>
|
||||
27 </TD><TD> 47 </TD><TD> 1a </TD><TD> 2c </TD><TD> 54 </TD><TD> 1a </TD><TD> 54 </TD><TD> 1a </TD><TD> [ { </TD></TR><TR><TD>
|
||||
28 </TD><TD> 48 </TD><TD> 1b </TD><TD> 1f </TD><TD> 5b </TD><TD> 1b </TD><TD> 5b </TD><TD> 1b </TD><TD> ] } </TD></TR><TR><TD>
|
||||
29 </TD><TD> 49 </TD><TD> 2b </TD><TD> 21 </TD><TD> 5d </TD><TD> 2b </TD><TD> 5c </TD><TD> 75 </TD><TD> \ | </TD></TR><TR><TD>
|
||||
30 </TD><TD> 57 </TD><TD> 3a </TD><TD> 32 </TD><TD> 58 </TD><TD> 3a </TD><TD> 14 </TD><TD> 1d </TD><TD> CapsLock </TD></TR><TR><TD>
|
||||
31 </TD><TD> 4 </TD><TD> 1e </TD><TD> 03 </TD><TD> 1c </TD><TD> 1e </TD><TD> 1c </TD><TD> 1e </TD><TD> A </TD></TR><TR><TD>
|
||||
32 </TD><TD> 22 </TD><TD> 1f </TD><TD> 5b </TD><TD> 1b </TD><TD> 1f </TD><TD> 1b </TD><TD> 1f </TD><TD> S </TD></TR><TR><TD>
|
||||
33 </TD><TD> 7 </TD><TD> 20 </TD><TD> 67 </TD><TD> 23 </TD><TD> 20 </TD><TD> 23 </TD><TD> 20 </TD><TD> D </TD></TR><TR><TD>
|
||||
34 </TD><TD> 9 </TD><TD> 21 </TD><TD> 2e </TD><TD> 2b </TD><TD> 21 </TD><TD> 2b </TD><TD> 21 </TD><TD> F </TD></TR><TR><TD>
|
||||
35 </TD><TD> 10 </TD><TD> 22 </TD><TD> 2d </TD><TD> 34 </TD><TD> 22 </TD><TD> 34 </TD><TD> 22 </TD><TD> G </TD></TR><TR><TD>
|
||||
36 </TD><TD> 11 </TD><TD> 23 </TD><TD> 20 </TD><TD> 33 </TD><TD> 23 </TD><TD> 33 </TD><TD> 23 </TD><TD> H </TD></TR><TR><TD>
|
||||
37 </TD><TD> 13 </TD><TD> 24 </TD><TD> 12 </TD><TD> 3b </TD><TD> 24 </TD><TD> 3b </TD><TD> 24 </TD><TD> J </TD></TR><TR><TD>
|
||||
38 </TD><TD> 14 </TD><TD> 25 </TD><TD> 05 </TD><TD> 42 </TD><TD> 25 </TD><TD> 42 </TD><TD> 25 </TD><TD> K </TD></TR><TR><TD>
|
||||
39 </TD><TD> 15 </TD><TD> 26 </TD><TD> 04 </TD><TD> 4b </TD><TD> 26 </TD><TD> 4b </TD><TD> 26 </TD><TD> L </TD></TR><TR><TD>
|
||||
40 </TD><TD> 51 </TD><TD> 27 </TD><TD> 5c </TD><TD> 4c </TD><TD> 27 </TD><TD> 4c </TD><TD> 27 </TD><TD> ; : </TD></TR><TR><TD>
|
||||
41 </TD><TD> 52 </TD><TD> 28 </TD><TD> 68 </TD><TD> 52 </TD><TD> 28 </TD><TD> 52 </TD><TD> 28 </TD><TD> ' " </TD></TR><TR><TD>
|
||||
42 </TD><TD> 50 </TD><TD> 00 </TD><TD> ff </TD><TD> 00 </TD><TD> ff </TD><TD> 00 </TD><TD> ff </TD><TD> non-US-1 </TD></TR><TR><TD>
|
||||
43 </TD><TD> 40 </TD><TD> 1c </TD><TD> 1e </TD><TD> 5a </TD><TD> 1c </TD><TD> 5a </TD><TD> 1c </TD><TD> Enter </TD></TR><TR><TD>
|
||||
44 </TD><TD> 225 </TD><TD> 2a </TD><TD> 2f </TD><TD> 12 </TD><TD> 2a </TD><TD> 12 </TD><TD> 2a </TD><TD> LShift </TD></TR><TR><TD>
|
||||
46 </TD><TD> 29 </TD><TD> 2c </TD><TD> 14 </TD><TD> 1a </TD><TD> 2c </TD><TD> 1a </TD><TD> 2c </TD><TD> Z </TD></TR><TR><TD>
|
||||
47 </TD><TD> 27 </TD><TD> 2d </TD><TD> 13 </TD><TD> 22 </TD><TD> 2d </TD><TD> 22 </TD><TD> 2d </TD><TD> X </TD></TR><TR><TD>
|
||||
48 </TD><TD> 6 </TD><TD> 2e </TD><TD> 06 </TD><TD> 21 </TD><TD> 2e </TD><TD> 21 </TD><TD> 2e </TD><TD> C </TD></TR><TR><TD>
|
||||
49 </TD><TD> 25 </TD><TD> 2f </TD><TD> 5d </TD><TD> 2a </TD><TD> 2f </TD><TD> 2a </TD><TD> 2f </TD><TD> V </TD></TR><TR><TD>
|
||||
50 </TD><TD> 5 </TD><TD> 30 </TD><TD> 69 </TD><TD> 32 </TD><TD> 30 </TD><TD> 32 </TD><TD> 30 </TD><TD> B </TD></TR><TR><TD>
|
||||
51 </TD><TD> 17 </TD><TD> 31 </TD><TD> 31 </TD><TD> 31 </TD><TD> 31 </TD><TD> 31 </TD><TD> 31 </TD><TD> N </TD></TR><TR><TD>
|
||||
52 </TD><TD> 16 </TD><TD> 32 </TD><TD> 30 </TD><TD> 3a </TD><TD> 32 </TD><TD> 3a </TD><TD> 32 </TD><TD> M </TD></TR><TR><TD>
|
||||
53 </TD><TD> 54 </TD><TD> 33 </TD><TD> 23 </TD><TD> 41 </TD><TD> 33 </TD><TD> 41 </TD><TD> 33 </TD><TD> , < </TD></TR><TR><TD>
|
||||
54 </TD><TD> 55 </TD><TD> 34 </TD><TD> 22 </TD><TD> 49 </TD><TD> 34 </TD><TD> 49 </TD><TD> 34 </TD><TD> . > </TD></TR><TR><TD>
|
||||
55 </TD><TD> 56 </TD><TD> 35 </TD><TD> 15 </TD><TD> 4a </TD><TD> 35 </TD><TD> 4a </TD><TD> 35 </TD><TD> / ? </TD></TR><TR><TD>
|
||||
57 </TD><TD> 229 </TD><TD> 36 </TD><TD> 07 </TD><TD> 59 </TD><TD> 36 </TD><TD> 59 </TD><TD> 36 </TD><TD> RShift </TD></TR><TR><TD>
|
||||
58 </TD><TD> 224 </TD><TD> 1d </TD><TD> 11 </TD><TD> 14 </TD><TD> 1d </TD><TD> 11 </TD><TD> 38 </TD><TD> LCtrl </TD></TR><TR><TD>
|
||||
60 </TD><TD> 226 </TD><TD> 38 </TD><TD> 6a </TD><TD> 11 </TD><TD> 38 </TD><TD> 19 </TD><TD> 71 </TD><TD> LAlt </TD></TR><TR><TD>
|
||||
61 </TD><TD> 44 </TD><TD> 39 </TD><TD> 72 </TD><TD> 29 </TD><TD> 39 </TD><TD> 29 </TD><TD> 39 </TD><TD> space </TD></TR><TR><TD>
|
||||
62 </TD><TD> 230 </TD><TD> e0-38 </TD><TD> e0-6a </TD><TD> e0-11 </TD><TD> e0-38 </TD><TD> 39 </TD><TD> 72 </TD><TD> RAlt </TD></TR><TR><TD>
|
||||
64 </TD><TD> 228 </TD><TD> e0-1d </TD><TD> e0-11 </TD><TD> e0-14 </TD><TD> e0-1d </TD><TD> 58 </TD><TD> 3a </TD><TD> RCtrl </TD></TR><TR><TD>
|
||||
75 </TD><TD> 73 </TD><TD> e0-52 </TD><TD> e0-28 </TD><TD> e0-70 </TD><TD> e0-52 </TD><TD> 67 </TD><TD> 7b </TD><TD> Insert </TD></TR><TR><TD>
|
||||
76 </TD><TD> 76 </TD><TD> e0-53 </TD><TD> e0-74 </TD><TD> e0-71 </TD><TD> e0-53 </TD><TD> 64 </TD><TD> 79 </TD><TD> Delete </TD></TR><TR><TD>
|
||||
80 </TD><TD> 74 </TD><TD> e0-47 </TD><TD> e0-60 </TD><TD> e0-6c </TD><TD> e0-47 </TD><TD> 6e </TD><TD> 7f </TD><TD> Home </TD></TR><TR><TD>
|
||||
81 </TD><TD> 77 </TD><TD> e0-4f </TD><TD> e0-61 </TD><TD> e0-69 </TD><TD> e0-4f </TD><TD> 65 </TD><TD> 7a </TD><TD> End </TD></TR><TR><TD>
|
||||
85 </TD><TD> 75 </TD><TD> e0-49 </TD><TD> e0-34 </TD><TD> e0-7d </TD><TD> e0-49 </TD><TD> 6f </TD><TD> 6f </TD><TD> PgUp </TD></TR><TR><TD>
|
||||
86 </TD><TD> 78 </TD><TD> e0-51 </TD><TD> e0-73 </TD><TD> e0-7a </TD><TD> e0-51 </TD><TD> 6d </TD><TD> 7e </TD><TD> PgDn </TD></TR><TR><TD>
|
||||
79 </TD><TD> 80 </TD><TD> e0-4b </TD><TD> e0-26 </TD><TD> e0-6b </TD><TD> e0-4b </TD><TD> 61 </TD><TD> 56 </TD><TD> Left </TD></TR><TR><TD>
|
||||
83 </TD><TD> 82 </TD><TD> e0-48 </TD><TD> e0-6c </TD><TD> e0-75 </TD><TD> e0-48 </TD><TD> 63 </TD><TD> 78 </TD><TD> Up </TD></TR><TR><TD>
|
||||
84 </TD><TD> 81 </TD><TD> e0-50 </TD><TD> e0-6d </TD><TD> e0-72 </TD><TD> e0-50 </TD><TD> 60 </TD><TD> 55 </TD><TD> Down </TD></TR><TR><TD>
|
||||
89 </TD><TD> 79 </TD><TD> e0-4d </TD><TD> e0-19 </TD><TD> e0-74 </TD><TD> e0-4d </TD><TD> 6a </TD><TD> 7d </TD><TD> Right </TD></TR><TR><TD>
|
||||
90 </TD><TD> 83 </TD><TD> 45 </TD><TD> 0b </TD><TD> 77 </TD><TD> 45 </TD><TD> 76 </TD><TD> 01 </TD><TD> NumLock </TD></TR><TR><TD>
|
||||
91 </TD><TD> 95 </TD><TD> 47 </TD><TD> 60 </TD><TD> 6c </TD><TD> 47 </TD><TD> 6c </TD><TD> 47 </TD><TD> KP-7 / Home </TD></TR><TR><TD>
|
||||
92 </TD><TD> 92 </TD><TD> 4b </TD><TD> 26 </TD><TD> 6b </TD><TD> 4b </TD><TD> 6b </TD><TD> 4b </TD><TD> KP-4 / Left </TD></TR><TR><TD>
|
||||
93 </TD><TD> 89 </TD><TD> 4f </TD><TD> 61 </TD><TD> 69 </TD><TD> 4f </TD><TD> 69 </TD><TD> 4f </TD><TD> KP-1 / End </TD></TR><TR><TD>
|
||||
95 </TD><TD> 84 </TD><TD> e0-35 </TD><TD> e0-15 </TD><TD> e0-4a </TD><TD> e0-35 </TD><TD> 77 </TD><TD> 45 </TD><TD> KP-/ </TD></TR><TR><TD>
|
||||
96 </TD><TD> 96 </TD><TD> 48 </TD><TD> 6c </TD><TD> 75 </TD><TD> 48 </TD><TD> 75 </TD><TD> 48 </TD><TD> KP-8 / Up </TD></TR><TR><TD>
|
||||
97 </TD><TD> 93 </TD><TD> 4c </TD><TD> 27 </TD><TD> 73 </TD><TD> 4c </TD><TD> 73 </TD><TD> 4c </TD><TD> KP-5 </TD></TR><TR><TD>
|
||||
98 </TD><TD> 90 </TD><TD> 50 </TD><TD> 6d </TD><TD> 72 </TD><TD> 50 </TD><TD> 72 </TD><TD> 50 </TD><TD> KP-2 / Down </TD></TR><TR><TD>
|
||||
99 </TD><TD> 98 </TD><TD> 52 </TD><TD> 28 </TD><TD> 70 </TD><TD> 52 </TD><TD> 70 </TD><TD> 52 </TD><TD> KP-0 / Ins </TD></TR><TR><TD>
|
||||
100 </TD><TD> 85 </TD><TD> 37 </TD><TD> 5e </TD><TD> 7c </TD><TD> 37 </TD><TD> 7e </TD><TD> 46 </TD><TD> KP-* </TD></TR><TR><TD>
|
||||
101 </TD><TD> 97 </TD><TD> 49 </TD><TD> 34 </TD><TD> 7d </TD><TD> 49 </TD><TD> 7d </TD><TD> 49 </TD><TD> KP-9 / PgUp </TD></TR><TR><TD>
|
||||
102 </TD><TD> 94 </TD><TD> 4d </TD><TD> 19 </TD><TD> 74 </TD><TD> 4d </TD><TD> 74 </TD><TD> 4d </TD><TD> KP-6 / Right </TD></TR><TR><TD>
|
||||
103 </TD><TD> 91 </TD><TD> 51 </TD><TD> 73 </TD><TD> 7a </TD><TD> 51 </TD><TD> 7a </TD><TD> 51 </TD><TD> KP-3 / PgDn </TD></TR><TR><TD>
|
||||
104 </TD><TD> 99 </TD><TD> 53 </TD><TD> 74 </TD><TD> 71 </TD><TD> 53 </TD><TD> 71 </TD><TD> 53 </TD><TD> KP-. / Del </TD></TR><TR><TD>
|
||||
105 </TD><TD> 86 </TD><TD> 4a </TD><TD> 35 </TD><TD> 7b </TD><TD> 4a </TD><TD> 84 </TD><TD> 54 </TD><TD> KP-- </TD></TR><TR><TD>
|
||||
106 </TD><TD> 87 </TD><TD> 4e </TD><TD> 0c </TD><TD> 79 </TD><TD> 4e </TD><TD> 7c </TD><TD> 37 </TD><TD> KP-+ </TD></TR><TR><TD>
|
||||
108 </TD><TD> 88 </TD><TD> e0-1c </TD><TD> e0-1e </TD><TD> e0-5a </TD><TD> e0-1c </TD><TD> 79 </TD><TD> 4e </TD><TD> KP-Enter </TD></TR><TR><TD>
|
||||
110 </TD><TD> 41 </TD><TD> 01 </TD><TD> 43 </TD><TD> 76 </TD><TD> 01 </TD><TD> 08 </TD><TD> 64 </TD><TD> Esc </TD></TR><TR><TD>
|
||||
112 </TD><TD> 58 </TD><TD> 3b </TD><TD> 24 </TD><TD> 05 </TD><TD> 3b </TD><TD> 07 </TD><TD> 58 </TD><TD> F1 </TD></TR><TR><TD>
|
||||
113 </TD><TD> 59 </TD><TD> 3c </TD><TD> 16 </TD><TD> 06 </TD><TD> 3c </TD><TD> 0f </TD><TD> 59 </TD><TD> F2 </TD></TR><TR><TD>
|
||||
114 </TD><TD> 60 </TD><TD> 3d </TD><TD> 08 </TD><TD> 04 </TD><TD> 3d </TD><TD> 17 </TD><TD> 5a </TD><TD> F3 </TD></TR><TR><TD>
|
||||
115 </TD><TD> 61 </TD><TD> 3e </TD><TD> 09 </TD><TD> 0c </TD><TD> 3e </TD><TD> 1f </TD><TD> 5b </TD><TD> F4 </TD></TR><TR><TD>
|
||||
116 </TD><TD> 62 </TD><TD> 3f </TD><TD> 5f </TD><TD> 03 </TD><TD> 3f </TD><TD> 27 </TD><TD> 5c </TD><TD> F5 </TD></TR><TR><TD>
|
||||
117 </TD><TD> 63 </TD><TD> 40 </TD><TD> 6b </TD><TD> 0b </TD><TD> 40 </TD><TD> 2f </TD><TD> 5d </TD><TD> F6 </TD></TR><TR><TD>
|
||||
118 </TD><TD> 64 </TD><TD> 41 </TD><TD> 33 </TD><TD> 83 </TD><TD> 41 </TD><TD> 37 </TD><TD> 5e </TD><TD> F7 </TD></TR><TR><TD>
|
||||
119 </TD><TD> 65 </TD><TD> 42 </TD><TD> 25 </TD><TD> 0a </TD><TD> 42 </TD><TD> 3f </TD><TD> 5f </TD><TD> F8 </TD></TR><TR><TD>
|
||||
120 </TD><TD> 66 </TD><TD> 43 </TD><TD> 17 </TD><TD> 01 </TD><TD> 43 </TD><TD> 47 </TD><TD> 60 </TD><TD> F9 </TD></TR><TR><TD>
|
||||
121 </TD><TD> 67 </TD><TD> 44 </TD><TD> 18 </TD><TD> 09 </TD><TD> 44 </TD><TD> 4f </TD><TD> 61 </TD><TD> F10 </TD></TR><TR><TD>
|
||||
122 </TD><TD> 68 </TD><TD> 57 </TD><TD> 6e </TD><TD> 78 </TD><TD> 57 </TD><TD> 56 </TD><TD> 62 </TD><TD> F11 </TD></TR><TR><TD>
|
||||
123 </TD><TD> 69 </TD><TD> 58 </TD><TD> 3a </TD><TD> 07 </TD><TD> 58 </TD><TD> 5e </TD><TD> 63 </TD><TD> F12 </TD></TR><TR><TD>
|
||||
124 </TD><TD> 70 </TD><TD> e0-37 </TD><TD> e0-5e </TD><TD> e0-7c </TD><TD> e0-37 </TD><TD> 57 </TD><TD> 6e </TD><TD> PrtScr </TD></TR><TR><TD>
|
||||
0 </TD><TD> 154 </TD><TD> 54 </TD><TD> 1a </TD><TD> 84 </TD><TD> 54 </TD><TD> 57 </TD><TD> 6e </TD><TD> Alt+SysRq </TD></TR><TR><TD>
|
||||
125 </TD><TD> 71 </TD><TD> 46 </TD><TD> 0a </TD><TD> 7e </TD><TD> 46 </TD><TD> 5f </TD><TD> 76 </TD><TD> ScrollLock </TD></TR><TR><TD>
|
||||
126 </TD><TD> 72 </TD><TD> e1-1d-45 </TD><TD> e1-11-0b </TD><TD> e1-14-77 </TD><TD> e1-1d-45 </TD><TD> 62 </TD><TD> 77 </TD><TD> Pause </TD></TR><TR><TD>
|
||||
0 </TD><TD> 0 </TD><TD> e0-46 </TD><TD> e0-0a </TD><TD> e0-7e </TD><TD> e0-46 </TD><TD> 62 </TD><TD> 77 </TD><TD> Ctrl+Break </TD></TR><TR><TD>
|
||||
0 </TD><TD> 227 </TD><TD> e0-5b </TD><TD> e0-1b </TD><TD> e0-1f </TD><TD> e0-5b </TD><TD> 8b </TD><TD> 8b </TD><TD> LWin (USB: LGUI) </TD></TR><TR><TD>
|
||||
0 </TD><TD> 231 </TD><TD> e0-5c </TD><TD> e0-75 </TD><TD> e0-27 </TD><TD> e0-5c </TD><TD> 8c </TD><TD> 8c </TD><TD> RWin (USB: RGUI) </TD></TR><TR><TD>
|
||||
0 </TD><TD> 0 </TD><TD> e0-5d </TD><TD> e0-2b </TD><TD> e0-2f </TD><TD> e0-5d </TD><TD> 8d </TD><TD> 8d </TD><TD> Menu </TD></TR><TR><TD>
|
||||
0 </TD><TD> 0 </TD><TD> e0-5f </TD><TD> e0-76 </TD><TD> e0-3f </TD><TD> e0-5f </TD><TD> 7f </TD><TD> 54 </TD><TD> Sleep </TD></TR><TR><TD>
|
||||
0 </TD><TD> 0 </TD><TD> e0-5e </TD><TD> e0-63 </TD><TD> e0-37 </TD><TD> e0-5e </TD><TD> 00 </TD><TD> ff </TD><TD> Power </TD></TR><TR><TD>
|
||||
0 </TD><TD> 0 </TD><TD> e0-63 </TD><TD> e0-78 </TD><TD> e0-5e </TD><TD> e0-63 </TD><TD> 00 </TD><TD> ff </TD><TD> Wake </TD></TR><TR><TD>
|
||||
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P>
|
||||
<P>
|
||||
<H2><A NAME="ss9.7">9.7 Vendor extensions</A>
|
||||
</H2>
|
||||
|
||||
<P>
|
||||
<A NAME="logiteche2"></A>
|
||||
Logitech uses an <B>e2</B> prefix for the codes sent by a
|
||||
pointing device integrated on the keyboard.
|
||||
<P>
|
||||
<P>
|
||||
<P>
|
||||
<P>
|
||||
<HR>
|
||||
<A HREF="scancodes-10.html">Next</A>
|
||||
<A HREF="scancodes-8.html">Previous</A>
|
||||
<A HREF="scancodes.html#toc9">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
175
specs/kbd/scancodes.html
Normal file
@@ -0,0 +1,175 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
||||
<TITLE>Keyboard scancodes</TITLE>
|
||||
<LINK HREF="scancodes-1.html" REL=next>
|
||||
|
||||
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="scancodes-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
<HR>
|
||||
<H1>Keyboard scancodes</H1>
|
||||
|
||||
<H2>Andries Brouwer, <CODE>aeb@cwi.nl</CODE></H2>v1.2e, 2004-05-20
|
||||
<P><HR>
|
||||
<EM>This note contains some information about PC keyboard scancodes.</EM>
|
||||
<HR>
|
||||
<P>
|
||||
<H2><A NAME="toc1">1.</A> <A HREF="scancodes-1.html">Keyboard scancodes</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="scancodes-1.html#ss1.1">1.1 Key release</A>
|
||||
<LI><A HREF="scancodes-1.html#ss1.2">1.2 Protocol scancodes</A>
|
||||
<LI><A HREF="scancodes-1.html#ss1.3">1.3 Escape scancodes</A>
|
||||
<LI><A HREF="scancodes-1.html#ss1.4">1.4 Ordinary scancodes</A>
|
||||
<LI><A HREF="scancodes-1.html#ss1.5">1.5 Escaped scancodes</A>
|
||||
<LI><A HREF="scancodes-1.html#ss1.6">1.6 Fake shifts</A>
|
||||
<LI><A HREF="scancodes-1.html#ss1.7">1.7 Added non-fake shifts</A>
|
||||
<LI><A HREF="scancodes-1.html#ss1.8">1.8 Turbo Mode</A>
|
||||
<LI><A HREF="scancodes-1.html#ss1.9">1.9 Power Saving</A>
|
||||
<LI><A HREF="scancodes-1.html#ss1.10">1.10 Initializing special keyboards</A>
|
||||
<LI><A HREF="scancodes-1.html#ss1.11">1.11 Manipulating extra LEDs</A>
|
||||
<LI><A HREF="scancodes-1.html#ss1.12">1.12 The laptop FN key</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc2">2.</A> <A HREF="scancodes-2.html">Special keyboards - XT keyboards</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="scancodes-2.html#ss2.1">2.1 XT keyboard</A>
|
||||
<LI><A HREF="scancodes-2.html#ss2.2">2.2 Victor keyboard</A>
|
||||
<LI><A HREF="scancodes-2.html#ss2.3">2.3 Olivetti M24 keyboard</A>
|
||||
<LI><A HREF="scancodes-2.html#ss2.4">2.4 Telerate keyboard</A>
|
||||
<LI><A HREF="scancodes-2.html#ss2.5">2.5 NCR keyboard</A>
|
||||
<LI><A HREF="scancodes-2.html#ss2.6">2.6 Cherry G80-0777</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc3">3.</A> <A HREF="scancodes-3.html">Special keyboards - Amstrad/Schneider keyboards</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="scancodes-3.html#ss3.1">3.1 Amstrad/Schneider PC1512</A>
|
||||
<LI><A HREF="scancodes-3.html#ss3.2">3.2 Amstrad/Schneider other models</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc4">4.</A> <A HREF="scancodes-4.html">Special keyboards - AT keyboards</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc5">5.</A> <A HREF="scancodes-5.html">Special keyboards - MF II keyboards</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="scancodes-5.html#ss5.1">5.1 Compaq keyboards</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.2">5.2 IBM keyboards</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.3">5.3 Logitech keyboards</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.4">5.4 Microsoft keyboards</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.5">5.5 Safeway keyboards</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.6">5.6 Internet Wireless Keyboard</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.7">5.7 Nokia keyboard</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.8">5.8 Focus KeyPro FK-9000 keyboard</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.9">5.9 BTC keyboard</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.10">5.10 LK411 and LK450 keyboards</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.11">5.11 An OmniKey keyboard</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.12">5.12 GRiD 2260 keyboard</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.13">5.13 An old Olivetti keyboard</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.14">5.14 Cherry G81-3000</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.15">5.15 Accord keyboard</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.16">5.16 Trust Ergonomic keyboard</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.17">5.17 Brazilian keyboards</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.18">5.18 RC930 keyboard</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.19">5.19 Tandberg Data keyboard</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.20">5.20 Host Connected keyboard</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.21">5.21 A nameless USB keyboard</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.22">5.22 Omnibook keyboard</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.23">5.23 EZ Button keyboard</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.24">5.24 Chicony KBP-8993 keyboard</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.25">5.25 Keyboards for HP Kayak and Vectra</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.26">5.26 A keyboard</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.27">5.27 Yahoo! keyboard</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.28">5.28 Honeywell Multimedia Keyboard</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.29">5.29 Samsung Ergonomics Keyboard</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.30">5.30 The "LiteOn MediaTouch Keyboard" type SK-2500</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.31">5.31 The Acer Aspire 1310LC laptop</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.32">5.32 The Emachines eKB-5190(A) keyboard</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.33">5.33 Keyboards with many keys</A>
|
||||
<LI><A HREF="scancodes-5.html#ss5.34">5.34 A keyboard treating PrtSc/SysRq like Pause/Break</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc6">6.</A> <A HREF="scancodes-6.html">NCD keyboards</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="scancodes-6.html#ss6.1">6.1 A Japanese keyboard using e0 as ordinary scancode</A>
|
||||
<LI><A HREF="scancodes-6.html#ss6.2">6.2 The NCD N-123NA keyboard</A>
|
||||
<LI><A HREF="scancodes-6.html#ss6.3">6.3 The NCD N-123UX keyboard</A>
|
||||
<LI><A HREF="scancodes-6.html#ss6.4">6.4 The NCD N-97 keyboard</A>
|
||||
<LI><A HREF="scancodes-6.html#ss6.5">6.5 NCD X terminals</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc7">7.</A> <A HREF="scancodes-7.html">Japanese keyboards</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="scancodes-7.html#ss7.1">7.1 Japanese 86/106 keyboards</A>
|
||||
<LI><A HREF="scancodes-7.html#ss7.2">7.2 Description of the all-Japanese keys</A>
|
||||
<LI><A HREF="scancodes-7.html#ss7.3">7.3 A Japanese keyboard that imitates a US one</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc8">8.</A> <A HREF="scancodes-8.html">Korean keyboards</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="scancodes-8.html#ss8.1">8.1 An A4tech keyboard</A>
|
||||
<LI><A HREF="scancodes-8.html#ss8.2">8.2 The DEC LK201-K</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc9">9.</A> <A HREF="scancodes-9.html">Keyboard-internal scancodes</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="scancodes-9.html#ss9.1">9.1 Three scancode sets</A>
|
||||
<LI><A HREF="scancodes-9.html#ss9.2">9.2 Make and Break codes</A>
|
||||
<LI><A HREF="scancodes-9.html#ss9.3">9.3 Translation</A>
|
||||
<LI><A HREF="scancodes-9.html#ss9.4">9.4 Correspondence</A>
|
||||
<LI><A HREF="scancodes-9.html#ss9.5">9.5 Use</A>
|
||||
<LI><A HREF="scancodes-9.html#ss9.6">9.6 A table</A>
|
||||
<LI><A HREF="scancodes-9.html#ss9.7">9.7 Vendor extensions</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc10">10.</A> <A HREF="scancodes-10.html">The AT keyboard controller</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="scancodes-10.html#ss10.1">10.1 The keyboard controller status register</A>
|
||||
<LI><A HREF="scancodes-10.html#ss10.2">10.2 The keyboard controller command byte</A>
|
||||
<LI><A HREF="scancodes-10.html#ss10.3">10.3 Keyboard controller commands</A>
|
||||
<LI><A HREF="scancodes-10.html#ss10.4">10.4 The input port P1</A>
|
||||
<LI><A HREF="scancodes-10.html#ss10.5">10.5 The output port P2</A>
|
||||
<LI><A HREF="scancodes-10.html#ss10.6">10.6 The test port T</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc11">11.</A> <A HREF="scancodes-11.html">Keyboard commands</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="scancodes-11.html#ss11.1">11.1 Keyboard command details</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc12">12.</A> <A HREF="scancodes-12.html">The PS/2 Mouse</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="scancodes-12.html#ss12.1">12.1 Modes</A>
|
||||
<LI><A HREF="scancodes-12.html#ss12.2">12.2 Scaling</A>
|
||||
<LI><A HREF="scancodes-12.html#ss12.3">12.3 PS/2 mouse protocol</A>
|
||||
<LI><A HREF="scancodes-12.html#ss12.4">12.4 Mouse Commands</A>
|
||||
<LI><A HREF="scancodes-12.html#ss12.5">12.5 Sliced parameters</A>
|
||||
<LI><A HREF="scancodes-12.html#ss12.6">12.6 Synaptics Touchpad</A>
|
||||
<LI><A HREF="scancodes-12.html#ss12.7">12.7 Vendor extensions</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc13">13.</A> <A HREF="scancodes-13.html">USB</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc14">14.</A> <A HREF="scancodes-14.html">Reporting</A></H2>
|
||||
|
||||
<HR>
|
||||
<A HREF="scancodes-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
</BODY>
|
||||
</HTML>
|
||||
BIN
specs/kbd/sk2500.jpg
Normal file
|
After Width: | Height: | Size: 10 KiB |
170
specs/kbd/table.h
Normal file
@@ -0,0 +1,170 @@
|
||||
/* Scancode stuff - aeb, 991216 */
|
||||
|
||||
/* translation from keyboard to scancode - the 8042 table */
|
||||
|
||||
unsigned char ttable[256] = {
|
||||
0xff,0x43,0x41,0x3f,0x3d,0x3b,0x3c,0x58,0x64,0x44,0x42,0x40,0x3e,0x0f,0x29,0x59,
|
||||
0x65,0x38,0x2a,0x70,0x1d,0x10,0x02,0x5a,0x66,0x71,0x2c,0x1f,0x1e,0x11,0x03,0x5b,
|
||||
0x67,0x2e,0x2d,0x20,0x12,0x05,0x04,0x5c,0x68,0x39,0x2f,0x21,0x14,0x13,0x06,0x5d,
|
||||
0x69,0x31,0x30,0x23,0x22,0x15,0x07,0x5e,0x6a,0x72,0x32,0x24,0x16,0x08,0x09,0x5f,
|
||||
0x6b,0x33,0x25,0x17,0x18,0x0b,0x0a,0x60,0x6c,0x34,0x35,0x26,0x27,0x19,0x0c,0x61,
|
||||
0x6d,0x73,0x28,0x74,0x1a,0x0d,0x62,0x6e,0x3a,0x36,0x1c,0x1b,0x75,0x2b,0x63,0x76,
|
||||
0x55,0x56,0x77,0x78,0x79,0x7a,0x0e,0x7b,0x7c,0x4f,0x7d,0x4b,0x47,0x7e,0x7f,0x6f,
|
||||
0x52,0x53,0x50,0x4c,0x4d,0x48,0x01,0x45,0x57,0x4e,0x51,0x4a,0x37,0x49,0x46,0x54,
|
||||
0x80,0x81,0x82,0x41,0x54,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,
|
||||
0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f,
|
||||
0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,
|
||||
0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf,
|
||||
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,
|
||||
0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xdf,
|
||||
0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef,
|
||||
0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff
|
||||
};
|
||||
|
||||
/* some entries guessed - see scancodes.sgml */
|
||||
|
||||
|
||||
/* Untranslated scancodes, and USB key values.
|
||||
For translated values, feed through ttable[].
|
||||
|
||||
I also included Vojtech Pavlik's scancodes.h in this directory.
|
||||
It mostly agrees with this table, but lacks
|
||||
Microsoft Internet keys, and misses some set1 values. */
|
||||
|
||||
struct keycode {
|
||||
unsigned int position, usb, set1, set2, set3;
|
||||
char *name; /* keycap on a standard US keyboard */
|
||||
} keycodes[] = {
|
||||
1, 53, 0x29, 0x0e, 0x0e, "`~",
|
||||
2, 30, 0x02, 0x16, 0x16, "1!",
|
||||
3, 31, 0x03, 0x1e, 0x1e, "2@",
|
||||
4, 32, 0x04, 0x26, 0x26, "3#",
|
||||
5, 33, 0x05, 0x25, 0x25, "4$",
|
||||
6, 34, 0x06, 0x2e, 0x2e, "5%E",
|
||||
7, 35, 0x07, 0x36, 0x36, "6^",
|
||||
8, 36, 0x08, 0x3d, 0x3d, "7&",
|
||||
9, 37, 0x09, 0x3e, 0x3e, "8*",
|
||||
10, 38, 0x0a, 0x46, 0x46, "9(",
|
||||
11, 39, 0x0b, 0x45, 0x45, "0)",
|
||||
12, 45, 0x0c, 0x4e, 0x4e, "-_",
|
||||
13, 46, 0x0d, 0x55, 0x55, "=+",
|
||||
15, 42, 0x0e, 0x66, 0x66, "Backspace",
|
||||
|
||||
16, 43, 0x0f, 0x0d, 0x0d, "Tab",
|
||||
17, 20, 0x10, 0x15, 0x15, "Q",
|
||||
18, 26, 0x11, 0x1d, 0x1d, "W",
|
||||
19, 8, 0x12, 0x24, 0x24, "E",
|
||||
20, 21, 0x13, 0x2d, 0x2d, "R",
|
||||
21, 23, 0x14, 0x2c, 0x2c, "T",
|
||||
22, 28, 0x15, 0x35, 0x35, "Y",
|
||||
23, 24, 0x16, 0x3c, 0x3c, "U",
|
||||
24, 12, 0x17, 0x43, 0x43, "I",
|
||||
25, 18, 0x18, 0x44, 0x44, "O",
|
||||
26, 19, 0x19, 0x4d, 0x4d, "P",
|
||||
27, 47, 0x1a, 0x54, 0x54, "[{",
|
||||
28, 48, 0x1b, 0x5b, 0x5b, "]}",
|
||||
29, 49, 0x2b, 0x5d, 0x5c, "\\|",
|
||||
|
||||
30, 57, 0x3a, 0x58, 0x14, "CapsLock",
|
||||
31, 04, 0x1e, 0x1c, 0x1c, "A",
|
||||
32, 22, 0x1f, 0x1b, 0x1b, "S",
|
||||
33, 7, 0x20, 0x23, 0x23, "D",
|
||||
34, 9, 0x21, 0x2b, 0x2b, "F",
|
||||
35, 10, 0x22, 0x34, 0x34, "G",
|
||||
36, 11, 0x23, 0x33, 0x33, "H",
|
||||
37, 13, 0x24, 0x3b, 0x3b, "J",
|
||||
38, 14, 0x25, 0x42, 0x42, "K",
|
||||
39, 15, 0x26, 0x4b, 0x4b, "L",
|
||||
40, 51, 0x27, 0x4c, 0x4c, ";:",
|
||||
41, 52, 0x28, 0x52, 0x52, "'\"",
|
||||
42, 50, 0, 0, 0, "non-US-1",
|
||||
43, 40, 0x1c, 0x5a, 0x5a, "Enter",
|
||||
|
||||
44, 225, 0x2a, 0x12, 0x12, "LShift",
|
||||
46, 29, 0x2c, 0x1a, 0x1a, "Z",
|
||||
47, 27, 0x2d, 0x22, 0x22, "X",
|
||||
48, 6, 0x2e, 0x21, 0x21, "C",
|
||||
49, 25, 0x2f, 0x2a, 0x2a, "V",
|
||||
50, 5, 0x30, 0x32, 0x32, "B",
|
||||
51, 17, 0x31, 0x31, 0x31, "N",
|
||||
52, 16, 0x32, 0x3a, 0x3a, "M",
|
||||
53, 54, 0x33, 0x41, 0x41, ",<",
|
||||
54, 55, 0x34, 0x49, 0x49, ".>",
|
||||
55, 56, 0x35, 0x4a, 0x4a, "/?",
|
||||
57, 229, 0x36, 0x59, 0x59, "RShift",
|
||||
|
||||
58, 224, 0x1d, 0x14, 0x11, "LCtrl",
|
||||
60, 226, 0x38, 0x11, 0x19, "LAlt",
|
||||
61, 44, 0x39, 0x29, 0x29, "space",
|
||||
62, 230, 0xe038, 0xe011, 0x39, "RAlt",
|
||||
64, 228, 0xe01d, 0xe014, 0x58, "RCtrl",
|
||||
|
||||
75, 73, 0xe052, 0xe070, 0x67, "Insert",
|
||||
76, 76, 0xe053, 0xe071, 0x64, "Delete",
|
||||
80, 74, 0xe047, 0xe06c, 0x6e, "Home",
|
||||
81, 77, 0xe04f, 0xe069, 0x65, "End",
|
||||
85, 75, 0xe049, 0xe07d, 0x6f, "PgUp",
|
||||
86, 78, 0xe051, 0xe07a, 0x6d, "PgDn",
|
||||
|
||||
79, 80, 0xe04b, 0xe06b, 0x61, "Left",
|
||||
83, 82, 0xe048, 0xe075, 0x63, "Up",
|
||||
84, 81, 0xe050, 0xe072, 0x60, "Down",
|
||||
89, 79, 0xe04d, 0xe074, 0x6a, "Right",
|
||||
|
||||
90, 83, 0x45, 0x77, 0x76, "NumLock",
|
||||
91, 95, 0x47, 0x6c, 0x6c, "KP-7 / Home",
|
||||
92, 92, 0x4b, 0x6b, 0x6b, "KP-4 / Left",
|
||||
93, 89, 0x4f, 0x69, 0x69, "KP-1 / End",
|
||||
95, 84, 0xe035, 0xe04a, 0x77, "KP-/",
|
||||
96, 96, 0x48, 0x75, 0x75, "KP-8 / Up",
|
||||
97, 93, 0x4c, 0x73, 0x73, "KP-5",
|
||||
98, 90, 0x50, 0x72, 0x72, "KP-2",
|
||||
99, 98, 0x52, 0x70, 0x70, "KP-0 / Ins",
|
||||
100, 85, 0x37, 0x7c, 0x7e, "KP-*",
|
||||
101, 97, 0x49, 0x7d, 0x7d, "KP-9",
|
||||
102, 94, 0x4d, 0x74, 0x74, "KP-6 / Right",
|
||||
103, 91, 0x51, 0x7a, 0x7a, "KP-3 / PgDn",
|
||||
104, 99, 0x53, 0x71, 0x71, "KP-. / Del",
|
||||
105, 86, 0x4a, 0x7b, 0x84, "KP--",
|
||||
106, 87, 0x4e, 0x79, 0x7c, "KP-+",
|
||||
108, 88, 0xe01c, 0xe05a, 0x79, "KP-Enter",
|
||||
|
||||
110, 41, 0x01, 0x76, 0x08, "Esc",
|
||||
112, 58, 0x3b, 0x05, 0x07, "F1",
|
||||
113, 59, 0x3c, 0x06, 0x0f, "F2",
|
||||
114, 60, 0x3d, 0x04, 0x17, "F3",
|
||||
115, 61, 0x3e, 0x0c, 0x1f, "F4",
|
||||
116, 62, 0x3f, 0x03, 0x27, "F5",
|
||||
117, 63, 0x40, 0x0b, 0x2f, "F6",
|
||||
118, 64, 0x41, 0x83, 0x37, "F7", /* Vojtech has 0x02 in set2 */
|
||||
119, 65, 0x42, 0x0a, 0x3f, "F8",
|
||||
120, 66, 0x43, 0x01, 0x47, "F9",
|
||||
121, 67, 0x44, 0x09, 0x4f, "F10",
|
||||
122, 68, 0x57, 0x78, 0x56, "F11",
|
||||
123, 69, 0x58, 0x07, 0x5e, "F12",
|
||||
|
||||
124, 70, 0xe037, 0xe07c, 0x57, "PrtScr",
|
||||
0, 154, 0x54, 0x84, 0x57, "Alt+SysRq",
|
||||
125, 71, 0x46, 0x7e, 0x5f, "ScrollLock",
|
||||
126, 72, 0xe11d45, 0xe11477, 0x62, "Pause",
|
||||
0, 0, 0xe046, 0xe07e, 0x62, "Ctrl+Break",
|
||||
|
||||
/* Microsoft Windows and Internet keys and Power keys */
|
||||
0, 227, 0xe05b, 0xe01f, 0x8b, "LWin (USB: LGUI)",
|
||||
0, 231, 0xe05c, 0xe027, 0x8c, "RWin (USB: RGUI)",
|
||||
0, 0, 0xe05d, 0xe02f, 0x8d, "Menu",
|
||||
|
||||
0, 0, 0xe06a, 0xe038, 0x38, "Back",
|
||||
0, 0, 0xe069, 0xe030, 0x30, "Forward",
|
||||
0, 0, 0xe068, 0xe028, 0x28, "Stop",
|
||||
0, 0, 0xe06c, 0xe048, 0x48, "Mail",
|
||||
0, 0, 0xe065, 0xe010, 0x10, "Search",
|
||||
0, 0, 0xe066, 0xe018, 0x18, "Favorites",
|
||||
0, 0, 0xe032, 0xe03a, 0x97, "Web / Home",
|
||||
|
||||
0, 0, 0xe06b, 0xe040, 0x40, "My Computer",
|
||||
0, 0, 0xe021, 0xe02b, 0x99, "Calculator",
|
||||
0, 0, 0xe05f, 0xe03f, 0x7f, "Sleep",
|
||||
0, 0, 0xe05e, 0xe037, 0, "Power",
|
||||
0, 0, 0xe063, 0xe05e, 0, "Wake",
|
||||
};
|
||||
BIN
specs/kbd/telerate-s.jpg
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
specs/kbd/telerate.jpg
Normal file
|
After Width: | Height: | Size: 70 KiB |
BIN
specs/kbd/victor-s.jpg
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
specs/kbd/victor.jpg
Normal file
|
After Width: | Height: | Size: 149 KiB |
BIN
specs/kbd/xt-at-switch.jpg
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
specs/kbd/xtkbd-s.jpg
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
specs/kbd/xtkbd.jpg
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
specs/kbd/yahoo912.jpg
Normal file
|
After Width: | Height: | Size: 28 KiB |
1184
specs/sysv-abi-update.html/ch4.eheader.html
Normal file
252
specs/sysv-abi-update.html/ch4.intro.html
Normal file
@@ -0,0 +1,252 @@
|
||||
<html>
|
||||
<title>Chapter 4: Object Files</title>
|
||||
<h1>Introduction</h1>
|
||||
This chapter describes the
|
||||
object file format, called ELF (Executable and Linking Format).
|
||||
There are three main types of object files.
|
||||
<ul>
|
||||
<p><li>
|
||||
A <i>relocatable file</i>
|
||||
holds code and data suitable for linking
|
||||
with other object files to create an executable
|
||||
or a shared object file.
|
||||
<p><li>
|
||||
An <i>executable file</i>
|
||||
holds a program suitable for execution;
|
||||
the file specifies how
|
||||
<code>exec</code>(BA_OS)
|
||||
creates a program's process image.
|
||||
<p><li>
|
||||
A
|
||||
<i>shared object file</i>
|
||||
holds code and data suitable for linking
|
||||
in two contexts.
|
||||
First, the link editor [see <code>ld</code>(BA_OS)]
|
||||
processes the shared object file with other relocatable
|
||||
and shared object files to create another object file.
|
||||
Second, the dynamic linker combines it with an executable file and other
|
||||
shared objects to create a process image.
|
||||
</ul>
|
||||
<p>
|
||||
Created by the assembler and link editor, object files are binary
|
||||
representations of programs intended to be executed directly on
|
||||
a processor. Programs that require other abstract machines, such
|
||||
as shell scripts, are excluded.
|
||||
</p>
|
||||
<p>
|
||||
After the introductory material, this chapter focuses on the file
|
||||
format and how it pertains to building programs. Chapter 5 also
|
||||
describes parts of the object file, concentrating on the information
|
||||
necessary to execute a program.
|
||||
</p>
|
||||
<a name=file_format></a>
|
||||
<h2>File Format</h2><p>
|
||||
Object files participate in program linking (building a program)
|
||||
and program execution (running a program). For convenience and
|
||||
efficiency, the object file format provides parallel views of a file's
|
||||
contents, reflecting the differing needs of those activities.
|
||||
Figure 4-1 shows an object file's organization.
|
||||
<hr>
|
||||
<b>Figure 4-1: Object File Format</b>
|
||||
<p>
|
||||
<table>
|
||||
<tr><td width="250">
|
||||
<table border=1 cellspacing=0>
|
||||
<caption align=bottom><b>Linking View</b></caption>
|
||||
<tr><td align=center>ELF Header</td></tr>
|
||||
<tr><td align=center>Program header table<br><i>optional</i></td></tr>
|
||||
<tr><td align=center>Section 1</td></tr>
|
||||
<tr><td align=center>...</td></tr>
|
||||
<tr><td align=center>Section n</td></tr>
|
||||
<tr><td align=center>...</td></tr>
|
||||
<tr><td align=center>Section header table<br><i>required</i></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
<td>
|
||||
<table border=1 cellspacing=0>
|
||||
<caption align=bottom><b>Execution View</b></caption>
|
||||
<tr><td align=center>ELF Header</td></tr>
|
||||
<tr><td align=center>Program header table<br><i>required</i></td></tr>
|
||||
<tr><td align=center>Segment 1<br></td></tr>
|
||||
<tr><td align=center>Segment 2<br></td></tr>
|
||||
<tr><td align=center>Segment 3<br></td></tr>
|
||||
<tr><td align=center>...</td></tr>
|
||||
<tr><td align=center>Section header table<br><i>optional</i></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr>
|
||||
<p>
|
||||
An <i>ELF header</i> resides at the beginning and
|
||||
holds a ``road map''
|
||||
describing the file's organization. <i>Sections</i> hold the bulk
|
||||
of object file information for the linking view: instructions,
|
||||
data, symbol table, relocation information, and so on.
|
||||
Descriptions of special sections appear later in the chapter.
|
||||
Chapter 5 discusses <i>segments</i> and the program execution
|
||||
view of the file.
|
||||
</p>
|
||||
<p>
|
||||
A <i>program header table</i> tells the system how to create a process image.
|
||||
Files used to build a process image (execute a program)
|
||||
must have a program header table; relocatable files do not need one.
|
||||
A <i>section header table</i>
|
||||
contains information describing the file's sections.
|
||||
Every section has an entry in the table; each entry
|
||||
gives information such as the section name, the
|
||||
section size, and so on.
|
||||
Files used during linking must have a section header table;
|
||||
other object files may or may not have one.
|
||||
<p><hr>
|
||||
<img src=warning.gif alt="NOTE:">
|
||||
Although the figure shows the program header table
|
||||
immediately after the ELF header, and the section header table
|
||||
following the sections, actual files may differ.
|
||||
Moreover, sections and segments have no specified order.
|
||||
Only the ELF header has a fixed position in the file.
|
||||
<hr><p>
|
||||
<a name=data_representation></a>
|
||||
<h2>Data Representation</h2><p>
|
||||
As described here, the object file
|
||||
format
|
||||
supports various processors with 8-bit bytes
|
||||
and either 32-bit or 64-bit architectures.
|
||||
Nevertheless, it is intended to be extensible to larger
|
||||
(or smaller) architectures.
|
||||
Object files therefore represent some control data
|
||||
with a machine-independent format,
|
||||
making it possible to identify object files and
|
||||
interpret their contents in a common way.
|
||||
Remaining data in an object file
|
||||
use the encoding of the target processor, regardless of
|
||||
the machine on which the file was created.
|
||||
<hr>
|
||||
<b>Figure 4-2: 32-Bit Data Types</b>
|
||||
<p>
|
||||
<table border=1 cellspacing=0>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Size</th>
|
||||
<th>Alignment</th>
|
||||
<th>Purpose</th>
|
||||
<tr>
|
||||
<td><code>Elf32_Addr</code></td>
|
||||
<TD align=center><code>4</code></td>
|
||||
<TD align=center><code>4</code></td>
|
||||
<td>Unsigned program address</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>Elf32_Off</code></td>
|
||||
<TD align=center><code>4</code></td>
|
||||
<TD align=center><code>4</code></td>
|
||||
<td>Unsigned file offset</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>Elf32_Half</code></td>
|
||||
<td align=center><code>2</code></td>
|
||||
<td align=center><code>2</code></td>
|
||||
<td>Unsigned medium integer</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>Elf32_Word</code></td>
|
||||
<TD align=center><code>4</code></td>
|
||||
<TD align=center><code>4</code></td>
|
||||
<td>Unsigned integer</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>Elf32_Sword</code></td>
|
||||
<TD align=center><code>4</code></td>
|
||||
<TD align=center><code>4</code></td>
|
||||
<td>Signed integer</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>unsigned char</code></td>
|
||||
<TD align=center><code>1</code></td>
|
||||
<TD align=center><code>1</code></td>
|
||||
<td>Unsigned small integer</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
<b>64-Bit Data Types</b>
|
||||
<p>
|
||||
<table border cellspacing=0>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Size</th>
|
||||
<th>Alignment</th>
|
||||
<th>Purpose</th>
|
||||
<tr>
|
||||
<td><code>Elf64_Addr</code></td>
|
||||
<TD align=center><code>8</code></td>
|
||||
<TD align=center><code>8</code></td>
|
||||
<td>Unsigned program address</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>Elf64_Off</code></td>
|
||||
<TD align=center><code>8</code></td>
|
||||
<TD align=center><code>8</code></td>
|
||||
<td>Unsigned file offset</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>Elf64_Half</code></td>
|
||||
<TD align=center><code>2</code></td>
|
||||
<TD align=center><code>2</code></td>
|
||||
<td>Unsigned medium integer</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>Elf64_Word</code></td>
|
||||
<td align=center><code>4</code></td>
|
||||
<td align=center><code>4</code></td>
|
||||
<td>Unsigned integer</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>Elf64_Sword</code></td>
|
||||
<td align=center><code>4</code></td>
|
||||
<td align=center><code>4</code></td>
|
||||
<td>Signed integer</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>Elf64_Xword</code></td>
|
||||
<td align=center><code>8</code></td>
|
||||
<td align=center><code>8</code></td>
|
||||
<td>Unsigned long integer</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>Elf64_Sxword</code></td>
|
||||
<td align=center><code>8</code></td>
|
||||
<td align=center><code>8</code></td>
|
||||
<td>Signed long integer</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>unsigned char</code></td>
|
||||
<td align=center><code>1</code></td>
|
||||
<td align=center><code>1</code></td>
|
||||
<td>Unsigned small integer</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
<hr>
|
||||
All data structures that the object file format
|
||||
defines follow the ``natural'' size and alignment guidelines
|
||||
for the relevant class.
|
||||
If necessary, data structures contain explicit padding to
|
||||
ensure 8-byte alignment for 8-byte objects,
|
||||
4-byte alignment for 4-byte objects, to force
|
||||
structure sizes to a multiple of 4 or 8, and so forth.
|
||||
Data also have suitable alignment from the beginning of the file.
|
||||
Thus, for example, a structure containing an
|
||||
<code>Elf32_Addr</code>
|
||||
member will be aligned on a 4-byte boundary within the file.
|
||||
<p>
|
||||
For portability reasons, ELF uses no bit-fields.
|
||||
<hr>
|
||||
<a href=contents.html><img src=contents.gif alt="Contents">
|
||||
<a href=ch4.eheader.html><img src=next.gif alt="Next"></a>
|
||||
<hr>
|
||||
<i>
|
||||
<small>
|
||||
© 1997, 1998, 1999, 2000, 2001 The Santa Cruz Operation, Inc. All rights reserved.
|
||||
</small>
|
||||
</i>
|
||||
</html>
|
||||
180
specs/sysv-abi-update.html/ch4.reloc.html
Normal file
@@ -0,0 +1,180 @@
|
||||
<html>
|
||||
<title>Relocation</title><p>
|
||||
<h1>Relocation</h1><p>
|
||||
Relocation is the process of connecting symbolic references
|
||||
with symbolic definitions.
|
||||
For example, when a program calls a function, the associated call
|
||||
instruction must transfer control to the proper destination address
|
||||
at execution.
|
||||
Relocatable files must have
|
||||
``relocation entries'' which
|
||||
are necessary because they contain information that
|
||||
describes how to modify their section contents, thus allowing
|
||||
executable and shared object files to hold
|
||||
the right information for a process's program image.
|
||||
<hr>
|
||||
<b>Figure 4-21: Relocation Entries</b>
|
||||
<p>
|
||||
<pre>
|
||||
<code>
|
||||
typedef struct {
|
||||
Elf32_Addr r_offset;
|
||||
Elf32_Word r_info;
|
||||
} Elf32_Rel;
|
||||
|
||||
typedef struct {
|
||||
Elf32_Addr r_offset;
|
||||
Elf32_Word r_info;
|
||||
Elf32_Sword r_addend;
|
||||
} Elf32_Rela;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Addr r_offset;
|
||||
Elf64_Xword r_info;
|
||||
} Elf64_Rel;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Addr r_offset;
|
||||
Elf64_Xword r_info;
|
||||
Elf64_Sxword r_addend;
|
||||
} Elf64_Rela;
|
||||
</code>
|
||||
</pre>
|
||||
<hr>
|
||||
<DL COMPACT>
|
||||
<p><dt><code>r_offset</code><dd>
|
||||
This member gives the location at which to apply the
|
||||
relocation action.
|
||||
For a relocatable file,
|
||||
the value is the byte offset from the beginning of the section
|
||||
to the storage unit affected by the relocation.
|
||||
For an executable file or a shared object,
|
||||
the value is the virtual address
|
||||
of the storage unit affected by the relocation.
|
||||
<p><dt><code>r_info</code><dd>
|
||||
This member gives both the symbol table index with respect to which
|
||||
the relocation must be made, and the type of relocation to apply.
|
||||
For example, a call instruction's relocation entry
|
||||
would hold the symbol table index of the function being called.
|
||||
If the index is <code>STN_UNDEF</code>,
|
||||
the undefined symbol index,
|
||||
the relocation uses 0 as the ``symbol value''.
|
||||
Relocation types are processor-specific;
|
||||
descriptions of their behavior appear in the processor
|
||||
supplement.
|
||||
When the text below refers to a relocation entry's
|
||||
relocation type or symbol table index, it means the result of applying
|
||||
<code>ELF32_R_TYPE</code> (or <code>ELF64_R_TYPE</code>) or <code>ELF32_R_SYM</code> (or <code>ELF64_R_SYM</code>),
|
||||
respectively, to the entry's <code>r_info</code> member.
|
||||
<hr>
|
||||
<PRE>
|
||||
#define ELF32_R_SYM(i) ((i)>>8)
|
||||
#define ELF32_R_TYPE(i) ((unsigned char)(i))
|
||||
#define ELF32_R_INFO(s,t) (((s)<<8)+(unsigned char)(t))
|
||||
|
||||
#define ELF64_R_SYM(i) ((i)>>32)
|
||||
#define ELF64_R_TYPE(i) ((i)&0xffffffffL)
|
||||
#define ELF64_R_INFO(s,t) (((s)<<32)+((t)&0xffffffffL))
|
||||
</PRE>
|
||||
<hr>
|
||||
<p><dt><code>r_addend</code><dd>
|
||||
This member specifies a constant addend used to
|
||||
compute the value to be stored into the relocatable field.
|
||||
</dl>
|
||||
<p>
|
||||
As specified previously, only
|
||||
<code>Elf32_Rela</code> and <code>Elf64_Rela</code>
|
||||
entries contain an explicit addend.
|
||||
Entries of type <code>Elf32_Rel</code> and <code>Elf64_Rel</code>
|
||||
store an implicit addend in the location to be modified.
|
||||
Depending on the processor architecture, one form or the other
|
||||
might be necessary or more convenient.
|
||||
Consequently, an implementation for a particular machine
|
||||
may use one form exclusively or either form depending on context.
|
||||
<p>
|
||||
A relocation section references two other sections:
|
||||
a symbol table and a section to modify.
|
||||
The section header's <code>sh_info</code> and <code>sh_link</code>
|
||||
members, described in
|
||||
<a href=ch4.sheader.html>``Sections''</a>
|
||||
above, specify these relationships.
|
||||
Relocation entries for different object files have
|
||||
slightly different interpretations for the
|
||||
<code>r_offset</code> member.
|
||||
<p>
|
||||
<ul>
|
||||
<p><li>
|
||||
In relocatable files, <code>r_offset</code>
|
||||
holds a section offset.
|
||||
The relocation section itself describes how to
|
||||
modify another section in the file; relocation offsets
|
||||
designate a storage unit within the second section.
|
||||
<p><li>
|
||||
In executable and shared object files,
|
||||
<code>r_offset</code> holds a virtual address.
|
||||
To make these files' relocation entries more useful
|
||||
for the dynamic linker, the section offset (file interpretation)
|
||||
gives way to a virtual address (memory interpretation).
|
||||
</ul>
|
||||
Although the interpretation of <code>r_offset</code>
|
||||
changes for different object files to
|
||||
allow efficient access by the relevant programs,
|
||||
the relocation types' meanings stay the same.
|
||||
<p>
|
||||
<a name="relocation_composition"></a>
|
||||
The typical application of an ELF relocation is to determine the
|
||||
referenced symbol value, extract the addend (either from the
|
||||
field to be relocated or from the addend field contained in
|
||||
the relocation record, as appropriate for the type of relocation
|
||||
record), apply the expression implied by the relocation type
|
||||
to the symbol and addend, extract the desired part of the expression
|
||||
result, and place it in the field to be relocated.
|
||||
<p>
|
||||
If multiple <i>consecutive</i> relocation records are applied
|
||||
to the same relocation location (<code>r_offset</code>),
|
||||
they are <i>composed</i> instead
|
||||
of being applied independently, as described above.
|
||||
By <i>consecutive</i>, we mean that the relocation records are
|
||||
contiguous within a single relocation section. By <i>composed</i>,
|
||||
we mean that the standard application described above is modified
|
||||
as follows:
|
||||
<ul>
|
||||
<li>
|
||||
In all but the last relocation operation of a composed sequence,
|
||||
the result of the relocation expression is retained, rather
|
||||
than having part extracted and placed in the relocated field.
|
||||
The result is retained at full pointer precision of the
|
||||
applicable ABI processor supplement.
|
||||
<p><li>
|
||||
In all but the first relocation operation of a composed sequence,
|
||||
the addend used is the retained result of the previous relocation
|
||||
operation, rather than that implied by the relocation type.
|
||||
</ul>
|
||||
<p>
|
||||
Note that a consequence of the above rules is that the location specified
|
||||
by a relocation type is relevant for the
|
||||
first element of a composed sequence (and then only for relocation
|
||||
records that do not contain an explicit addend field) and for the
|
||||
last element, where the location determines where the relocated value
|
||||
will be placed. For all other relocation operands in a composed
|
||||
sequence, the location specified is ignored.
|
||||
<p>
|
||||
An ABI processor supplement may specify individual relocation types
|
||||
that always stop a composition sequence, or always start a new one.
|
||||
<a name="relocation_types"></a>
|
||||
<h2>Relocation Types (Processor-Specific)</h2>
|
||||
<hr>
|
||||
<img src=warning.gif alt="NOTE:">
|
||||
This section requires processor-specific information. The ABI
|
||||
supplement for the desired processor describes the details.
|
||||
<hr>
|
||||
<a href=ch4.symtab.html><img src=previous.gif alt="Previous"></a>
|
||||
<a href=contents.html><img src=contents.gif alt="Contents"></a>
|
||||
<a href=ch5.intro.html><img src=next.gif alt="Next"></a>
|
||||
<hr>
|
||||
<i>
|
||||
<small>
|
||||
© 1997, 1998, 1999, 2000, 2001 The Santa Cruz Operation, Inc. All rights reserved.
|
||||
</small>
|
||||
</i>
|
||||
</html>
|
||||