On 27.03.2013 22:28, Masur Jonathan wrote:
> Hello,
> it really sounds incredible SDCC can do this automatically !
> What if you call a function that itself call a function that will affect 
> the bank switching ? Can SDCC detect such cases and do all the 
> bank-switching automatically ?

Well, sdcc does not do real interprocedural optimization. So unless the
function is inlined, sdcc will assume that the state of BBR is unknown
after the call. This could result in a write to BBR that is not
necessary (but the function body might be in a different .rel file, so
sdcc cannot know if the called function might change BBR; the only safe
way is to assume that the state of BBR is unknown after the call).

> This really sounds incredible. If SDCC can do all this, it's one more 
> reason to port it to the 6502 !
> 
> PS : What about interrupts that touches bank-switching ?

You should either not access banked memory in the handler, or put code
to save and restore BBR upon interrupts in your crt0.rel.

Philipp

------------------------------------------------------------------------------
Own the Future-Intel® Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to