/* Timer A3 controls the scheduler */
void far vTimerA3ISR(void);
#pragma INTERRUPT vTimerA3ISR
void far vTimerA3ISR(void){
#pragma ASM
; /* check if we had interrupted the monitor */
MOV.B 17[SP], R0H ; /* get PC(H) */
AND.B R0H, 0FH ; /* mask flags out of PC(H) */
MOV.B 15[SP], R0L ; /* get PC(M) */
CMP.W #0fc0H, R0 ; /* monitor interrupted ? */
JLTU ?+
POPM R0,R1,R2,R3,A0,A1,FB
REIT ; /* ==>> do NOT switch task) */
NOP
?:
STC SP, _uexc_current_sp ; /* save stackpointer */
JSR.a _UEXC_CheckTask ; /* Scheduler */
POPM R0,R1,R2,R3,A0,A1,FB
REIT ; /* ==>> exit */
NOP
#pragma ENDASM
}
Listing 1—Debugging the
µexec under the control of the ROM monitor can be difficult. To avoid scheduling
into the ROM monitor, the scheduler checks the memory area before changing task.
If the ROM monitor is active, scheduling stops.