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.

[label:]        .ds     size

 

In order that it may be referenced from other files as well, it is necessary to define the label with the .public directive.

.public label name

 

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  4               ;Aligns _val0 to 4 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