Jump to content
Sign in to follow this  
AllanL5

Bug in SX 'BANK' expansions

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Guest Pavel

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...