CLD            clear direction flag to UP (DF UP 0)
sets   (Delta) to positive; string ops auto-increment
STD            set direction flag to DN (DF DN 1)
sets   (Delta) to negative; string ops auto-decrement

REP/REPE/REPZ  (prefix) repeat: perform string operation repeatedly
CX (CX-1); string op repeats until CX==0
REPNE/REPNZ    (prefix) repeat: useful for string ops CMPS and SCAS
ZF 0; CX (CX-1); StrOp repeats while (CX!=0 and ZF==0)

MOVSB          copy byte(word) string (byte: =1, word: =2)
MOVSW           ES:[DI] DS:[SI]; DI+= ; SI+= 
MOVSXB         copy byte(word) with SF (sign) extension                386+
MOVSXW         copy byte(word) with ZF (zero) extension                386+

LODSB          copy string byte(word) into AL(AX)
AL   DS:[SI]; SI+=1;
LODSW           AX   DS:[SI]; SI+=2;

STOSB          store bytes(words) into string
ES:[DI] AL; DI+=1;
STOSW           ES:[DI] AX; DI+=2;

CMPSB          compare byte(word) strings (byte: =1, word: =2)
CMPSW           flags (result of CMP DS:[SI],ES:[DI]); DI+= ; SI+= 

SCASB          find byte(word) in string
flags (result of CMP DS:[DI],AL); DI+=1
SCASW           flags (result of CMP DS:[DI],AX); DI+=2

INSB           port input byte(word) into string (byte: =1, word: =2)
INSW                                                                   286+
ES:[DI] (byte/word at port DX); DI+= ;

OUTSB          port output byte(word) from string (byte: =1, word: =2)
OUTSW                                                                  286+
[port DX] DS:[SI]; SI+= ;

String Operation Instructions