MIPS中.word和.equ有什么区别?

Nik*_*ntz 2 assembly mips

我认为两者都是一样的:变量声明和初始化.你能详细说明吗?

Jim*_*hel 10

.word分配空间并初始化数据..equ定义一个常量,但不为它分配任何空间.

所以,例如,您可能会说:

one .equ 1  ; defines a constant called "one"
counter: .word one ; allocates space and initializes it with the value 1
Run Code Online (Sandbox Code Playgroud)

不同之处在于.equ指令不在编译图像中分配任何空间.

  • 作为C的类比,你的第一行就像`#define one 1`,你的第二行就像`word counter = one;` (2认同)