# Lab 1 Viewing CPU and memory, programming with machine instructions and assembly instructions

Source: Internet
Author: User

Iv. conclusion of the experiment

Task one: Using debug, the following program segment is written to memory, executed on a per-execution, observing the contents of the relevant registers in the CPU after each program execution

Method One:

(1) Use the e command at the beginning of the 1000:0 to read the program's machine code into the memory unit, using the D command to view the information in memory, and using the U command disassembly, the machine code read to the assembly instructions;

(2) First rewrite the point of the cs:ip, so that the value of Cs:ip points to the location of the writer segment, and then use the T command to step through debugging, execute assembly instructions

As you can see, the value of the CS:IP is changed after each execution of a assembly instruction, not just the value of the corresponding register, because of the change in the assembly instruction, in order to ensure that the assembly instruction is continuous, and the Cs:ip value is added to the length of the assembly instruction each time the assembly instruction is executed.

Method Two:

(1) using a command to write assembly instructions

(2) using the T command to debug the corresponding assembly instructions, observe the change of the corresponding register

The result is the same as method one (2)

Write the following instruction to the memory unit starting at 2000:0, and use the three instructions to calculate the 2 8-square.

(1) Use the A command to write the corresponding assembly instruction from the memory unit starting from 2000:0

(2) Change the direction of the CS:IP, point it to 2000:0, and use the T command to perform assembly instructions

As you can see, the execution of the assembly instructions forms a loop due to the existence of the assembler Directive "JMP 2000:0003". Therefore, we can use this instruction to calculate the specific value of 2 of the 8-time square.

(3) The result is obtained after executing the loop multiple times with the T command

ax=100h

Task three: See what's in memory

(1) Use the R command to view memory information between memory FFF00-FFFFF

We can clearly see that the memory segment, the right side only "01/01/92" This date, so, it is not difficult to guess, the date is what we are looking for the motherboard production date

(2) Try to rewrite the production date

You can see that the ASCII code value for this date is: 2F 2F 39 32

We rewrite the date as "02/02/92", the corresponding ASCII code is: 2F 2F 39 32

Rewrite it with the e command

After rewriting, use the D command again to display the memory information

As you can see, the memory information has not changed, which is why?

Because the production date is written on the host ROM (read-only memory), we cannot change it.

Fill in the data from the cell where the memory starts at b8100h

(1) Write the data to the memory unit with the e command

The above two graphs we can see, when entering a data, in the upper right corner of the screen to generate a match, enter two identical data, the corresponding symbol color will change.

(2) The reason for this situation

This is because in the 8086CPU, memory address space distribution caused, 8086CPU, A0000-BFFFF is memory address space, we enter data into the memory address space, is to write data to the memory, which will of course be displayed card output to the display, There is the result that we see.

Five, summary and experience

Compilation of Knowledge:

Through this experiment, it deepened my proficiency in the use of various instructions in assembly language, and the specific experimental operation also made me aware of the actual working state of 8086CPU. For example: The address of the CS:IP represents the execution direction of the instruction, change the direction of the field Cs:ip before executing the corresponding instruction, the situation of the 8086CPU machine memory address space allocation, how to use the assembly instruction to process the data, calculate, etc. Through this experiment, I found that the best way to cultivate interest in a subject is to let oneself participate in, hands-on operation, so as to find their grasp of knowledge, to find their own shortcomings

The paper came to light, and I knew it was going to be preach.

Blog Park Operational Aspects:

Essay writing process must be kept on time, do not send hope in the system of automatic saving, finish a part in time to save to the draft box is the most important, otherwise it will be the same as me, to do the last careless press to the fallback key, can only be re-written again/(ㄒoㄒ)/~~.

Lab 1 Viewing CPU and memory, programming with machine instructions and assembly instructions

Related Keywords:

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.