⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tmt.s

📁 nuclues plus 源代码程序
💻 S
📖 第 1 页 / 共 3 页
字号:
;}
;
;
;/*************************************************************************/
;/*                                                                       */
;/* FUNCTION                                                              */
;/*                                                                       */
;/*      TMT_Retrieve_TS_Task                                             */
;/*                                                                       */
;/* DESCRIPTION                                                           */
;/*                                                                       */
;/*      This function returns the time-sliced task pointer.              */
;/*                                                                       */
;/* AUTHOR                                                                */
;/*                                                                       */
;/*      William E. Lamie, Accelerated Technology, Inc.                   */
;/*                                                                       */
;/* CALLED BY                                                             */
;/*                                                                       */
;/*      TMC_Timer_HISR                      Timer HISR                   */
;/*                                                                       */
;/* CALLS                                                                 */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* INPUTS                                                                */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* OUTPUTS                                                               */
;/*                                                                       */
;/*      TMD_Time_Slice_Task                 Time sliced task pointer     */
;/*                                                                       */
;/* HISTORY                                                               */
;/*                                                                       */
;/*         NAME            DATE                    REMARKS               */
;/*                                                                       */
;/*      K. Homer        03-01-1994      Created initial version 1.1      */
;/*      D. Lamie        03-18-1994      Verified version 1.1             */
;/*      K. Homer        10-20-1994      Corrected, TMD_Time_Slice_Task   */
;/*                                        was erroneously treated as     */
;/*                                        32-bit.                        */
;/*                                        resulting in version 1.1a      */
;/*      D. Lamie        10-25-1994      Verified version 1.1a            */
;/*                                                                       */
;/*************************************************************************/
;NU_TASK  *TMT_Retrieve_TS_Task(VOID)
;{
        .public  _TMT_Retrieve_TS_Task
_TMT_Retrieve_TS_Task:
;
;    /* Return the time slice task pointer.  */
        ldd     _TMD_Time_Slice_Task        ; Pickup the time-slice task
        rts                                 ; Return to caller
;}
;
;
;
;/*************************************************************************/
;/*                                                                       */
;/* FUNCTION                                                              */
;/*                                                                       */
;/*      TMT_Timer_Interrupt                                              */
;/*                                                                       */
;/* DESCRIPTION                                                           */
;/*                                                                       */
;/*      This function processes the actual hardware interrupt.           */
;/*      Processing includes updating the system clock and the count-     */
;/*      down timer and the time-slice timer.  If one or both of the      */
;/*      timers expire, the timer HISR is activated.                      */
;/*                                                                       */
;/* AUTHOR                                                                */
;/*                                                                       */
;/*      William E. Lamie, Accelerated Technology, Inc.                   */
;/*                                                                       */
;/* CALLED BY                                                             */
;/*                                                                       */
;/*      Interrupt Vector                                                 */
;/*                                                                       */
;/* CALLS                                                                 */
;/*                                                                       */
;/*      TCT_Activate_HISR                   Activate timer HISR          */
;/*      TCT_Interrupt_Context_Save          Save interrupted context     */
;/*      TCT_Interrupt_Context_Restore       Restore interrupted context  */
;/*                                                                       */
;/* 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             */
;/*      W. Lamie        08-09-1993      Add logic to insure that time-   */
;/*                                        slice expirations are not lost,*/
;/*                                        resulting in version 1.0a      */
;/*      D. Lamie        08-09-1993      Verified version 1.0a            */
;/*                                                                       */
;/*************************************************************************/
;VOID  TMT_Timer_Interrupt(void)
;{
        .public _TMT_Timer_Interrupt
_TMT_Timer_Interrupt:
;
;    /* Save minimal context on the stack.  */
;
;    /* Increment the system clock.  */
;    TMD_System_Clock++;
;
        ldd     _TMD_System_Clock+2         ; Increment the system clock
        addd    #1                          ; Note: the system clock is
        std     _TMD_System_Clock+2         ; 32-bits.  This causes all
        bcc     _TMT_Clock_Inc_Done         ; the extra work
        inc     _TMD_System_Clock+1
        bne     _TMT_Clock_Inc_Done
        inc     _TMD_System_Clock
_TMT_Clock_Inc_Done:
;    
;    /* Determine if the count-down timer is active.  */
;    if (TMD_Timer_State == TM_ACTIVE)
;    {
;
        ldd     _TMD_Timer_State            ; Pickup the timer state 
        bne     _TMT_Timer_Dec_Done         ; If not active, done with it
;    
;        /* Decrement the count-down timer.  */
;        TMD_Timer--;
;
        ldd     _TMD_Timer+2                ; Decrement the 32-bit system
        subd    #1                          ;   timer
        std     _TMD_Timer+2
        ldd     _TMD_Timer
        sbcb    #0
        sbca    #0
        std     _TMD_Timer
;        
;        /* Determine if the timer has expired. If so, modify the state 
;           to indicate that it has expired.  */
;        if (TMD_Timer == 0)
;
        ldd     _TMD_Timer                  ; Determine if the timer has 
        jbne    _TMT_Timer_Dec_Done         ;   reached 0.  If so, it has
        ldd     _TMD_Timer+2                ;   expired
        bne     _TMT_Timer_Dec_Done
;        
;            TMD_Timer_State =  TM_EXPIRED;
;
        ldd     #2                          ; Indicate that the timer has 
        std     _TMD_Timer_State            ;   expired by modifying the state
;
;    }
_TMT_Timer_Dec_Done:
;    
;    /* Determine if the time-slice timer is active.  Note that the parameters
;       for the time-slice are controlled by the Thread Control (TC) 
;       component.  */
;    if (TMD_Time_Slice_State == TM_ACTIVE)
;    {
        ldd     _TMD_Time_Slice_State       ; Determine if a time slice is 
                                            ;   active
        bne     _TMT_TS_Dec_Done            ; If not, skip time slice decrement
;    
;        /* Decrement the time slice counter.  */
;        TMD_Time_Slice--;
;
        ldd     _TMD_Time_Slice+2           ; Decrement the 32-bit time slice
        subd    #1                          ;   value
        std     _TMD_Time_Slice+2
        ldd     _TMD_Time_Slice
        sbcb    #0
        sbca    #0
        std     _TMD_Time_Slice
;        
;        /* Determine if the time-slice timer has expired. If so, modify the
;           time-slice state to indicate that it has.  */
;        if (TMD_Time_Slice == 0)
;        {
;
        ldd     _TMD_Time_Slice             ; Determine if the time slice has
        jbne    _TMT_TS_Dec_Done            ;   reached 0 yet.  If not, skip
        ldd     _TMD_Time_Slice+2           ;   the remainder of the time slice
        bne     _TMT_TS_Dec_Done            ;   processing
;                
;            TMD_Time_Slice_State =  TM_EXPIRED;
;
        ldd     #2                          ; Time slice has reached 0
        std     _TMD_Time_Slice_State       ; Modify state to indicate that it
                                            ;   has expired
;
;            /* Copy the current thread into the time-slice task pointer.  */
;            TMD_Time_Slice_Task =  TCD_Current_Thread;
;
        ldd     _TCD_Current_Thread         ; Pickup the thread associated with
                                            ;   the time slice
        std     _TMD_Time_Slice_Task        ; Save it for processing the time
                                            ;   slice later
;
;            /* Set current time slice to 1 just to insure that this expiration
;               is not lost.  */
        pshx                                ; Save IX on the stack
        xgdx                                ; Move task control pointer into IX
        clra                                ; Build clear value
        clrb                                ;
        std     26,x                        ; Clear MSW of current time slice
        ldd     #1                          ; Build minimal time slice value
        std     28,x                        ; Store minimal time slice in LSW 
                                            ;   of current time slice field
        pulx                                ; Recover IX from the stack
;
;        }
;    }
_TMT_TS_Dec_Done:
;    
;    /* Determine if either of the basic timers have expired.  If so, 
;       activate the timer HISR.  */
;    if ((TMD_Timer_State == TM_EXPIRED) ||
;        (TMD_Time_Slice_State == TM_EXPIRED))
;    {
;
        ldd     _TMD_Timer_State            ; Pickup the timer state
        subd    #2                          ; Adjust to zero
        beq     _TMT_Expiration             ; If time expired, activate HISR
        ldd     _TMD_Time_Slice_State       ; Pickup the time slice state
        cpd     #2                          ; Compare with TM_EXPIRED
        bne     _TMT_No_Expiration          ; If not 0, no expirations
;
_TMT_Expiration:
;
;        /* Save context of the system.  */
;        TCT_Interrupt_Context_Save(0);
;
        jsr     _TCT_Interrupt_Context_Save 
;        
;        /* Activate the HISR timer function.  */
;        TCT_Activate_HISR(&TMD_HISR);
        ldd     #_TMD_HISR
        jsr     _TCT_Activate_HISR
;
;        /* Restore context.  Note: control does not return from the
;           following jmp.  */
;        TCT_Interrupt_Context_Restore();
        jmp     _TCT_Interrupt_Context_Restore
;    }
;
;    /* Recover minimal context and return to point of interrupt.  */
;
_TMT_No_Expiration:
        rti                                 ; Return to the point of interrupt
;}
        .end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -