; this is the start of the interrupt service routine. The values of W and status are not known, but they may be important.
movwf WTemp ; save W register, so whatever was in W is now in WTemp. Status is not affected by movwf
swapf STATUS,w ;move the status register to W, using swap so that status isn't affected while doing this move.
movwf StatusTemp ;save what was the status register, now swapped round, in StatusTemp
movf INTCON,w ;
movwf IntStat ; Save the INTCON register. I don't know why, but possibly to work out what to do during the interrupt.
; This is where the actual interrupt code can go. It can do anything it likes to the W or status
;It is possible that the interrupt only needed to save INTCON, but doing that would have affected the W and status registers, so they had to be protected first
swapf StatusTemp,w ;Now what was in status register before the interrupt is swapped back to its original order
movwf STATUS ; and put back into the status register.
swapf WTemp,f ;The temporary store for the original W register is swapped
swapf WTemp,w ; and then it is swapped back and at the same time put back in W
clrf INTCON ;INTCON is cleared to disable more interrupts
retfie ;returns from interrupt