Sections and Symbols. Freescale Semiconductor sc100
Anuncio
Anuncio
Freescale Semiconductor, Inc.
SC_Assem.book Page 77 Thursday, September 23, 2004 10:44 AM
Software Project Management
Sections arrange source statements arbitrarily, for example, grouping all statements that reserve P space storage locations.
Sections and Symbols
The default arrangement is that symbols defined within a section are local symbols. Any reference to a local symbol can be satisfied in the file in which it is defined.
Defining symbols outside a section makes them global. Such symbols can satisfy an outstanding current-file reference at assembly time, or an outstanding reference in any file at link time. Code inside or outside any section may reference global symbols freely, as long as the global symbol does not conflict with another symbol of the same name.
To declare a section’s local symbols global:
• Use the GLOBAL directive for an individual symbol.
• Use the GLOBAL qualifier of the SECTION directive for all symbols in a section.
In Listing 4.1, SYM1 and SYM2 are global symbols, initially defined outside any section.
But section EXAMPLE defines SYM1 locally, with a different value:
• This interior redefinition means that the first MOVE instruction moves the value 3 to
R0.
• SYM2 remains a global symbol, so the second MOVE instruction moves the value 2 to
R1.
• The final MOVE instruction is outside any section, so it uses the global SYM1 definition, moving the value 1 to R2.
Listing 4.1 Sections and Data Hiding
SYM1
SYM2
SYM1
EQU 1
EQU 2
SECTION EXAMPLE
EQU 3
MOVE #SYM1,R0
MOVE #SYM2,R1
ENDSEC
MOVE #SYM1,R2
SC100 Assembler User Guide 77
For More Information: www.freescale.com
Descargar
Anuncio