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

📄 int.s

📁 nucleus 文件系统,内核和彩色图形系统,在小系统上非常好用
💻 S
📖 第 1 页 / 共 5 页
字号:
;/*      None                                                             */
;/*                                                                       */
;/* OUTPUTS                                                               */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* HISTORY                                                               */
;/*                                                                       */
;/*         NAME            DATE                    REMARKS               */
;/*                                                                       */
;/*      G. D. Fender    09-23-1998      Added clear BSS, 68328 timer code*/
;/*                                                                       */
;/*************************************************************************/
        .xdef    _INT_Initialize
        .xdef    _main
_INT_Initialize:
_main:
;VOID    INT_Initialize(void)
;{
;
;    /* Lockout interrupts during initialization.  */

      MOVE.W    #0x2700,SR           ; Lockout interrupts
      MOVE.W    #0x0,0xFFF618        ; kill watch dog timer
;
;  /*	Assign timer interrupt vector
	MOVE.B    #0x40,0xFFF300       ; Int Vect Reg - User Area = 0x100
	MOVE.L    #_INT_Timer_Interrupt,0x118   ; steal timer1 interrupt

;    /* BEGIN 68328 specific Code */

;   /* Copy the ROM vector table to RAM (address 0x0)  */
;
;      MOVE.L   #_INT_Vectors, A1
;      MOVE.L   #0,A2
;      MOVE.L   #256,D1
;_INT_Vect_Copy:
;      MOVE.L   (A1)+,D0
;      MOVE.L   D0,(A2)+
;      SUBQ.L   #1,D1
;      BNE      _INT_Vect_Copy

;    /* END 68328 specific Code */

;   /*  Clear the BSS area */
;
      MOVEA.L   #__BSS_START,A0      ; Pickup address of start of BSS area
      MOVEQ     #0,D0                ; Get a zero
BSS_Loop:
      CMPA.L    #__BSS_END,A0        ; Are we done?
      BEQ       BSS_Loop_Done        ; Yes, jump
      MOVE.L    D0,(A0)              ; Store a zip
      ADDQ.L    #4,A0                ; Bump Addr
      BRA       BSS_Loop             ; repeat
BSS_Loop_Done:
;
;    /* Setup the vectors loaded flag to indicate to other routines in the
;       system whether or not all of the default vectors have been loaded.
;       If INT_Loaded_Flag is 1, all of the default vectors have been loaded.
;       Otherwise, if INT_Loaded_Flag is 0, registering an LISR cause the
;       default vector to be loaded.  */
;    INT_Loaded_Flag =  0;
;
      MOVE.L    #0,_INT_Loaded_Flag  ; Indicate whether vector table is
                                       ; loaded (1) or not loaded (0)
;
;    /* Save the current value of the system stack.  */
;
;      CLR.L     -(A7)                ; Place a NULL on the system stack
;      MOVE.L    A7,_TCD_System_Stack ; Save system stack pointer

; Start insert new *********************************

        MOVE.L #_sys_memory ,A7               ; Get last available memory
        ADD.L   #SYS_STACK,A7               ; Add system stack size
        CLR.L   -(A7)                       ; Place a NULL on the system stack 
        MOVE.L  A7,_TCD_System_Stack        ; Save system stack pointer

;
;    /* Define the global data structures that need to be initialized by this
;       routine.  These structures are used to define the system timer
;       management HISR.  */
;    TMD_HISR_Stack_Ptr =        _sys_memory;
;    TMD_HISR_Stack_Size =       HISR_STACK;
;    TMD_HISR_Priority =         0;
;
      MOVE.L    A7 , D0      ; Put the available memory
                                       ; address in D0
      MOVE.L    D0,_TMD_HISR_Stack_Ptr ; Save the HISR stack pointer
      MOVE.L    #HISR_STACK,_TMD_HISR_Stack_Size ;   and stack size
      MOVE.L    #0,_TMD_HISR_Priority; HISR priority 0-2
      ADD.L     #HISR_STACK,D0       ; Position past the HISR stack
;
;
;     /* Call INC_Initialize with a pointer to the first available memory
;        address after the compiler's global data.  This memory may be used
;        by the application.  */
;     INC_Initialize(first_available_address);
;
;
;    /* 68328 Periodic  Interrupt setup.  Setup registers to generate
;       a periodic interrupt every 10ms. This takes 208 counts of the
;       timer running at the sysclock (33.33Mhz/2) divided by 16*50
;
;    /* BEGIN 68328 specific Code */
	MOVE.W	#0x32,0xFFF602       ; timer1_prescale = 50
	MOVE.W	#0x0D0,0xFFF604      ; timer1_compare = 208d = 10 ms
	MOVE.W	#0x35,0xFFF600       ; timer1_control = restart mode,
                                       ; toggle output, sysclock/16,
                                       ; enable int and timer.
        MOVE.L  #0x003FFFFD,0xFFF304   ; Int Mask Reg Allow IRQ7,Timer1
;    /* End of 68328 Periodic Timer Interrupt setup.  */
;
;    /* END 68328 specific Code */
      MOVE.L    D0,-(A7)

      JSR       _INC_Initialize
;}
;
;
;/*************************************************************************/
;/*                                                                       */
;/* FUNCTION                                                              */
;/*                                                                       */
;/*      INT_Vectors_Loaded                                               */
;/*                                                                       */
;/* DESCRIPTION                                                           */
;/*                                                                       */
;/*      This function returns the flag that indicates whether or not     */
;/*      all the default vectors have been loaded.  If it is false,       */
;/*      each LISR register also loads the ISR shell into the actual      */
;/*      vector table.                                                    */
;/*                                                                       */
;/* AUTHOR                                                                */
;/*                                                                       */
;/*                                                                       */
;/*      G. D. Fender, Accelerated Technology, Inc.                          */
;/*                                                                       */
;/* CALLED BY                                                             */
;/*                                                                       */
;/*      TCC_Register_LISR                   Register LISR for vector     */
;/*                                                                       */
;/* CALLS                                                                 */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* INPUTS                                                                */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* OUTPUTS                                                               */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* HISTORY                                                               */
;/*                                                                       */
;/*         NAME            DATE                    REMARKS               */
;/*                                                                       */
;/*    G. Fender        09-21-1998      Created initial version 1.0       */
;/*                                       for 68328ADS port.              */
;/*************************************************************************/
        .xdef    _INT_Vectors_Loaded
