SPRUI03E June 2015 – January 2023
Reserve Space in the .bss Section
.bss symbol,size in bytes[, alignment[, bank offset]]
The .bss directive reserves space for variables in the .bss section. This directive is usually used to allocate space in RAM.
This directive is similar to the .usect directive (see .usect topic); both simply reserve space for data and that space has no contents. However, .usect defines additional sections that can be placed anywhere in memory, independently of the .bss section.
For more information about sections, see Chapter 3.
In this example, the .bss directive allocates space for a variable, array. The symbol array points to 100 bytes of uninitialized space (at .bss SPC = 0). Symbols declared with the .bss directive can be referenced in the same manner as other symbols and can also be declared global.
1 *******************************************
2 ** Start assembling into .text section. **
3 *******************************************
4 00000000 .text
5 00000000 008001A0 MV A0,A1
6
7 *******************************************
8 ** Allocate 100 bytes in .bss. **
9 *******************************************
10 00000000 .bss array,100
11
12 *******************************************
13 ** Still in .text **
14 *******************************************
15 00000004 010401A0 MV A1,A2
16
17 *******************************************
18 ** Declare external .bss symbol **
19 *******************************************
20 .global array