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