Reputation: 8695
What does this assembler code do?
someName label word
dw 8 dup(0)
How does label
work?
Upvotes: 2
Views: 16116
Reputation: 1
A label is just a name for a specific location in your code or a specific memory address. By using labels instead of actual addresses, your code can be maintained much more easy because the labels do not need to change when you add code and move around code. The compiler compiles it to actual addresses underneath.
Upvotes: 0
Reputation: 11
A label can be placed at the beginning of a statement. During assembly, the label is assigned the current value of the active location counter and serves as an instruction operand. There are two types of lables: symbolic and numeric.
Upvotes: 1
Reputation: 62068
Typically label
creates a symbolic name for the code/data that follows and also assigns it a type. It's similar to defining a variable with given name and type/size. But it does not actually allocate space for it. It can be used to create aliases to variables.
Upvotes: 5
Reputation: 993403
Despite your lack of details about which assembler you are using, I can take a guess.
The someName label word
statement assigns the current address (of type word
) to someName
. This means that later in the program, you can use the label someName
instead of a specific address.
The dw
statement reserves some amount of space of type word
. I'm not entirely certain what the 8dup(0)
means, but it might be 8 words (16 bytes) of space.
Upvotes: 2