• 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.

  • 相关阅读:
    REP开发技巧
    css grid栅格布局
    flex学习, 尝试布局一个计算器
    sublime text html插件emmet
    flex布局
    SQL Server为字段添加默认值
    windows和linux文件输
    python eric6 IDE
    git撤销修改
    pyQt5
  • 原文地址:https://www.cnblogs.com/mrorangerabbit/p/10017391.html
Copyright © 2020-2023  润新知