Experiment 2 programming with machine instructions and assembly instructions

Source: Internet
Author: User

Experiment conclusion

Lab task (1)

1. Use the e command to modify ~ 0021: F data, and the correct write operations after modification

2. Run Command A to enter the command

3. Single-step debugging of each line of commands

4. Memory values of each register after instruction execution

MoV ax, [0]; AX = 3130 H

Add ax, [2]; AX = 6462 H

MoV BX [4]; BX = 3534 H

Add Bx, [6]; BX = 6c6ah

Push ax; SP = 00feh; the address of the modified memory unit is 2200: Fe and the content is 3130 H.

Push BX; SP = 00fch; the address of the modified memory unit is 2200: fc and the content is 6462 H.

Pop ax; SP = 00feh; AX = 6c6ah

Pop BX; SP = 0100 h; BX = 6462 H

Push [4]; SP = 00feh; the address of the modified memory unit is 2200: Fe, and the content is 3534 H.

Push [6]; SP = 00fch; the address of the modified memory unit is 2200: fc, And the content is 6c6ah

5. After "mov SS, ax" is executed, "mov ax, [0]" is directly executed, and "mov sp, 0100" is skipped ".

Cause: When the debug t command executes the command to modify the SS register, the next command is also executed.

 

Lab task (2)

1. Run Command A to enter the 7-line command and Run Command e to modify the value from ~ 2000: F value, view the modified part

MoV ax, 2000; Save the number H to the Register ax

MoV SS, ax; Save the number 2000h in the register ax to the stack segment register SS

MoV sp, 10; Save the number 10 h to the stack address register sp

The initial stack top is, and the initial stack bottom is.

2. debug each line of Assembly commands in one step. After each command is debugged in one step, run the D command to view ~ 2000: F value

After "mov SS, ax" is executed, the value of memory from to 2000: F changes to the last nine, and then every time a command is executed, the memory is from to 2000: the value variation in F is increased by one.

 

Summary and experiences

Through this experiment, I have basically understood the principles and basic operations of the stack. At the same time, I also found that when the debug t command executes the instruction to modify the SS register, the next instruction is also executed.

 

Experiment 2 programming with machine instructions and assembly instructions

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.