SPRU513Z August 2001 – October 2023 SM320F28335-EP
Reserve Space
[label] .space size in bits
[label] .bes size in bits
The .spaceand .bes directives reserve the number of bits given by size in bits in the current section and fill them with 0s. The section program counter is incremented to point to the word following the reserved space.
When you use a label with the .space directive, it points to the first word reserved. When you use a label with the .bes directive, it points to the last reserved.
This example shows how memory is reserved with the .space and .bes directives .
1 *********************************************
2 ** Begin assembling into .text section. **
3 *********************************************
4 000000 .text
5 *********************************************
6 ** Reserve 0F0 bits (15 words in the **
7 ** .text section. **
8 *********************************************
9 000000 .space 0F0h
10 00000f 0100 .word 100h, 200h
000010 0200
11 *********************************************
12 ** Begin assembling into .data section. **
13 *********************************************
14 000000 .data
15 000000 0049 .string "In .data"
000001 006E
000002 0020
000003 002E
000004 0064
000005 0061
000006 0074
000007 0061
16 *********************************************
17 ** Reserve 100 bits in the .data section; **
18 ** RES_1 points to the first word that **
19 ** contains reserved bits. **
20 *********************************************
21 000008 RES_1: .space 100
22 00000f 000F .word 15
23 *********************************************
24 ** Reserve 20 bits in the .data section; **
25 ** RES_2 points to the last word that **
26 ** contains reserved bits. **
27 *********************************************
28 000011 RES_2: .bes 20
29 000012 0036 .word 36h
30 000013 0011" .word RES_