Mercurial > hg > Members > kono > nitros9-code
annotate level1/cmds/mdir.asm @ 2514:7828af6e1b59
Adding startup.dw
author | boisy |
---|---|
date | Tue, 06 Apr 2010 13:09:10 +0000 |
parents | 4604b8d90bd5 |
children |
rev | line source |
---|---|
0 | 1 ******************************************************************** |
13 | 2 * Mdir - Show module directory |
0 | 3 * |
4 * $Id$ | |
5 * | |
1325
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
1277
diff
changeset
|
6 * Edt/Rev YYYY/MM/DD Modified by |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
1277
diff
changeset
|
7 * Comment |
0 | 8 * ------------------------------------------------------------------ |
1325
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
1277
diff
changeset
|
9 * 5 ????/??/?? |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
1277
diff
changeset
|
10 * |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
1277
diff
changeset
|
11 * 6 2003/01/14 Boisy G. Pitre |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
1277
diff
changeset
|
12 * Changed option to -e, optimized slightly. |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
1277
diff
changeset
|
13 * |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
1277
diff
changeset
|
14 * 7 2003/08/25 Rodney V. Hamilton |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
1277
diff
changeset
|
15 * Fixed leading zero supression, more optimizations. |
0 | 16 |
17 nam Mdir | |
13 | 18 ttl Show module directory |
0 | 19 |
13 | 20 * Disassembled 02/04/05 12:49:18 by Disasm v1.6 (C) 1988 by RML |
0 | 21 |
22 ifp1 | |
13 | 23 use defsfile |
0 | 24 endc |
13 | 25 |
0 | 26 tylg set Prgrm+Objct |
27 atrv set ReEnt+rev | |
1325
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
1277
diff
changeset
|
28 rev set $00 |
1277 | 29 edition set 7 |
92 | 30 stdout set 1 |
13 | 31 |
0 | 32 mod eom,name,tylg,atrv,start,size |
13 | 33 |
838 | 34 org 0 |
35 mdstart rmb 2 | |
36 mdend rmb 2 | |
37 parmptr rmb 2 | |
1277 | 38 zflag rmb 1 supress leading zeros flag |
92 | 39 bufptr rmb 1 |
0 | 40 u0008 rmb 1 |
838 | 41 datebuf rmb 3 |
42 timebuf rmb 3 | |
1277 | 43 u000F rmb 1 name field width |
44 u0010 rmb 1 last starting column | |
838 | 45 narrow rmb 1 |
1277 | 46 buffer rmb 80 |
47 rmb 450 stack & parameters | |
0 | 48 size equ . |
13 | 49 |
50 name fcs /Mdir/ | |
200
e9ce43cc215e
Made major changes to headers for consistency and identification
boisy
parents:
92
diff
changeset
|
51 fcb edition |
13 | 52 |
92 | 53 tophead fcb C$LF |
1277 | 54 fcs " Module directory at " |
92 | 55 ltitle fcb C$LF |
13 | 56 fcc "Addr Size Typ Rev Attr Use Module name" |
57 fcb C$LF | |
58 fcc "---- ---- --- --- ---- --- ------------" | |
59 fcb C$CR | |
838 | 60 stitle fcb C$LF |
13 | 61 fcc "Addr Size Ty Rv At Uc Name" |
62 fcb C$LF | |
63 fcc "---- ---- -- -- -- -- ---------" | |
64 fcb C$CR | |
65 | |
838 | 66 start stx <parmptr |
1277 | 67 clr <zflag |
838 | 68 clr <narrow assume wide output |
69 lda #stdout standard output | |
70 ldb #SS.ScSiz we need screen size | |
71 os9 I$GetStt get it | |
72 bcc L00D2 branch if we got it | |
73 cmpb #E$UnkSvc not a known service request error? | |
74 lbne Exit if not, exit | |
1791 | 75 bra Do80 |
838 | 76 L00D2 cmpx #80 80 columns? |
1791 | 77 blt Chk51 branch if less than |
78 Do80 ldd #$0C30 | |
79 bra SetSize | |
80 Chk51 cmpx #51 51 columns? | |
81 blt Do32 | |
82 Do51 ldd #$0C28 | |
83 bra SetSize | |
84 Do32 inc <narrow | |
838 | 85 ldd #$0A15 |
1791 | 86 SetSize |
13 | 87 std <u000F |
1791 | 88 leay >tophead,pcr |
1277 | 89 leax <buffer,u |
90 stx <bufptr | |
91 lbsr copySTR | |
838 | 92 leax datebuf,u |
0 | 93 os9 F$Time |
838 | 94 leax timebuf,u |
13 | 95 lbsr L0224 |
1277 | 96 lbsr writeBUF |
97 ldx >D.ModDir MUST use ext addr for page 0 | |
838 | 98 stx <mdstart |
13 | 99 ldd >D.ModDir+2 |
838 | 100 std <mdend |
1277 | 101 leax -MD$ESize,x |
92 | 102 * Check for 'E' given as argument |
838 | 103 ldy <parmptr |
104 ldd ,y+ | |
105 andb #$DF | |
106 cmpd #$2D45 -E ? | |
1277 | 107 bne L015D |
108 leax >ltitle,pcr | |
838 | 109 tst <narrow |
1277 | 110 beq L012B |
111 leax >stitle,pcr | |
838 | 112 L012B ldy #80 max. length to write |
113 lda #stdout | |
0 | 114 os9 I$WritLn |
838 | 115 ldx <mdstart |
1277 | 116 bra L01B9 |
117 loop ldy MD$MPtr,x | |
118 beq L015D skip if unused slot | |
119 ldd M$Name,y | |
0 | 120 leay d,y |
1277 | 121 lbsr copySTR |
122 L0141 lbsr outSP | |
0 | 123 ldb <u0008 |
13 | 124 subb #$12 |
125 cmpb <u0010 | |
126 bhi L0154 | |
127 L014C subb <u000F | |
128 bhi L014C | |
129 bne L0141 | |
130 bra L015D | |
1277 | 131 L0154 lbsr writeBUF |
132 L015D leax MD$ESize,x | |
838 | 133 cmpx <mdend |
92 | 134 bcs loop |
1277 | 135 lbsr writeBUF |
838 | 136 bra ExitOk |
92 | 137 * |
838 | 138 * A module entry is 2 two byte pointers. |
92 | 139 * If the first pointer is $0000, then the slot is unused |
1277 | 140 L0168 ldy MD$MPtr,x ptr=0? |
141 beq gotonxt yes, skip unused slot | |
142 ldd MD$MPtr,x address (faster than tfr) | |
143 bsr out4HS | |
144 ldd M$Size,y size | |
145 bsr out4HS | |
838 | 146 tst <narrow |
13 | 147 bne L0181 |
1277 | 148 bsr outSP |
149 L0181 lda M$Type,y type/lang | |
150 bsr out2HS | |
838 | 151 tst <narrow |
13 | 152 bne L018B |
1277 | 153 bsr outSP |
154 L018B lda M$Revs,y revision | |
155 anda #RevsMask | |
156 bsr out2HS | |
157 ldb M$Revs,y attributes | |
158 lda #'r | |
159 bsr L01FE bit 7 (ReEnt) | |
838 | 160 tst <narrow |
13 | 161 bne L01A7 |
1277 | 162 lda #'w bit 6 (ModProt:1=writable) |
13 | 163 bsr L01FE |
1277 | 164 lda #'3 bit 5 (ModNat:6309 Native mode) |
13 | 165 bsr L01FE |
1277 | 166 lda #'? bit 4 undefined |
13 | 167 bsr L01FE |
1277 | 168 L01A7 bsr outSP |
169 bsr outSP | |
170 lda MD$Link,x user count | |
171 bsr out2HS | |
172 ldd M$Name,y | |
173 leay d,y module name | |
174 bsr copySTR | |
175 bsr writeBUF | |
176 gotonxt leax MD$ESize,x | |
838 | 177 L01B9 cmpx <mdend |
13 | 178 bcs L0168 |
92 | 179 |
838 | 180 ExitOk clrb |
181 Exit os9 F$Exit | |
92 | 182 |
1277 | 183 out4HS inc <zflag supress leading zeros |
184 inc <zflag | |
185 bsr Byt2Hex | |
186 dec <zflag | |
0 | 187 tfr b,a |
1277 | 188 out2HS bsr Byt2Hex |
189 bra outSP | |
838 | 190 |
1277 | 191 Byt2Hex inc <zflag supress leading zero |
192 pshs a | |
0 | 193 lsra |
194 lsra | |
195 lsra | |
196 lsra | |
13 | 197 bsr L01DB |
1277 | 198 puls a |
199 anda #$0F is this a zero? | |
200 L01DB bne L01E8 no, print it | |
201 tst <zflag still supressing zeros? | |
202 bgt outZSP yes, count it and print space | |
203 L01E8 clr <zflag nonzero, print all the rest | |
204 adda #'0 | |
92 | 205 cmpa #'9 |
206 bls ApndA | |
1277 | 207 adda #$07 Make it A-F |
92 | 208 bra ApndA |
1277 | 209 |
210 outZSP dec <zflag countdown to last digit | |
1747 | 211 outSP lda #C$SPAC append a space |
92 | 212 * |
213 * append a char (in reg a) to buffer | |
214 * | |
215 ApndA pshs x | |
216 ldx <bufptr | |
0 | 217 sta ,x+ |
92 | 218 stx <bufptr |
0 | 219 puls pc,x |
1277 | 220 * |
221 * process attribute flag bit | |
222 * | |
13 | 223 L01FE rolb |
92 | 224 bcs ApndA |
225 lda #'. | |
226 bra ApndA | |
1277 | 227 * |
228 * Copy an FCS string to buffer | |
229 * | |
230 copySTR lda ,y | |
0 | 231 anda #$7F |
92 | 232 bsr ApndA |
0 | 233 lda ,y+ |
1277 | 234 bpl copySTR |
0 | 235 rts |
92 | 236 * |
237 * Append a CR to buffer and write it | |
238 * | |
1277 | 239 writeBUF pshs y,x,a |
92 | 240 lda #C$CR |
241 bsr ApndA | |
242 leax <buffer,u | |
1277 | 243 stx <bufptr |
13 | 244 ldy #80 |
92 | 245 lda #stdout |
0 | 246 os9 I$WritLn |
247 puls pc,y,x,a | |
92 | 248 |
1277 | 249 * Write the time to the buffer as HH:MM:SS |
838 | 250 L0224 bsr Byt2ASC |
251 bsr Colon | |
252 Colon lda #': | |
92 | 253 bsr ApndA |
838 | 254 Byt2ASC ldb ,x+ |
1277 | 255 Hundreds subb #100 |
838 | 256 bcc Hundreds |
1277 | 257 * code to print 100's digit removed - max timefield value is 59 |
258 Tens lda #'9+1 | |
259 TensLoop deca | |
838 | 260 addb #10 |
261 bcc TensLoop | |
92 | 262 bsr ApndA |
0 | 263 tfr b,a |
92 | 264 adda #'0 |
265 bra ApndA | |
13 | 266 |
0 | 267 emod |
268 eom equ * | |
13 | 269 end |