⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 s08_01.htm

📁 Programmer s Reference Manual is an improtant book on Intel processor architecture and programming.
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><HTML><HEAD><TITLE>80386 Programmer's Reference Manual -- Section 8.1</TITLE></HEAD><BODY><B>up:</B> <A HREF="c08.htm">Chapter 8 -- Input/Output</A><BR><B>prev:</B> <A HREF="c08.htm">Chapter 8 -- Input/Output</A><BR><B>next:</B> <A HREF="s08_02.htm">8.2  I/O Instructions</A><P><HR><P><H1>8.1  I/O Addressing</H1>The 80386 allows input/output to be performed in either of two ways:<UL><LI> By means of a separate I/O address space (using specific I/Oinstructions)<LI> By means of memory-mapped I/O (using general-purpose operandmanipulation instructions).</UL><H2>8.1.1  I/O Address Space</H2>The 80386 provides a separate I/O address space, distinct from physicalmemory, that can be used to address the input/output ports that are used forexternal 16 devices. The I/O address space consists of 2^(16) (64K)individually addressable 8-bit ports; any two consecutive 8-bit ports can betreated as a 16-bit port; and four consecutive 8-bit ports can be treatedas a 32-bit port. Thus, the I/O address space can accommodate up to 64K8-bit ports, up to 32K 16-bit ports, or up to 16K 32-bit ports.<P>The program can specify the address of the port in two ways. Using animmediate byte constant, the program can specify:<UL><LI> 256 8-bit ports numbered 0 through 255.<LI> 128 16-bit ports numbered 0, 2, 4, . . . , 252, 254.<LI> 64 32-bit ports numbered 0, 4, 8, . . . , 248, 252.</UL>Using a value in DX, the program can specify:<UL><LI> 8-bit ports numbered 0 through 65535<LI> 16-bit ports numbered 0, 2, 4, . . . , 65532, 65534<LI> 32-bit ports numbered 0, 4, 8, . . . , 65528, 65532</UL>The 80386 can transfer 32, 16, or 8 bits at a time to a device located inthe I/O space. Like doublewords in memory, 32-bit ports should be aligned ataddresses evenly divisible by four so that the 32 bits can be transferred ina single bus access. Like words in memory, 16-bit ports should be aligned ateven-numbered addresses so that the 16 bits can be transferred in a singlebus access. An 8-bit port may be located at either an even or odd address.<P>The instructions <A HREF="IN.htm">IN</A> and <A HREF="OUT.htm">OUT</A> move data between a register and a port in theI/O address space. The instructions <A HREF="INS.htm">INS</A> and <A HREF="OUTS.htm">OUTS</A> move strings of databetween the memory address space and ports in the I/O address space.<H2>8.1.2  Memory-Mapped I/O</H2>I/O devices also may be placed in the 80386 memory address space. As longas the devices respond like memory components, they are indistinguishable tothe processor.<P>Memory-mapped I/O provides additional programming flexibility. Anyinstruction that references memory may be used to access an I/O port locatedin the memory space. For example, the <A HREF="MOV.htm">MOV</A> instruction can transfer databetween any register and a port; and the <A HREF="AND.htm">AND</A>, <A HREF="OR.htm">OR</A>, and <A HREF="TEST.htm">TEST</A> instructions maybe used to manipulate bits in the internal registers of a device (see <A HREF="s08_02.htm#fig8-1">Figure 8-1</A>  ). Memory-mapped I/O performed via the full instruction set maintainsthe full complement of addressing modes for selecting the desired I/Odevice (e.g., direct address, indirect address, base register, indexregister, scaling).<P>Memory-mapped I/O, like any other memory reference, is subject to accessprotection and control when executing in protected mode. Refer to <A HREF="c06.htm">Chapter 6</A>  for a discussion of memory protection.<P><HR><P><B>up:</B> <A HREF="c08.htm">Chapter 8 -- Input/Output</A><BR><B>prev:</B> <A HREF="c08.htm">Chapter 8 -- Input/Output</A><BR><B>next:</B> <A HREF="s08_02.htm">8.2  I/O Instructions</A></BODY>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -