HP Compaq D315 Technical Reference Manual page 101

Hp personal computers technical reference guide
Table of Contents

Advertisement

5.6.3.2 8042 Control
The BIOS function INT 16 is typically used for controlling interaction with the keyboard. Sub-
functions of INT 16 conduct the basic routines of handling keyboard data (i.e., translating the
keyboard's scan codes into ASCII codes). The keyboard/pointing device interface is accessed by
the CPU through I/O mapped ports 60h and 64h, which provide the following functions:
♦ Output buffer reads
♦ Input buffer writes
♦ Status reads
♦ Command writes
Ports 60h and 64h can be accessed using the IN instruction for a read and the OUT instruction for
a write. Prior to reading data from port 60h, the "Output Buffer Full" status bit (64h, bit <0>)
should be checked to ensure data is available. Likewise, before writing a command or data, the
"Input Buffer Empty" status bit (64h, bit <1>) should also be checked to ensure space is available.
I/O Port 60h
I/O port 60h is used for accessing the input and output buffers. This register is used to send and
receive data from the keyboard and the pointing device. This register is also used to send the
second byte of multi-byte commands to the 8042 and to receive responses from the 8042 for
commands that require a response.
A read of 60h by the CPU yields the byte held in the output buffer. The output buffer holds data
that has been received from the keyboard and is to be transferred to the system.
A CPU write to 60h places a data byte in the input byte buffer and sets the CMD/ DATA bit of the
Status register to DATA. The input buffer is used for transferring data from the system to the
keyboard. All data written to this port by the CPU will be transferred to the keyboard except bytes
that follow a multibyte command that was written to 64h
I/O Port 64h
I/O port 64h is used for reading the status register and for writing commands. A read of 64h by
the CPU will yield the status byte defined as follows:
Bit
Function
7..4
General Purpose Flags.
3
CMD/DATA Flag (reflects the state of A2 during a CPU write).
0 = Data
1 = Command
2
General Purpose Flag.
1
Input Buffer Full. Set (to 1) upon a CPU write. Cleared by
IN A, DBB instruction.
0
Output Buffer Full (if set). Cleared by a CPU read of the
buffer.
A CPU write to I/O port 64h places a command value into the input buffer and sets the
CMD/DATA bit of the status register (bit <3>) to CMD.
Compaq D315 and hp d325 Personal Computers
Featuring the AMD Athlon XP Processor
Second Edition - April 2003
Technical Reference Guide
5-19

Advertisement

Table of Contents
loading

This manual is also suitable for:

D325 mtD325 stD325

Table of Contents