Mercurial > hg > Members > kono > nitros9-code
annotate level1/cmds/irqs.asm @ 1919:028161cd3535
uses ss.fd
author | boisy |
---|---|
date | Fri, 25 Nov 2005 12:39:54 +0000 |
parents | 84ea83668304 |
children |
rev | line source |
---|---|
963 | 1 ******************************************************************** |
2 * irqs - Show interrupt polling table | |
3 * | |
4 * $Id$ | |
5 * | |
1325
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
963
diff
changeset
|
6 * Edt/Rev YYYY/MM/DD Modified by |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
963
diff
changeset
|
7 * Comment |
963 | 8 * ------------------------------------------------------------------ |
1325
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
963
diff
changeset
|
9 * 1 ????/??/?? Kevin Darling |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
963
diff
changeset
|
10 * Created. |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
963
diff
changeset
|
11 * |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
963
diff
changeset
|
12 * 2 ????/??/?? Gene Heskett |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
963
diff
changeset
|
13 * Modified. |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
963
diff
changeset
|
14 * |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
963
diff
changeset
|
15 * 3 2003/01/07 Boisy G. Pitre |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
963
diff
changeset
|
16 * Streamlined and fixed problems. |
963 | 17 |
18 nam irqs | |
19 ttl Show interrupt polling table | |
20 | |
21 ifp1 | |
22 use defsfile | |
23 endc | |
24 | |
1325
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
963
diff
changeset
|
25 rev set $00 |
963 | 26 edition set 3 |
27 | |
28 MaxDEnts set 32 max device entries we will display | |
29 MaxPEnts set 32 max polling entries we will display | |
30 | |
31 mod emod,name,prgrm+objct,reent+rev,start,endmem | |
32 | |
33 org 0 | |
34 usaver rmb 2 | |
35 narrow rmb 1 | |
36 polcount rmb 1 number of polling entries in polling table | |
37 devcount rmb 1 number of device entries in device table | |
38 datptr rmb 2 pointer to DAT image in system proc descriptor | |
39 notuse rmb 2 | |
40 outptr rmb 2 points to next available char in buffer | |
41 counter rmb 1 | |
42 devptr rmb 2 | |
43 tblptr rmb 2 | |
44 dpvars rmb 9 | |
45 rptbuf rmb 80 | |
46 ddevtbl rmb 2 copy of D.DevTbl in globals | |
47 dpoltbl rmb 2 copy of D.PolTbl in globals | |
48 IFGT Level-1 | |
49 poltable rmb 32*POLSIZ | |
50 devtable rmb 32*DEVSIZ | |
51 modulep rmb 256 | |
52 syspdesc rmb P$Size | |
53 ENDC | |
54 sstack rmb 200 | |
55 endmem equ . | |
56 | |
57 name fcs "irqs" | |
58 fcb edition | |
59 | |
60 PollHdr fcc "Polling Table at: " | |
61 PollHdrL equ *-PollHdr | |
62 Device fcc " Device Table at: " | |
63 DeviceL equ *-Device | |
64 NTopline fcc " Device Drvr IRQ Flip" | |
65 fcb C$CR | |
66 NToplineL equ *-NTopline | |
67 NLine2 fcc "Port Mem Name Vect Mask Pr" | |
68 fcb C$CR | |
69 NLine2L equ *-NLine2 | |
70 NLine3 fcc "---- ---- ----------- ---- --" | |
71 fcb C$CR | |
72 NLine3L equ *-NLine3 | |
73 Topline fcc " Device Driver IRQ Flip " | |
74 fcb C$CR | |
75 ToplineL equ *-Topline | |
76 Line2 fcc "Port Mem Name Vector &Mask Pty" | |
77 fcb C$CR | |
78 Line2L equ *-Line2 | |
79 Line3 fcc "---- ---- ------------ ----- ---" | |
80 crtn fcb C$CR | |
81 Line3L equ *-Line3 | |
82 Init fcs /Init/ | |
83 | |
84 start stu <usaver at 0000 in direct page | |
85 * First things first: get Polling Table and Device Table counts in the | |
86 * Init module | |
87 lda #MaxDEnts get max dev ents | |
88 sta <devcount | |
89 lda #MaxPEnts get max poll ents | |
90 sta <polcount | |
91 clra module type/lang byte | |
92 leax Init,pcr point to name | |
93 os9 F$Link link to it | |
94 bcs errexit branch if error | |
95 ldd PollCnt,u get poll count in A, dev count in B | |
96 os9 F$UnLink unlink it | |
97 ldu <usaver | |
98 cmpa <polcount is actual size greater or equal than our max? | |
99 bge chkdev branch if so | |
100 sta <polcount | |
101 chkdev cmpb <devcount is actual size greater or equal than our max? | |
102 bge cont branch if so | |
103 stb <devcount | |
104 cont clr <narrow | |
105 lda #$01 | |
106 ldb #SS.ScSiz | |
107 os9 I$GetStt | |
108 bcs cont2 | |
109 cmpx #Line3L+1 | |
110 bge cont2 | |
111 sta <narrow we're narrow | |
112 cont2 leax >crtn,pcr | |
113 ldy #$0001 | |
114 os9 I$WritLn write a carriage return | |
115 bcs errexit | |
116 leax >PollHdr,pc | |
117 ldy #PollHdrL | |
118 os9 I$Write write polling table header | |
119 bcs errexit | |
120 IFGT Level-1 | |
121 lda #$01 process ID #1 - system process | |
122 leax syspdesc,u point to buffer | |
123 os9 F$GPrDsc get a copy of it | |
124 bcs errexit | |
125 leax P$DatImg,x point to DAT image | |
126 stx <datptr save off pointer for later | |
127 ENDC | |
128 bra z00C5 | |
129 okexit clrb | |
130 errexit os9 F$Exit | |
131 z00C5 leay rptbuf,u | |
132 sty <outptr | |
133 IFGT Level-1 | |
134 leau ddevtbl,u | |
135 ldd <datptr get ptr P$datimg | |
136 ldx #D.DevTbl | |
137 ldy #$0004 include D.Poltbl 4 bytes to copy | |
138 os9 F$CpyMem get the two globals | |
139 bcs errexit | |
140 ldu <usaver restore u | |
141 ELSE | |
142 ldd >D.DevTbl | |
143 std <ddevtbl | |
144 ldd >D.PolTbl | |
145 std <dpoltbl | |
146 ENDC | |
147 ldd <dpoltbl | |
148 lbsr OutHex cnvrt 4 dgts of poll tbl addr | |
149 lbsr z01B1 output poll tbl address in ASCII | |
150 * troubleshooting printout | |
151 leax >Device,pcr | |
152 ldy #DeviceL | |
153 lda #1 | |
154 os9 I$Write | |
155 leax rptbuf,u | |
156 stx <outptr | |
157 ldd <ddevtbl | |
158 lbsr OutHex | |
159 lbsr z01B1 | |
160 * to here | |
161 lda #1 | |
162 leax >crtn,pcr stick another \n on it | |
163 ldy #$0001 | |
164 os9 I$WritLn | |
165 bcs errexit | |
166 leax >Topline,pcr | |
167 ldy #ToplineL | |
168 tst <narrow | |
169 beq branch1 | |
170 leax >NTopline,pcr | |
171 ldy #NToplineL | |
172 branch1 os9 I$WritLn | |
173 bcs errexit | |
174 leax >Line2,pcr | |
175 ldy #Line2L | |
176 tst <narrow | |
177 beq branch2 | |
178 leax >NLine2,pcr | |
179 ldy #NLine2L | |
180 branch2 os9 I$WritLn | |
181 bcs errexit | |
182 leax >Line3,pcr | |
183 ldy #Line3L | |
184 tst <narrow | |
185 beq branch3 | |
186 leax >NLine3,pcr | |
187 ldy #NLine3L | |
188 branch3 os9 I$WritLn | |
189 lbcs errexit | |
190 IFGT Level-1 | |
191 * Copy polling table | |
192 lda <polcount | |
193 ldb #POLSIZ | |
194 mul | |
195 tfr d,y | |
196 ldx <dpoltbl | |
197 ldd <datptr | |
198 leau poltable,u | |
199 os9 F$CpyMem | |
200 ldu <usaver | |
201 lbcs errexit | |
202 * Copy device table | |
203 lda <devcount | |
204 ldb #DEVSIZ | |
205 mul | |
206 tfr d,y | |
207 ldx <ddevtbl | |
208 ldd <datptr | |
209 leau devtable,u | |
210 os9 F$CpyMem | |
211 ldu <usaver | |
212 lbcs errexit | |
213 ENDC | |
214 | |
215 * Go through IRQ polling table until we find a non-empty slot or the end | |
216 ldb <polcount get polling count | |
217 stb <counter save off in our counter variable | |
218 IFGT Level-1 | |
219 leax poltable,u point X to polling table we copied | |
220 ELSE | |
221 ldx <dpoltbl | |
222 ENDC | |
223 z0165 ldd Q$STAT,x get static pointer | |
224 beq z016B branch if empty | |
225 bsr ShowIRQ else process it | |
226 z016B dec <counter decrement couunter | |
227 lbeq okexit exit if end | |
228 leax POLSIZ,x else advance X | |
229 bra z0165 and get some more | |
230 | |
231 * Here we process the IRQ polling entry at X | |
232 ShowIRQ leay rptbuf,u | |
233 sty <outptr reset output buffer pointer | |
234 ldd Q$POLL,x | |
235 lbsr OutHex convert 2 bytes port addr->ascii | |
236 ldd Q$STAT,x | |
237 lbsr OutHex convert 2 bytes memsiz->ascii | |
238 lbsr OutSpace extra space in line | |
239 bsr z01CA now do name | |
240 ldd Q$SERV,x get irq vector | |
241 lbsr OutHex convert it to ascii | |
242 lbsr OutSpace extra space | |
243 lda Q$FLIP,x get flip | |
244 lbsr z0247 convert 1 byte | |
245 tst <narrow | |
246 bne branch4 | |
247 lbsr OutSpace space | |
248 branch4 lda Q$MASK,x get mask | |
249 lbsr z0241 convert 1 byte + space | |
250 tst <narrow | |
251 bne branch5 | |
252 lbsr OutSpace extra space | |
253 branch5 lda Q$PRTY,x get priority byte | |
254 lbsr z0247 convert 1 byte | |
255 z01B1 pshs x | |
256 ldx <outptr | |
257 lda #C$CR terminate this line | |
258 sta ,x | |
259 leax rptbuf,u ptr to outbuff | |
260 ldy #80 max 80 chars | |
261 lda #$01 stdout | |
262 os9 I$WritLn | |
263 lbcs errexit | |
264 puls x,pc | |
265 | |
266 z01CA pshs x | |
267 IFGT Level-1 | |
268 leax poltable,u | |
269 ELSE | |
270 ldx <dpoltbl | |
271 ENDC | |
272 ldb <devcount | |
273 pshs b | |
274 * now we make an assumption that data | |
275 * areas for the same driver will be | |
276 * in the same page of memory, so compare | |
277 * only the high bytes of the address | |
278 ldb Q$STAT,x get irq dat addr | |
279 IFGT Level-1 | |
280 leax devtable,u devtbl buffer | |
281 ELSE | |
282 ldx <ddevtbl | |
283 ENDC | |
284 z01D6 cmpb V$STAT,x | |
285 beq Match if match, found device | |
286 leax DEVSIZ,x else inc to next tbl entry | |
287 dec ,s and decrement coounter | |
288 bne z01D6 continue if more | |
289 leas $01,s get rid of stack data | |
290 ldy <outptr | |
291 leay 8,y this leaves name visible | |
292 sty <outptr until new one found | |
293 puls x,pc | |
294 | |
295 z01E9 ldy <outptr | |
296 ldb #08 | |
297 lda #C$SPAC a space | |
298 z01EA sta ,y+ | |
299 decb | |
300 bne z01EA | |
301 sty <outptr | |
302 rts | |
303 | |
304 Match puls b fix stack | |
305 ldx V$DRIV,x get driver module pointer | |
306 beq z01E9 branch if none | |
307 IFGT Level-1 | |
308 pshs u | |
309 leau modulep,u | |
310 ldd <datptr | |
311 * hopefully the driver name is in the 1st 256 bytes | |
312 ldy #256 | |
313 os9 F$CpyMem | |
314 puls u | |
315 lbcs errexit | |
316 leax modulep,u | |
317 ENDC | |
318 ldd M$Name,x | |
319 leax d,x | |
320 lda #8 | |
321 tst <narrow | |
322 beq storeit | |
323 lda #7 | |
324 storeit sta <counter | |
325 clrb | |
326 bra z0220 | |
327 z021D bsr z025B | |
328 z0220 incb | |
329 cmpb <counter | |
330 bcc z0232 | |
331 lda ,x+ | |
332 bpl z021D | |
333 anda #$7F | |
334 bsr z025B | |
335 cmpb <counter | |
336 bcc z023A | |
337 z0232 bsr OutSpace | |
338 incb | |
339 cmpb <counter | |
340 bcs z0232 | |
341 z023A puls x,pc | |
342 | |
343 * HexCvt | |
344 * Entry: | |
345 * D = number to convert to hex | |
346 * X = pointer to buffer where hex string is stored | |
347 * Exit | |
348 OutHex pshs b convert to ascii | |
349 bsr z0247 make 2 digits | |
350 puls a | |
351 z0241 bsr z0247 make 2 more | |
352 OutSpace lda #C$SPAC | |
353 bra z025B | |
354 z0247 tfr a,b | |
355 lsra | |
356 lsra | |
357 lsra | |
358 lsra | |
359 bsr z0251 | |
360 tfr b,a | |
361 z0251 anda #$0F | |
362 cmpa #$0A | |
363 bcs z0259 | |
364 adda #$07 | |
365 z0259 adda #$30 | |
366 z025B pshs x | |
367 ldx <outptr get outbuf ptr | |
368 sta ,x+ | |
369 stx <outptr | |
370 puls pc,x | |
371 | |
372 emod | |
373 emod equ * | |
374 end |