Mercurial > hg > Members > kono > nitros9-code
annotate level1/cmds/deldir.asm @ 872:ad7443c6b53d
Fixed problem where dir wasn't being forked
author | boisy |
---|---|
date | Thu, 16 Jan 2003 21:18:13 +0000 |
parents | c6ebca55eed3 |
children | c155aac72190 |
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 " |
872 | 159 DIROPTL equ *-DIROPTS |
0 | 160 L0145 pshs u |
686 | 161 leau <buffer,u |
0 | 162 pshs u |
872 | 163 ldb #DIROPTL |
686 | 164 leax <DIROPTS,pcr |
0 | 165 lbsr L0270 |
686 | 166 ldx <parmptr |
0 | 167 ldd <u0046 |
168 decb | |
169 lbsr L0270 | |
170 lda #C$CR | |
171 L015E sta ,u+ | |
172 tfr u,d | |
173 subd ,s | |
174 tfr d,y | |
175 puls u | |
686 | 176 leax <DIR,pcr |
177 lda #Prgrm+Objct | |
0 | 178 clrb |
179 os9 F$Fork | |
180 puls u | |
181 bcs L013E | |
182 os9 F$Wait | |
183 L0178 rts | |
686 | 184 |
185 ReadKey leax <buffer,u | |
0 | 186 ldy #80 |
848
c6ebca55eed3
Dir now uses -e and -x and deldir changed accordingly
boisy
parents:
686
diff
changeset
|
187 clra |
0 | 188 os9 I$ReadLn |
189 bcs L01B8 | |
190 L0187 lda ,x+ | |
686 | 191 cmpa #C$SPAC eat spaces |
0 | 192 beq L0187 |
686 | 193 eora #'Y |
0 | 194 anda #$DF |
686 | 195 beq L01AD branch if Y |
0 | 196 lda ,-x |
686 | 197 eora #'L branch if L |
0 | 198 anda #$DF |
199 beq L01A9 | |
200 lda ,x | |
686 | 201 eora #'D branch if D |
0 | 202 anda #$DF |
203 beq L01A5 | |
204 bra L01B4 | |
205 L01A5 ldb #$01 | |
206 bra L01AF | |
207 L01A9 ldb #$02 | |
208 bra L01AF | |
209 L01AD ldb #$04 | |
686 | 210 L01AF stb <what2do |
0 | 211 clrb |
212 bra L01B8 | |
213 L01B4 ldb #$01 | |
214 orcc #Carry | |
215 L01B8 rts | |
686 | 216 DelDir fcc "DELDIR" |
0 | 217 fcb C$CR |
686 | 218 DotDot fcc ".." |
0 | 219 fcb C$CR |
686 | 220 L01C3 ldb <what2do |
0 | 221 bitb #$05 |
222 beq L0210 | |
686 | 223 lda <fpath |
0 | 224 pshs u |
686 | 225 ldu #64 |
0 | 226 L01D0 ldx #$0000 |
227 os9 I$Seek | |
228 puls u | |
229 L01D8 bsr L0215 | |
230 bcs L0209 | |
686 | 231 ldx <parmptr |
0 | 232 lda #READ.+WRITE. |
233 os9 I$ChgDir | |
234 bcs L0214 | |
235 ldy <u0048 | |
236 clrb | |
686 | 237 lda #Prgrm+Objct |
0 | 238 pshs u |
239 leau <u0024,u | |
686 | 240 leax <DelDir,pcr |
0 | 241 os9 F$Fork |
242 puls u | |
243 bcs L0214 | |
244 os9 F$Wait | |
245 bcs L0214 | |
686 | 246 leax <DotDot,pcr |
0 | 247 lda #READ.+WRITE. |
248 os9 I$ChgDir | |
249 bcc L01D8 | |
250 L0209 cmpb #E$EOF | |
251 bne L0214 | |
252 clrb | |
253 bra L0214 | |
254 L0210 ldb #$01 | |
255 orcc #Carry | |
256 L0214 rts | |
686 | 257 L0215 lda <fpath |
0 | 258 leax <u0024,u |
259 ldy #$0020 | |
260 os9 I$Read | |
261 bcs L0238 | |
262 lda ,x | |
263 beq L0215 | |
264 os9 F$PrsNam | |
265 lda -$01,y | |
266 anda #$7F | |
267 sta -$01,y | |
268 lda #C$CR | |
269 sta ,y | |
270 clra | |
271 incb | |
272 std <u0048 | |
273 L0238 rts | |
686 | 274 ATTR fcc "ATTR" |
0 | 275 fcb C$CR |
686 | 276 ATTROPTS fcc " -d" |
0 | 277 fcb C$CR |
872 | 278 ATTROPTL equ *-ATTROPTS |
0 | 279 L0242 pshs u |
686 | 280 leau <buffer,u |
0 | 281 pshs u |
282 ldd <u0046 | |
283 decb | |
686 | 284 ldx <parmptr |
0 | 285 bsr L0270 |
686 | 286 leax <ATTROPTS,pcr |
872 | 287 ldb #ATTROPTL |
0 | 288 bsr L0270 |
289 tfr u,d | |
290 subd ,s | |
291 tfr d,y | |
292 puls u | |
686 | 293 leax <ATTR,pcr |
0 | 294 clrb |
686 | 295 lda #Prgrm+Objct |
0 | 296 os9 F$Fork |
297 bcs L026D | |
298 os9 F$Wait | |
299 L026D puls u | |
300 rts | |
301 L0270 decb | |
302 lda ,x+ | |
303 sta ,u+ | |
304 tstb | |
305 bne L0270 | |
306 rts | |
307 | |
308 emod | |
309 eom equ * | |
310 end | |
311 |