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.

  • 相关阅读:
    结束咯
    在Ubuntu上不能使用PPA下载
    月亮+大环
    piano
    花都论坛,广州花都本地生活
    LLVM的调用协议与内存对齐
    SALVIA 0.5.2优化谈
    LLVM随笔
    OS之争:永不停歇的战争(二,完结)
    OS之争:永不停歇的战争(一)
  • 原文地址:https://www.cnblogs.com/mrorangerabbit/p/10017391.html
Copyright © 2011-2022 走看看