Renesas Technology, Tools FAQs
Last Updated: August 7, 2000
Document Number: 01051251_e
Q.
When I declared "const" character string data as the structure, the compiler generated not only constant data but also assembler code
that reserve a ROM area. What is this ROM area for?
A.
The compiler reserves two types of ROM areas: one area for placing constants and one area for placing the address pointer
indicating the constant location start address. The following example shows how the NC30WA compiles the structure.
[Structure Declaration Example]
typedef struct {
uchar SIZE;
uchar far *DATA;
}TEMPLATE;
const TEMPLATE TBL_TEMPLATE[];
const TEMPLATE TBL_TEMPLATE[] = {
{ 2, (uchar far *)"\x10\x04" },
{ 2, (uchar far *)"\x10\x04" },
{ 2, (uchar far *)"\x10\x04" }
};
[Structure Data Definition Example]
Character string is placed in a specified area "\x10\x04" at (location).
NC30WA adds the label [___ TO] this address.
1.
Following two types of structure data are placed in the ROM area
These types only repeat the number of the array's elements.
- Constant 2
❍
- Address of character string (the above mentioned "\x10\x04", __TO, which becomes "__TO")❍
Accordingly, { 2, (uchar far *)"\x10\04" }is converted to the following assembly code.
_TBL_MSTEMPLATE:
.byte 02H ;<============== Constant 2 1 byte
.word (___T0)&0FFFFH ;<==== lower 2 bytes of address of letter-string
.word (___T0&0FF0000H)>>16 ;upper 2 bytes of address of letter-string
2.
"\x10\x04" is output at the location indicated by the _TO label.
___T0:
.byte 10H
.byte 04H
.byte 00H ;<== End of character string, NULL is included.
3.
Top of Page | Back to Previous Page
Terms of Use Privacy Policy
(C)2004 Renesas Technology Corp., All Rights Reserved.
Comentarios a estos manuales