简体   繁体   English

#在汇编中是什么意思?

[英]What Does # Mean in Assembly?

For example, what would be the difference between, MOVE 8,D2 and MOVE #8,D2? 例如,MOVE 8,D2和MOVE#8,D2有什么区别? Just wondering what the # represents and what would happen without it. 只是想知道#代表什么以及如果没有它会发生什么。

in 68k assembly, the # sign denotes immediate constants. 在68k汇编中,#号表示立即数。 Everything else is normally considered an address: 通常将其他所有内容视为地址:

move.w #6,d0

will load the constant immediate value 6 into register d0, while 将常量立即数6加载到寄存器d0中,而

move.w 6,d0

will do something entirely different: It will fetch the word at the constant address 6 into register d0 将会做完全不同的事情:它将把常量地址6上的字提取到寄存器d0中

表示以下是数字而不是寄存器。

通常在ARM和OP的代码中表示立即数,但是在其他汇编程序类型中,此符号是不同的,例如#与x86中的$相同。

In GNU AS, if you use the # before anything else on a given line, the line will be ignored (comment). 在GNU AS中,如果在给定行上的其他任何内容之前使用#,则该行将被忽略(注释)。 If use # before a value after an instruction, the value will be considered an immediate. 如果在指令后的值之前使用#,则该值将被视为立即数。 If you want to use in-line comments at that point on the same line, you have to use C-style (ie, /* comment here */) comments. 如果要在同一行的同一位置使用行内注释,则必须使用C样式的注释(即,/ *此处为* /)。 For example: 例如:

# Write the palette to CRAM
lea Palette, a0                 /* Move palette address to a0 */
move.w #size_palette_w-1, d0    /* Loop counter = 8 words in palette */

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM