Thomas, First, as Olin would say: you are not owed an answer here. However, since I'm a much nicer guy than he is ;-) I'll try to help you: The 'pagesel' works to restore the page because it can just jam the appropriate code address bits into PCLATH. On the other hand, to restore the bank, you'd have to save it someplace first. You can't just store STATUS in some handy place and restore it later for a couple reasons: 1: You'd be tweaking more than the bank bits. 2: If the routine you called ended up using GCALL itself it would overwrite the save area on you. One possibility would be to push the bank bits onto a software stack and restore them afterword. We can store a four level stack in a single byte (2 bits per level). Lets call the variable we use for this purpose "GSTACK". You will need to ensure that this location is visible in all banks. This would be in locations 0x70 thru 0x7F on the PIC16F62x and PIC16F87x chips. So, your GCALL could end up looking like this: rlf GSTACK,F ; make room for two more bits rlf GSTACK,F bcf GSTACK,0 bcf GSTACK,1 btfsc STATUS,RP0 bsf GSTACK,0 btfsc STATUS,RP1 bsf GSTACK,1 lcall name pagesel here bcf STATUS,RP0 bcf STATUS,RP1 btfsc GSTACK,0 bsf STATUS,RP0 btfsc GSTACK,1 bsf STATUS,RP1 rrf GSTACK,F ; pop old bits off rrf GSTACK,F rather a lot of code, don't you think? It would probably be better to just explicity set the correct bank upon return from the routine. Bob Ammerman RAm Systems > >;---------------------------------------------------------------- > >GCALL MACRO name > > local here > > lcall name > > pagesel here > >here > > ENDM > > > >_________________________________________________________________ > >Chat with friends online, try MSN Messenger: http://messenger.msn.com > > > >-- > >http://www.piclist.com hint: PICList Posts must start with ONE topic: > >[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > > _________________________________________________________________ > MSN Photos is the easiest way to share and print your photos: > http://photos.msn.com/support/worldwide.aspx > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads