📄 cld.s
字号:
; RTD #$4
RTS
;} /* end of CLD_Load_Clock */
;
;
;
;/************************************************************************/
;/* */
;/* FUNCTION "CLD_Read_Clock" */
;/* */
;/* */
;/* DESCRIPTION */
;/* */
;/* This function is used to read the system time clock. */
;/* */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Accelerated Technology */
;/* */
;/* CALLED FROM */
;/* */
;/* Routines that require time information */
;/* */
;/* ROUTINES CALLED */
;/* */
;/* None */
;/* */
;/* INPUTS */
;/* */
;/* None */
;/* */
;/* OUTPUTS */
;/* */
;/* return(CLD_System_Clock) */
;/* */
;/************************************************************************/
;unsigned int CLD_Read_Clock()
;{
export CLD_Read_Clock
CLD_Read_Clock
;
; /* Return the value of the system clock. */
; return(CLD_System_Clock);
MOVE.L CLD_System_Clock,D0
RTS
;} /* end of CLD_Read_Clock */
;
;
;
;/************************************************************************/
;/* */
;/* FUNCTION "CLD_Start_System_Timer" */
;/* */
;/* */
;/* DESCRIPTION */
;/* */
;/* This function is used to start the system timer. */
;/* */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Accelerated Technology */
;/* */
;/* CALLED FROM */
;/* */
;/* Routines that start and stop time slice timer */
;/* */
;/* ROUTINES CALLED */
;/* */
;/* None */
;/* */
;/* INPUTS */
;/* */
;/* time */
;/* */
;/* OUTPUTS */
;/* */
;/* None */
;/* */
;/************************************************************************/
;void CLD_Start_System_Timer(time)
;{
export CLD_Start_System_Timer
CLD_Start_System_Timer
;
; /* Set the system timer variables accordingly. */
; CLD_System_Timer = time;
; CLD_Sys_Timer_Active = NU_TRUE;
MOVE.L 4(A7),CLD_System_Timer
MOVEQ.L #1,D0
MOVE.L D0,CLD_Sys_Timer_Active
; /* Fix for version 3.07 and later of the INTROL compiler
; * Return and pop parameters off stack
; */
; RTD #$4
RTS
;}
;
;
;
;/************************************************************************/
;/* */
;/* FUNCTION "CLD_Stop_System_Timer" */
;/* */
;/* */
;/* DESCRIPTION */
;/* */
;/* This function is used to stop the system timer. */
;/* */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Accelerated Technology */
;/* */
;/* CALLED FROM */
;/* */
;/* Routines that start and stop time slice timer */
;/* */
;/* ROUTINES CALLED */
;/* */
;/* None */
;/* */
;/* INPUTS */
;/* */
;/* None */
;/* */
;/* OUTPUTS */
;/* */
;/* None */
;/* */
;/************************************************************************/
;void CLD_Stop_System_Timer()
;{
export CLD_Stop_System_Timer
CLD_Stop_System_Timer
;
; /* Set the system timer variables accordingly. */
; CLD_Sys_Timer_Active = NU_FALSE;
CLR.L CLD_Sys_Timer_Active
RTS
;} /* end of CLD_Read_Clock */
;
;
;
;/************************************************************************/
;/* */
;/* FUNCTION "CLD_Timer_Interrupt" */
;/* */
;/* */
;/* DESCRIPTION */
;/* */
;/* This function is used to process a timer interrupt. Although */
;/* this function is target dependent, it does serve as a good */
;/* example of a pre-emptive interrupt routine. */
;/* */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Accelerated Technology */
;/* */
;/* CALLED FROM */
;/* */
;/* Hardware Timer Vector */
;/* */
;/* ROUTINES CALLED */
;/* */
;/* SKP_Time_Slice Time slice */
;/* CLP_Timer_Expiration Process timer expiration */
;/* */
;/* INPUTS */
;/* */
;/* None */
;/* */
;/* OUTPUTS */
;/* */
;/* None */
;/* */
;/************************************************************************/
;void CLD_Timer_Interrupt(void)
;
;{
export CLD_Timer_Interrupt
CLD_Timer_Interrupt
;
; /* Increment the generic system clock. */
; CLD_System_Clock++;
ADDQ.L #1,CLD_System_Clock
;
; /* Decrement the system timer if there is something to decrement. */
; if (CLD_System_Timer)
TST.L CLD_System_Timer
BEQ _No_System_Timer
; CLD_System_Timer--;
SUBQ.L #-$FFFFFFFF,CLD_System_Timer
_No_System_Timer:
;
; /* Decrement the task timer if there is something to decrement. */
; if (CLD_Timer)
TST.L CLD_Timer
BEQ _No_Timer
; CLD_Timer--;
SUBQ.L #-$FFFFFFFF,CLD_Timer
_No_Timer:
MOVE SR,-(A7) ; Save current SR
ORI #$0700,SR ; Lockout interrupts
;
; /* Determine if a task timer has expired. */
; if ((CLP_Active_List_Ptr != NU_NULL) && (CLD_Timer == 0))
; {
;
; /* Call the task timer expiration routine. */
TST.L CLP_Active_List_Ptr
BEQ _No_Timer_Active
TST.L CLD_Timer
BNE _No_Timer_Active
; CLP_Timer_Expiration();
BSR CLP_Timer_Expiration
_No_Timer_Active:
; }
;
; /* Determine if a time slice has occurred. */
; if ((CLD_Sys_Timer_Active) && (CLD_System_Timer == 0))
; {
;
; /* Call the time slice processing routine. */
TST.L CLD_Sys_Timer_Active
BEQ _No_Time_Slice_Active
TST.L CLD_System_Timer
BNE _No_Time_Slice_Active
; SKP_Time_Slice();
CLR.L CLD_Sys_Timer_Active ; Disable just in case
BSR SKP_Time_Slice
_No_Time_Slice_Active:
; }
;
MOVE (A7)+,SR ; Recover SR
RTS ; Return to caller
;} /* end of CLD_Timer_Interrupt */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -