📄 context.asm
字号:
;*
;==============================================================================
; COPYRIGHT (C) 2003-2007 Haishen Ruan, All rights reserved.
; SUMMARY:
; Interrupt service for fujitsu F2MC-16LX/16F.
;
;
; LICENSE INFORMATION
; RS-RTOS is free software; you can redistribute it and/or modify it under
; terms of the GNU General Public License as published by the
; Free Software Foundation; either version 2, or (at your option) any
; later version.
;
; RS-RTOS is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
; General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with RS-RTOS; see file COPYING. If not, write to the Free Software
; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
;
; As a special exception, including RS-RTOS header files in a file,
; instantiating RS-RTOS generics or templates, or linking other files
; with RS-RTOS objects to produce an executable application, does not
; by itself cause the resulting executable application to be covered
; by the GNU General Public License. This exception does not
; however invalidate any other reasons why the executable file might be
; covered by the GNU Public License.
;
;
; DESCRIPTION:
; See http://www.RS-RTOS.org for documentation, latest information, license
; and contact details.
; email:ruanhaishen@gmail.com
;============================================================================*/
;*===========================================================================*/
#include "../inc/mem_model.h"
TBTC .EQU 0xA9 ; Timerbase timer control register
TBOF .EQU TBTC:3 ; Interrupt request flag bit
.GLOBAL ___switch_to
.GLOBAL ___timer_handle
.GLOBAL ___interrupt_handle
.GLOBAL ___do_tick
.GLOBAL ___schedule
.GLOBAL ___interrupt_dispatch
.GLOBAL __sched_lock
.SECTION CODE, CODE, ALIGN=1
;====================================================================
;void __switch_to(sp_t __p_* curr_sp, sp_t next_sp)
;{
___switch_to:
LINK #00
PUSHW (RW0,RW1,RW2,RW4,RW5,RW6,RW7)
; *curr_sp = SP;
; SP = next_sp;
#if RSI_MEM_MODEL == SMALL
MOVW A,SP
MOVW A,@RW3+04H
MOVW @AL,AH
MOVW A,@RW3+06H
MOVW SP,A
#elif RSI_MEM_MODEL == MEDIUM
MOVW A,SP
MOVW A,@RW3+06H
MOVW @AL,AH
MOVW A,@RW3+08H
MOVW SP,A
#elif RSI_MEM_MODEL == COMPACT
MOVL A,@RW3+04H
MOVW RW0,A
SWAPW
MOV ADB,A
MOV A,SSB
MOVW A,SP
ADB
MOVL @RW0,A
MOVL A,@RW3+08H
MOVW SP,A
SWAPW
MOV SSB,A
#else
MOVL A,@RW3+06H
MOVW RW0,A
SWAPW
MOV ADB,A
MOV A,SSB
MOVW A,SP
ADB
MOVL @RW0,A
MOVL A,@RW3+0AH
MOVW SP,A
SWAPW
MOV SSB,A
#endif
POPW (RW0,RW1,RW2,RW4,RW5,RW6,RW7)
MOVW A, SP
MOVW RW3, A
UNLINK
#if RSI_MEM_MODEL == SMALL || RSI_MEM_MODEL == COMPACT
RET
#else
RETP
#endif
;}
;====================================================================
___timer_handle:
#if RSI_MEM_MODEL == COMPACT || RSI_MEM_MODEL == LARGE
AND CCR, #0BFH
MOV A, #bnksym __sched_lock
MOV ADB, A
ADB
#endif
INCW __sched_lock
#if RSI_MEM_MODEL == COMPACT || RSI_MEM_MODEL == LARGE
OR CCR, #40H
#endif
;======================================
; (High memory)
; | | |
; | | | <- SSP must be here after reti instruction
; | AH |
; | AL |
; | DPR | ADB |
; | DTB | PCB |
; | PC |
; | PS | <- SSP must be here before reti instruction
; (Low memory)
;======================================
#if RSI_MEM_MODEL == SMALL || RSI_MEM_MODEL == COMPACT
CALL ___do_tick
#else
CALLP ___do_tick
#endif
;======================================
#if RSI_MEM_MODEL == COMPACT || RSI_MEM_MODEL == LARGE
MOV A, #bnksym __sched_lock
MOV ADB, A
ADB
#endif
DECW __sched_lock
CLRB I:TBOF
MOVW A, __sched_lock
BNZ timer_return
#if RSI_MEM_MODEL == SMALL || RSI_MEM_MODEL == COMPACT
CALL ___schedule
#else
CALLP ___schedule
#endif
timer_return:
RETI
;====================================================================
___interrupt_handle:
#if RSI_MEM_MODEL == COMPACT || RSI_MEM_MODEL == LARGE
MOV A, #bnksym __sched_lock
MOV ADB, A
ADB
#endif
INCW __sched_lock
OR CCR, #40H
POPW A
SUBW A, #5 + ___interrupt_begin
MOVN A, #5
DIV A
PUSHW A
#if RSI_MEM_MODEL == SMALL || RSI_MEM_MODEL == COMPACT
CALL ___interrupt_dispatch
#else
CALLP ___interrupt_dispatch
#endif
ADDSP #02
;-----------------------------------
#if RSI_MEM_MODEL == COMPACT || RSI_MEM_MODEL == LARGE
MOV A, #bnksym __sched_lock
MOV ADB, A
ADB
#endif
DECW __sched_lock
MOVW A, __sched_lock
BNZ handle_return
#if RSI_MEM_MODEL == SMALL || RSI_MEM_MODEL == COMPACT
CALL ___schedule
#else
CALLP ___schedule
#endif
handle_return:
RETI
;====================================================================
___interrupt_begin:
___int0:
AND CCR, #0BFH
CALL ___interrupt_handle
___int1:
AND CCR, #0BFH
CALL ___interrupt_handle
___int2:
AND CCR, #0BFH
CALL ___interrupt_handle
___int3:
AND CCR, #0BFH
CALL ___interrupt_handle
___int4:
AND CCR, #0BFH
CALL ___interrupt_handle
___int5:
AND CCR, #0BFH
CALL ___interrupt_handle
___int6:
AND CCR, #0BFH
CALL ___interrupt_handle
___int7:
AND CCR, #0BFH
CALL ___interrupt_handle
___int8:
AND CCR, #0BFH
CALL ___interrupt_handle
___int9:
AND CCR, #0BFH
CALL ___interrupt_handle
___int10:
AND CCR, #0BFH
CALL ___interrupt_handle
___int11:
AND CCR, #0BFH
CALL ___interrupt_handle
___int12:
AND CCR, #0BFH
CALL ___interrupt_handle
___int13:
AND CCR, #0BFH
CALL ___interrupt_handle
___int14:
AND CCR, #0BFH
CALL ___interrupt_handle
___int15:
AND CCR, #0BFH
CALL ___interrupt_handle
___int16:
AND CCR, #0BFH
CALL ___interrupt_handle
___int17:
AND CCR, #0BFH
CALL ___interrupt_handle
___int18:
AND CCR, #0BFH
CALL ___interrupt_handle
___int19:
AND CCR, #0BFH
CALL ___interrupt_handle
___int20:
AND CCR, #0BFH
CALL ___interrupt_handle
___int21:
AND CCR, #0BFH
CALL ___interrupt_handle
___int22:
AND CCR, #0BFH
CALL ___interrupt_handle
___int23:
AND CCR, #0BFH
CALL ___interrupt_handle
___int24:
AND CCR, #0BFH
CALL ___interrupt_handle
___int25:
AND CCR, #0BFH
CALL ___interrupt_handle
___int26:
AND CCR, #0BFH
CALL ___interrupt_handle
___int27:
AND CCR, #0BFH
CALL ___interrupt_handle
___int28:
AND CCR, #0BFH
CALL ___interrupt_handle
___int29:
AND CCR, #0BFH
CALL ___interrupt_handle
___int30:
AND CCR, #0BFH
CALL ___interrupt_handle
___int31:
AND CCR, #0BFH
CALL ___interrupt_handle
___int32:
AND CCR, #0BFH
CALL ___interrupt_handle
___int33:
AND CCR, #0BFH
CALL ___interrupt_handle
___int34:
AND CCR, #0BFH
CALL ___interrupt_handle
___int35:
AND CCR, #0BFH
CALL ___interrupt_handle
___int36:
AND CCR, #0BFH
CALL ___interrupt_handle
___int37:
AND CCR, #0BFH
CALL ___interrupt_handle
___int38:
AND CCR, #0BFH
CALL ___interrupt_handle
___int39:
AND CCR, #0BFH
CALL ___interrupt_handle
___int40:
AND CCR, #0BFH
CALL ___interrupt_handle
___int41:
AND CCR, #0BFH
CALL ___interrupt_handle
___int42:
AND CCR, #0BFH
CALL ___interrupt_handle
___int43:
AND CCR, #0BFH
CALL ___interrupt_handle
___int44:
AND CCR, #0BFH
CALL ___interrupt_handle
___int45:
AND CCR, #0BFH
CALL ___interrupt_handle
___int46:
AND CCR, #0BFH
CALL ___interrupt_handle
___int47:
AND CCR, #0BFH
CALL ___interrupt_handle
___int48:
AND CCR, #0BFH
CALL ___interrupt_handle
___int49:
AND CCR, #0BFH
CALL ___interrupt_handle
___int50:
AND CCR, #0BFH
CALL ___interrupt_handle
___int51:
AND CCR, #0BFH
CALL ___interrupt_handle
___int52:
AND CCR, #0BFH
CALL ___interrupt_handle
___int53:
AND CCR, #0BFH
CALL ___interrupt_handle
___int54:
AND CCR, #0BFH
CALL ___interrupt_handle
___int55:
AND CCR, #0BFH
CALL ___interrupt_handle
___int56:
AND CCR, #0BFH
CALL ___interrupt_handle
___int57:
AND CCR, #0BFH
CALL ___interrupt_handle
___int58:
AND CCR, #0BFH
CALL ___interrupt_handle
___int59:
AND CCR, #0BFH
CALL ___interrupt_handle
___int60:
AND CCR, #0BFH
CALL ___interrupt_handle
___int61:
AND CCR, #0BFH
CALL ___interrupt_handle
___int62:
AND CCR, #0BFH
CALL ___interrupt_handle
___int63:
AND CCR, #0BFH
CALL ___interrupt_handle
___int64:
AND CCR, #0BFH
CALL ___interrupt_handle
___int65:
AND CCR, #0BFH
CALL ___interrupt_handle
___int66:
AND CCR, #0BFH
CALL ___interrupt_handle
___int67:
AND CCR, #0BFH
CALL ___interrupt_handle
___int68:
AND CCR, #0BFH
CALL ___interrupt_handle
___int69:
AND CCR, #0BFH
CALL ___interrupt_handle
___int70:
AND CCR, #0BFH
CALL ___interrupt_handle
___int71:
AND CCR, #0BFH
CALL ___interrupt_handle
___int72:
AND CCR, #0BFH
CALL ___interrupt_handle
___int73:
AND CCR, #0BFH
CALL ___interrupt_handle
___int74:
AND CCR, #0BFH
CALL ___interrupt_handle
___int75:
AND CCR, #0BFH
CALL ___interrupt_handle
___int76:
AND CCR, #0BFH
CALL ___interrupt_handle
___int77:
AND CCR, #0BFH
CALL ___interrupt_handle
___int78:
AND CCR, #0BFH
CALL ___interrupt_handle
___int79:
AND CCR, #0BFH
CALL ___interrupt_handle
___int80:
AND CCR, #0BFH
CALL ___interrupt_handle
___int81:
AND CCR, #0BFH
CALL ___interrupt_handle
___int82:
AND CCR, #0BFH
CALL ___interrupt_handle
___int83:
AND CCR, #0BFH
CALL ___interrupt_handle
___int84:
AND CCR, #0BFH
CALL ___interrupt_handle
___int85:
AND CCR, #0BFH
CALL ___interrupt_handle
___int86:
AND CCR, #0BFH
CALL ___interrupt_handle
___int87:
AND CCR, #0BFH
CALL ___interrupt_handle
___int88:
AND CCR, #0BFH
CALL ___interrupt_handle
___int89:
AND CCR, #0BFH
CALL ___interrupt_handle
___int90:
AND CCR, #0BFH
CALL ___interrupt_handle
___int91:
AND CCR, #0BFH
CALL ___interrupt_handle
___int92:
AND CCR, #0BFH
CALL ___interrupt_handle
___int93:
AND CCR, #0BFH
CALL ___interrupt_handle
___int94:
AND CCR, #0BFH
CALL ___interrupt_handle
___int95:
AND CCR, #0BFH
CALL ___interrupt_handle
___int96:
AND CCR, #0BFH
CALL ___interrupt_handle
___int97:
AND CCR, #0BFH
CALL ___interrupt_handle
___int98:
AND CCR, #0BFH
CALL ___interrupt_handle
___int99:
AND CCR, #0BFH
CALL ___interrupt_handle
___int100:
AND CCR, #0BFH
CALL ___interrupt_handle
___int101:
AND CCR, #0BFH
CALL ___interrupt_handle
___int102:
AND CCR, #0BFH
CALL ___interrupt_handle
___int103:
AND CCR, #0BFH
CALL ___interrupt_handle
___int104:
AND CCR, #0BFH
CALL ___interrupt_handle
___int105:
AND CCR, #0BFH
CALL ___interrupt_handle
___int106:
AND CCR, #0BFH
CALL ___interrupt_handle
___int107:
AND CCR, #0BFH
CALL ___interrupt_handle
___int108:
AND CCR, #0BFH
CALL ___interrupt_handle
___int109:
AND CCR, #0BFH
CALL ___interrupt_handle
___int110:
AND CCR, #0BFH
CALL ___interrupt_handle
___int111:
AND CCR, #0BFH
CALL ___interrupt_handle
___int112:
AND CCR, #0BFH
CALL ___interrupt_handle
___int113:
AND CCR, #0BFH
CALL ___interrupt_handle
___int114:
AND CCR, #0BFH
CALL ___interrupt_handle
___int115:
AND CCR, #0BFH
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -