Hi. I hope more precise Interrupt process.
current GCBASIC generate code ------------------------------------ ORG 4 ;Save Context movwf SysW swapf STATUS,W movwf SysSTATUS clrf SysIntOffCount incf SysIntOffCount,F ;Call Interrupt sub goto INTERRUPT INTERRUPTDONE ;Restore Context clrf SysIntOffCount swapf SysSTATUS,W movwf STATUS swapf SysW,F swapf SysW,W retfie ------------------------------------
But, I hope generate code as like SDCC (This marged GCBASIC and SDCC) ------------------------------------ sharebank udata_ovr 0x0070 PSAVE res 1 SSAVE res 1 WSAVE res 1 STK12 res 1 ............. STK00 res 1 ------------------------------------ c_interrupt code 0x4 _int_proc ;Function start MOVWF WSAVE ' <----- address SWAPF STATUS,W CLRF STATUS ' <----- reset BANK MOVWF SSAVE MOVF PCLATH,W ' <----- save CLRF PCLATH MOVWF PSAVE MOVF FSR,W ' <----- save BANKSEL ___sdcc_saved_fsr MOVWF ___sdcc_saved_fsr
clrf SysIntOffCount incf SysIntOffCount,F ;Call Interrupt sub goto INTERRUPT INTERRUPTDONE ;Restore Context clrf SysIntOffCount
BANKSEL ___sdcc_saved_fsr MOVF ___sdcc_saved_fsr,W MOVWF FSR MOVF PSAVE,W MOVWF PCLATH CLRF STATUS SWAPF SSAVE,W MOVWF STATUS SWAPF WSAVE,F SWAPF WSAVE,W END_OF_INTERRUPT RETFIE ------------------------------------
Thanks. kamiya
Log in to post a comment.
Hi. I hope more precise Interrupt process.
current GCBASIC generate code
------------------------------------
ORG 4
;Save Context
movwf SysW
swapf STATUS,W
movwf SysSTATUS
clrf SysIntOffCount
incf SysIntOffCount,F
;Call Interrupt sub
goto INTERRUPT
INTERRUPTDONE
;Restore Context
clrf SysIntOffCount
swapf SysSTATUS,W
movwf STATUS
swapf SysW,F
swapf SysW,W
retfie
------------------------------------
But, I hope generate code as like SDCC
(This marged GCBASIC and SDCC)
------------------------------------
sharebank udata_ovr 0x0070
PSAVE res 1
SSAVE res 1
WSAVE res 1
STK12 res 1
.............
STK00 res 1
------------------------------------
c_interrupt code 0x4
_int_proc ;Function start
MOVWF WSAVE ' <----- address
SWAPF STATUS,W
CLRF STATUS ' <----- reset BANK
MOVWF SSAVE
MOVF PCLATH,W ' <----- save
CLRF PCLATH
MOVWF PSAVE
MOVF FSR,W ' <----- save
BANKSEL ___sdcc_saved_fsr
MOVWF ___sdcc_saved_fsr
clrf SysIntOffCount
incf SysIntOffCount,F
;Call Interrupt sub
goto INTERRUPT
INTERRUPTDONE
;Restore Context
clrf SysIntOffCount
BANKSEL ___sdcc_saved_fsr
MOVF ___sdcc_saved_fsr,W
MOVWF FSR
MOVF PSAVE,W
MOVWF PCLATH
CLRF STATUS
SWAPF SSAVE,W
MOVWF STATUS
SWAPF WSAVE,F
SWAPF WSAVE,W
END_OF_INTERRUPT
RETFIE
------------------------------------
Thanks.
kamiya