interrupt68000easy68k

68k Assembly: Does the CPU does store the status register on interrupt?


I have not been able to find any information as to whether the MC68000 preserves its status register / CCR during external interrupts. I imagine it would be an issue if the CPU were to interrupt immediately before a conditional branch, and the interrupt modifies the CCR. Right now my interrupt code looks like this:

            ORG     $110000   ; Location of IPL6 vector
IPL6        MOVE.W  SR, -(SP) ; Is this line necessary?
            MOVE.L  D0, -(SP)
            ; Perform interrupt tasks here
            MOVE.L  (SP)+, D0
            MOVE.W  (SP)+, SR ; Is this line necessary?
            RTE               ; Return

I'm wondering if the indicated lines that push/pop the SR from the stack are required, or if the CPU automatically saves and restores the SR during interrupts.


Solution

  • Yes, the CPU does store the status register on interrupt. Logically this is needed or otherwise issues like you mentioned would happen.

    On page 6-84 of MOTOROLA M68000 FAMILY Programmer’s Reference Manual the RTE command shows that it restores SR among other registers so it has to have been stored previously.