This is from the interrupt section on the datasheet:
{
The “return from interrupt” instruction, RETFIE, exits interrupt routine as well as sets the GIE bit.
During an interrupt, only the return PC value is saved on the stack. Typically, users may wish to save key registers during an interrupt e.g. W register and STATUS register. This will have to be implemented in software.
• Stores the W register
• Stores the STATUS register in Bank 0
• Executes the ISR code
• Restores the STATUS (and bank select bit
register)
• Restores the W register
}
You do not need RETFIE instruction, as you already discovered. It will get you back to where you were (the sound function in your case). If you do not call the instruction you can jump to some other code (CALL) routine, or the next instruction.
As for what to store, it really is up to you. The datasheet for each device shows what registers are kept and under what interrupt conditions. In general, if is not in a variable it is not guaranteed. The quote above shows you a guideline of usually the minimum that you store before you process the interrupt.
Bookmarks