Hello
I assume you are using a HC08 CPU and you want to place the variable flags in the direct memory area (between 0x00 and 0xFF).
Am I right?
I also assume you are using a project created using the project wizard. Is that correct?
This is done as follows:
#pragma DATA_SEG __SHORT_SEG MY_ZEROPAGE
struct {
unsigned char flag1:1
unsigned char flag2:1
unsigned char flag3:1
} flags;
#pragma DATA_SEG DEFAULT
If you have an external declaration for this variable, make sure to declare it in the same section.
#pragma DATA_SEG __SHORT_SEG MY_ZEROPAGE
extern struct {
unsigned char flag1:1
unsigned char flag2:1
unsigned char flag3:1
} flags;
#pragma DATA_SEG DEFAULT
There is an alternate notation.
If you have the following definition in a header file, which is included in all project source file:
#pragma DATA_SEG __SHORT_SEG MY_ZEROPAGE
#pragma DATA_SEG DEFAULT
You can then define the variable as follows:
struct {
unsigned char flag1:1
unsigned char flag2:1
unsigned char flag3:1
} flags @"MY_ZEROPAGE";
The declaration will then look as follows:
extern struct {
unsigned char flag1:1
unsigned char flag2:1
unsigned char flag3:1
} flags @"MY_ZEROPAGE";
CrasyCat