CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

#locate usage

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Carl Tashian
Guest







#locate usage
PostPosted: Mon Nov 26, 2001 8:06 am     Reply with quote

I'm using #locate to reserve space for variables.. and I wonder, does #locate know the size of the variable being located? Can it prevent entire structs from being clobbered, or does it just handle the built-in types?

Thanks,
Carl
___________________________
This message was ported from CCS's old forum
Original Post ID: 1316
Tomi
Guest







Re: #locate usage
PostPosted: Mon Nov 26, 2001 11:40 am     Reply with quote

The size of the type is reserved.
A sample list:
typedef struct {
char c;
float f;
int16 i;
} struct1;

char c1,c2;
char i;
struct1 y;
#locate y = 0x22 // the struct is 0x22-0x28 (last byte)

c1=c2=0;
i = 10;
y.i = 20;

.................... c1=c2=0;
0019: CLRF 2A
001A: MOVF 2A,W
001B: MOVWF 29 // c1 var. @0x29
.................... i = 10;
001C: MOVLW 0A
001D: MOVWF 2B
.................... y.i = 20;
001E: CLRF 28 // the last element (int16) of the struct
001F: MOVLW 14
0020: MOVWF 27


:=I'm using #locate to reserve space for variables.. and I wonder, does #locate know the size of the variable being located? Can it prevent entire structs from being clobbered, or does it just handle the built-in types?
:=
:=Thanks,
:=Carl
___________________________
This message was ported from CCS's old forum
Original Post ID: 1321
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group