source: buchla-68k/orig/MT/MTINTS.S@ 0170798

Last change on this file since 0170798 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Imported original source code.

  • Property mode set to 100755
File size: 8.1 KB
RevLine 
[3ae31e9]1* ------------------------------------------------------------------------------
2* mtints.s -- Multi-Tasker -- first level interrupt handlers
3* Version 11 -- 1988-04-15 -- D.N. Lynx Crowe
4* (c) Copyright 1988 -- D.N. Lynx Crowe
5* ------------------------------------------------------------------------------
6*
7 .text
8*
9DEBUGGER .equ 0 * define non-zero for any debug
10*
11DEBUG_I1 .equ 0 * define non-zero for int1 debug
12DEBUG_I2 .equ 0 * define non-zero for int2 debug
13DEBUG_I3 .equ 0 * define non-zero for int3 debug
14DEBUG_I4 .equ 0 * define non-zero for int4 debug
15DEBUG_I5 .equ 0 * define non-zero for int5 debug
16*
17 .xdef MTInt1
18 .xdef MTInt2
19 .xdef MTInt3
20 .xdef MTInt4
21 .xdef MTInt5
22*
23 .ifne DEBUGGER
24*
25 .xref _DB_Cmnt * debug comment function
26*
27 .endc
28*
29 .xref MT_ITCB1
30 .xref MT_ITCB2
31 .xref MT_ITCB3
32 .xref MT_ITCB4
33 .xref MT_ITCB5
34*
35 .xref MT_ISEM1
36 .xref MT_ISEM2
37 .xref MT_ISEM3
38 .xref MT_ISEM4
39 .xref MT_ISEM5
40*
41 .xref MT_Enq
42*
43 .xref _MT_CurP
44 .xref _MT_RdyQ
45*
46 .page
47*
48* TCB offsets ('NEXT' must be the first thing in the TCB)
49* -----------
50NEXT .equ 0 * LONG - next TCB in queue
51FWD .equ NEXT+4 * LONG - next TCB in chain
52TID .equ FWD+4 * WORD - task ID
53PRI .equ TID+2 * WORD - task priority
54SLICE .equ PRI+2 * LONG - slice time limit
55REGS .equ SLICE+4 * LONG[16] - registers
56TCB_SP .equ REGS+64 * LONG - stack pointer
57TCB_PC .equ TCB_SP+4 * LONG - program counter
58TCB_SR .equ TCB_PC+4 * WORD - status register
59FLAGS .equ TCB_SR+2 * WORD - task flags
60TOS .equ FLAGS+2 * LONG - top of stack
61*
62TCB_A6 .equ REGS+56 * LONG - task a6 image
63TCB_A7 .equ REGS+60 * LONG - task a7 image
64*
65TCBLEN .equ TOS+4 * length of TCB
66*
67* TCB flags
68* ---------
69MTF_RDY .equ $0001 * 'ready' bit
70NOT_RDY .equ $FFFE * 'ready' bit complement
71MTF_SWT .equ $0002 * 'wait' bit
72NOT_SWT .equ $FFFD * 'wait' bit complement
73MTF_RUN .equ $0004 * 'run' bit
74NOT_RUN .equ $FFFB * 'run' bit complement
75MTF_STP .equ $0008 * 'stop' bit
76NOT_STP .equ $FFF7 * 'stop' bit complement
77*
78* Miscellaneous definitions
79* -------------------------
80IPL7 .equ $0700 * processor IPL 7 mask
81*
82RPRV .equ a1 * previous TCB pointer
83RCUR .equ a2 * current TCB pointer
84RNXT .equ a3 * next TCB pointer
85RTCP .equ a6 * general TCB pointer
86*
87RPRI .equ d0 * task priority
88*
89 .page
90*
91* MTInt1 -- Level 1 -- VSDD frame interrupt
92* ------ -------------------------------
93MTInt1: ori.w #IPL7,sr * disable interrupts
94*
95 .ifne DEBUG_I1
96 movem.l d0-d7/a0-a6,-(a7) * DB_CMNT("MTInt1");
97 move.l #DB_msg1,-(a7) * ...
98 jsr _DB_Cmnt * ...
99 tst.l (a7)+ * ...
100 movem.l (a7)+,d0-d7/a0-a6 * ...
101 .endc
102*
103 movem.l a6-a7,-(a7) * save a6-a7 on stack
104 movea.l _MT_CurP,RTCP * get the current TCB pointer
105 movem.l d0-d7/a0-a5,REGS(RTCP) * save d0-d7/a0-a5 in the TCB
106 move.l (a7)+,TCB_A6(RTCP) * save a6 in the TCB
107 move.l (a7)+,TCB_A7(RTCP) * save a7 in the TCB
108 move.w (a7)+,TCB_SR(RTCP) * save sr in the TCB
109 move.l (a7)+,TCB_PC(RTCP) * save the pc in the TCB
110 move.l a7,TCB_SP(RTCP) * save the sp in the TCB
111 andi.w #NOT_RUN,FLAGS(RTCP) * turn off its run flag
112 move.w PRI(RTCP),RPRI * get the task priority in RPRI
113 lea _MT_RdyQ,RCUR * get the ready queue pointer
114 lea MT_ITCB1,RNXT * get the interrupt TCB pointer
115 andi.w #NOT_SWT,FLAGS(RNXT) * turn off its wait flag
116 clr.l MT_ISEM1 * clear the interrupt semaphore
117 jmp MT_Enq * go do the task dispatch
118*
119 .page
120*
121* MTInt2 -- Level 2 -- FPU interrupt
122* ------ ------------------------
123MTInt2: ori.w #IPL7,sr * disable interrupts
124*
125 .ifne DEBUG_I2
126 movem.l d0-d7/a0-a6,-(a7) * DB_CMNT("MTInt2");
127 move.l #DB_msg2,-(a7) * ...
128 jsr _DB_Cmnt * ...
129 tst.l (a7)+ * ...
130 movem.l (a7)+,d0-d7/a0-a6 * ...
131 .endc
132*
133 movem.l a6-a7,-(a7) * save a6-a7 on stack
134 movea.l _MT_CurP,RTCP * get the current TCB pointer
135 movem.l d0-d7/a0-a5,REGS(RTCP) * save d0-d7/a0-a5 in the TCB
136 move.l (a7)+,TCB_A6(RTCP) * save a6 in the TCB
137 move.l (a7)+,TCB_A7(RTCP) * save a7 in the TCB
138 move.w (a7)+,TCB_SR(RTCP) * save sr in the TCB
139 move.l (a7)+,TCB_PC(RTCP) * save the pc in the TCB
140 move.l a7,TCB_SP(RTCP) * save the sp in the TCB
141 andi.w #NOT_RUN,FLAGS(RTCP) * turn off its run flag
142 move.w PRI(RTCP),RPRI * get the task priority in RPRI
143 lea _MT_RdyQ,RCUR * get the ready queue pointer
144 lea MT_ITCB2,RNXT * get the interrupt TCB pointer
145 andi.w #NOT_SWT,FLAGS(RNXT) * turn off its wait flag
146 clr.l MT_ISEM2 * clear the interrupt semaphore
147 jmp MT_Enq * go do the task dispatch
148*
149 .page
150*
151* MTInt3 -- Level 3 -- Analog processor interrupt
152* ------ -------------------------------------
153MTInt3: ori.w #IPL7,sr * disable interrupts
154*
155 .ifne DEBUG_I3
156 movem.l d0-d7/a0-a6,-(a7) * DB_CMNT("MTInt3");
157 move.l #DB_msg3,-(a7) * ...
158 jsr _DB_Cmnt * ...
159 tst.l (a7)+ * ...
160 movem.l (a7)+,d0-d7/a0-a6 * ...
161 .endc
162*
163 movem.l a6-a7,-(a7) * save a6-a7 on stack
164 movea.l _MT_CurP,RTCP * get the current TCB pointer
165 movem.l d0-d7/a0-a5,REGS(RTCP) * save d0-d7/a0-a5 in the TCB
166 move.l (a7)+,TCB_A6(RTCP) * save a6 in the TCB
167 move.l (a7)+,TCB_A7(RTCP) * save a7 in the TCB
168 move.w (a7)+,TCB_SR(RTCP) * save sr in the TCB
169 move.l (a7)+,TCB_PC(RTCP) * save the pc in the TCB
170 move.l a7,TCB_SP(RTCP) * save the sp in the TCB
171 andi.w #NOT_RUN,FLAGS(RTCP) * turn off its run flag
172 move.w PRI(RTCP),RPRI * get the task priority in RPRI
173 lea _MT_RdyQ,RCUR * get the ready queue pointer
174 lea MT_ITCB3,RNXT * get the interrupt TCB pointer
175 andi.w #NOT_SWT,FLAGS(RNXT) * turn off its wait flag
176 clr.l MT_ISEM3 * clear the interrupt semaphore
177 jmp MT_Enq * go do the task dispatch
178*
179 .page
180*
181* MTInt4 -- Level 4 -- Timer interrupt
182* ------ --------------------------
183MTInt4: ori.w #IPL7,sr * disable interrupts
184*
185 .ifne DEBUG_I4
186 movem.l d0-d7/a0-a6,-(a7) * DB_CMNT("MTInt4");
187 move.l #DB_msg4,-(a7) * ...
188 jsr _DB_Cmnt * ...
189 tst.l (a7)+ * ...
190 movem.l (a7)+,d0-d7/a0-a6 * ...
191 .endc
192*
193 movem.l a6-a7,-(a7) * save a6-a7 on stack
194 movea.l _MT_CurP,RTCP * get the current TCB pointer
195 movem.l d0-d7/a0-a5,REGS(RTCP) * save d0-d7/a0-a5 in the TCB
196 move.l (a7)+,TCB_A6(RTCP) * save a6 in the TCB
197 move.l (a7)+,TCB_A7(RTCP) * save a7 in the TCB
198 move.w (a7)+,TCB_SR(RTCP) * save sr in the TCB
199 move.l (a7)+,TCB_PC(RTCP) * save the pc in the TCB
200 move.l a7,TCB_SP(RTCP) * save the sp in the TCB
201 andi.w #NOT_RUN,FLAGS(RTCP) * turn off its run flag
202 move.w PRI(RTCP),RPRI * get the task priority in RPRI
203 lea _MT_RdyQ,RCUR * get the ready queue pointer
204 lea MT_ITCB4,RNXT * get the interrupt TCB pointer
205 andi.w #NOT_SWT,FLAGS(RNXT) * turn off its wait flag
206 clr.l MT_ISEM4 * clear the interrupt semaphore
207 jmp MT_Enq * go do the task dispatch
208*
209 .page
210*
211* MTInt5 -- Level 5 -- Serial I/O interrupt
212* ------ -------------------------------
213MTInt5: ori.w #IPL7,sr * disable interrupts
214*
215 .ifne DEBUG_I5
216 movem.l d0-d7/a0-a6,-(a7) * DB_CMNT("MTInt5");
217 move.l #DB_msg5,-(a7) * ...
218 jsr _DB_Cmnt * ...
219 tst.l (a7)+ * ...
220 movem.l (a7)+,d0-d7/a0-a6 * ...
221 .endc
222*
223 movem.l a6-a7,-(a7) * save a6-a7 on stack
224 movea.l _MT_CurP,RTCP * get the current TCB pointer
225 movem.l d0-d7/a0-a5,REGS(RTCP) * save d0-d7/a0-a5 in the TCB
226 move.l (a7)+,TCB_A6(RTCP) * save a6 in the TCB
227 move.l (a7)+,TCB_A7(RTCP) * save a7 in the TCB
228 move.w (a7)+,TCB_SR(RTCP) * save sr in the TCB
229 move.l (a7)+,TCB_PC(RTCP) * save the pc in the TCB
230 move.l a7,TCB_SP(RTCP) * save the sp in the TCB
231 andi.w #NOT_RUN,FLAGS(RTCP) * turn off its run flag
232 move.w PRI(RTCP),RPRI * get the task priority in RPRI
233 lea _MT_RdyQ,RCUR * get the ready queue pointer
234 lea MT_ITCB5,RNXT * get the interrupt TCB pointer
235 andi.w #NOT_SWT,FLAGS(RNXT) * turn off its wait flag
236 clr.l MT_ISEM5 * clear the interrupt semaphore
237 jmp MT_Enq * go do the task dispatch
238*
239 .ifne DEBUGGER
240*
241 .data
242*
243DB_msg1: dc.b 'MTInt1',0
244DB_msg2: dc.b 'MTInt2',0
245DB_msg3: dc.b 'MTInt3',0
246DB_msg4: dc.b 'MTInt4',0
247DB_msg5: dc.b 'MTInt5',0
248*
249 .endc
250*
251 .end
Note: See TracBrowser for help on using the repository browser.