Download MSP430 Assembly Language Tools v 3.1 User's Guide (Rev. C

Transcript
.space/.bes — Reserve Space
www.ti.com
.space/.bes
Reserve Space
Syntax
[label] .space size in bytes
[label] .bes
Description
size in bytes
The .space and .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.
Example
This example shows how memory is reserved with the .space and .bes directives.
1
2
3
4 0000
5
6
7
8
9 0000
10 00f0 0100
00f2 0200
11
12
13
14 0000
15 0000 0049
0001 006E
0002 0020
0003 002E
0004 0064
0005 0061
0006 0074
0007 0061
16
17
18
19
20
21 0008
22 006c 000F
23 006e 0008!
24
25
26
27
28
29 0083
30 0084 0036
31 0086 0083!
104
Assembler Directives
**************************************************
**
Begin assembling into the .text section.
**
**************************************************
.text
**************************************************
**
Reserve 0F0 bytes in the .text section.
**
**************************************************
.space 0F0h
.word
100h, 200h
**************************************************
**
Begin assembling into the .data section.
**
**************************************************
.data
.string "In .data"
***************************************************
** Reserve 100 bytes in the .data section; RES_1 **
**
points to the first byte that contains
**
**
reserved bytes.
**
***************************************************
RES_1: .space 100
.word
15
.word
RES_1
***************************************************
** Reserve 20 bits in the .data section; RES_2 **
**
points to the last byte that contains
**
**
reserved bytes.
**
***************************************************
RES_2: .bes
20
.word
36h
.word
RES_2
SLAU131C – November 2008
Submit Documentation Feedback