1 of 23

Types of Input/Output

  • The I/O system allows peripherals to provide data or receive results of processing the data
    • Using I/O ports
  • The 8088/8086 MPU can employ two types of I/O
    • Isolated I/O
    • Memory-mapped I/O
      • They differ in how I/O ports are mapped into the address space

2 of 23

Types of Input/Output (cont.)

  • Isolated input/output
    • When using isolated I/O in a microcomputer system, the I/O device are treated separate from memory
      • The memory address space contains 1 M consecutive byte address in the range 0000016 through FFFFF16
      • The I/O address space contains 64K consecutive byte addresses in the range 000016 through FFFF16
    • The bytes in two consecutive I/O addresses can be accessed as word-wide data
    • Page 0: 000016 ~ 00FF16
      • Certain I/O instructions can only perform in this range

3 of 23

Types of Input/Output (cont.)

  • Isolated input/output

8088/8086 memory and I/O address spaces

4 of 23

Types of Input/Output (cont.)

  • Isolated input/output

Isolated I/O ports

5 of 23

Types of Input/Output (cont.)

  • Isolated input/output
    • Advantages:
      • The complete 1Mbyte memory address space is available for use with memory
      • Special instructions have been provided to perform I/O operations with maximized performance
    • The bytes in two consecutive I/O addresses can be accessed as word-wide data
    • Disadvantages:
      • All input and output data transfers must take place between the AL or AX register and I/O port

6 of 23

Types of Input/Output (cont.)

  • Memory-mapped input/output
    • MPU looks at the I/O port as though it is a storage location in memory
      • Some of the memory address space is dedicated to I/O ports
    • Instructions that affect data in memory are used instead of the special I/O instructions
      • More instructions and addressing modes are available to perform I/O operations
      • I/O transfers can take place between I/O port and other internal registers
    • The memory instructions tend to execute slower than those specifically designed for isolated I/O
    • Part of the memory address space is lost

7 of 23

Types of Input/Output(cont.)

  • Memory-mapped input/output

Memory mapped I/O ports

8 of 23

Isolated Input/Output Interface

  • I/O devices:
    • Keyboard
    • Printer
    • Mouse
    • 82C55A, etc
  • Functions of interface circuit:
    • Select the I/O port
    • Latch output data
    • Sample input data
    • Synchronize data transfer
    • Translate between TTL voltage levels and those required to operate the I/O devices

9 of 23

Isolated Input/Output Interface (cont.)

  • Minimum-mode interface

Minimum-mode 8088 system I/O interface

10 of 23

Isolated Input/Output Interface (cont.)

  • Minimum-mode interface

Minimum-mode 8086 system I/O interface

11 of 23

Isolated Input/Output Interface (cont.)

  • Maximum-mode interface

Maximum-mode 8088 system I/O interface

12 of 23

Isolated Input/Output Interface (cont.)

  • Maximum-mode interface

Maximum-mode 8086 system I/O interface

13 of 23

Isolated Input/Output Interface (cont.)

  • Maximum-mode interface

I/O bus cycle status codes

14 of 23

Input/Output Data Transfer

  • Input/output data transfers in the 8088 and 8086 microcomputers can be either byte-wide or word-wide
  • I/O addresses are 16 bits in length and are output by the 8088 to the I/O interface over bus lines AD0 through AD7 and A8 through A15
  • In 8088, the word transfers is performed as two consecutive byte-wide data transfer and takes two bus cycle
  • In 8086, the word transfers can takes either one or two bus cycle
  • Word-wide I/O ports should be aligned at even-address boundaries

15 of 23

Input/Output Data Instructions

16 of 23

Input/Output Data Instructions�(cont.)

EXAMPLE:

    • Write a sequence of instructions that will output the data FF16 to a byte-wide output port at address AB16 of the I/O address space.

Solution:

    • First, the AL register is loaded with FF16 as an immediate operand in the instruction

MOV AL, 0FFH

    • Now the data in AL can be output to the byte-wide output port with the instruction

OUT 0ABH, AL

17 of 23

Input/Output Data Instructions�(cont.)

EXAMPLE:

    • Write a series of instructions that will output FF16 to an output port located at address B00016 of the I/O address space

Solution:

    • The DX register must first be loaded with the address of the output port. This is done with the instruction

MOV DX, 0B000H

    • Next, the data that are to be output must be loaded into AL with the instruction

MOV AL, 0FFH

    • Finally, the data are output with the instruction

OUT DX, AL

18 of 23

Input/Output Data Instructions�(cont.)

EXAMPLE:

    • Data are to be read in from two byte-wide input ports at addresses AA16 and A916 and then output as a word-wide output port at address B00016. Write a sequence of instructions to perform this input/output operation.

19 of 23

Input/Output Data Instructions�(cont.)

Solution:

    • First read in the byte at address AA16 into AL and move it into AH.

IN AL, 0AAH

MOV AH, AL

    • Now the other byte can be read into AL by the instruction

IN AL, 09AH

    • And to write out the word of data

MOV DX, 0B000H

OUT DX, AX

20 of 23

Input/Output Bus Cycles

  • Input bus cycle of the 8088

21 of 23

Input/Output Bus Cycles (cont.)

  • Output bus cycle of the 8088

22 of 23

Input/Output Bus Cycles (cont.)

  • Input bus cycle of the 8086

23 of 23

Input/Output Bus Cycles (cont.)

  • Output bus cycle of the 8086