Mercurial > hg > Members > kono > nitros9-code
annotate level1/cmds/attr.asm @ 851:16b8c7dc0082
Made source comment improvements
author | boisy |
---|---|
date | Wed, 15 Jan 2003 00:56:21 +0000 |
parents | c6e6cf68e03e |
children | c70da2076f02 |
rev | line source |
---|---|
0 | 1 ******************************************************************** |
2 * Attr - Modify file attributes | |
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:
187
diff
changeset
|
8 * 11 From Tandy OS-9 Level Two VR 02.00.01 |
0 | 9 |
10 nam Attr | |
11 ttl Modify file attributes | |
12 | |
13 * Disassembled 98/09/11 11:44:51 by Disasm v1.6 (C) 1988 by RML | |
14 | |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
15 ifp1 |
0 | 16 use defsfile |
17 use rbfdefs | |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
18 endc |
0 | 19 |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
20 tylg set Prgrm+Objct |
0 | 21 atrv set ReEnt+rev |
22 rev set $01 | |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
23 edition set 11 |
0 | 24 |
846 | 25 DOHELP set 1 |
26 | |
0 | 27 mod eom,name,tylg,atrv,start,size |
28 | |
29 fpath rmb 1 | |
30 rawpath rmb 1 | |
31 parmptr rmb 2 | |
32 cmdperms rmb 2 | |
33 u0006 rmb 1 | |
34 u0007 rmb 1 | |
35 pathopts rmb 20 | |
36 u001C rmb 2 | |
37 u001E rmb 1 | |
38 u001F rmb 9 | |
39 u0028 rmb 32 | |
40 filename rmb 32 | |
41 fdesc rmb 16 | |
42 u0078 rmb 46 | |
43 u00A6 rmb 414 | |
44 size equ . | |
45 | |
46 name fcs /Attr/ | |
47 fcb edition | |
48 | |
846 | 49 IFNE DOHELP |
50 HelpMsg fcb C$LF | |
0 | 51 fcc "Use: Attr <pathname> {[-]<opts>}" |
52 fcb C$LF | |
53 fcc " opts: -d s r w e pr pw pe -a" | |
54 fcb C$CR | |
846 | 55 ENDC |
0 | 56 L0052 fcb C$LF |
57 fcc "You do not own that file." | |
58 fcb C$CR | |
59 L006D fcb C$LF | |
60 fcc "Use Makdir to create a directory" | |
61 fcb C$CR | |
62 L008F fcb C$LF | |
63 fcc "ERROR; the directory is not empty" | |
64 fcb C$CR | |
65 L00B2 fcc "dsewrewr" | |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
66 fcb $FF |
0 | 67 |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
68 start stx <parmptr save param ptr |
0 | 69 clr <u0007 |
70 com <u0007 | |
71 clra | |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
72 os9 I$Open open file on commandline |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
73 bcc L00D9 branch if ok |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
74 ldx <parmptr get saved param ptr |
0 | 75 lda #DIR.!READ. load perms |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
76 os9 I$Open open as directory |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
77 bcc L00D9 branch if ok |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
78 ldx <parmptr get param ptr |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
79 lda #DIR. load different perms |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
80 os9 I$Open try one more time |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
81 bcs L0114 branch if error |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
82 L00D9 sta <fpath save off path |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
83 stx <cmdperms save updated parm ptr |
0 | 84 leax pathopts,u point X to buffer |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
85 ldb #SS.Opt load with status code |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
86 os9 I$GetStt get status |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
87 bcs L0114 branch if error |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
88 clrb |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
89 lda ,x get path type |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
90 cmpa #DT.RBF check if rbf path |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
91 lbne L01AC branch if not |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
92 ldx <parmptr else get parm ptr |
0 | 93 leay <filename,u point to buffer |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
94 lda ,x+ get file name character |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
95 cmpa #PDELIM path delimiter? |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
96 bne L0106 no |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
97 L00FA sta ,y+ else save char in Y |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
98 lda ,x+ get next file name char |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
99 cmpa #C$PERD period? |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
100 bcs L0106 branch if not |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
101 cmpa #PDELIM path delimiter? |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
102 bne L00FA branch if not |
226 | 103 L0106 lda #PENTIR |
0 | 104 ldb #C$SPAC |
105 std ,y++ | |
106 leax <filename,u point X to filename | |
107 lda #READ.!WRITE. load perms | |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
108 os9 I$Open open in raw mode |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
109 L0114 lbcs L01AC branch if error |
0 | 110 sta <rawpath |
111 lda <fpath | |
112 clr <u001F,u | |
113 pshs u | |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
114 ldx <u001C,u get MS 16 bits |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
115 ldu <u001E,u get LS 16 bits |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
116 lda <rawpath get path |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
117 os9 I$Seek seek |
0 | 118 puls u |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
119 bcs L01AC branch if error |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
120 leax <fdesc,u point to buffer |
0 | 121 ldy #FD.SEG |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
122 os9 I$Read |
0 | 123 bcs L01AC |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
124 os9 F$ID get ID |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
125 cmpy #$0000 super user? |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
126 beq L014B branch if so |
0 | 127 cmpy <fdesc+FD.OWN,u is user same as file's owner? |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
128 bne L01C1 branch if not |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
129 L014B ldx <cmdperms point to perms on cmd line |
0 | 130 lbsr L021D |
131 bcs L018B | |
132 L0152 lbsr L021D | |
133 bcc L0152 | |
134 clrb | |
135 lda ,x | |
226 | 136 cmpa #C$CR |
0 | 137 bne L01AC |
138 pshs u | |
139 ldx <u001C,u | |
140 ldu <u001E,u | |
141 lda <rawpath | |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
142 os9 I$Seek seek |
0 | 143 puls u |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
144 bcs L01AC branch if error |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
145 leax <fdesc,u point to file desc |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
146 ldy #1 only 1 byte |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
147 os9 I$Write write out new attributes |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
148 bcs L01AC branch if error |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
149 os9 I$Close close file |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
150 bcs L01AC branch if error |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
151 lda <fpath get file path |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
152 os9 I$Close close file |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
153 bcs L01AC branch if error |
0 | 154 ldb <u0007 |
155 beq L01BE | |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
156 L018B ldb <fdesc,u get attribute |
0 | 157 leax >L00B2,pcr |
158 leay <u0078,u | |
159 lda ,x+ | |
160 L0197 lslb | |
161 bcs L019C | |
162 lda #'- | |
163 L019C sta ,y+ | |
164 lda ,x+ | |
165 bpl L0197 | |
166 lda #C$CR | |
167 sta ,y+ | |
168 leax <u0078,u | |
169 clrb | |
170 bra L01B0 | |
846 | 171 IFNE DOHELP |
172 L01AC leax >HelpMsg,pcr | |
173 ENDC | |
0 | 174 L01B0 pshs b |
175 lda #2 | |
176 ldy #256 | |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
177 os9 I$WritLn |
0 | 178 comb |
179 puls b | |
846 | 180 IFEQ DOHELP |
181 L01AC equ * | |
182 ENDC | |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
183 L01BE os9 F$Exit |
0 | 184 L01C1 clrb |
185 leax >L0052,pcr | |
186 bra L01B0 | |
187 L01C8 leax >L006D,pcr | |
188 clrb | |
189 bra L01B0 | |
190 L01CF pshs u,y,x | |
191 lda <fpath | |
192 ldx #$0000 | |
226 | 193 ldu #DIR.SZ*2 |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
194 os9 I$Seek |
0 | 195 ldu $04,s |
196 bcs L01BE | |
197 L01E0 leax <u0028,u | |
226 | 198 ldy #DIR.SZ |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
199 os9 I$Read |
0 | 200 bcs L01F7 |
201 tst ,x | |
202 beq L01E0 | |
203 leax >L008F,pcr | |
204 clrb | |
205 bra L01B0 | |
206 L01F7 puls u,y,x | |
226 | 207 cmpb #E$EOF |
0 | 208 bne L01AC |
209 rts | |
210 L01FE fdb $ff41 | |
211 fdb $ff80,$44ff,$4053,$ff01,$52ff,$0257,$ff04,$45ff | |
212 fdb $0850,$52ff,$1050,$57ff,$2050,$45ff | |
213 fcb $00 | |
214 L021D clr <u0006 | |
215 L021F lda ,x+ | |
216 cmpa #C$SPAC | |
217 beq L021F | |
218 cmpa #C$COMA | |
219 beq L021F | |
220 cmpa #'- | |
221 bne L0231 | |
222 com <u0006 | |
223 lda ,x+ | |
224 L0231 leax -1,x | |
225 leay >L01FE,pcr | |
226 L0237 ldb ,y+ | |
227 pshs y,x | |
228 beq L027F | |
229 L023D lda ,x+ | |
230 eora ,y+ | |
231 anda #$DF | |
232 beq L023D | |
233 lda -1,y | |
234 bmi L0251 | |
235 puls y,x | |
236 L024B lda ,y+ | |
237 bpl L024B | |
238 bra L0237 | |
239 L0251 lda ,-x | |
240 cmpa #$30 | |
241 bcc L027F | |
242 cmpb #$FF | |
243 beq L0278 | |
244 bitb #$80 | |
245 beq L0268 | |
246 tst <u0006 | |
247 lbeq L01C8 | |
248 lbsr L01CF | |
249 L0268 puls y,b,a | |
250 lda <fdesc,u | |
251 eora <u0006 | |
252 ora -$01,y | |
253 eora <u0006 | |
254 sta <fdesc,u | |
255 clrb | |
256 rts | |
257 L0278 eorb <u0006 | |
258 stb <u0007 | |
259 clrb | |
260 puls pc,y,b,a | |
261 L027F coma | |
262 puls pc,y,x | |
263 | |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
264 emod |
0 | 265 eom equ * |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
266 end |