Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- TASM 2.x / MASM 6.x Assembly Language - <b>stosb store string byte flags: not altered</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
STOSB            Store String Byte                   Flags: not altered

STOSB

          Logic:    (ES:DI) . AL
                    if DF = 0
                        DI . DI + 1
                    else
                        DI . DI - 1

    STOSB copies the value in AL 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 AL in the
    next location.

  --------------------------------------------------------------------------
   Operands                  Clocks   Transfers  Bytes   Example
      -                        11         1        1     STOSB
   (repeat)                9 + 10/rep   1/rep      1     REP STOSB
  --------------------------------------------------------------------------

    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     AL,0            ;The value to initialize BUFFER to
          LEA     DI,BUFFER       ;Starting location of BUFFER
          MOV     CX,100          ;Size of BUFFER
          CLD                     ;Let's move in forward direction
  REP     STOSB                   ;Compare this line to example for STOS

See Also: STOS STOSW CMPS LODS MOVS SCAS REP CLD STD

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