The data section is used to allocate static space for variables. While there are many directives for the data section, below are some of the most commonly used ones. RARS has a help menu that lists all of the directives. Skim through it for future reference.
Here is a list of common directives:
.space
Allocates an specified number of bytes in the program's data
segment in memory..align
Aligns the next data item along a specified byte boundary:
0 = byte, 1 = half, 2 = word, 3 = double. The align directive is commonly
used in conjunction with another directive..byte
, .half
, .word
Store the listed value(s) as bytes/halfwords/words
in the data segment of memory..include
Inserts the contents of a specified file. Use double-quotes around
the file name..asciz
Stores the string in memory, with a null-terminator..ascii
Stores the string in memory without a null-terminator.