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.

  • 相关阅读:
    JavaScript自动化构建工具grunt、gulp、webpack介绍
    开始使用 Vuejs 2.0 ---简单总结2
    开始使用 Vuejs 2.0 ---简单总结1
    Bootboxjs快速制作Bootstrap的弹出框效果
    FlexSlider是一个非常出色的jQuery滑动切换插件
    CSS实现背景透明,文字不透明(兼容各浏览器)
    jquery中attr和prop的区别
    GitHub 的分支创建与合并
    [译]使用NuGet管理共享代码
    [译]Nuget.Server
  • 原文地址:https://www.cnblogs.com/mrorangerabbit/p/10017391.html
Copyright © 2011-2022 走看看