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