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 increases
Df=1, after each operation, Si, di decreases
We can use the assembly syntax to describe the functions of MOVSB as follows:
mov es:[di],byte ptr ds:[si]; 8086 does not support such instructions, only for the purposes of description
If Df=0:inc si
Inc di
If Df=1:dec si
Dec di
As you can see, the function of MOVSB is to feed the bytes in the memory unit pointed to by Ds:si into Es:di, and then increment or decrement the SI and Si according to the value of the flag register DF bit.
2.rep
In general, MOVSB are used in conjunction with rep, in the following format: Rep MOVSB
Use the assembly syntax to describe:
S:mov SB
Loop s
See the role of rep is based on CX values, Executes the subsequent string transfer instructions repeatedly. Because the MOVSB will increment or decrement a memory unit without executing the SI/DI, then the rep movsb can loop through the transfer of (CX) characters