I'm having some issues with a few macros I wrote, and it seems to have something to do with register banking.
Is the compiler supposed to track BSR usage through a sub/function/macro call?
If a routine (in this case a macro) modifies the BSR does the compiler expect it to be restored/zeroed when the routine exits
and returns to the caller?
compiler expectations for bank select register?
Moderators: David Barker, Jerry Messina
-
- Swordfish Developer
- Posts: 1470
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
- David Barker
- Swordfish Developer
- Posts: 1214
- Joined: Tue Oct 03, 2006 7:01 pm
- Location: Saltburn by the Sea, UK
- Contact:
Re: compiler expectations for bank select register?
If some user code modifies BSR, the user code is responsible for restoring it.
-
- Swordfish Developer
- Posts: 1470
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Re: compiler expectations for bank select register?
Do I need to restore it to what it was on entry or can I just set it to 0?
- David Barker
- Swordfish Developer
- Posts: 1214
- Joined: Tue Oct 03, 2006 7:01 pm
- Location: Saltburn by the Sea, UK
- Contact:
Re: compiler expectations for bank select register?
It needs to be the same - the compiler does not track ANY user changes
-
- Swordfish Developer
- Posts: 1470
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Re: compiler expectations for bank select register?
Thanks. That seems to have fixed it up.