* remove "\r" nonsense
[mascara-docs.git] / i386 / i386.reference / IN.htm
blob7def871b19865ea96075ebe7103dcf5962d29342
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
2 <HTML>
3 <HEAD>
4 <TITLE>80386 Programmer's Reference Manual -- Opcode IN</TITLE>
5 </HEAD>
6 <BODY>
7 <B>up:</B> <A HREF="c17.htm">
8 Chapter 17 -- 80386 Instruction Set</A><BR>
9 <B>prev:</B><A HREF="IMUL.htm"> IMUL Signed Multiply</A><BR>
10 <B>next:</B><A HREF="INC.htm"> INC Increment by 1</A>
11 <P>
12 <HR>
13 <P>
14 <H1>IN -- Input from Port</H1>
16 <PRE>
17 Opcode Instruction Clocks Description
19 E4 ib IN AL,imm8 12,pm=6*/26** Input byte from immediate port
20 into AL
21 E5 ib IN AX,imm8 12,pm=6*/26** Input word from immediate port
22 into AX
23 E5 ib IN EAX,imm8 12,pm=6*/26** Input dword from immediate port
24 into EAX
25 EC IN AL,DX 13,pm=7*/27** Input byte from port DX into AL
26 ED IN AX,DX 13,pm=7*/27** Input word from port DX into AX
27 ED IN EAX,DX 13,pm=7*/27** Input dword from port DX into
28 EAX
29 </PRE>
31 <EM>
32 <H3>Notes</H3>
33 <PRE>
34 *If CPL <= IOPL
35 **If CPL > IOPL or if in virtual 8086 mode
36 </PRE>
37 </EM>
39 <H2>Operation</H2>
41 <PRE>
42 IF (PE = 1) AND ((VM = 1) OR (CPL > IOPL))
43 THEN (* Virtual 8086 mode, or protected mode with CPL > IOPL *)
44 IF NOT I-O-Permission (SRC, width(SRC))
45 THEN #GP(0);
46 FI;
47 FI;
48 DEST := [SRC]; (* Reads from I/O address space *)
49 </PRE>
51 <H2>Description</H2>
53 IN transfers a data byte or data word from the port numbered by the
54 second operand into the register (AL, AX, or EAX) specified by the first
55 operand. Access any port from 0 to 65535 by placing the port number
56 in the DX register and using an IN instruction with DX as the second
57 parameter. These I/O instructions can be shortened by using an 8-bit
58 port I/O in the instruction. The upper eight bits of the port address will
59 be 0 when 8-bit port I/O is used.
61 <H2>Flags Affected</H2>
63 None
65 <H2>Protected Mode Exceptions</H2>
67 #GP(0) if the current privilege level is larger (has less privilege) than
68 IOPL and any of the corresponding I/O permission bits in TSS equals 1
70 <H2>Real Address Mode Exceptions</H2>
72 None
74 <H2>Virtual 8086 Mode Exceptions</H2>
76 #GP(0) fault if any of the corresponding I/O permission bits in TSS
77 equals 1
80 <P>
81 <HR>
82 <P>
83 <B>up:</B> <A HREF="c17.htm">
84 Chapter 17 -- 80386 Instruction Set</A><BR>
85 <B>prev:</B><A HREF="IMUL.htm"> IMUL Signed Multiply</A><BR>
86 <B>next:</B><A HREF="INC.htm"> INC Increment by 1</A>
87 </BODY>