0
|
1 ********************************************************************
|
|
2 * PMap - Show process map information
|
|
3 *
|
|
4 * $Id$
|
|
5 *
|
|
6 * From "Inside Level II" by Kevin Darling
|
|
7 *
|
1255
|
8 * Edt/Rev YYYY/MM/DD Modified by
|
|
9 * Comment
|
0
|
10 * ------------------------------------------------------------------
|
1255
|
11 * ? 1987/02/08 Kevin Darling
|
|
12 * Original version.
|
|
13 *
|
|
14 * 2 1989/09/12 Ken Drexler
|
1350
|
15 * Revised to handle 4K or 8K blocks.
|
0
|
16
|
|
17 nam PMap
|
|
18 ttl Show process map information
|
|
19
|
|
20 ifp1
|
|
21 use defsfile
|
|
22 endc
|
|
23
|
|
24 Type set Prgrm+Objct
|
1255
|
25 Revs set ReEnt+0
|
0
|
26 Bufsiz set 512
|
|
27 edition set 2
|
|
28
|
|
29 stdout set 1
|
|
30 maxnam set 30
|
|
31
|
|
32 pag
|
|
33 ***************************************************
|
|
34 *
|
|
35 mod PrgSiz,Name,Type,Revs,Entry,DatSiz
|
|
36
|
|
37 Name fcs /PMap/
|
|
38 fcb edition
|
|
39
|
|
40 * Data Equates
|
|
41 umem rmb 2
|
|
42 sysImg rmb 2 pointer to sysprc datimg
|
|
43 datimg rmb 2 datimg for copymem
|
|
44 lineptr rmb 2
|
|
45 number rmb 3
|
|
46 leadflag rmb 1
|
|
47 pid rmb 1
|
|
48 hdr rmb 12
|
|
49 blkcnt rmb 1 no. blocks/64k
|
|
50 outbuf rmb 80
|
|
51 buffer rmb bufsiz*2 working proc. desc.
|
|
52 stack rmb 200
|
|
53 datsiz equ .
|
|
54
|
|
55 *************************************************
|
|
56 *
|
|
57 * Messages
|
|
58 *
|
|
59 Head1A fcc / ID 01 23 45 67 89 AB CD EF Program /
|
|
60 fcb C$CR
|
|
61
|
|
62 Head2A fcc /____ __ __ __ __ __ __ __ __ ___________/
|
|
63 Hdrcr fcb C$CR
|
|
64
|
|
65 Head1B fcc / ID 0 1 2 3 4 5 6 7 8 9 A B C D E F Program/
|
|
66 fcb C$CR
|
|
67
|
|
68 Head2B fcc /____ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ _______/
|
|
69 fcb C$CR
|
|
70
|
|
71 SysNam fcs "SYSTEM"
|
|
72 syslen equ *-Sysnam
|
|
73
|
|
74 spc 3
|
|
75 ***************************************************
|
|
76 *
|
|
77 Entry stu Umem
|
|
78 lda #1 start with process 1
|
|
79 clr Pid
|
|
80
|
|
81 * Print header
|
|
82 leax buffer,u point at storage
|
|
83 os9 F$GBlkMp get block info
|
|
84 bcs Error
|
|
85 cmpd #8192 8k?
|
|
86 beq Set8k
|
|
87 cmpd #4096 4k?
|
|
88 beq Set4k
|
|
89 bra Error we only do 4k/8k
|
|
90
|
|
91 Set8k lda #64/8
|
|
92 bra Entry1
|
|
93
|
|
94 Set4k lda #64/4
|
|
95 Entry1 sta blkcnt save size
|
|
96 leax Hdrcr,pcr print line
|
|
97 lbsr PrintL1 print it
|
|
98 lda blkcnt
|
|
99 cmpa #64/4 4k?
|
|
100 beq Headr4
|
|
101 Headr8 leax Head1A,pcr
|
|
102 lbsr PrintL1 print it
|
|
103 leax Head2A,pcr
|
|
104 bra Head41
|
|
105
|
|
106 Headr4 leax Head1B,pcr
|
|
107 lbsr PrintL1
|
|
108 leax Head2B,pcr
|
|
109 Head41 lbsr PrintL1
|
|
110
|
|
111 * Main Program Loop
|
|
112 Main ldu umem
|
|
113 leax OutBuf,U set line pointer
|
|
114 stx Lineptr
|
|
115 inc Pid next process
|
|
116 beq Bye >= 255 --> exit
|
|
117 lda Pid get proc id
|
|
118 leax Buffer,U set destination
|
|
119 os9 F$GPrDsc
|
|
120 bcs Main loop if no descriptor
|
|
121 bsr Output print data for descriptor
|
|
122 bra Main
|
|
123
|
|
124 Bye clrb
|
|
125 Error os9 F$Exit
|
|
126
|
|
127 * Subroutines
|
|
128
|
|
129 Output lda P$ID,X process id
|
|
130 lbsr Outdecl
|
|
131 lbsr Space
|
|
132 lbsr Space
|
|
133
|
|
134 * Print Process DAT Image
|
|
135 * IN: x = process descriptor
|
|
136 *
|
|
137 pshs X
|
|
138 leax P$DATImg,x point to DAT image
|
|
139 ldb blkcnt set count
|
|
140 pshs b
|
|
141
|
|
142 PrntImg ldd ,x++ get DAT block
|
|
143 cmpd #$00FC empty?
|
|
144 bne prntimg2
|
|
145 ldy lineptr
|
|
146 ldd #"..
|
|
147 std ,y++
|
|
148 sty lineptr
|
|
149 lbsr space
|
|
150 bra prntimg3
|
|
151
|
|
152 PrntImg2 tfr b,a print block no.
|
|
153 lbsr Out2HS
|
|
154
|
|
155 PrntImg3 dec ,s count -= 1
|
|
156 bne Prntimg
|
|
157 puls b,x
|
|
158
|
|
159 * Print primary module name
|
|
160 * IN: X - process descriptor
|
|
161 *
|
|
162 lbsr Space
|
|
163 leay P$DATImg,X
|
|
164 tfr Y,D d=dat image
|
|
165 std datimg save pointer
|
|
166 ldx P$PModul,X x=offset in map
|
|
167 bne doname
|
|
168 leax >sysnam,pcr point at name
|
|
169 ldy lineptr
|
|
170 ldb #syslen
|
|
171
|
|
172 Copy lda ,x+
|
|
173 sta ,y+
|
|
174 decb
|
|
175 bne copy
|
|
176 bsr Name2
|
|
177 bra Printlin
|
|
178
|
|
179 Doname bsr Printnam
|
|
180
|
|
181 * Print Line
|
|
182 Printlin ldx lineptr terminate line
|
|
183 lda #C$CR
|
|
184 sta ,X
|
|
185 ldu umem
|
|
186 leax outbuf,U
|
|
187
|
|
188 * Print line
|
|
189 PrintL1 ldy #80
|
|
190 lda #stdout
|
|
191 os9 I$Writln
|
|
192 bcs Error
|
|
193 rts
|
|
194
|
|
195 ** Find and print a module name
|
|
196 * IN: X - module offset
|
|
197 * U - data area
|
|
198 * datimg = pointer
|
|
199 *
|
|
200 Printnam equ *
|
|
201
|
|
202 * Read module header
|
|
203 pshs U save u
|
|
204 leau hdr,U destination
|
|
205 ldd datimg proc datimg pointer
|
|
206 ldy #10 set length
|
|
207 os9 F$CpyMem
|
|
208 lbcs Error
|
|
209
|
|
210 * Read name from Module to buffer
|
|
211 ldd M$Name,U get name offset from header
|
|
212 ldu lineptr move name to outbuf
|
|
213 leax D,X X - offset to name
|
|
214 ldd datimg
|
|
215 ldy #maxnam set maximum length
|
|
216 os9 F$CpyMem
|
|
217 puls U
|
|
218 lbcs Error
|
|
219
|
|
220 Name2 pshs X
|
|
221 ldx lineptr
|
|
222 clrb set length = 0
|
|
223 Name3 incb
|
|
224 lda ,X+
|
|
225 bpl Name3
|
|
226 cmpb #40
|
|
227 bcc Name5
|
|
228 anda #$7F clear d7
|
|
229 sta -1,X
|
|
230 cmpb #9
|
|
231 bcc Name5
|
|
232 lda #C$SPAC
|
|
233 Name4 sta ,X+
|
|
234 incb
|
|
235 cmpb #9
|
|
236 bcs Name4
|
|
237 Name5 stx lineptr
|
|
238 puls X,PC
|
|
239
|
|
240 * Print hex digit in A
|
|
241 Out2HS bsr Hexl
|
|
242
|
|
243 Space lda #C$SPAC
|
|
244 bra Print
|
|
245
|
|
246
|
|
247 * Print Hexidecimal Digit in A
|
|
248 Hexl tfr A,B
|
|
249 lsra
|
|
250 lsra
|
|
251 lsra
|
|
252 lsra
|
|
253 bsr Outhex
|
|
254 tfr B,A
|
|
255 Outhex anda #$0F
|
|
256 cmpa #$0A 0 - 9
|
|
257 bcs Outdig
|
|
258 adda #$07 A - F
|
|
259 Outdig adda #'0 make ASCII
|
|
260
|
|
261 * Put character in A in buf
|
|
262 Print pshs X
|
|
263 ldx lineptr
|
|
264 sta ,X+
|
|
265 stx lineptr
|
|
266 puls X,PC
|
|
267
|
|
268 * Print 1 Decimal Digit in A
|
|
269 *
|
|
270 Outdecl tfr A,B number to B
|
|
271 clra
|
|
272
|
|
273 * Print 2 Decimal Digits in D
|
|
274 Outdec clr leadflag
|
|
275 pshs X
|
|
276 ldx umem
|
|
277 leax number,X
|
|
278 clr ,X
|
|
279 clr 1,X
|
|
280 clr 2,X
|
|
281 Hundred inc ,X
|
|
282 subd #100
|
|
283 bcc Hundred
|
|
284 addd #100
|
|
285 Ten inc 1,X
|
|
286 subd #10
|
|
287 bcc Ten
|
|
288 addd #10
|
|
289 incb
|
|
290 stb 2,X
|
|
291 bsr Printled
|
|
292 bsr Printled
|
|
293 bsr Printnum
|
|
294 bsr Space
|
|
295 puls X,PC
|
|
296
|
|
297 Printnum lda ,X+ get char
|
|
298 adda #'0-1 make ASCII
|
|
299 bra Print
|
|
300
|
|
301 Printled tst leadflag print leading zero?
|
|
302 bne Printnum yes
|
|
303 ldb ,X is it zero?
|
|
304 inc leadflag
|
|
305 decb
|
|
306 bne Printnum no, print zeros
|
|
307 clr leadflag
|
|
308 lda #C$SPAC
|
|
309 leax 1,X
|
|
310 bra Print
|
|
311
|
|
312 emod
|
|
313 Prgsiz equ *
|
|
314 end
|