Variables and Data Types
all initialized variables are defined in the .data section of code
Last updated
all initialized variables are defined in the .data section of code
Last updated
Number values may be specified in decimal, hex, or octal.
When specifying hex or base-16 values, they are preceded with a 0x . For example, to specify 127 as hex, it would be 0x7f .
When specifying octal, or-base-8 values, they are followed by a q . For example,to specify 511 as octal, it would be 777q .
The default radix (base) is decimal, so no special notation is required for decimal (base-10) numbers.
in assembly there is no need to define the variable type like C, instead the only thing that matters here is the variable length:
Initialized arrays are defined with comma separated values.
Constants are defined with equ . The general format is:
The constants are substituted for their defined values during the assembly process. As such, a constant is not assigned a memory location. This makes the constant more flexible since it is not assigned a specific type/size (byte, word, double-word, etc.). The values are subject to the range limitations of the intended use.
example:
the length calculation and declaration in the .data section will be constant when using 'equ'.
we can use both hex and decimal representation of ASCII characters including the newline character:
example:
Uninitialized data is declared in the "section .bss" section.
The general format is:
Some simple examples include:
The TIMES directive allows multiple initializations to the same value