This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Question about the directive in asm file

Hello:

I am still not very familar with the "directive" in assembly language.

Here in the snapshot, I want to allocate 10 16-bit numbers into the directive name ".mydata".

 

I have two questions:

1-The ".short" is also called "directive" which reserves 16-bits of memory initialized to a value.  That means if I want to put 10 16-bit digits into the directive ".mydata", I need to add ".short" to the front of every digital?

Why we need multiple directive names?

 

2-Why the ".mydata" cannot be put at the first column from the left?  I tried to put it on the left most, but the error occured.

 

Thank you

  • Hi,

    Moving your post to right forum to be better answered.

    Thanks & regards,
    Sivaraj K
  • A "directive" is just an instruction to the assembler to do something, like store a data value.  We don't call it "instruction" because that would be confused with the machine instructions.

    1. You can create multiple values with a single .short directive, if you want to:

        .short 0, 7, 10, 7

    2. If you put the directive in the first column, it will get treated as a label.  You need to add some whitespace to let the assembler know it is not a label.