Rolf wrote: > ORG 0x004 ; interrupt vector location > 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 > They key point here (and also what I *think* that Tamas has got wrong) is that MOVWF does *not* change the Z-flag. It doesn't change any STATUS flags. Thats why the code *does* work, even without any SWAPF's in the code above. Below, OTOH, SWAP *must* be used, since MOVF (either to "W" or to "F") *does* set/clear the Z-flag. Jan-Erik. > > ; isr code can go here or be located as a call subroutine elsewhere > > > 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 > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist