Logic [port] ← [DS:eSI] if DF = 0 eSI ← eSI + n ; n = 1 for byte, 2 for word, else ; 4 for dword (386+) eSI ← eSI - n endif
The OUTS instruction transfers a byte, word, or dword from memory (at DS:eSI) to an output port (specified in the DX register). After the transfer, eSI is updated to point to the next string location. The port is always addressed through DX. If the address-size attribute is 16 bits, SI is used as source-index register; if 32 bits, ESI is used.
Protected mode An exception occurs if the current task has insufficient privilege for the I/O. OUTS is not IOPL-sensitive in V86 mode.
Note: This instruction is always translated by the assembler into OUTSB, Output String Byte, OUTSW, Output String Word, or OUTSD, Output String Dword, depending upon whether destination refers to a string of bytes, words or doublewords. In either case, you must explicitly load the DS and eSI registers with the location of the source.
OUTSB, OUTSW, and OUTSD are synonyms for the byte, word, and doubleword OUTS instructions that do not require an operand. They are simpler to use but provide no type or segment checking.
These instructions normally use a REP prefix to indicate a block write of the number of bytes as specified in eCX.
Example: lds si,[pSec] ; Point DS:SI to storage mov dx,PORT_NUM ; DX = port number mov cx,512 ; No. of bytes to write cld ; String ops forward rep outsb ; Write to the port