Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What Does # Mean in Assembly?

Tags:

assembly

68000

For example, what would be the difference between, MOVE 8,D2 and MOVE #8,D2? Just wondering what the # represents and what would happen without it.

like image 345
User9123 Avatar asked Oct 16 '25 03:10

User9123


2 Answers

In GNU AS, if you use the # before anything else on a given line, the line will be ignored (comment). 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 (i.e., /* comment here */) comments. 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 */
like image 152
Will Sams Avatar answered Oct 17 '25 17:10

Will Sams


in 68k assembly, the # sign denotes immediate constants. Everything else is normally considered an address:

move.w #6,d0

will load the constant immediate value 6 into register d0, while

move.w 6,d0

will do something entirely different: It will fetch the word at the constant address 6 into register d0

like image 38
tofro Avatar answered Oct 17 '25 16:10

tofro



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!