Mercurial > hg > Members > kono > nitros9-code
annotate level1/cmds/attr.asm @ 827:6653afab1671
Made smaller, better!
author | boisy |
---|---|
date | Tue, 14 Jan 2003 02:58:01 +0000 |
parents | 1659ca4836e7 |
children | c6e6cf68e03e |
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 |
25 mod eom,name,tylg,atrv,start,size | |
26 | |
27 fpath rmb 1 | |
28 rawpath rmb 1 | |
29 parmptr rmb 2 | |
30 cmdperms rmb 2 | |
31 u0006 rmb 1 | |
32 u0007 rmb 1 | |
33 pathopts rmb 20 | |
34 u001C rmb 2 | |
35 u001E rmb 1 | |
36 u001F rmb 9 | |
37 u0028 rmb 32 | |
38 filename rmb 32 | |
39 fdesc rmb 16 | |
40 u0078 rmb 46 | |
41 u00A6 rmb 414 | |
42 size equ . | |
43 | |
44 name fcs /Attr/ | |
45 fcb edition | |
46 | |
47 L0012 fcb C$LF | |
48 fcc "Use: Attr <pathname> {[-]<opts>}" | |
49 fcb C$LF | |
50 fcc " opts: -d s r w e pr pw pe -a" | |
51 fcb C$CR | |
52 L0052 fcb C$LF | |
53 fcc "You do not own that file." | |
54 fcb C$CR | |
55 L006D fcb C$LF | |
56 fcc "Use Makdir to create a directory" | |
57 fcb C$CR | |
58 L008F fcb C$LF | |
59 fcc "ERROR; the directory is not empty" | |
60 fcb C$CR | |
61 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
|
62 fcb $FF |
0 | 63 |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
64 start stx <parmptr save param ptr |
0 | 65 clr <u0007 |
66 com <u0007 | |
67 clra | |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
68 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
|
69 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
|
70 ldx <parmptr get saved param ptr |
0 | 71 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
|
72 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
|
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 param ptr |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
75 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
|
76 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
|
77 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
|
78 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
|
79 stx <cmdperms save updated parm ptr |
0 | 80 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
|
81 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
|
82 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
|
83 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
|
84 clrb |
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
85 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
|
86 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
|
87 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
|
88 ldx <parmptr else get parm ptr |
0 | 89 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
|
90 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
|
91 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
|
92 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
|
93 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
|
94 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
|
95 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
|
96 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
|
97 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
|
98 bne L00FA branch if not |
226 | 99 L0106 lda #PENTIR |
0 | 100 ldb #C$SPAC |
101 std ,y++ | |
102 leax <filename,u point X to filename | |
103 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
|
104 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
|
105 L0114 lbcs L01AC branch if error |
0 | 106 sta <rawpath |
107 lda <fpath | |
108 clr <u001F,u | |
109 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
|
110 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
|
111 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
|
112 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
|
113 os9 I$Seek seek |
0 | 114 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
|
115 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
|
116 leax <fdesc,u point to buffer |
0 | 117 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
|
118 os9 I$Read |
0 | 119 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
|
120 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
|
121 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
|
122 beq L014B branch if so |
0 | 123 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
|
124 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
|
125 L014B ldx <cmdperms point to perms on cmd line |
0 | 126 lbsr L021D |
127 bcs L018B | |
128 L0152 lbsr L021D | |
129 bcc L0152 | |
130 clrb | |
131 lda ,x | |
226 | 132 cmpa #C$CR |
0 | 133 bne L01AC |
134 pshs u | |
135 ldx <u001C,u | |
136 ldu <u001E,u | |
137 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
|
138 os9 I$Seek seek |
0 | 139 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
|
140 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
|
141 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
|
142 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
|
143 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
|
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 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
|
146 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
|
147 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
|
148 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
|
149 bcs L01AC branch if error |
0 | 150 ldb <u0007 |
151 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
|
152 L018B ldb <fdesc,u get attribute |
0 | 153 leax >L00B2,pcr |
154 leay <u0078,u | |
155 lda ,x+ | |
156 L0197 lslb | |
157 bcs L019C | |
158 lda #'- | |
159 L019C sta ,y+ | |
160 lda ,x+ | |
161 bpl L0197 | |
162 lda #C$CR | |
163 sta ,y+ | |
164 leax <u0078,u | |
165 clrb | |
166 bra L01B0 | |
167 L01AC leax >L0012,pcr | |
168 L01B0 pshs b | |
169 lda #2 | |
170 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
|
171 os9 I$WritLn |
0 | 172 comb |
173 puls b | |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
174 L01BE os9 F$Exit |
0 | 175 L01C1 clrb |
176 leax >L0052,pcr | |
177 bra L01B0 | |
178 L01C8 leax >L006D,pcr | |
179 clrb | |
180 bra L01B0 | |
181 L01CF pshs u,y,x | |
182 lda <fpath | |
183 ldx #$0000 | |
226 | 184 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
|
185 os9 I$Seek |
0 | 186 ldu $04,s |
187 bcs L01BE | |
188 L01E0 leax <u0028,u | |
226 | 189 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
|
190 os9 I$Read |
0 | 191 bcs L01F7 |
192 tst ,x | |
193 beq L01E0 | |
194 leax >L008F,pcr | |
195 clrb | |
196 bra L01B0 | |
197 L01F7 puls u,y,x | |
226 | 198 cmpb #E$EOF |
0 | 199 bne L01AC |
200 rts | |
201 L01FE fdb $ff41 | |
202 fdb $ff80,$44ff,$4053,$ff01,$52ff,$0257,$ff04,$45ff | |
203 fdb $0850,$52ff,$1050,$57ff,$2050,$45ff | |
204 fcb $00 | |
205 L021D clr <u0006 | |
206 L021F lda ,x+ | |
207 cmpa #C$SPAC | |
208 beq L021F | |
209 cmpa #C$COMA | |
210 beq L021F | |
211 cmpa #'- | |
212 bne L0231 | |
213 com <u0006 | |
214 lda ,x+ | |
215 L0231 leax -1,x | |
216 leay >L01FE,pcr | |
217 L0237 ldb ,y+ | |
218 pshs y,x | |
219 beq L027F | |
220 L023D lda ,x+ | |
221 eora ,y+ | |
222 anda #$DF | |
223 beq L023D | |
224 lda -1,y | |
225 bmi L0251 | |
226 puls y,x | |
227 L024B lda ,y+ | |
228 bpl L024B | |
229 bra L0237 | |
230 L0251 lda ,-x | |
231 cmpa #$30 | |
232 bcc L027F | |
233 cmpb #$FF | |
234 beq L0278 | |
235 bitb #$80 | |
236 beq L0268 | |
237 tst <u0006 | |
238 lbeq L01C8 | |
239 lbsr L01CF | |
240 L0268 puls y,b,a | |
241 lda <fdesc,u | |
242 eora <u0006 | |
243 ora -$01,y | |
244 eora <u0006 | |
245 sta <fdesc,u | |
246 clrb | |
247 rts | |
248 L0278 eorb <u0006 | |
249 stb <u0007 | |
250 clrb | |
251 puls pc,y,b,a | |
252 L027F coma | |
253 puls pc,y,x | |
254 | |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
255 emod |
0 | 256 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
|
257 end |