📄 int.s
字号:
;/* D. Lamie 08-09-1993 Verified version 1.0a */
;/* */
;/*************************************************************************/
;VOID INT_Initialize(void)
;{
.public _INT_Initialize
_INT_Initialize:
.public _main
_main:
;
; /* Lockout interrupts, just in case they are not already. */
;
sei ; Set interrupt mask
;
; /* 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 = 1;
;
ldd #1 ; Build flag's value (0 or 1)
std _INT_Loaded_Flag ; Setup the flag
;
; /* Define the global data structures that need to be initialized by this
; routine. These structures are used to define the system timer
; management HISR and task. */
; TMD_HISR_Stack_Ptr = sp + 2;
tsx ; Pickup current stack pointer
xgdx ; Move it into D register
addd #2 ; Increment by 2 for start of
; the HISR stack area
std _TMD_HISR_Stack_Ptr ; Setup the HISR pointer
;
; TMD_HISR_Stack_Size = HISRSIZE;
;
clra ; Upper half is alway 0
clrb ;
std _TMD_HISR_Stack_Size ;
ldd #HISRSIZE ; Build size of HISR stack
std _TMD_HISR_Stack_Size+2 ; Setup the HISR stack size
;
; TMD_HISR_Priority = HISRPRI;
;
ldd #HISRPRI ; Build HISR priority (0-2)
std _TMD_HISR_Priority ; Setup HISR priority
;
; /* Save current value of sp. */
tsx ; Pickup the stack pointer
stx _TCD_System_Stack ; Save it in the system stack
; pointer
;
; /* Initialize the periodic timer interrupt. By default, the Real-Time
; Interrupt (RTI) feature of the 68HC11 is used. */
;
ldaa #PACTL_VALUE ; Load RTI rate information
staa PACTL ; Setup PACTL register with RTI
; interrupt rate
ldaa #TMSK2_VALUE ; Load RTI interrupt enable control
staa TMSK2 ; Setup TMSK2 register with RTI
; interrupt enable
;
; /* Calculate the first available memory address. */
;
ldd _TMD_HISR_Stack_Ptr ; Pickup the timer HISR stack base
addd _TMD_HISR_Stack_Size+2 ; Size of timer 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. In the 68HC11 port, this pointer is in the
; D register. */
; INC_Initialize(first_available_memory);
;
jmp _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 */
;/* */
;/* William E. Lamie, Accelerated Technology, Inc. */
;/* */
;/* CALLED BY */
;/* */
;/* TCC_Register_LISR Register LISR for vector */
;/* */
;/* 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 */
;/* */
;/*************************************************************************/
;INT INT_Vectors_Loaded(void)
;{
.public _INT_Vectors_Loaded
_INT_Vectors_Loaded:
;
; /* Just return the loaded vectors flag. */
; return(INT_Loaded_Flag);
;
ldd _INT_Loaded_Flag ; Pickup the vectors loaded flag
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 */
;/* */
;/* William E. Lamie, 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 */
;/* */
;/* W. Lamie 06-01-1993 Created initial version 1.0 */
;/* D. Lamie 06-01-1993 Verified version 1.0 */
;/* */
;/*************************************************************************/
;VOID *INT_Setup_Vector(INT vector, VOID *new)
;{
.public _INT_Setup_Vector
_INT_Setup_Vector:
pshx ; Save the IX register
tsx ; Move stack pointer into IX
;
;VOID *old_vector; /* Old interrupt vector */
;VOID **vector_table; /* Pointer to vector table */
;
; /* Calculate the starting address of the actual vector table. */
; vector_table = (VOID **) VECTORS;
;
;
; /* Pickup the old interrupt vector. */
; old_vector = vector_table[vector];
;
lsld ; Convert vector to offset into the
; vector table
addd #VECTORS ; Build absolute vector address
xgdy ; Place the absolute address into
; IY
;
; /* Setup the new interrupt vector. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -