更改绝对字地址的值

时间:2014-09-09 21:00:56

标签: absolute masm

如何执行更改绝对字地址值的操作?

假设您在5DAh处有一些值,并且您想要计算该地址上的零个数,或者将值从一个绝对地址移动到另一个绝对地址。怎么能这样做?

2 个答案:

答案 0 :(得分:0)

简答:你不能

你面前可能有一个技巧问题(没有任何线索,只是我的猜测)。

8086芯片的物理架构没有那条指令。

至于你的两个具体问题......

" ...你想要计算该地址上的零个数... "

这有些含糊不清,实际上是如此含糊,以至于我无法理解。

" ...将值从一个绝对地址移动到另一个... "

好问题。我们将在32位,no,16和32位中执行此操作。

16位示例

    Push    Si                      ;source index register
    Push    Di                      ;destination index register
    Push    Ax                      ;We'll use this for the transfer

    Lea Si, Where_The_Number_Is_Now ;You'll define this, somehow
    Lea Di, Where_We_Want_It_To_Go  ;You'll define this also, same thing

    Mov Ax, Ds:[Si]                 ;The "Ds:" may or may not be needed, be safe
    Mov Ds:[Di], Ax                 ;Probably do need "Ds:" for this instruction

    Pop Ax                          ;Do pay attention to the reverse order
    Pop Di                          ;...of popping the registers in exact
    Pop Si                          ;...opposite of how they were pushed

                                    ; And you are done

32位示例

    Push    Esi                         ;source index register
    Push    Edi                         ;destination index register
    Push    Eax                         ;We'll use this for the transfer

    Lea Esi, Where_The_Number_Is_Now    ;You'll define this, somehow
    Lea Edi, Where_We_Want_It_To_Go     ;You'll define this also, same thing

    Mov Eax, Ds:[Esi]                   ;The "Ds:" may or may not be needed, be safe
    Mov Ds:[Edi], Eax                   ;Probably do need "Ds:" for this instruction

    Pop Eax                             ;Do pay attention to the reverse order
    Pop Edi                             ;...of popping the registers in exact
    Pop Esi                             ;...opposite of how they were pushed

                                        ; And you are done

答案 1 :(得分:0)

要更改绝对字地址的值:

mov             byte ptr [5dah], 0

...或...

mov             word ptr [5dah], 0

将值从一个绝对字地址移动到另一个绝对字地址:

mov             al, byte ptr [5dah]
mov             byte ptr [1234h], al

...或...

mov             ax, word ptr [5dah]
mov             word ptr [1234h], ax

至于另一个问题,那个询问如何计算该地址上零的数量的问题,你有点模糊。