compiler expectations for bank select register?

Coding and general discussion relating to the compiler

Moderators: David Barker, Jerry Messina

Post Reply
Jerry Messina
Swordfish Developer
Posts: 1469
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

compiler expectations for bank select register?

Post by Jerry Messina » Tue Jul 19, 2016 8:51 am

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?

User avatar
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?

Post by David Barker » Tue Jul 19, 2016 12:24 pm

If some user code modifies BSR, the user code is responsible for restoring it.

Jerry Messina
Swordfish Developer
Posts: 1469
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: compiler expectations for bank select register?

Post by Jerry Messina » Tue Jul 19, 2016 12:37 pm

Do I need to restore it to what it was on entry or can I just set it to 0?

User avatar
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?

Post by David Barker » Tue Jul 19, 2016 1:34 pm

It needs to be the same - the compiler does not track ANY user changes

Jerry Messina
Swordfish Developer
Posts: 1469
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: compiler expectations for bank select register?

Post by Jerry Messina » Tue Jul 19, 2016 5:16 pm

Thanks. That seems to have fixed it up.

Post Reply