Opcode Instruction Clocks Description 6E OUTS DX,r/m8 14,pm=8*/28** Output byte [(E)SI] to port in DX 6F OUTS DX,r/m16 14,pm=8*/28** Output word [(E)SI] to port in DX 6F OUTS DX,r/m32 14,pm=8*/28** Output dword [(E)SI] to port in DX 6E OUTSB 14,pm=8*/28** Output byte DS:[(E)SI] to port in DX 6F OUTSW 14,pm=8*/28** Output word DS:[(E)SI] to port in DX 6F OUTSD 14,pm=8*/28** Output dword DS:[(E)SI] to port in DX
*If CPL <= IOPL **If CPL > IOPL or if in virtual 8086 mode
IF AddressSize = 16 THEN use SI for source-index; ELSE (* AddressSize = 32 *) use ESI for source-index; FI; 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); FI; FI; IF byte type of instruction THEN [DX] := [source-index]; (* Write byte at DX I/O address *) IF DF = 0 THEN IncDec := 1 ELSE IncDec := -1; FI; FI; IF OperandSize = 16 THEN [DX] := [source-index]; (* Write word at DX I/O address *) IF DF = 0 THEN IncDec := 2 ELSE IncDec := -2; FI; FI; IF OperandSize = 32 THEN [DX] := [source-index]; (* Write dword at DX I/O address *) IF DF = 0 THEN IncDec := 4 ELSE IncDec := -4; FI; FI; FI; source-index := source-index + IncDec;
OUTS does not allow specification of the port number as an immediate value. The port must be addressed through the DX register value. Load the correct value into DX before executing the OUTS instruction.
The address of the source data is determined by the contents of source-index register. Load the correct index value into SI or ESI before executing the OUTS instruction.
After the transfer, source-index register is advanced automatically. If the direction flag is 0 (CLD was executed), the source-index register is incremented; if the direction flag is 1 (STD was executed), it is decremented. The amount of the increment or decrement is 1 if a byte is output, 2 if a word is output, or 4 if a doubleword is output.
OUTSB, OUTSW, and OUTSD are synonyms for the byte, word, and doubleword OUTS instructions. OUTS can be preceded by the REP prefix for block output of CX bytes or words. Refer to the REP instruction for details on this operation.
up:
Chapter 17 -- 80386 Instruction Set
prev: OUT Output to Port
next: POP Pop a Word from the Stack