80386 Programmer's Reference Manual -- Opcode OUT

OUT -- Output to Port

OpcodeInstructionClocks DescriptionExample
E6 iboutb al,imm810,pm=4*/24** Output byte AL to immediate port numberoutb %al,$0x7f
E7 iboutw ax,imm810,pm=4*/24** Output word AL to immediate port numberoutw %ax,$0x7f
E7 iboutl eax,imm810,pm=4*/24** Output dword AL to immediate port numberoutl %eax,$0x7f
EEoutb al,dx11,pm=5*/25** Output byte AL to port number in outb %al,%dx
EFoutw ax,dx11,pm=5*/25** Output word AL to port number in outw %ax,%dx
EFoutl eax,dx11,pm=5*/25** Output dword AL to port number in DXoutl %eax,%dx


   *If CPL <= IOPL
  **If CPL > IOPL or if in virtual 8086 mode


IF (PE = 1) AND ((VM = 1) OR (CPL > IOPL))
THEN (* Virtual 8086 mode, or protected mode with CPL > IOPL *)
   IF NOT I-O-Permission (DEST, width(DEST))
   THEN #GP(0);
[DEST] := SRC; (* I/O address space used *)


OUT transfers a data byte or data word from the register (AL, AX, or EAX) given as the second operand to the output port numbered by the first operand. Output to any port from 0 to 65535 is performed by placing the port number in the DX register and then using an OUT instruction with DX as the first operand. If the instruction contains an eight-bit port ID, that value is zero-extended to 16 bits.

Flags Affected


Protected Mode Exceptions

#GP(0) if the current privilege level is higher (has less privilege) than IOPL and any of the corresponding I/O permission bits in TSS equals 1

Real Address Mode Exceptions


Virtual 8086 Mode Exceptions

#GP(0) fault if any of the corresponding I/O permission bits in TSS equals 1

[Home Page dell'ITIS "Fermi"] [80386 Programmer's Reference Manual Index] [Previous] [Next]