SPNU118Z September 1995 – March 2023 66AK2E05 , 66AK2H06 , 66AK2H12 , 66AK2H14 , AM1705 , AM1707 , AM1802 , AM1806 , AM1808 , AM1810 , AM5K2E04 , OMAP-L132 , OMAP-L137 , OMAP-L138 , SM470R1B1M-HT , TMS470R1A288 , TMS470R1A384 , TMS470R1A64 , TMS470R1B1M , TMS470R1B512 , TMS470R1B768
Reserve Space
[label] .space size in bytes
[label] .bes size in bytes
The .spaceand .bes directives reserve the number of bytes given by size in bytes 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 byte reserved. When you use a label with the .bes directive, it points to the last byte reserved.
This example shows how memory is reserved with the .space and .bes directives .
1 **************************************************
2 ** Begin assembling into the .text section. **
3 **************************************************
4 00000000 .text
5
6 **************************************************
7 ** Reserve 0F0 bytes in the .text section. **
8 **************************************************
9 00000000 .space 0F0h
10 000000f0 00000100 .word 100h, 200h
000000f4 00000200
11 **************************************************
12 ** Begin assembling into the .data section. **
13 **************************************************
14 00000000 .data
15 00000000 49 .string "In .data"
00000001 6E
00000002 20
00000003 2E
00000004 64
00000005 61
00000006 74
00000007 61
16 ***************************************************
17 ** Reserve 100 bytes in the .data section; RES_1 **
18 ** points to the first byte that contains **
19 ** reserved bytes. **
20 ***************************************************
21 00000008 RES_1: .space 100
22 0000006c 0000000F .word 15
23 00000070 00000008" .word RES_1
24
25 ***************************************************
26 ** Reserve 20 bits in the .data section; RES_2 **
27 ** points to the last byte that contains **
28 ** reserved bytes. **
29 **************************************************
30 00000087 RES_2: .bes 20
31 00000088 00000036 .word 36h
32 0000008c 00000087" .word RES_2