1.10th bit DF of the flag register, direction sign bit. In the string processing instruction, control the increment and decrement of si,di after each operation
Df=0, after each operation, Si, di add
Df=1, after each operation, Si, di decreases
We are able to describe the functions of MOVSB in the assembly syntax such as the following:
mov es:[di],byte ptr ds:[si]; 8086 does not support this instruction, only for descriptive narrative use
Suppose Df=0:inc si
Inc di
Suppose Df=1:dec si
Dec di
It can be seen that the function of the MOVSB is to feed the bytes in the memory unit pointed to by Ds:si into Es:di, and then increment or decrement si and Si according to the value of the flag register DF bit.
2.rep
In general, MOVSB are used in conjunction with rep, such as the following: Rep MOVSB
To describe a narrative in a compiled grammar:
S:mov SB
Loop s
It can be seen that the role of rep is to repeatedly run the following string delivery instructions based on CX values. Because the MOVSB will increment or decrement a memory unit without running the Si/di, the rep movsb can loop through (CX) characters.
DF Flag and string move instruction (MOVSB/MOVSW)