Mercurial > hg > Members > kono > nitros9-code
annotate level1/cmds/attr.asm @ 1211:f54f04a78c54
Rodney Hamilton fixes
author | boisy |
---|---|
date | Mon, 23 Jun 2003 17:45:27 +0000 |
parents | 617c1b90e623 |
children | 84ea83668304 |
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 |
921
617c1b90e623
Added DOHELP conditionals, set all to zero to eliminate help from commands
boisy
parents:
873
diff
changeset
|
20 DOHELP set 0 |
617c1b90e623
Added DOHELP conditionals, set all to zero to eliminate help from commands
boisy
parents:
873
diff
changeset
|
21 |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
22 tylg set Prgrm+Objct |
0 | 23 atrv set ReEnt+rev |
24 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
|
25 edition set 11 |
0 | 26 |
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 |
873 | 56 NotOwner fcb C$LF |
0 | 57 fcc "You do not own that file." |
58 fcb C$CR | |
873 | 59 UseMkDir fcb C$LF |
0 | 60 fcc "Use Makdir to create a directory" |
61 fcb C$CR | |
873 | 62 DirNtEmt fcb C$LF |
0 | 63 fcc "ERROR; the directory is not empty" |
64 fcb C$CR | |
873 | 65 Attrs 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 |
873 | 68 start stx <parmptr save param ptr |
0 | 69 clr <u0007 |
70 com <u0007 | |
873 | 71 * Open file at X as file |
0 | 72 clra |
873 | 73 os9 I$Open open file on commandline |
74 bcc L00D9 branch if ok | |
75 * If error, try to open as directory with read permission | |
76 ldx <parmptr get saved param ptr | |
77 lda #DIR.!READ. load perms | |
78 os9 I$Open open as directory | |
79 bcc L00D9 branch if ok | |
80 * One last time, try open as directory only | |
81 ldx <parmptr get param ptr | |
82 lda #DIR. load different perms | |
83 os9 I$Open try one more time | |
84 bcs L0114 branch if error | |
85 L00D9 sta <fpath save off path | |
86 stx <cmdperms save updated parm ptr | |
87 leax pathopts,u point X to buffer | |
88 ldb #SS.Opt load with status code | |
89 os9 I$GetStt get status | |
90 bcs L0114 branch if error | |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
91 clrb |
873 | 92 lda ,x get path type |
93 cmpa #DT.RBF check if rbf path | |
94 lbne ShowHelp branch if not | |
95 ldx <parmptr else get parm ptr | |
0 | 96 leay <filename,u point to buffer |
873 | 97 lda ,x+ get file name character |
98 cmpa #PDELIM path delimiter? | |
99 bne L0106 no | |
100 L00FA sta ,y+ else save char in Y | |
101 lda ,x+ get next file name char | |
102 cmpa #C$PERD period? | |
103 bcs L0106 branch if not | |
104 cmpa #PDELIM path delimiter? | |
105 bne L00FA branch if not | |
226 | 106 L0106 lda #PENTIR |
0 | 107 ldb #C$SPAC |
108 std ,y++ | |
873 | 109 leax <filename,u point X to filename |
110 lda #READ.!WRITE. load perms | |
111 os9 I$Open open in raw mode | |
112 L0114 lbcs ShowHelp branch if error | |
0 | 113 sta <rawpath |
114 lda <fpath | |
115 clr <u001F,u | |
116 pshs u | |
873 | 117 ldx <u001C,u get MS 16 bits |
118 ldu <u001E,u get LS 16 bits | |
119 lda <rawpath get path | |
120 os9 I$Seek seek | |
0 | 121 puls u |
873 | 122 bcs ShowHelp branch if error |
123 leax <fdesc,u point to buffer | |
0 | 124 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
|
125 os9 I$Read |
873 | 126 bcs ShowHelp |
127 os9 F$ID get ID | |
128 cmpy #$0000 super user? | |
129 beq L014B branch if so | |
130 cmpy <fdesc+FD.OWN,u is user same as file's owner? | |
131 bne L01C1 branch if not | |
132 L014B ldx <cmdperms point to perms on cmd line | |
0 | 133 lbsr L021D |
134 bcs L018B | |
135 L0152 lbsr L021D | |
136 bcc L0152 | |
137 clrb | |
138 lda ,x | |
226 | 139 cmpa #C$CR |
873 | 140 bne ShowHelp |
0 | 141 pshs u |
142 ldx <u001C,u | |
143 ldu <u001E,u | |
144 lda <rawpath | |
873 | 145 os9 I$Seek seek |
0 | 146 puls u |
873 | 147 bcs ShowHelp branch if error |
148 leax <fdesc,u point to file desc | |
149 ldy #1 only 1 byte | |
150 os9 I$Write write out new attributes | |
151 bcs ShowHelp branch if error | |
152 os9 I$Close close file | |
153 bcs ShowHelp branch if error | |
154 lda <fpath get file path | |
155 os9 I$Close close file | |
156 bcs ShowHelp branch if error | |
0 | 157 ldb <u0007 |
158 beq L01BE | |
873 | 159 L018B ldb <fdesc,u get attribute |
160 leax >Attrs,pcr | |
0 | 161 leay <u0078,u |
162 lda ,x+ | |
163 L0197 lslb | |
164 bcs L019C | |
165 lda #'- | |
166 L019C sta ,y+ | |
167 lda ,x+ | |
168 bpl L0197 | |
169 lda #C$CR | |
170 sta ,y+ | |
171 leax <u0078,u | |
172 clrb | |
173 bra L01B0 | |
921
617c1b90e623
Added DOHELP conditionals, set all to zero to eliminate help from commands
boisy
parents:
873
diff
changeset
|
174 ShowHelp equ * |
846 | 175 IFNE DOHELP |
921
617c1b90e623
Added DOHELP conditionals, set all to zero to eliminate help from commands
boisy
parents:
873
diff
changeset
|
176 leax >HelpMsg,pcr |
617c1b90e623
Added DOHELP conditionals, set all to zero to eliminate help from commands
boisy
parents:
873
diff
changeset
|
177 ELSE |
617c1b90e623
Added DOHELP conditionals, set all to zero to eliminate help from commands
boisy
parents:
873
diff
changeset
|
178 clrb |
617c1b90e623
Added DOHELP conditionals, set all to zero to eliminate help from commands
boisy
parents:
873
diff
changeset
|
179 bra L01BE |
846 | 180 ENDC |
0 | 181 L01B0 pshs b |
182 lda #2 | |
183 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
|
184 os9 I$WritLn |
0 | 185 comb |
186 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
|
187 L01BE os9 F$Exit |
0 | 188 L01C1 clrb |
873 | 189 leax >NotOwner,pcr |
0 | 190 bra L01B0 |
873 | 191 L01C8 leax >UseMkDir,pcr |
0 | 192 clrb |
193 bra L01B0 | |
194 L01CF pshs u,y,x | |
195 lda <fpath | |
196 ldx #$0000 | |
226 | 197 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
|
198 os9 I$Seek |
0 | 199 ldu $04,s |
200 bcs L01BE | |
201 L01E0 leax <u0028,u | |
226 | 202 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
|
203 os9 I$Read |
0 | 204 bcs L01F7 |
205 tst ,x | |
206 beq L01E0 | |
873 | 207 leax >DirNtEmt,pcr |
0 | 208 clrb |
209 bra L01B0 | |
210 L01F7 puls u,y,x | |
226 | 211 cmpb #E$EOF |
873 | 212 bne ShowHelp |
0 | 213 rts |
214 L01FE fdb $ff41 | |
215 fdb $ff80,$44ff,$4053,$ff01,$52ff,$0257,$ff04,$45ff | |
216 fdb $0850,$52ff,$1050,$57ff,$2050,$45ff | |
217 fcb $00 | |
218 L021D clr <u0006 | |
219 L021F lda ,x+ | |
220 cmpa #C$SPAC | |
221 beq L021F | |
222 cmpa #C$COMA | |
223 beq L021F | |
224 cmpa #'- | |
225 bne L0231 | |
226 com <u0006 | |
227 lda ,x+ | |
228 L0231 leax -1,x | |
229 leay >L01FE,pcr | |
230 L0237 ldb ,y+ | |
231 pshs y,x | |
232 beq L027F | |
233 L023D lda ,x+ | |
234 eora ,y+ | |
235 anda #$DF | |
236 beq L023D | |
237 lda -1,y | |
238 bmi L0251 | |
239 puls y,x | |
240 L024B lda ,y+ | |
241 bpl L024B | |
242 bra L0237 | |
243 L0251 lda ,-x | |
244 cmpa #$30 | |
245 bcc L027F | |
246 cmpb #$FF | |
247 beq L0278 | |
248 bitb #$80 | |
249 beq L0268 | |
250 tst <u0006 | |
251 lbeq L01C8 | |
252 lbsr L01CF | |
253 L0268 puls y,b,a | |
254 lda <fdesc,u | |
255 eora <u0006 | |
256 ora -$01,y | |
257 eora <u0006 | |
258 sta <fdesc,u | |
259 clrb | |
260 rts | |
261 L0278 eorb <u0006 | |
262 stb <u0007 | |
263 clrb | |
264 puls pc,y,b,a | |
265 L027F coma | |
266 puls pc,y,x | |
267 | |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
268 emod |
0 | 269 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
|
270 end |