Experiment 2 machine instruction and assembly instruction Programming

Source: Internet
Author: User
1. Tutorial 2 (p71)

(1) exercise "1. Preparation: Use of debug 」

(2) complete the "2. Experiment task" on the basis of the exercise:

To facilitate the verification of the experiment results, make the following two adjustments to (1) in "2. Experiment task:

① Run the e command to set the memory unit before running the command.0021:0 ~Change 8 bytes of data30 h, 31 H, 32 h, 33 H, 34 h, 35 h, 36 h, 37 h 

② PlaceMoV ax, FFFF→ ChangedMoV ax, 0021Before the experiment, analyze and record the values in each blank space after instruction execution.

During the experiment, debug the experiment and check whether the experiment results are consistent with the theoretical analysis. If they are inconsistent, try.

Locate the problem and analyze the cause.

The p71 lab is as follows:

Lab analysis: Is mov sp, 10 executed?

Before the program is executed, Ax = 0000, Ss = 0b39, SP = ffee
After mov ax and 2000 are executed in one step with the T command, Ax = 2000; SS = 0b39; SP = ffee

Run mov SS in one step with the T command. After ax, Ax = 2000; SS = 2000; SP = 0010

Note: Before executing mov SS with the T command in a single step, Ss = 0b39, SP = ffee, and SS = 2000, SP = 0010 after executing. It is normal for SS to change to 2000, which is the execution result of mov SS and ax. If SP is changed to 0010, it is after mov SS and ax, because it is the next instruction of mov SS and ax. Obviously, when mov SS and ax are executed using the T command, its next command mov SP and 10 are also executed.

Lab task (1 ):

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

② Record: p74 command entered using command

③ Record: single-step debugging of each line of commands (for example, multiple single-step debugging steps can be split into screens, but do not omit them)

④ After executing the command in p74, fill in the result of each register and copy the result in the document by hand or by taking a mobile phone photo. ③ Observe the single-step debugging and compare it with the theoretical analysis results to check whether the results are consistent.

Experiment 2 was conducted in the data center, but the modified address was not viewed at the time. Modify the settings on your computer as follows:

Enter the command in the first half of the experiment as follows:

The T command is executed in one step as follows:

The first part draws the conclusion:

Ax = 3130

Ax = 6462

BX = 3534

BX = 6c6a

The result of the last two parts is as follows:

SP = 00fe; the address of the modified memory unit is 2200: Fe to ff. The content is 62 64.

Ax inbound stack sp = sp-2 = 0100h-2 = 00feh

SP = 00fc; the address of the modified memory unit is 2200: The FC to fd content is 6a 6c

BX inbound stack sp = sp-2 = 00feh-2 = 00fch

SP = 00fe; AX = 6c6a

SP = 0100; BX = 6462

Push [4] sp = 00fe; the address of the modified memory unit is 2200: The content from Fe to FF is 34 35.

Push [6] sp = 00fc; the address of the modified memory unit is 2200: The content from FC to FD is 36 37.

Due to negligence, incorrect handwriting leads to a wrong step in the conclusion step, resulting in a wrong deviation between the upper and lower phases. Please note that.

Lab task (2 ):

① Record the 7-line command entered using command a in Figure 3.19 and use command e to modify the value from ~ 2000: F value and the modified part

② Debug each line of Assembly commands in one step. After each command is debugged in one step, use the D command to view

2000:0 ~ 2000: F value. Observe the changes in the related register values after each instruction is executed, and ~ 2000: F unit value change, and think about the reasons.

Perform the following steps on your PC:

Analysis conclusion:

The initial stack top and bottom are 2000:0010 and 2000:0010 respectively.

For example, in practice (3), when an interrupt routine is executed, the CPU automatically presses the register variables used by the Interrupt Routine to the stack, including the values of the above register variables, the command is then executed.

 

Experiment 2 machine instruction and assembly instruction Programming

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.