zoukankan      html  css  js  c++  java
  • Assembly Experiment5

    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.

  • 相关阅读:
    浅浅的分析下es6箭头函数
    css实现背景半透明文字不透明的效果
    五星评分,让我告诉你半颗星星怎么做
    微信小程序--成语猜猜看
    微信小程序开发中如何实现侧边栏的滑动效果?
    强力推荐微信小程序之简易计算器,很适合小白程序员
    swing _JFileChooser文件选择窗口
    file类简单操作
    序列化对象
    MessageBox_ swt
  • 原文地址:https://www.cnblogs.com/mrorangerabbit/p/10017391.html
Copyright © 2011-2022 走看看