📄 tmt.s
字号:
;/* TMT_Read_Timer */
;/* */
;/* DESCRIPTION */
;/* */
;/* This function returns the current value of the count-down timer. */
;/* */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Accelerated Technology, Inc. */
;/* */
;/* CALLED BY */
;/* */
;/* TMC_Start_Timer Start timer function */
;/* */
;/* CALLS */
;/* */
;/* None */
;/* */
;/* INPUTS */
;/* */
;/* None */
;/* */
;/* OUTPUTS */
;/* */
;/* TMD_Timer Value of count-down timer */
;/* */
;/* HISTORY */
;/* */
;/* NAME DATE REMARKS */
;/* */
;/* W. Lamie 06-01-1993 Created initial version 1.0 */
;/* D. Lamie 06-01-1993 Verified version 1.0 */
;/* K. Homer 03-01-1994 Modified interrupt lockout code, */
;/* resulting in version 1.1 */
;/* D. Lamie 03-18-1994 Verified version 1.1 */
;/* */
;/*************************************************************************/
;UNSIGNED TMT_Read_Timer(void)
;{
.public _TMT_Read_Timer
_TMT_Read_Timer:
;
; /* Return the current value of the count-down timer. */
; return(TMD_Timer);
;
pshx ; Save IX on the stack
sei ; Lockout interrupts
ldy _TMD_Timer ; Pickup MSW of timer
ldx _TMD_Timer+2 ; Pickup LSW of timer
ldd _TCD_Interrupt_Level ; Pickup current interrupt lockout
; See if interrupts are to be
; enabled or disabled
bne _TMT_Read_Done ; If non-zero, leave interrupts
; disabled
cli ; Otherwise, enable interrupts
_TMT_Read_Done:
xgdx ; Move LSW into D for return
pulx ; Recover IX from the stack
rts ; Return to caller
;}
;
;
;
;/*************************************************************************/
;/* */
;/* FUNCTION */
;/* */
;/* TMT_Enable_Timer */
;/* */
;/* DESCRIPTION */
;/* */
;/* This function enables the count-down timer with the specified */
;/* value. */
;/* */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Accelerated Technology, Inc. */
;/* */
;/* CALLED BY */
;/* */
;/* TMC_Start_Timer Start timer function */
;/* TMC_Timer_Task Timer expiration task */
;/* */
;/* CALLS */
;/* */
;/* None */
;/* */
;/* INPUTS */
;/* */
;/* time New count-down time */
;/* */
;/* OUTPUTS */
;/* */
;/* None */
;/* */
;/* HISTORY */
;/* */
;/* NAME DATE REMARKS */
;/* */
;/* W. Lamie 06-01-1993 Created initial version 1.0 */
;/* D. Lamie 06-01-1993 Verified version 1.0 */
;/* */
;/*************************************************************************/
;VOID TMT_Enable_Timer(UNSIGNED time)
;{
.public _TMT_Enable_Timer
_TMT_Enable_Timer:
;
; /* Place the new time value into the count-down timer. */
; TMD_Timer = time;
tsy ; Setup access to the stack
ldd 4,y ; Pickup LSW of time
std _TMD_Timer+2 ; Store it
ldd 2,y ; Pickup MSW of time
std _TMD_Timer ; Store it
;
; /* Indicate that the timer is active. */
; TMD_Timer_State = TM_ACTIVE;
clra ; Build TM_ACTIVE value
clrb ;
std _TMD_Timer_State ; Set the timer state flag
;
rts ; Return to caller
;}
;
;
;/*************************************************************************/
;/* */
;/* FUNCTION */
;/* */
;/* TMT_Adjust_Timer */
;/* */
;/* DESCRIPTION */
;/* */
;/* This function adjusts the count-down timer with the specified */
;/* value- if the new value is less that the current. */
;/* */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Accelerated Technology, Inc. */
;/* */
;/* CALLED BY */
;/* */
;/* TMC_Start_Timer Start timer function */
;/* */
;/* CALLS */
;/* */
;/* None */
;/* */
;/* INPUTS */
;/* */
;/* time New count-down time */
;/* */
;/* OUTPUTS */
;/* */
;/* None */
;/* */
;/* HISTORY */
;/* */
;/* NAME DATE REMARKS */
;/* */
;/* K. Homer 03-01-1994 Created initial version 1.1 */
;/* D. Lamie 03-18-1994 Verified version 1.1 */
;/* */
;/*************************************************************************/
;VOID TMT_Adjust_Timer(UNSIGNED time)
;{
.public _TMT_Adjust_Timer
_TMT_Adjust_Timer:
;
tsy ; Pickup stack pointer
sei ; Lockout interrupts
;
; /* Determine if the new time is less than the current. */
; if (time < TMD_Timer)
;
ldd 2,y ; Pickup MSW of time
cpd _TMD_Timer ; compare upper
bhi _TMT_Skip_Adjust ; If above, skip adjust
blo _TMT_Do_Adjust ; If below, do adjustment
ldd 4,y ; Pickup LSW of time
cpd _TMD_Timer+2 ; compare lower
bhs _TMT_Skip_Adjust ; If above or equal, skip adjust
;
_TMT_Do_Adjust:
;
; /* Adjust the timer. */
; TMD_Timer = time;
;
std _TMD_Timer+2 ; Store it
ldd 2,y ; Pickup MSW of time
std _TMD_Timer ; Store it
;
_TMT_Skip_Adjust:
;
ldd _TCD_Interrupt_Level ; Pickup current interrupt lockout
; See if interrupts are to be
; enabled or disabled
bne _TMT_Adjust_Done ; If non-zero, leave interrupts
; disabled
cli ; Otherwise, enable interrupts
_TMT_Adjust_Done:
rts ; Return to caller
;}
;
;
;
;/*************************************************************************/
;/* */
;/* FUNCTION */
;/* */
;/* TMT_Disable_Timer */
;/* */
;/* DESCRIPTION */
;/* */
;/* This function disables the count-down timer. */
;/* */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Accelerated Technology, Inc. */
;/* */
;/* CALLED BY */
;/* */
;/* TMC_Start_Timer Start timer function */
;/* TMC_Timer_Task Timer expiration task */
;/* */
;/* CALLS */
;/* */
;/* None */
;/* */
;/* INPUTS */
;/* */
;/* None */
;/* */
;/* OUTPUTS */
;/* */
;/* None */
;/* */
;/* HISTORY */
;/* */
;/* NAME DATE REMARKS */
;/* */
;/* W. Lamie 06-01-1993 Created initial version 1.0 */
;/* D. Lamie 06-01-1993 Verified version 1.0 */
;/* */
;/*************************************************************************/
;VOID TMT_Disable_Timer(void)
;{
.public _TMT_Disable_Timer
_TMT_Disable_Timer:
;
; /* Disable the count-down timer. */
; TMD_Timer_State = TM_NOT_ACTIVE;
;
ldd #1 ; Build TM_NOT_ACTIVE value
std _TMD_Timer_State ; Set the state flag
;
rts ; Return to caller
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -