PROG0 CODE
movwf w_temp ;save off current W register contents
movf STATUS,w ;move status register into W register
movwf status_temp ;save off contents of STATUS register
movf PCLATH,W ;move pclath register into W register
movwf pclath_temp ;save off contents of PCLATH register
;*****************************************************************************
; IRQ HANDLER
;*****************************************************************************
irq_handler:
movf pclath_temp,W ;retrieve copy of PCLATH register
movwf PCLATH ;restore pre-isr PCLATH register contents
movf status_temp,w ;retrieve copy of STATUS register
movwf STATUS ;restore pre-isr STATUS register contents
swapf w_temp,f
swapf w_temp,w ;restore pre-isr W register contents
retfie ;return from interrupt