[Wang Shuang compilation] Experiment 4, question 3

Source: Internet
Author: User

The followingProgramThe function is to copy the commands before "mov ax, 4c00h" to the memory at and complete the program. Debug the machine and track the running results.

Assume Cs: Code

Code segment

MoV ax ,--?
MoV ds, ax
MoV ax, 0020 H
MoV es, ax
MoV BX, 0
MoV CX ,--?
S: mov Al, [BX]
MoV ES: [BX], Al
INC BX
Loop s

MoV ax, 4c00h
Int 21 h

Code ends

End
Tip:

(1) What is the replication? From where to where?

(2) What is the replication? How many bytes are there? How do you know the number of bytes to be copied?

 

Analysis:

Empty: CS. Because we started from CS: IPCodeInput.

2 blank: 17 h.

// This visual test has a big problem. Everyone wants to find the register or the data, and so on, and can directly find the total number of bytes to be copied.

In fact, we only need to give CX a small value first. Then debug and run. View the Cx value. -5 h is the result we need.

// The reason for-5 is that mov ax, 4c00h, and INT 21 h have a length of 5;

It took nearly an hour for beginners to compile the Assembly. The original answer was so strange.

I can't help myself ..

 

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.