Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Peter Norton Programmer's Guide - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

  The 8086-family microprocessors communicate with and control many parts of
  the computer through the use of input and output (I/O) ports. The I/O
  ports are doorways through which information passes as it travels to or
  from an I/O device, such as a keyboard or a printer. Most of the support
  chips we described in Chapter 1 are accessed through I/O ports; in fact,
  each chip may use several port addresses for different purposes.

  Each port is identified by a 16-bit port number, which can range from 00H
  through FFFFH (65,535). The CPU identifies a particular port by the port's
  number.

  As it does when accessing memory, the CPU uses the data and address buses
  as conduits for communication with the ports. To access a port, the CPU
  first sends a signal on the system bus to notify all I/O devices that the
  address on the bus is that of a port. The CPU then sends the port address.
  The device with the matching port address responds.

  The port number addresses a memory location that is associated with an I/O
  device but is not part of main memory. In other words, an I/O port number
  is not the same as a memory address. For example, I/O port 3D8H has
  nothing to do with memory address 003D8H. To access an I/O port, you don't
  use data-transfer instructions like MOV and STOS. Instead, you use the
  instructions IN and OUT, which are reserved for I/O port access.

  --------------------------------------------------------------------------
  NOTE:
    Many high-level programming languages provide functions that access I/O
    ports. The BASIC functions INP and OUT, and the C functions inp and
    outp, are typical examples.
  --------------------------------------------------------------------------

  The uses of specific I/O ports are determined by the hardware designers.
  Programs that make use of I/O ports need to be aware of the port numbers,
  as well as their use and meaning. Port number assignments differ slightly
  among the PC family members, but, in general, IBM has reserved the same
  ranges of I/O port numbers for the same input/output devices in all PCs
  and PS/2s. (See Figure 2-10.) For details on how each I/O port is used,
  see the descriptions of the various input/output devices in the IBM
  technical reference manuals.


  Description                                    I/O Port        Comment
                                                 Numbers
  ----------------------------------------------------------------------------------------------
  Programmable Interrupt Controller (master)     20H-3FH

  System timer                                   40H-5FH

  Keyboard controller                            60H-6FH         On PS/2 Model 30, ports 60H-6FH
                                                                 are reserved for system-board
                                                                 control and status

  System control port B                          61H             PS/2 models 50, 60, and 80 only

  Real-time clock, NMI mask                      70H-7FH         On PC, PC/XT, and PS/2 Model
                                                                 30, NMI mask is at port A0H

  System control port A                          92H             PS/2 models 50, 60, and 80 only

  Programmable Interrupt Controller (slave)      A0H-BFH         On PS/2 Model 30, A0H-AFH

  Real-time clock                                B0H-BFH,        PS/2 Model 30 only
                                                 E0H-EFH

  Clear math coprocessor busy                    F0H

  Reset math coprocessor                         F1H

  Math coprocessor                               F8H-FFH

  Fixed-disk controller                          1F0H-1F8H

  Game control adapter                           200H-207H

  Parallel printer 3                             278H-27BH

  Serial communications 2                        2F8H-2FFH

  Fixed-disk controller                          320H-32FH       PC/XT and PS/2 Model 30

  PC network                                     360H-363H,
                                                 368H-36BH

  Parallel printer 2                             378H-37BH

  Monochrome Display Adapter                     3B0H-3BBH       Also used by EGA and VGA in
                                                                 monochrome video modes

  Parallel printer 1                             3BCH-3BFH

  Enhanced Graphics Adapter (EGA),               3C0H-3CFH
  Video Graphics Array (VGA)

  Color Graphics Adapter (CGA),                  3D0H-3DFH       Also used by EGA and VGA in
  Multi-Color Graphics Array (MCGA)                              color video modes

  Diskette controller                            3F0H-3F7H

  Serial communications 1                        3F8H-3FFH
  ----------------------------------------------------------------------------------------------


  Figure 2-10.  PC and PS/2 input/output port assignments. This table lists
  the most frequently used I/O ports. For a complete list, see the IBM
  Technical Reference manuals.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson