下面是C 语言库 rts2xx.lib 中提供的恢复现场例程,其中分明包含 ST0,ST1. ST1 中还存放 DP,ARP,ARB .. 等等主程序重要信息,不保存还得了?
****************************************************************************
* FUNCTION DEF : I$$REST
* This function is branched to at the end of an interrupt
* handler to restore the environment of the interrupted
* code. This function performs the return from interrupt.
* In order to ensure correct restoration of the T register,
* this function assumes that interrupts are disabled during
* its execution.
****************************************************************************
I$$REST:
DINT
MAR *- ; POINT TO TOP ELEMENT ON STACK
RPTK 6 ; RESTORE TOP 6 ELEMENTS OF STACK
PSHD *-
LAR AR7,*- ; RESTORE ALL AUX REGISTERS EXCEPT AR1
LAR AR6,*-
LAR AR5,*-
LAR AR4,*-
LAR AR3,*-
LAR AR2,*-
LAR AR0,*-
MAR *- ; SKIP T REGISTER (FOR NOW)
LT *+
MPYK 1 ; RESTORE LOW PRODUCT REGISTER
LT *- ; RESTORE T REGISTER
MAR *- ; SKIP LOW PRODUCT REGISTER VALUE
LPH *- ; RESTORE HIGH PRODUCT REGISTER
ZALS *- ; RESTORE ACCUMULATOR
ADDH *-
LST *- ; RESTORE STATUS REGISTERS
LST1 *- ; OLD ARP IS RESTORED *NOW*
EINT ; RESTORE INTERRUPTS
RET ; RETURN TO INTERRUPTED CODE
RET
|