967
|
1 ********************************************************************
|
|
2 * DirM - Show module directory
|
|
3 *
|
|
4 * $Id$
|
|
5 *
|
|
6 * Changes:
|
|
7 *
|
|
8 * Added internal print buffer, so an I$Write call is not performed for every
|
|
9 * byte printed out. Halves printout time.
|
|
10 *
|
|
11 * Added SS.ScSiz check, and goes to 32-column output if display is 40 columns
|
|
12 * or less.
|
|
13 *
|
1255
|
14 * Edt/Rev YYYY/MM/DD Modified by
|
|
15 * Comment
|
967
|
16 * ------------------------------------------------------------------
|
1255
|
17 * ? 1994/11/10 Alan DeKok
|
|
18 * Disassembled at 8:18:38
|
|
19 *
|
|
20 * 5 ????/??/?? Alan DeKok
|
|
21 * Added internal print buffer, so an I$Write call is not performed for
|
|
22 * every byte printed out. Halves printout time. Added SS.ScSiz check
|
|
23 * and goes to 32-column output if display is 40 columns or less.
|
967
|
24
|
|
25 nam DirM
|
|
26 ttl Show module directory
|
|
27
|
|
28 ifp1
|
|
29 use defsfile
|
|
30 endc
|
|
31
|
|
32 tylg set Prgrm+Objct
|
|
33 atrv set ReEnt+rev
|
1255
|
34 rev set $00
|
967
|
35 edition set 5
|
|
36
|
|
37 Bound equ 40 width at which change is made to 32-col printing
|
|
38
|
|
39
|
|
40 mod eom,name,tylg,atrv,start,size
|
|
41
|
|
42 MD.DAT rmb 2
|
|
43 MD.Crnt rmb 2
|
|
44 MD.Strt rmb 2
|
|
45 MD.End rmb 2
|
|
46 MD.MPDAT rmb 5
|
|
47 PntCnt rmb 1
|
|
48
|
|
49 *Single rmb 1 single entry/line?
|
|
50 Width rmb 1 width of the output device
|
|
51
|
|
52 PBuffer rmb 31 internal print buffer
|
|
53 Buffer rmb 40 room for a name buffer
|
|
54 MD.Data rmb 2048 size of the module directory
|
|
55 rmb 200 for the stack
|
|
56 size equ .
|
|
57 name equ *
|
|
58 fcs /DirM/
|
|
59 fcb edition
|
|
60
|
|
61 H2 fcc / Bk Ofst Size Ty At Link Name/
|
|
62 fcb C$CR
|
|
63 H3 fcc / -- ---- ---- -- -- ---- -----/
|
|
64 H1 fcb C$CR
|
|
65
|
|
66 * Believe it or not, all this internal crap is still smaller than having
|
|
67 * a different version of the header for 32/80 columns.
|
|
68 Dump ldu #PBuffer output print buffer
|
|
69 lda ,x+ get first character
|
|
70 sta ,u+ move it over
|
|
71 ldb <Width get the width
|
|
72
|
|
73 D.01 cmpa #C$CR CR?
|
|
74 beq D.Print yup, dump it out
|
|
75
|
|
76 lda ,x+ grab a character
|
|
77 sta ,u+ save it
|
|
78 cmpa #C$SPAC was it a space?
|
|
79 bne D.01 no, just save it
|
|
80
|
|
81 cmpb #Bound 40-column screen?
|
|
82 bls D.01 yes, don't add the space
|
|
83 sta ,u+ if a space, save another copy of it
|
|
84 bra D.01
|
|
85
|
|
86 D.Print lda #$01 to STDOUT
|
|
87 ldx #PBuffer
|
|
88 ldy #50 max. size of data to print
|
|
89 OS9 I$WritLn dump it out
|
|
90 bcs Exit
|
|
91 rts
|
|
92
|
|
93 start equ *
|
|
94 stu <MD.DAT u=$0000 always on startup in OS-9 LII
|
|
95 ldd #$0100+SS.ScSiz stdout, get screen size
|
|
96 OS9 I$GetStt
|
|
97 bcs s.01
|
|
98 tfr x,d
|
|
99 bra s.02 save actual screen size
|
|
100
|
|
101 s.01 cmpb #E$UnkSvc
|
|
102 bne Exit
|
|
103 ldb #80 default to 80 columns if error
|
|
104 s.02 stb <Width
|
|
105
|
|
106 leax <H1,pcr print out initial CR
|
|
107 bsr Dump
|
|
108 leax >H2,pcr header of names
|
|
109 bsr Dump
|
|
110 leax <H3,pcr and hyphens
|
|
111 bsr Dump
|
|
112
|
|
113 ldx #MD.Data
|
|
114 os9 F$GModDr
|
|
115 bcs Exit
|
|
116 stu <MD.Strt save start address of system module dir
|
|
117
|
|
118 sty <MD.End save end of the module directory
|
|
119 bra L00B5
|
|
120
|
|
121 ClnExit clrb
|
|
122 Exit os9 F$Exit
|
|
123
|
|
124 L00AD ldx <MD.Crnt
|
|
125 leax MD$ESIZE,x go to the next entry
|
|
126 cmpx <MD.End
|
|
127 bcc ClnExit
|
|
128
|
|
129 L00B5 stx <MD.Crnt
|
|
130 ldu #PBuffer temporary print buffer
|
|
131 ldd MD$MPDAT,x get module DAT image
|
|
132 beq L00AD if zero, skip this entry
|
|
133 pshs d
|
|
134 cmpd <MD.DAT
|
|
135 beq L00CD
|
|
136 std <MD.DAT save the current DAT image
|
|
137 lda #'- start of this block
|
|
138 fcb $8C skip 2 bytes
|
|
139
|
|
140 L00CD lda #C$SPAC space
|
|
141 sta ,u+ store it in the data buffer
|
|
142 L00D0 puls d restore current DAT image
|
|
143 subd <MD.Strt take out start of the block
|
|
144 ldy #MD.Data point to module directory data
|
|
145 leay d,y to the DAT image within it
|
|
146 tfr y,d
|
|
147 std <MD.MPDAT save pointer to DAT
|
|
148 lda MD$MPtr,x module pointer
|
|
149 lsra
|
|
150 lsra
|
|
151 lsra
|
|
152 lsra turn address into block offset
|
|
153 anda #$0E keep low bits only
|
|
154 inca DAT image is (junk),(block)
|
|
155 lda a,y get the starting block number
|
|
156 bsr L0165 dump it out
|
|
157 ldd MD$MPtr,x get real pointer
|
|
158 anda #$1F get offset inside block
|
|
159 bsr L0159 print it out
|
|
160 ldx MD$MPtr,x and get pointer again
|
|
161
|
|
162 pshs u save print buffer pointer
|
|
163 ldu #Buffer to a name buffer
|
|
164 ldy #$000A move first 10 bytes of the module?
|
|
165 ldd <MD.MPDAT
|
|
166 os9 F$CpyMem copy it over
|
|
167 puls u restore print buffer ptr
|
|
168 bcs Exit
|
|
169
|
|
170 ldd <Buffer+M$Size
|
|
171 bsr L0159 print out the size of the module
|
|
172 lda <Buffer+M$Type
|
|
173 bsr L0165 print out the Ty/Lg
|
|
174 lda <Buffer+M$Revs
|
|
175 bsr L0165 print out At/Rv
|
|
176 ldx <MD.Crnt get current module pointer
|
|
177 ldd MD$Link,x link count
|
|
178 bsr L0159
|
|
179 ldd <Buffer+M$Name
|
|
180 ldx <MD.Crnt
|
|
181 ldx MD$MPtr,x start address of the module
|
|
182 leax d,x point to the name
|
|
183
|
|
184 pshs u save print buffer ptr
|
|
185 ldu #Buffer to the buffer again
|
|
186 lda <Width
|
|
187 cmpa #Bound
|
|
188 bhi n.01
|
|
189 leau -6,u discount 6 spaces
|
|
190
|
|
191 n.01 ldd <MD.MPDAT
|
|
192 ldy #40 copy over 40 bytes of the name
|
|
193 os9 F$CpyMem
|
|
194 tfr u,x save copy of the start of the buffer
|
|
195 puls u restore print buffer ptr
|
|
196 lbcs Exit
|
|
197
|
|
198 ldb #39 maximum number of characters to check
|
|
199 L013F lda ,x+ get a character
|
|
200 bpl L013F if it's OK
|
|
201 anda #$7F force it to be printable
|
|
202 sta -1,x save it again
|
|
203 lda #C$CR drop a CR after the last character of the name
|
|
204
|
|
205 sta ,x save it
|
|
206 ldx #PBuffer point to the start of the buffer
|
|
207 ldy #64 64 characters
|
|
208 lda #$01
|
|
209 os9 I$WritLn print out the name
|
|
210 lbra L00AD start all over again
|
|
211
|
|
212 * Print out a 2-byte hex number in D
|
|
213 L0159 pshs b save low order character
|
|
214 ldb #3 3 digits to print out
|
|
215 bsr L0171 print out A
|
|
216 puls a restore low byte
|
|
217 bsr L0173 print it, too
|
|
218 bra L0167 and dump out 2 spaces
|
|
219
|
|
220 * print out a 1-digit hex number in A
|
|
221 L0165 bsr L016F
|
|
222 L0167 lda <Width check the width
|
|
223 cmpa #Bound
|
|
224 bls L016B if 40 columns or smaller, don't print extra space
|
|
225 lda #C$SPAC space
|
|
226 sta ,u+
|
|
227 L016B lda #C$SPAC and another space
|
|
228 sta ,u+
|
|
229 rts
|
|
230
|
|
231 L016F ldb #$01
|
|
232 L0171 stb <PntCnt
|
|
233 L0173 tfr a,b save a copy of the number in B
|
|
234 lsra
|
|
235 lsra
|
|
236 lsra
|
|
237 lsra move high nibble into the lower nibble
|
|
238 bsr L017D print out lower nibble of A as hex number
|
|
239 tfr b,a restore lower nibble
|
|
240
|
|
241 L017D anda #$0F make 0-15
|
|
242 beq L019C if zero, skip printing it out
|
|
243 clr <PntCnt
|
|
244 cmpa #$0A higher than A?
|
|
245 bcs L0189 no, add in ascii zero
|
|
246 adda #$07 yes, add difference between 9 and A
|
|
247 L0189 adda #'0 turn it into an ascii number
|
|
248
|
|
249 Print sta ,u+ save the character in the buffer
|
|
250 rts
|
|
251
|
|
252 L019C dec <PntCnt count down of number of characters to print
|
|
253 bmi L0189 if last one, print out a zero
|
|
254 bra L016B otherwise print out a space
|
|
255
|
|
256 emod
|
|
257 eom equ *
|
|
258 end
|