You are on page 1of 1

http://www.edaboard.com/thread288227.

html
__asm {
movwf W_TEMP
;given multiple banks, and no global mem
ory you need to make a w_temp in each because you cannot change status prior to
saving it.
swapf STATUS, W
;The swapf instruction, unlike the movf, aff
ects NO status bits, which is why it is used here.
clrf STATUS
;point to bank 0 and clear all the flags
movwf STATUS_TEMP
movf PCLATH, W
;save PCLath
movwf PCLATH_TEMP
clrf PCLATH
;assume that this ISR is in page 0
;bcf STATUS, IPR
;This bcf is redundant & unnecessary unless
the clrf status (above) is removed
movf FSR, W
movwf FSR_TEMP
}
//ISR
__asm {
;The example fails to restore FSR here. One should
movf FSR_TEMP, W
movwf FSR
;to complete the restore sequence.
movf PCLATH_TEMP, W
movwf PCLATH
swapf STATUS_TEMP, W
movwf STATUS
swapf W_TEMP
swapf W_TEMP, W
}

You might also like