[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
STOSW            Store String Word                   Flags: not altered

          Logic:    (ES:DI) . AX
                    if DF = 0
                        DI . DI + 2
                    else
                        DI . DI - 2

    STOSW copies the value in AX into the location pointed to by ES:DI. DI
    is then incremented (if the direction flag is cleared) or decremented
    (if the direction flag is set), in preparation for storing AX in the
    next location.

  --------------------------------------------------------------------------
   Operands                  Clocks   Transfers  Bytes   Example
      -                        15         1        1     STOSW
   (repeat)                9 + 14/rep   1/rep      1     REP STOSW
  --------------------------------------------------------------------------

    When used in conjunction with the REP prefixes, the Store String
    instructions are useful for initializing a block of memory. For
    example, the following code would initialize the 100-byte memory block
    at BUFFER to 0:

          MOV     AX,0            ;The value to initialize BUFFER to
          LEA     DI,BUFFER       ;Starting location of BUFFER
          MOV     CX,50           ;Size of BUFFER, in words
          CLD                     ;Let's move in forward direction
  REP     STOSW                   ;Compare this line to example for STOS

See Also: STOS STOSB CMPS LODS MOVS SCAS REP CLD STD
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson