We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I have one question about accessing high byte of 2-byte idata variable.
Case 1: for xdata variable we can use below to access the higher byte:
#define ADDR *((_2BYTE xdata *) 0x0800) #define ADDRH *((_1BYTE xdata *) 0x0800) #define ADDRL *((_1BYTE xdata *) 0x0801)
If ADDRH is enough to make decision then we can just use ADDRH, instead of ADDR(2-byte)... This save code space...
Case 2: if ADDR is declared as "idata" then is there any way achieving the same goal like Case 1 ?
All we want to do is "save code base"...
Thanks in advance...
1. the reason why "ADDR" is at fix location in DATA area is: our project utilizes ROM+RAM for firmware and the ROM part can not be changed once tape-out...
There's a flaw in that line of reasoning. You're fighting the tools instead of cooperating with them.
If DATA variables are not fixed then in the future when we add new routine/feature the DATA area "arrangement" maybe changed. This causes mismatch between ROM and RAM...
That would only happen if you went about that job in the wrong way. If you plan on fixing that ROM image and add to it, you should have two separate projects: one for the ROM alone, the other for the RAM alone. The RAM project should then be linked to the finished ROM image file (either the entire thing, or only its symbols).