0
|
1 ********************************************************************
|
|
2 * DDir - Show device table entries
|
|
3 *
|
|
4 * $Id$
|
|
5 *
|
|
6 * Ed. Comments Who YY/MM/DD
|
|
7 * ------------------------------------------------------------------
|
|
8 * 2 Reworked AD
|
|
9
|
|
10 nam DDir
|
|
11 ttl program module
|
|
12
|
|
13 * Disassembled 94/11/05 14:18:05 by Alan DeKok
|
|
14 *
|
|
15 * Future revisions:
|
|
16 * Check <D.Init and DevCnt for entries in device polling table
|
|
17 * check 9/D for size of table - go to V$DESC and look for $87CD
|
|
18
|
|
19 ifp1
|
|
20 use defsfile
|
|
21 endc
|
|
22
|
|
23 tylg set Prgrm+Objct
|
|
24 atrv set ReEnt+rev
|
|
25 rev set $01
|
|
26 edition set 2
|
|
27
|
|
28 mod eom,name,tylg,atrv,start,size
|
|
29
|
|
30 MemStrt rmb 2
|
|
31 DATImg rmb 4
|
|
32 u0006 rmb 2
|
|
33 u0008 rmb 1
|
|
34 u0009 rmb 8
|
|
35 DevTbl rmb 2
|
|
36 u0013 rmb 1
|
|
37 u0014 rmb 80
|
|
38 u0064 rmb 512
|
|
39 u0264 rmb 512
|
|
40 u0464 rmb 712
|
|
41 size equ .
|
|
42
|
|
43 name fcs /DDir/
|
|
44 fcb edition
|
|
45
|
|
46 L0012 fcc /Device Table at: /
|
|
47 x12Len equ *-L0012
|
|
48 Header fcc /Device Desc Driver Static File Usr/
|
|
49 fcb $0D
|
|
50 L004B fcc /Name Port Name Mem Manager Cnt/
|
|
51 fcb $0D
|
|
52 L0073 fcc /----------- ------------- ------- ---/
|
|
53 MyCR fcb $0D
|
|
54
|
|
55 start ldd ,x get parameter bytes
|
|
56 cmpd #$2D3F -?
|
|
57 lbeq Help
|
|
58
|
|
59 lda #$01
|
|
60 stu <MemStrt
|
|
61 leax >MyCR,pcr
|
|
62 ldy #$0001
|
|
63 os9 I$WritLn output a CR
|
|
64 lbcs Exit
|
|
65 leax >L0012,pcr dump out header
|
|
66 ldy #x12Len
|
|
67 os9 I$Write
|
|
68 lbcs Exit
|
|
69 lda #$01
|
|
70 leax >u0464,u
|
|
71 os9 F$GPrDsc get system process descriptor
|
|
72 bcs Exit
|
|
73 leax <P$DATImg,x
|
|
74 stx <DATImg save address of system's DAT image
|
|
75 bra L00D3
|
|
76
|
|
77 ClnExit clrb
|
|
78 Exit os9 F$Exit
|
|
79
|
|
80 L00D3 ldu <MemStrt
|
|
81 leau >u0064,u
|
|
82 ldd <DATImg
|
|
83 ldx #D.DevTbl I/O device table
|
|
84 ldy #$0002 size of the pointer
|
|
85 os9 F$CpyMem
|
|
86 lbcs Exit
|
|
87
|
|
88 ldu <MemStrt
|
|
89 leay <u0014,u
|
|
90 sty <u0006
|
|
91 ldd <u0064,u get the pointer
|
|
92 std <DevTbl save it
|
|
93 lbsr L0222
|
|
94 lbsr L01E6
|
|
95
|
|
96 lda #$01
|
|
97 leax >MyCR,pcr dump out another CR
|
|
98 ldy #$0001
|
|
99 os9 I$WritLn
|
|
100 lbcs Exit
|
|
101
|
|
102 leax >Header,pcr
|
|
103 ldy #$0028
|
|
104 os9 I$WritLn
|
|
105 lbcs Exit
|
|
106
|
|
107 leax >L004B,pcr
|
|
108 ldy #$0028
|
|
109 os9 I$WritLn
|
|
110 lbcs Exit
|
|
111 leax >L0073,pcr
|
|
112 ldy #$0028
|
|
113 os9 I$WritLn
|
|
114 lbcs Exit
|
|
115
|
|
116 ldu <MemStrt
|
|
117 leau >u0064,u
|
|
118 ldx <DevTbl
|
|
119 ldy #$0100
|
|
120 ldd <DATImg
|
|
121 os9 F$CpyMem copy the device table over
|
|
122 lbcs Exit
|
|
123 ldb #256/DEVSIZ
|
|
124 stb <u0008 total number of entries to get
|
|
125 stu <u0009 save pointer to start of DevTbl
|
|
126
|
|
127 L0155 bsr L0165
|
|
128 dec <u0008
|
|
129 lbeq ClnExit if done them all, exit
|
|
130
|
|
131 ldx <u0009 get current pointer
|
|
132 leax DEVSIZ,x go to the next one
|
|
133 stx <u0009 save the pointer again
|
|
134 bra L0155 and loop back
|
|
135
|
|
136 L0165 ldu <MemStrt
|
|
137 leay <u0014,u
|
|
138 sty <u0006
|
|
139 lda #C$SPAC space
|
|
140 ldb #$05
|
|
141 L0171 sta ,y+ save 5 spaces
|
|
142 decb
|
|
143 bne L0171
|
|
144
|
|
145 ldx <u0009 get the current pointer
|
|
146 ldx V$DESC,x descriptor?
|
|
147 bne L017D if exists, go do it
|
|
148 rts otherwise exit
|
|
149
|
|
150 L017D pshs u
|
|
151 leau >u0264,u to another buffer
|
|
152 ldd <DATImg system DAT image
|
|
153 ldy #200 get 200 bytes
|
|
154 os9 F$CpyMem
|
|
155 puls u
|
|
156 lbcs Exit
|
|
157
|
|
158 leax >u0264,u point to the start of the buffer
|
|
159 ldd M$Name,x pointer to the name
|
|
160 leax d,x
|
|
161 lda #$05
|
|
162 bsr L01FF dump out the first 5 bytes of the name?
|
|
163
|
|
164 leax >u0264,u
|
|
165 lda M$Port,x port address of the device
|
|
166 lbsr L0228
|
|
167 ldy <u0006
|
|
168 leay -$01,y
|
|
169 sty <u0006
|
|
170 ldd M$Port+1,x
|
|
171 lbsr L0222
|
|
172 lbsr L022A
|
|
173 leax >u0264,u
|
|
174 ldd M$PDev,x device driver name offset
|
|
175 leax d,x
|
|
176 lda #$09
|
|
177 bsr L01FF dump out 9 bytes of the driver name
|
|
178 ldx <u0009
|
|
179 ldd V$STAT,x
|
|
180 lbsr L0222
|
|
181 lbsr L022A
|
|
182 leax >u0264,u
|
|
183 ldd M$FMGr,x file manager name offset
|
|
184 leax d,x point to it
|
|
185 lda #$09
|
|
186 bsr L01FF dump out 9 bytes of the file manager's name
|
|
187 ldx <u0009
|
|
188 lda V$USRS,x use count
|
|
189 lbsr L0228 print it
|
|
190 ldx <u0006
|
|
191 leax -$01,x
|
|
192 bra L01E8
|
|
193
|
|
194 L01E6 ldx <u0006
|
|
195
|
|
196 L01E8 lda #C$CR save a CR in memory
|
|
197 sta ,x
|
|
198 ldu <MemStrt
|
|
199 leax <u0014,u to the buffer
|
|
200 ldy #$0050 80 characters max.
|
|
201 lda #$01
|
|
202 os9 I$WritLn dump the buffer out
|
|
203 lbcs Exit
|
|
204 rts
|
|
205
|
|
206 L01FF sta <u0013 dump out A bytes at X
|
|
207 clrb
|
|
208 bra L0207
|
|
209
|
|
210 L0204 lbsr L0242
|
|
211 L0207 incb
|
|
212 cmpb <u0013
|
|
213 bcc L0219
|
|
214 lda ,x+
|
|
215 bpl L0204
|
|
216 anda #$7F
|
|
217 lbsr L0242 dump it out
|
|
218 cmpb <u0013
|
|
219 bcc L0221
|
|
220
|
|
221 L0219 lbsr L022A
|
|
222 incb
|
|
223 cmpb <u0013
|
|
224 bcs L0219
|
|
225 L0221 rts
|
|
226
|
|
227 L0222 pshs b
|
|
228 bsr L022E
|
|
229 puls a
|
|
230 L0228 bsr L022E
|
|
231 L022A lda #C$SPAC output a space
|
|
232 bra L0242
|
|
233
|
|
234 L022E tfr a,b
|
|
235 lsra
|
|
236 lsra
|
|
237 lsra
|
|
238 lsra
|
|
239 bsr L0238
|
|
240 tfr b,a
|
|
241 L0238 anda #$0F get the number
|
|
242 cmpa #$0A >10?
|
|
243 bcs L0240 no, make it a number
|
|
244 adda #$07 if so, make it A-F
|
|
245 L0240 adda #$30
|
|
246 L0242 pshs x
|
|
247 ldx <u0006 get buffer pointer
|
|
248 sta ,x+
|
|
249 stx <u0006
|
|
250 puls pc,x
|
|
251
|
|
252 Help lda #1 to STDOUT
|
|
253 leax HMsg,pcr
|
|
254 ldy #HLen
|
|
255 OS9 I$Write
|
|
256 clrb
|
|
257 OS9 F$Exit
|
|
258
|
|
259 HMsg fcc /ddir: NitrOS-9 v1.21 or greater only./
|
|
260 fdb C$CR,C$LF
|
|
261 HLen equ *-HMsg
|
|
262
|
|
263 emod
|
|
264 eom equ *
|
|
265 end
|