码迷,mamicode.com
首页 > 其他好文 > 详细

Assembly Experiment5

时间:2018-11-25 22:15:39      阅读:229      评论:0      收藏:0      [点我收藏+]

标签:exec   ring   register   sse   image   view   color   sas   seve   

Answer to the experiment(1),(2),(3),(4)

技术分享图片

技术分享图片

技术分享图片

技术分享图片

Experiment(5):

Screenshots&Results:

技术分享图片

 

技术分享图片

from the command u

we can know that

 a : 076A

 b :076B

c1 :076C

 

 elements in c1 before adding a and b

技术分享图片

after adding a and b

技术分享图片

076C:0000~076C:0007: 02 04 06 08 0A 0C 0E 10

just double the elements in a (also a+b)

 

Experiment(6):

Screenshots&Results:

技术分享图片

 disassemblig:

 技术分享图片

we can know that

a:076A

b:076C

 

技术分享图片

 elements in b before push elements into stack b

the last two elements: 6c 70 is the address of the stack b (076C)

 技术分享图片

 elements instack b after pushing elements into b

obviouly, the answer is right

 

Review of this experiment:

From this experiment, we get the method to design the program by ourselves, especially under the circuma=stance that the several segments are given.

Also, we need to know which way to add a number into a register is more fast, for example, when expressing (bx)+=1 in assembly language, we use ( inc bx  ) instead of ( add bx,1), because when you disassemblying the code, you will find that the former statement cost 2 words, but the latter cost 3 words. But, it doesn‘t work when the number getting bigger, for example, if you want to express (bx)+=2 or more, using ( add bx,2 ) is faster.

Another important method is that we need to focus on the changes of the elements in the segments during executing step by step, only by dong this dull work, you can easily find your protential mistakes.

However , the most important recipe I get during this experiment is that, because there are only 4 special segments in 8086CPU (DS, ES, SS, CS) , which means that you should use them properly after thinking. And, if you need to reuse one of these segments, you should protect the former data in the segments by using (push segment) and (pop segment) to preserve and recover the data in the segment before.

 

Assembly Experiment5

标签:exec   ring   register   sse   image   view   color   sas   seve   

原文地址:https://www.cnblogs.com/mrorangerabbit/p/10017391.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!