Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- iAPx86 - <b>ins input string from port flags: not altered</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
INS             Input String From Port               Flags: Not altered

INS destination,DX                                   CPU: 186+ IOpm

        Logic   [ES:eDI] . [port]
                if DF = 0
                   eDI . eDI + n        ; n = 1 for byte, 2 for word,
                else                    ;     4 for dword (386+)
                   eDI . eDI - n
                endif

    The INS instruction reads a value from a port (specified in the DX
    register) and transfers it to memory (at ES:eDI). After the
    transfer, eDI is updated to point to the next string location. The
    port is always addressed through DX.  If the address-size
    attribute is 16 bits, DI is used as destination-index register; if
    32 bits, EDI is used.

    Protected mode
    An exception occurs if the current task has insufficient privilege
    for the I/O. INS is not IOPL-sensitive in V86 mode.


    Note:       This instruction is always translated by the
                assembler into INSB, Input String Byte, INSW, Input
                String Word, or INSD, Input String Dword, depending
                upon whether destination refers to a string of bytes,
                words or doublewords. In either case, you must
                explicitly load the ES and eDI registers with the
                location of the destination.

                INSB, INSW, and INSD are synonyms for the byte, word,
                and doubleword INS 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
    read of the number of bytes as specified in eCX.


        Example:
        les     di,[pSec]               ; Point ES:DI to storage
        mov     dx,PORT_NUM             ; DX = port number
        mov     cx,512                  ; No. of bytes to read
        cld                             ; String ops forward
        rep     insb                    ; Read the port


    Opcode      Format
    6C          INS  m8,DX              ; = INSB (186+)
    6D          INS  m16,DX             ; = INSW (186+)
    6D          INS  m32,DX             ; = INSD (386+)


    Length and timing
    Variations  Bytes   8088    186     286     386     486     Pentium
    insb         1       -      14       5      15      17      9    NP
    insw         1       -      14       5      15      17      9    NP
    insd         1       -       -       -      15      17      9    NP

                             Protected Mode

                Bytes                           386     486     Pentium
                 1                           9/29/29 10/32/30 6/24/22 NP

                   Cycles for: CPL <= IOPL / CPL > IOPL / V86

See Also: REP IN OUT OUTS CLD STD IOPL

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson