1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML 2.0//EN">
4 <TITLE>80386 Programmer's Reference Manual -- Opcode OUTS
</TITLE>
7 <B>up:
</B> <A HREF=
"c17.htm">
8 Chapter
17 --
80386 Instruction Set
</A><BR>
9 <B>prev:
</B><A HREF=
"OUT.htm"> OUT Output to Port
</A><BR>
10 <B>next:
</B><A HREF=
"POP.htm"> POP Pop a Word from the Stack
</A>
14 <H1>OUTS/OUTSB/OUTSW/OUTSD -- Output String to Port
</H1>
17 Opcode Instruction Clocks Description
19 6E OUTS DX,r/m8
14,pm=
8*/
28** Output byte [(E)SI] to port in DX
20 6F OUTS DX,r/m16
14,pm=
8*/
28** Output word [(E)SI] to port in DX
21 6F OUTS DX,r/m32
14,pm=
8*/
28** Output dword [(E)SI] to port in DX
22 6E OUTSB
14,pm=
8*/
28** Output byte DS:[(E)SI] to port in
24 6F OUTSW
14,pm=
8*/
28** Output word DS:[(E)SI] to port in
26 6F OUTSD
14,pm=
8*/
28** Output dword DS:[(E)SI] to port in
35 **If CPL
> IOPL or if in virtual
8086 mode
44 THEN use SI for source-index;
45 ELSE (* AddressSize =
32 *)
46 use ESI for source-index;
49 IF (PE =
1) AND ((VM =
1) OR (CPL
> IOPL))
50 THEN (* Virtual
8086 mode, or protected mode with CPL
> IOPL *)
51 IF NOT I-O-Permission (DEST, width(DEST))
55 IF byte type of instruction
57 [DX] := [source-index]; (* Write byte at DX I/O address *)
58 IF DF =
0 THEN IncDec :=
1 ELSE IncDec := -
1; FI;
62 [DX] := [source-index]; (* Write word at DX I/O address *)
63 IF DF =
0 THEN IncDec :=
2 ELSE IncDec := -
2; FI;
67 [DX] := [source-index]; (* Write dword at DX I/O address *)
68 IF DF =
0 THEN IncDec :=
4 ELSE IncDec := -
4; FI;
71 source-index := source-index + IncDec;
76 OUTS transfers data from the memory byte, word, or doubleword at the
77 source-index register to the output port addressed by the DX register. If
78 the address-size attribute for this instruction is
16 bits, SI is used for
79 the source-index register; otherwise, the address-size attribute is
32 bits,
80 and ESI is used for the source-index register.
82 OUTS does not allow specification of the port number as an immediate value.
83 The port must be addressed through the DX register value. Load the correct
84 value into DX before executing the OUTS instruction.
86 The address of the source data is determined by the contents of
87 source-index register. Load the correct index value into SI or ESI before
88 executing the OUTS instruction.
90 After the transfer, source-index register is advanced automatically. If
91 the direction flag is
0 (
<A HREF=
"CLD.htm">CLD
</A>
92 was executed), the source-index register is
93 incremented; if the direction flag is
1 (
<A HREF=
"STD.htm">STD
</A> was executed), it is
94 decremented. The amount of the increment or decrement is
1 if a byte is
95 output,
2 if a word is output, or
4 if a doubleword is output.
97 OUTSB, OUTSW, and OUTSD are synonyms for the byte, word, and
98 doubleword OUTS instructions. OUTS can be preceded by the
99 <A HREF=
"REP.htm">REP
</A>
100 prefix for block output of CX bytes or words. Refer to the
101 <A HREF=
"REP.htm">REP
</A>
102 instruction for details on this operation.
104 <H2>Flags Affected
</H2>
108 <H2>Protected Mode Exceptions
</H2>
110 #GP(
0) if CPL is greater than IOPL and any of the corresponding I/O
111 permission bits in TSS equals
1; #GP(
0) for an illegal memory operand
112 effective address in the CS, DS, or ES segments; #SS(
0) for an illegal
113 address in the SS segment; #PF(fault-code) for a page fault
115 <H2>Real Address Mode Exceptions
</H2>
117 Interrupt
13 if any part of the operand would lie outside of the effective
118 address space from
0 to
0FFFFH
120 <H2>Virtual
8086 Mode Exceptions
</H2>
122 #GP(
0) fault if any of the corresponding I/O permission bits in TSS
123 equals
1; #PF(fault-code) for a page fault
129 <B>up:
</B> <A HREF=
"c17.htm">
130 Chapter
17 --
80386 Instruction Set
</A><BR>
131 <B>prev:
</B><A HREF=
"OUT.htm"> OUT Output to Port
</A><BR>
132 <B>next:
</B><A HREF=
"POP.htm"> POP Pop a Word from the Stack
</A>