2

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.

User9123
  • 675
  • 1
  • 8
  • 20
  • 1
    It's the prefix for an immediate value. – fuz Sep 29 '18 at 18:22
  • 1
    Possible duplicate: https://stackoverflow.com/questions/6097958/what-does-the-hash-value-associated-with-the-arm-ldr-instruction-mean – Sigma Sep 29 '18 at 18:27
  • 1
    @Sigma The linked question is on ARM, this one on m68k - How can this be a duplicate? ARM uses # on offsets as well, m68k doesn't. – tofro Oct 04 '18 at 08:52

4 Answers4

4

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

tofro
  • 5,640
  • 14
  • 31
4

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 */
Will Sams
  • 196
  • 2
  • 14
1

Means the following is a number instead of a register. 

Lakshitha Wisumperuma
  • 1,574
  • 1
  • 10
  • 17
1

Normally in ARM and OP's code means an immediate constant but in other assembler types this symbol is different for example # is the same as $ in x86.

Sigma
  • 387
  • 3
  • 17