DF Flag and string move instruction (MOVSB/MOVSW)

Source: Internet
Author: User
Tags processing instruction

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.