Mercurial > hg > Members > kono > nitros9-code
annotate level1/cmds/deldir.asm @ 860:35aca42e87ce
Added better comments
author | boisy |
---|---|
date | Thu, 16 Jan 2003 03:06:50 +0000 |
parents | c6ebca55eed3 |
children | ad7443c6b53d |
rev | line source |
---|---|
0 | 1 ******************************************************************** |
2 * Deldir - Delete a directory | |
3 * | |
4 * $Id$ | |
5 * | |
6 * Ed. Comments Who YY/MM/DD | |
7 * ------------------------------------------------------------------ | |
200
e9ce43cc215e
Made major changes to headers for consistency and identification
boisy
parents:
0
diff
changeset
|
8 * 3 From Tandy OS-9 Level Two VR 02.00.01 |
848
c6ebca55eed3
Dir now uses -e and -x and deldir changed accordingly
boisy
parents:
686
diff
changeset
|
9 * 4 Updated to add -e instead of e to dir BGP 03/01/14 |
0 | 10 |
11 nam Deldir | |
12 ttl Delete a directory | |
13 | |
14 * Disassembled 98/09/10 23:18:11 by Disasm v1.6 (C) 1988 by RML | |
15 | |
16 ifp1 | |
17 use defsfile | |
18 endc | |
19 | |
20 tylg set Prgrm+Objct | |
21 atrv set ReEnt+rev | |
22 rev set $01 | |
848
c6ebca55eed3
Dir now uses -e and -x and deldir changed accordingly
boisy
parents:
686
diff
changeset
|
23 edition set 4 |
0 | 24 |
25 mod eom,name,tylg,atrv,start,size | |
26 | |
686 | 27 parmptr rmb 2 |
28 fpath rmb 1 | |
29 what2do rmb 1 | |
30 stats rmb 24 | |
0 | 31 u001C rmb 4 |
32 u0020 rmb 4 | |
33 u0024 rmb 10 | |
34 u002E rmb 6 | |
35 u0034 rmb 15 | |
36 u0043 rmb 1 | |
37 u0044 rmb 1 | |
38 u0045 rmb 1 | |
39 u0046 rmb 2 | |
40 u0048 rmb 2 | |
686 | 41 buffer rmb 336 |
0 | 42 size equ . |
43 | |
44 name fcs /Deldir/ | |
45 fcb edition | |
46 | |
686 | 47 start bsr OpenPath |
48 bcs OpenErr | |
49 bsr GetOpts | |
0 | 50 bcc L002B |
686 | 51 lbsr PromptUser |
52 bcs OpenErr | |
0 | 53 lbsr L01C3 |
686 | 54 bcs OpenErr |
0 | 55 lbsr L0242 |
686 | 56 bcs OpenErr |
57 L002B lda <fpath | |
0 | 58 os9 I$Close |
59 bcs L004D | |
686 | 60 ldx <parmptr |
0 | 61 os9 I$Delete |
62 bcs L004D | |
63 lda ,x | |
64 cmpa #C$CR | |
65 bne start | |
66 clrb | |
67 bra L004D | |
686 | 68 OpenErr pshs b |
69 lda <fpath | |
0 | 70 os9 I$Close |
71 puls b | |
72 orcc #Carry | |
73 L004D os9 F$Exit | |
686 | 74 |
75 | |
76 OpenPath stx <parmptr save parameter pointer | |
0 | 77 lda #READ.+WRITE. |
78 os9 I$Open | |
79 bcs L005D | |
686 | 80 sta <fpath |
0 | 81 bra L0089 |
686 | 82 L005D ldx <parmptr |
0 | 83 lda #DIR.+READ. |
84 os9 I$Open | |
85 bcs L0090 | |
686 | 86 sta <fpath |
87 L0068 ldx <parmptr | |
0 | 88 os9 F$PrsNam |
89 clra | |
90 incb | |
91 std <u0046 | |
92 lda ,y | |
93 cmpa #PDELIM | |
94 bne L0089 | |
95 lda #C$CR | |
96 sta ,y+ | |
97 lda #READ.+WRITE. | |
686 | 98 ldx <parmptr |
0 | 99 os9 I$ChgDir |
100 bcs L0090 | |
686 | 101 sty <parmptr |
0 | 102 bra L0068 |
103 L0089 leax <-u001C,u | |
104 stx <u0044 | |
686 | 105 clr <what2do |
0 | 106 L0090 rts |
686 | 107 |
108 GetOpts lda <fpath | |
0 | 109 ldb #SS.OPT |
686 | 110 leax stats,u |
0 | 111 os9 I$GetStt |
112 bcs L00AB | |
113 ldx <u0044 | |
114 lda <$33,x | |
115 anda #$80 | |
116 beq L00AA | |
117 clrb | |
118 orcc #Carry | |
119 bra L00AB | |
120 L00AA clrb | |
121 L00AB rts | |
686 | 122 |
123 Prompt fcb C$LF | |
0 | 124 fcc "Deleting directory file. " |
125 fcb C$LF | |
126 fcc "List directory, delete directory, or quit ? (l/d/q) " | |
848
c6ebca55eed3
Dir now uses -e and -x and deldir changed accordingly
boisy
parents:
686
diff
changeset
|
127 PromptL equ *-Prompt |
686 | 128 Cont fcb C$LF |
0 | 129 fcc "Continue? (y/n) " |
848
c6ebca55eed3
Dir now uses -e and -x and deldir changed accordingly
boisy
parents:
686
diff
changeset
|
130 ContL equ *-Cont |
686 | 131 |
132 PromptUser | |
133 tstb | |
0 | 134 bne L013E |
135 lda #$01 | |
686 | 136 leax <Prompt,pcr |
848
c6ebca55eed3
Dir now uses -e and -x and deldir changed accordingly
boisy
parents:
686
diff
changeset
|
137 ldy #PromptL |
0 | 138 os9 I$WritLn |
139 L011B bcs L013E | |
686 | 140 bsr ReadKey |
0 | 141 bcs L013E |
686 | 142 ldb <what2do |
0 | 143 cmpb #$01 |
144 bne L012A | |
145 clrb | |
146 bra L013E | |
147 L012A bsr L0145 | |
148 L012C bcs L013E | |
686 | 149 leax <Cont,pcr |
848
c6ebca55eed3
Dir now uses -e and -x and deldir changed accordingly
boisy
parents:
686
diff
changeset
|
150 ldy #ContL |
0 | 151 lda #$01 |
152 os9 I$WritLn | |
153 bcs L013E | |
686 | 154 bsr ReadKey |
0 | 155 L013E rts |
686 | 156 DIR fcc "DIR" |
0 | 157 fcb C$CR |
848
c6ebca55eed3
Dir now uses -e and -x and deldir changed accordingly
boisy
parents:
686
diff
changeset
|
158 DIROPTS fcc "-E " |
0 | 159 L0145 pshs u |
686 | 160 leau <buffer,u |
0 | 161 pshs u |
162 ldb #$02 | |
686 | 163 leax <DIROPTS,pcr |
0 | 164 lbsr L0270 |
686 | 165 ldx <parmptr |
0 | 166 ldd <u0046 |
167 decb | |
168 lbsr L0270 | |
169 lda #C$CR | |
170 L015E sta ,u+ | |
171 tfr u,d | |
172 subd ,s | |
173 tfr d,y | |
174 puls u | |
686 | 175 leax <DIR,pcr |
176 lda #Prgrm+Objct | |
0 | 177 clrb |
178 os9 F$Fork | |
179 puls u | |
180 bcs L013E | |
181 os9 F$Wait | |
182 L0178 rts | |
686 | 183 |
184 ReadKey leax <buffer,u | |
0 | 185 ldy #80 |
848
c6ebca55eed3
Dir now uses -e and -x and deldir changed accordingly
boisy
parents:
686
diff
changeset
|
186 clra |
0 | 187 os9 I$ReadLn |
188 bcs L01B8 | |
189 L0187 lda ,x+ | |
686 | 190 cmpa #C$SPAC eat spaces |
0 | 191 beq L0187 |
686 | 192 eora #'Y |
0 | 193 anda #$DF |
686 | 194 beq L01AD branch if Y |
0 | 195 lda ,-x |
686 | 196 eora #'L branch if L |
0 | 197 anda #$DF |
198 beq L01A9 | |
199 lda ,x | |
686 | 200 eora #'D branch if D |
0 | 201 anda #$DF |
202 beq L01A5 | |
203 bra L01B4 | |
204 L01A5 ldb #$01 | |
205 bra L01AF | |
206 L01A9 ldb #$02 | |
207 bra L01AF | |
208 L01AD ldb #$04 | |
686 | 209 L01AF stb <what2do |
0 | 210 clrb |
211 bra L01B8 | |
212 L01B4 ldb #$01 | |
213 orcc #Carry | |
214 L01B8 rts | |
686 | 215 DelDir fcc "DELDIR" |
0 | 216 fcb C$CR |
686 | 217 DotDot fcc ".." |
0 | 218 fcb C$CR |
686 | 219 L01C3 ldb <what2do |
0 | 220 bitb #$05 |
221 beq L0210 | |
686 | 222 lda <fpath |
0 | 223 pshs u |
686 | 224 ldu #64 |
0 | 225 L01D0 ldx #$0000 |
226 os9 I$Seek | |
227 puls u | |
228 L01D8 bsr L0215 | |
229 bcs L0209 | |
686 | 230 ldx <parmptr |
0 | 231 lda #READ.+WRITE. |
232 os9 I$ChgDir | |
233 bcs L0214 | |
234 ldy <u0048 | |
235 clrb | |
686 | 236 lda #Prgrm+Objct |
0 | 237 pshs u |
238 leau <u0024,u | |
686 | 239 leax <DelDir,pcr |
0 | 240 os9 F$Fork |
241 puls u | |
242 bcs L0214 | |
243 os9 F$Wait | |
244 bcs L0214 | |
686 | 245 leax <DotDot,pcr |
0 | 246 lda #READ.+WRITE. |
247 os9 I$ChgDir | |
248 bcc L01D8 | |
249 L0209 cmpb #E$EOF | |
250 bne L0214 | |
251 clrb | |
252 bra L0214 | |
253 L0210 ldb #$01 | |
254 orcc #Carry | |
255 L0214 rts | |
686 | 256 L0215 lda <fpath |
0 | 257 leax <u0024,u |
258 ldy #$0020 | |
259 os9 I$Read | |
260 bcs L0238 | |
261 lda ,x | |
262 beq L0215 | |
263 os9 F$PrsNam | |
264 lda -$01,y | |
265 anda #$7F | |
266 sta -$01,y | |
267 lda #C$CR | |
268 sta ,y | |
269 clra | |
270 incb | |
271 std <u0048 | |
272 L0238 rts | |
686 | 273 ATTR fcc "ATTR" |
0 | 274 fcb C$CR |
686 | 275 ATTROPTS fcc " -d" |
0 | 276 fcb C$CR |
277 L0242 pshs u | |
686 | 278 leau <buffer,u |
0 | 279 pshs u |
280 ldd <u0046 | |
281 decb | |
686 | 282 ldx <parmptr |
0 | 283 bsr L0270 |
686 | 284 leax <ATTROPTS,pcr |
0 | 285 ldb #$04 |
286 bsr L0270 | |
287 tfr u,d | |
288 subd ,s | |
289 tfr d,y | |
290 puls u | |
686 | 291 leax <ATTR,pcr |
0 | 292 clrb |
686 | 293 lda #Prgrm+Objct |
0 | 294 os9 F$Fork |
295 bcs L026D | |
296 os9 F$Wait | |
297 L026D puls u | |
298 rts | |
299 L0270 decb | |
300 lda ,x+ | |
301 sta ,u+ | |
302 tstb | |
303 bne L0270 | |
304 rts | |
305 | |
306 emod | |
307 eom equ * | |
308 end | |
309 |