Wang Shuang's question in chapter 1 of Assembly Language detection point 10th (1)

Source: Internet
Author: User

Question: The followingProgramWhat is the value in ax after execution? (Use the principle of the Call Command for analysis. Do not follow up in debug to verify your conclusion. For this program, the result of one-step tracking in debug cannot represent the actual execution result of the CPU)

Assume Cs: codesgstack segment DW 8 DUP (0) stack ends codesg segment start: mov ax, stackmov SS, axmov sp, 16mov ds, axmov ax, 0 call word ptr ds: [0eh] Inc axinc axmov ax, 4c00hint 21 h codesg ends end start

Originally, according to the aboveCodeAnalysis: when the call is executed, the first INC ax address is first stack, and the data of DS: [0eh] is used as the IP address to execute the code pointed to by the IP address. The SS and DS here are the same. DS: [0eh] is the top element of the stack, that is, the first address of the first INC Ax just entered into the stack ", therefore, the code to be executed is "the first INC ax" and the final result is 3.

This Code cannot run properly during debugging. I don't know if my analysis is correct. In addition, it is also a problem why the program cannot be properly debugged.

Related Article

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.