A.3.1 Defining variables with no initial values
Use the .DS directive in a section with no initial value to allocate area for a variable with no initial value.
In order that it may be referenced from other files as well, it is necessary to declare the label with the .PUBLIC directive.
Example | Defining variables with no initial values |
.DSEG sbss
.PUBLIC _val0 ;Sets _val0 as able to be referenced from other files
.PUBLIC _val1 ;Sets _val1 as able to be referenced from other files
.PUBLIC _val2 ;Sets _val2 as able to be referenced from other files
.ALIGN 2 ;Aligns _val0 to 2 bytes
_val0:
.DS 4 ;Allocates 4 bytes of area for val0
_val1:
.DS 2 ;Allocates 2 bytes of area for val1
_val2:
.DS 1 ;Allocates 1 byte of area for val2
|