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