Files
oldlinux-files/Ref-docs/manual Intel386/I386Manual/IN.HTM
2024-02-19 00:21:47 -05:00

73 lines
2.9 KiB
HTML

<html><!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title>80386 Programmer's Reference Manual -- Opcode IN</title>
</head>
<body>
<b>up:</b> <a href="C17.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/C17.HTM">Chapter 17 -- 80386 Instruction Set</a><br>
<b>prev:</b><a href="IMUL.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/IMUL.HTM"> IMUL Signed Multiply</a><br>
<b>next:</b><a href="INC.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/INC.HTM"> INC Increment by 1</a>
<p>
<hr>
<p>
<h1>IN -- Input from Port</h1>
<pre>
Opcode Instruction Clocks Description
E4 ib IN AL,imm8 12,pm=6*/26** Input byte from immediate port
into AL
E5 ib IN AX,imm8 12,pm=6*/26** Input word from immediate port
into AX
E5 ib IN EAX,imm8 12,pm=6*/26** Input dword from immediate port
into EAX
EC IN AL,DX 13,pm=7*/27** Input byte from port DX into AL
ED IN AX,DX 13,pm=7*/27** Input word from port DX into AX
ED IN EAX,DX 13,pm=7*/27** Input dword from port DX into
EAX
</pre>
<em>
<h3>Notes</h3>
<pre>
*If CPL &lt;= IOPL
**If CPL &gt; IOPL or if in virtual 8086 mode
</pre>
</em>
<h2>Operation</h2>
<pre>
IF (PE = 1) AND ((VM = 1) OR (CPL &gt; IOPL))
THEN (* Virtual 8086 mode, or protected mode with CPL &gt; IOPL *)
IF NOT I-O-Permission (SRC, width(SRC))
THEN #GP(0);
FI;
FI;
DEST := [SRC]; (* Reads from I/O address space *)
</pre>
<h2>Description</h2>
IN transfers a data byte or data word from the port numbered by the second operand into the register (AL, AX, or EAX) specified by the first operand. Access any port from 0 to 65535 by placing the port number in the DX register and using an IN instruction with DX as the second parameter. These I/O instructions can be shortened by using an 8-bit port I/O in the instruction. The upper eight bits of the port address will be 0 when 8-bit port I/O is used.
<h2>Flags Affected</h2>
None
<h2>Protected Mode Exceptions</h2>
#GP(0) if the current privilege level is larger (has less privilege) than IOPL and any of the corresponding I/O permission bits in TSS equals 1
<h2>Real Address Mode Exceptions</h2>
None
<h2>Virtual 8086 Mode Exceptions</h2>
#GP(0) fault if any of the corresponding I/O permission bits in TSS equals 1
<p>
<hr>
<p><b>up:</b> <a href="C17.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/C17.HTM">Chapter 17 -- 80386 Instruction Set</a><br>
<b>prev:</b><a href="IMUL.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/IMUL.HTM"> IMUL Signed Multiply</a><br>
<b>next:</b><a href="INC.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/INC.HTM"> INC Increment by 1</a>
</body>