Hello Calvin, As you can see I assumed your question was about an Interrupt-Service-Routine, and will answer it accordingly. (Maybe next time you could give us pic-listers some more information to work with ... Please :-) Here is a routine I use in a PIC16C74A. It works like a charm. ;----------------------------------------- ;Because W-register is saved before the Bank-select bits are set for the Interrupt-;routine the register-bank in wich the W-register is saved is undetermined. ;therefore the Storage-register S_WReg exists in _ALL_ register-banks ! ;- Save your W-register here. It doesn't matter in what bank it will be put, ; because you will read it (at the end of this routine) from the same bank movwf S_WReg ;Save W register ;/ ! S_WReg exists in _ALL_ register-banks ! ;- Now copy STATUS into W (without changing ANY status-flags !) swapf STATUS,W ;Read Status register into W ;- Select the Register-bank you want to work in bcf STATUS,RP0 ;/ Select Register-bank #0 bcf STATUS,RP1 ;/ ( <- This line is NOT needed in most of the PIC's) ;- Now store your STATUS-register in a Known register-bank movwf S_SReg ;/ ;- Save any register you'll want to use in your ISR (Interrupt-Service-Routine). movf FSR,W ;Save FSR movwf S_FSR ;/ ; Do your interrupt-stuf here ! ... ;- Restore all save registers movf S_FSR,W ;Restore FSR-register movwf FSR ;/ ;- Copy saved STATUS-register into W (Twice nibble-swapped gives origional) swapf S_SReg,W ;Restore Status register ;- Store W into STATUS, thereby restoring Register-bank -flags movwf STATUS ;/ ;- Read saved W register from the register-bank you started with swapf S_WReg ;Restore W register swapf S_WReg,W ;/ ;- Last but not least, return from interrupt :-) retfie ;----------------------------------------- One last thing: Define your S_WReg as _first_ byte in free-usable RAM, it'll make life that much easier ... Greetz, Rudy Wieser ---------- > Van: TONY NIXON 54964 > Aan: PICLIST@MITVMA.MIT.EDU > Onderwerp: Re: Quick question... > Datum: woensdag 11 maart 1998 2:03 > > > How can I define a register (i.e. W_Temp) in several banks at the same time? > > > > Calvin > > > > I am assuming this question is about context saving when servicing an > interrupt with unknown RAM page settings. > > There was some discussion about this a while ago and, from memory I > think it was Andy?? who came up with code similar to the following. > > The W_Hold registers are in RAM page 0 and 1 > W_Hold (b) = W_Hold (a) + 128 > > irqvec > movwf W_Hold ; store w reg - ram page 0 or 1 > swapf status,w > bcf status,rp0 ; ram page 0 > movwf S_Hold ; store status in RP 0 > movf pclath,w ; save rom page info > movwf pclsave > movf fsr,w > movwf F_Hold > ; assuming IRQ code is in ROM page 0 > ; for GOTO's etc > clrf pclath > > Regards > > Tony > > PicNPoke Multimedia 16F84 Beginners PIC Tools. > > PicNPoke - PicNPlay - PicNPlan - PicNPrep - PicNPost > Plus DT type saver. > New addition - PicNPort I/O Tutor. > > http://www.dontronics.com/picnpoke.html