Information Technology Reference
In-Depth Information
Sending the write auxiliary device (d4h) command to 64h (Control register).
The next byte is a command code which is sent to port 60h, and then transferred to the
mouse port (valid codes are given in Table 10.3). This command transfer only occurs for
a single transfer.
The mouse can either be set into a stream mode or a remote mode, and writes movement data
into the keyboard buffer. In stream mode, the mouse transmits movement data when it is
moved by a given amount (set by the sample rate). In remote mode the mouse only transfers
movement data when there is a specific read data command.
When the read data command is sent, the 8-byte data packet is read from the addresses as
specified in Table 10.4. An example of programming the mouse is given next:
_outp(0x64,0xd4); /* Write aux. device
*/
do
{
inval=_inp(0x64);
} while ((inval & 0x02)==0x02); /* wait until input buffer empty */
_outp(0x60,0xe7); /* set scaling
*/
Table 10.4
Control register commands
Offset
Description
Bit 7: YOV (Y-data overflow),
00h
Bit 6: XOV (X-data overflow),
Bit 5: YNG (Y-value negative),
Bit 4: XNG (X-value negative),
Bit 1: RIG (right button pressed),
Bit 0: LEF (left button pressed).
02h
X-data movement since last access
04h
Y-data movement since last access
10.6 Exercises
10.6.1
What is the base address of the joystick port:
(a)
101h
(b)
201h
(c)
301h
(d)
401h
10.6.2
Which I/O port addresses are used for the keyboard:
(a)
60h, 64h
(b)
160h, 164h
(c)
260h, 264h
(d)
360h, 364h
10.6.3
How is the x position and y position determined:
(a)
The time for a single-shot
(b)
A voltage level
(c)
An electrical current
(d)
A value in a register
Search WWH ::




Custom Search