汇编内存操作数说明 [英] Assembly memory operands clarification

查看:289
本文介绍了汇编内存操作数说明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,例如[BX]在括号之间时,它是指其内存内容.但同时我也不明白.

I understand when for example [BX] is in between brackets it is referring to its memory contents. But at the same time I do not understand that.

CMP [BX], 12ADH

在那个例子中,我不了解真正在比较什么.

In that example I do not understand what is really being compared.

MOV EBX, [BX]

与该移动相同,我不知道正在移动的内容的内存地址或其中的值.

Same for this move, I don't get what is being moved its memory address or the value inside of it.

推荐答案

CMP [BX], 12ADH

这实际上是一条无效指令,因为您尚未指定第一个操作数的大小.假设您打算进行WORD(16位)比较,例如:

This is actually an invalid instruction, as you haven't specified the size of the first operand. Assuming you intend a WORD (16-bit) comparison, like:

CMP WORD [BX], 12ADH

这将首先从BX寄存器中指定地址的内存中提取16位WORD.然后,它将把该值与立即值12ADh进行比较.

This will first fetch a 16-bit WORD from memory at the address specified in the BX register. Then, it will compare that value to the immediate value 12ADh.

请注意,CMP的作用与SUB相同,但实际上并未修改任何值.它只会假装"进行减法,并相应地设置FLAGS.

Note that CMP does the same thing as SUB, but without actually modifying any values. It only "pretends" to do the subtraction, and sets the FLAGS accordingly.

MOV EBX, [BX]

这将从BX寄存器中指定的地址的内存中提取32位DWORD.然后,它将把该值存储在EBX寄存器中.

This will fetch a 32-bit DWORD from memory at the address specified in the BX register. Then, it will store that value in the EBX register.

在类似WORD [BX]的表达式中,我们可以说BX指向"内存中的16位WORD:

In an expression like WORD [BX], we can say that BX "points to" a 16-bit WORD in memory:

         Memory             Register File
           ...
        _________             ________
 100h  |  1234h  |     /---- |  102h  | BX
       |_________|     |     |________|
 102h  |  5678h  | <---/        ...
       |_________|
 104h  |  9ABCh  |
       |_________|
 106h  |  DEF0h  |
       |_________|
           ...

这篇关于汇编内存操作数说明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