0
|
1 ********************************************************************
|
|
2 * MDir - Show module information
|
|
3 *
|
|
4 * $Id$
|
|
5 *
|
1255
|
6 * Edt/Rev YYYY/MM/DD Modified by
|
|
7 * Comment
|
0
|
8 * ------------------------------------------------------------------
|
1277
|
9 * 7 ????/??/??
|
1350
|
10 * Original Tandy/Microware version.
|
1255
|
11 *
|
|
12 * 8 2003/01/14 Boisy Pitre
|
|
13 * Changed option to -e, optimized slightly. Could use greater optimization.
|
1277
|
14 *
|
|
15 * 9 2003/08/24 Rodney Hamilton
|
1350
|
16 * Corrected leading zero supression, more optimizations.
|
1810
|
17 *
|
|
18 * 9r1 2005/04/19 Boisy G. Pitre
|
|
19 * Made column computation and use more efficient.
|
0
|
20
|
|
21 nam MDir
|
|
22 ttl Show module information
|
|
23
|
|
24 * Disassembled 98/09/11 11:57:27 by Disasm v1.6 (C) 1988 by RML
|
|
25
|
|
26 ifp1
|
|
27 use defsfile
|
|
28 endc
|
|
29
|
|
30 tylg set Prgrm+Objct
|
|
31 atrv set ReEnt+rev
|
1810
|
32 rev set $01
|
1277
|
33 edition set 9
|
0
|
34
|
|
35 mod eom,name,tylg,atrv,start,size
|
|
36
|
1277
|
37 ParamPtr rmb 2
|
|
38 zflag rmb 1 supress leading zeros flag
|
|
39 bufptr rmb 2 current position in the line buffer
|
|
40 datebuf rmb 3
|
|
41 timebuf rmb 3
|
839
|
42 narrow rmb 1
|
1277
|
43 u000C rmb 1 name field width
|
|
44 u000D rmb 1 last starting column
|
|
45 linebuf rmb 80
|
|
46 u005E rmb 2 ptr to module dir end
|
|
47 u0060 rmb 2 ptr to module dir start
|
0
|
48 u0062 rmb 4096
|
1277
|
49 u1062 rmb 64 module name buffer
|
|
50 u10A2 rmb 13 module stats ??
|
|
51 rmb 256 stack area
|
0
|
52 size equ .
|
|
53
|
|
54 name fcs /MDir/
|
|
55 fcb edition
|
|
56
|
839
|
57 header fcs " Module Directory at "
|
|
58 header2 fcs "Block Offset Size Typ Rev Attr Use Module Name"
|
|
59 header3 fcs "----- ------ ---- --- --- ---- ---- ------------"
|
|
60 sheader1 fcs "Blk Ofst Size Ty Rv At Uc Name"
|
|
61 sheader2 fcs "___ ____ ____ __ __ __ __ ______"
|
|
62 lock fcs "Lock "
|
|
63 slock fcs "Lk"
|
0
|
64
|
|
65 start pshs u
|
|
66 leau >u1062,u
|
|
67 L00D4 clr ,-u
|
|
68 cmpu ,s
|
|
69 bhi L00D4
|
|
70 puls u
|
1277
|
71 clr <zflag clear leading zero supression
|
|
72 clr <narrow default to wide
|
1810
|
73 * ldd #$0C30 wide column width=12/last start col=48
|
|
74 * std <u000C
|
1277
|
75 stx <ParamPtr save args ptr
|
|
76 leax linebuf,u
|
|
77 stx <bufptr
|
|
78 lbsr writeBUF
|
1810
|
79 ldd #$01*256+SS.ScSiz standard output and get screen size
|
839
|
80 os9 I$GetStt get it!
|
|
81 bcc L00FF branch if ok
|
1810
|
82 * cmpb #E$UnkSvc unknown service?
|
|
83 * lbne L0241 exit with error if not
|
|
84 * bra L010C else ignore screen width test
|
1277
|
85
|
1810
|
86 L00FF tfr x,d
|
|
87 cmpb #40 compare against 51
|
|
88 bgt higher if greater or equal, go on
|
839
|
89 inc <narrow else set narrow flag
|
1810
|
90 lda #10
|
|
91 fcb $8C
|
|
92 higher lda #12 narrow column width=10/last start col=21
|
|
93 pshs a
|
|
94 subb ,s+
|
0
|
95 std <u000C
|
1277
|
96 L010C leay >header,pcr point to main header
|
|
97 lbsr copySTR
|
|
98 leax datebuf,u date/time buffer
|
|
99 os9 F$Time get current date & time
|
|
100 leax timebuf,u only wanted the time
|
|
101 lbsr L02B8 print TIME as HH:MM:SS
|
|
102 lbsr writeBUF
|
|
103 leax <u0062,u buffer for module directory
|
0
|
104 pshs u
|
1277
|
105 os9 F$GModDr get module directory
|
|
106 sty <u005E save local end ptr
|
|
107 stu <u0060 save system start ptr
|
0
|
108 puls u
|
1277
|
109 leax -MD$ESize,x
|
|
110 ldy <ParamPtr
|
839
|
111 ldd ,y+
|
|
112 andb #$DF
|
|
113 cmpd #$2D45 -e option?
|
0
|
114 bne L018E
|
1277
|
115 lbsr writeBUF
|
839
|
116 L0149 leay >header2,pcr
|
|
117 tst <narrow
|
1277
|
118 beq L014D
|
|
119 leay >sheader1,pcr
|
|
120 L014D lbsr copySTR
|
|
121 lbsr writeBUF
|
|
122 L015D leay >header3,pcr
|
|
123 tst <narrow
|
|
124 beq L0161
|
839
|
125 leay >sheader2,pcr
|
1277
|
126 L0161 lbsr copySTR
|
|
127 lbsr writeBUF
|
0
|
128 leax <u0062,u
|
|
129 lbra L023A
|
1277
|
130
|
|
131 * just print the module names, no E flag
|
0
|
132 L016D lbsr L0308
|
|
133 beq L018E
|
|
134 lbsr L02DE
|
1277
|
135 lbsr copySTR
|
|
136 L0178 lbsr outSP
|
|
137 ldb <bufptr+1
|
0
|
138 subb #$0E
|
|
139 cmpb <u000D
|
|
140 bhi L018B
|
|
141 L0183 subb <u000C
|
|
142 bhi L0183
|
|
143 bne L0178
|
|
144 bra L018E
|
1277
|
145
|
|
146 L018B lbsr writeBUF
|
|
147 L018E leax MD$ESize,x
|
0
|
148 cmpx <u005E
|
|
149 bcs L016D
|
1277
|
150 lbsr writeBUF final/partial line
|
|
151 lbra L0240 exit OK
|
|
152
|
|
153 * print extended info line for each module
|
0
|
154 L019A lbsr L0308
|
1277
|
155 lbeq L0238 skip if DAT image ptr==0
|
0
|
156 tfr d,y
|
|
157 ldd ,y
|
839
|
158 tst <narrow
|
0
|
159 beq L01B1
|
1277
|
160 lbsr outSP
|
|
161 lbsr outb2HS 2-digit block number
|
|
162 bra L01BE
|
|
163 L01B1 lbsr out4HS 4-digit block number
|
|
164 lbsr outSP
|
|
165 lbsr outSP
|
|
166 * module offset
|
|
167 L01BE ldd MD$MPtr,x
|
|
168 bsr out4HS 4-digit offset
|
839
|
169 tst <narrow
|
0
|
170 bne L01CA
|
1277
|
171 lbsr outSP
|
|
172 L01CA lbsr L02DE read module's header info
|
0
|
173 leay >u10A2,u
|
1277
|
174 * module size
|
|
175 ldd M$Size,y
|
|
176 bsr out4HS 4-digit size
|
839
|
177 tst <narrow
|
0
|
178 bne L01DC
|
1277
|
179 lbsr outSP
|
|
180 * type/lang
|
|
181 L01DC lda M$Type,y
|
|
182 bsr out2HS 2-digit type/lang
|
839
|
183 tst <narrow
|
0
|
184 bne L01E7
|
1277
|
185 lbsr outSP
|
|
186 * att/rev
|
|
187 L01E7 lda M$Revs,y
|
|
188 anda #RevsMask
|
|
189 bsr out2HS 2-digit revision
|
|
190 ldb M$Revs,y upper half = attributes
|
|
191 lda #'r
|
|
192 bsr L0291 bit7: ReEnt (reentrant module)
|
839
|
193 tst <narrow
|
0
|
194 bne L0207
|
1277
|
195 lda #'w bit6: ModProt (writeable module)
|
|
196 bsr L0291
|
|
197 lda #'3 bit5: ModNat (native mode 6309)
|
|
198 bsr L0291
|
|
199 lda #'? bit4 undefined
|
|
200 bsr L0291
|
|
201 * user count
|
|
202 L0207 bsr outSP
|
|
203 ldd MD$Link,x D=user count
|
|
204 cmpd #$FFFF if -1,
|
0
|
205 bne L0223
|
1277
|
206 L021B leay >lock,pcr print "Lock"
|
839
|
207 tst <narrow
|
1277
|
208 bne L021F
|
839
|
209 leay >slock,pcr
|
1277
|
210 L021F bsr copySTR
|
0
|
211 bra L0230
|
1277
|
212
|
839
|
213 L0223 tst <narrow
|
0
|
214 beq L022E
|
1277
|
215 bsr outSP
|
|
216 bsr outb2HS 2-digit user count
|
0
|
217 bra L0230
|
1277
|
218
|
|
219 L022E bsr out4HS 4-digit user count
|
|
220 * module name
|
|
221 L0230 leay >u1062,u point to name buffer
|
|
222 bsr copySTR
|
|
223 bsr writeBUF
|
|
224 L0238 leax MD$ESize,x next entry
|
|
225 L023A cmpx <u005E more to do?
|
|
226 lbcs L019A yes, continue
|
0
|
227 L0240 clrb
|
|
228 L0241 os9 F$Exit
|
1277
|
229
|
|
230 * print regD as 4 hex digits plus space
|
|
231 out4HS inc <zflag supress leading zeros
|
|
232 inc <zflag
|
|
233 bsr out2H print MSB as 2 hex
|
|
234 dec <zflag
|
|
235 * print regB as 2 hex digits plus space
|
|
236 outb2HS tfr b,a print LSB as 2 hex
|
|
237
|
|
238 * print regA as 2 hex digits plus space
|
|
239 out2HS bsr out2H
|
|
240 bra outSP
|
|
241
|
|
242 out2H inc <zflag supress leading zero
|
|
243 pshs a
|
0
|
244 lsra
|
|
245 lsra
|
|
246 lsra
|
|
247 lsra
|
1277
|
248 bsr L026C print MSdigit
|
|
249 puls a print LSdigit
|
|
250 anda #$0F is this a zero?
|
|
251 L026C bne L027B no, print it
|
|
252 tst <zflag still supressing zeros?
|
|
253 bgt outZSP yes, count it and print space
|
|
254 L027B clr <zflag nonzero, print all the rest
|
|
255 adda #'0
|
839
|
256 cmpa #'9
|
1277
|
257 bls outCH
|
0
|
258 adda #$07
|
1277
|
259 bra outCH
|
|
260
|
|
261 * process attribute flag bit
|
|
262 L0291 rolb
|
|
263 bcs outCH
|
|
264 lda #'.
|
|
265 bra outCH
|
|
266
|
|
267 outZSP dec <zflag count down to last digit
|
|
268 outSP lda #C$SPAC append a SPACE to the line buffer
|
|
269
|
|
270 * Append character in regA to the line buffer
|
|
271 outCH pshs x
|
|
272 ldx <bufptr
|
0
|
273 sta ,x+
|
1277
|
274 stx <bufptr
|
0
|
275 puls pc,x
|
839
|
276
|
1277
|
277 * Copy an FCS string to the line buffer
|
|
278 L0296 bsr outCH
|
|
279 copySTR lda ,y+
|
|
280 bpl L0296
|
0
|
281 anda #$7F
|
1277
|
282 bra outCH
|
839
|
283
|
1277
|
284 * Append a CR and send entire line to stdout
|
|
285 writeBUF pshs y,x,a
|
839
|
286 lda #C$CR
|
1277
|
287 bsr outCH
|
|
288 leax linebuf,u
|
|
289 stx <bufptr
|
839
|
290 ldy #80
|
0
|
291 lda #$01
|
|
292 os9 I$WritLn
|
|
293 puls pc,y,x,a
|
1277
|
294
|
|
295 * Print TIME as HH:MM:SS
|
|
296 L02B8 bsr L02C0 print HH
|
|
297 bsr L02BC print :MM
|
|
298 * print :SS and return
|
839
|
299 L02BC lda #':
|
1277
|
300 bsr outCH
|
0
|
301 L02C0 ldb ,x+
|
1277
|
302 L02C4 subb #100
|
0
|
303 bcc L02C4
|
1277
|
304 * code to print 100's digit removed - max timefield value is 59
|
|
305 L02CF lda #'9+1
|
0
|
306 L02D1 deca
|
839
|
307 addb #10
|
0
|
308 bcc L02D1
|
1277
|
309 bsr outCH tens digit
|
0
|
310 tfr b,a
|
839
|
311 adda #'0
|
1277
|
312 bra outCH units digit
|
|
313
|
|
314 * copy module header & name to local buffers
|
0
|
315 L02DE pshs u,x
|
1277
|
316 bsr L0308 D=ptr to mdir entry
|
|
317 ldx 4,x X=MD$MPtr
|
|
318 ldy #13
|
|
319 leau >u10A2,u buffer for module header data
|
|
320 os9 F$CpyMem copy 13 bytes of module header
|
|
321 pshs b,a save DAT image ptr
|
|
322 ldd 4,u name offset
|
|
323 leax d,x X=name ptr
|
|
324 puls b,a restore DAT image ptr
|
|
325 ldu 2,s
|
|
326 leau >u1062,u U=ptr to name buffer
|
839
|
327 ldy #64
|
1277
|
328 os9 F$CpyMem copy 64 bytes of name data
|
|
329 tfr u,y Y=ptr to name buf
|
0
|
330 puls pc,u,x
|
1277
|
331
|
|
332 * calculate local buffer address for current mdir entry (DAT image ptr)
|
|
333 L0308 ldd ,x D=MD$MPDAT
|
|
334 beq L0319 if 0, skip empty slot
|
0
|
335 pshs y
|
1277
|
336 leay <u0062,u Y=local MDIR buffer
|
0
|
337 pshs y
|
1277
|
338 subd <u0060 D=offset (MD$MPDAT-mdstart)
|
|
339 addd ,s++ D=ptr to local mdir entry
|
0
|
340 puls y
|
1277
|
341 L0319 rts
|
0
|
342
|
|
343 emod
|
|
344 eom equ *
|
|
345 end
|