MOVS             Move String (Byte or Word)          Flags: not altered
 
MOVS destination-string,source-string
 
          Logic:    (ES:DI)  (DS:SI)
                    if DF = 0
                        SI  SI + n         ; n = 1 for byte, 2 for word scan
                        DI  DI + n
                    else
                        SI  SI - n
                        DI  DI - n
 
    This instruction copies the byte or word pointed to by DS:SI, into the
    location pointed to by ES:DI. After the move, SI and DI are
    incremented (if the direction flag is cleared) or decremented (if the
    direction flag is set), to point to the next element of the string.
 
  --------------------------------------------------------------------------
   Operands                  Clocks   Transfers  Bytes   Example
                           byte(word)
   dest,source               18(26)       2        1     MOVS WORD_BUFF,INPUT
   (repeat) dest,source   9+17(25)/rep  2/rep      1     REP MOVSW
  --------------------------------------------------------------------------
 
       Note:          This instruction is always translated by the
                      assembler into either MOVSB, Move String Byte; or
                      MOVSW, Move String Word, depending upon whether
                      source-string refers to a string of bytes or words.
                      In either case, you must explicitly load the SI and
                      DI registers with the offset of the source and
                      destination strings.
 
  -------------------------------- Example ---------------------------------
 
    Assuming BUFFER1 as been defined somewhere as:
 
          BUFFFER1        DB      100 DUP (?)
 
    the following example moves 100 bytes from BUFFER1 to BUFFER2:
 
          CLD                     ;Move in the forward direction
          LEA     SI, BUFFER1     ;Source address to SI
          LEA     DI, BUFFER2     ;Destination address to DI
          MOV     CX,100          ;CX is used by the REP prefix
  REP     MOVS    BUFFER2, BUFFER1 ;    ...and MOVS it.

Seealso:



This page last updated on Fri Nov 30 10:49:50 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster