This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Locating members of a struct variable to absolute memory locations

I would like to know if I can use "_at_" to locate struct members to absolute memory locations. For instance, I have a struct variable defined as following,

xdata struct {

	unsigned char member1;
	unsigned char member2;
	.
	.
	unsigned char member5;
	unsigned char member6;

	}	myStruct;

myStruct.member1 to myStruct.member5 are located in a contiguous memory block, but myStruct.member6 is located somewhere else for a backward compatibility purpose. I can surely declare this "stray" member as an individual variable, nevertheless, I just think it would be nice to access it via a data structure for its consistancy. Can I do this by using "_at_"?

Thank you all.

Parents
  • If you describe your problem in detail maybe we could think of something.
    Probably I shouldn't have said what I said about violating priciples. But if you think of it, imagine that a structure has a member located at an absolute memory location. What would sizeof(structure) mean? What would happen if there were two variables of that type? Or an array?
    Re-writing assembly code in C is no easy task. In some cases it can be easier to figure out how the program works and re-write it from scratch. If you wish to preserve some of the original structure of the program, maybe it's better to use macros to emulate features that are not present in C.
    Best luck!
    - Mike

Reply
  • If you describe your problem in detail maybe we could think of something.
    Probably I shouldn't have said what I said about violating priciples. But if you think of it, imagine that a structure has a member located at an absolute memory location. What would sizeof(structure) mean? What would happen if there were two variables of that type? Or an array?
    Re-writing assembly code in C is no easy task. In some cases it can be easier to figure out how the program works and re-write it from scratch. If you wish to preserve some of the original structure of the program, maybe it's better to use macros to emulate features that are not present in C.
    Best luck!
    - Mike

Children
No data