AllanL5 0 Report post Posted April 5, 2004 When I imbed the following: #define GETVAL( MyVal, ParmNum, Page) \ asm {bank ParmNum} \ asm {mov w,ParmNum} \ asm {bank MyVal } \ asm {mov MyVal,w} The second 'bank' expansion does not get translated to the bank data, instead the string replacement of 'MyVal' gets put in there -- in ParmNum, '030h' gets put in. I think this is a bug, no? Or will this work properly the way it is? Quote Share this post Link to post Share on other sites
Guest Pavel Report post Posted April 8, 2004 Compiler will remove redundant bank instructions. What probably happens in this is that both ParmNum and MyVal are in the same register bank. Since the bank was already set for ParmNum compiler removes the second bank instruction that sets the same bank. Regards, Pavel Quote Share this post Link to post Share on other sites
AllanL5 0 Report post Posted April 11, 2004 Yes, the compiler is excellent at removing redundant 'bank' expressions. That's one of the things I really like about it -- I can sprinkle 'bank' instructions around, and know that only the needed ones will be kept. However, in this case the SECOND 'bank' instruction is NOT being removed. I re-defined the variables, and defined a few character arrays (just to insure one variable was in one bank, and the other variable was in another bank). I can email you the example code, if you like. But the code SHOULD expand as (I believe ) : bank 010h movw ParmNum bank 030h movw MyVal Instead, it expands as bank 010h movw ParmNum bank MyVal movw MyVal If MyVal is in the same bank as ParmNum, wouldn't this leave an extraneous 'bank' in the code? And if they aren't in the same bank, will the 'bank MyVal' expression work? Thanks. Quote Share this post Link to post Share on other sites