_INT_Vectors_Loaded:
;INT    INT_Vectors_Loaded(void)
;{
;
;    /* Just return the loaded vectors flag.  */
;    return(INT_Loaded_Flag);
        MOVE.L  _INT_Loaded_Flag,D0         ; Put the flag into D0
        RTS                                 ; Return to caller
;}
;
;
;/*************************************************************************/
;/*                                                                       */
;/* FUNCTION                                                              */
;/*                                                                       */
;/*      INT_Setup_Vector                                                 */
;/*                                                                       */
;/* DESCRIPTION                                                           */
;/*                                                                       */
;/*      This function sets up the specified vector with the new vector   */
;/*      value.  The previous vector value is returned to the caller.     */
;/*                                                                       */
;/* AUTHOR                                                                */
;/*                                                                       */
;/*                                                                       */
;/*      G. D. Fender, Accelerated Technology, Inc.                          */
;/*                                                                       */
;/* CALLED BY                                                             */
;/*                                                                       */
;/*      Application                                                      */
;/*      TCC_Register_LISR                   Register LISR for vector     */
;/*                                                                       */
;/* CALLS                                                                 */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* INPUTS                                                                */
;/*                                                                       */
;/*      vector                              Vector number to setup       */
;/*      new                                 Pointer to new assembly      */
;/*                                            language ISR               */
;/*                                                                       */
;/* OUTPUTS                                                               */
;/*                                                                       */
;/*      old vector contents                                              */
;/*                                                                       */
;/* HISTORY                                                               */
;/*                                                                       */
;/*         NAME            DATE                    REMARKS               */
;/*                                                                       */
;/*    G. Fender        09-21-1998      Created initial version 1.0       */
;/*                                       for 68328ADS port.              */
;/*                                                                       */
;/*************************************************************************/
        .xdef    _INT_Setup_Vector
_INT_Setup_Vector:
;VOID  *INT_Setup_Vector(INT vector, VOID *new)
;{
;
;VOID    *old_vector;                        /* Old interrupt vector      */
;VOID   **vector_table;                      /* Pointer to vector table   */
;
;    /* Calculate the starting address of the actual vector table.  */

⌨️ 快捷键说明

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