0
|
1 ********************************************************************
|
|
2 * Attr - Modify file attributes
|
|
3 *
|
|
4 * $Id$
|
|
5 *
|
|
6 * Ed. Comments Who YY/MM/DD
|
|
7 * ------------------------------------------------------------------
|
|
8 * 8 Original Tandy distribution version
|
|
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
|
|
15 ifp1
|
|
16 use defsfile
|
|
17 use rbfdefs
|
|
18 endc
|
|
19
|
|
20 tylg set Prgrm+Objct
|
|
21 atrv set ReEnt+rev
|
|
22 rev set $01
|
|
23 edition set 8
|
|
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"
|
|
62 fcb $FF
|
|
63
|
|
64 start stx <parmptr save param ptr
|
|
65 clr <u0007
|
|
66 com <u0007
|
|
67 clra
|
|
68 os9 I$Open open file on commandline
|
|
69 bcc L00D9 branch if ok
|
|
70 ldx <parmptr get saved param ptr
|
|
71 lda #DIR.!READ. load perms
|
|
72 os9 I$Open open as directory
|
|
73 bcc L00D9 branch if ok
|
|
74 ldx <parmptr get param ptr
|
|
75 lda #DIR. load different perms
|
|
76 os9 I$Open try one more time
|
|
77 bcs L0114 branch if error
|
|
78 L00D9 sta <fpath save off path
|
|
79 stx <cmdperms save updated parm ptr
|
|
80 leax pathopts,u point X to buffer
|
|
81 ldb #SS.Opt load with status code
|
|
82 os9 I$GetStt get status
|
|
83 bcs L0114 branch if error
|
|
84 clrb
|
|
85 lda ,x get path type
|
|
86 cmpa #DT.RBF check if rbf path
|
|
87 lbne L01AC branch if not
|
|
88 ldx <parmptr else get parm ptr
|
|
89 leay <filename,u point to buffer
|
|
90 lda ,x+ get file name character
|
|
91 cmpa #PDELIM path delimiter?
|
|
92 bne L0106 no
|
|
93 L00FA sta ,y+ else save char in Y
|
|
94 lda ,x+ get next file name char
|
|
95 cmpa #C$PERD period?
|
|
96 bcs L0106 branch if not
|
|
97 cmpa #PDELIM path delimiter?
|
|
98 bne L00FA branch if not
|
|
99 L0106 lda #'@
|
|
100 ldb #C$SPAC
|
|
101 std ,y++
|
|
102 leax <filename,u point X to filename
|
|
103 lda #READ.!WRITE. load perms
|
|
104 os9 I$Open open in raw mode
|
|
105 L0114 lbcs L01AC branch if error
|
|
106 sta <rawpath
|
|
107 lda <fpath
|
|
108 clr <u001F,u
|
|
109 pshs u
|
|
110 ldx <u001C,u get MS 16 bits
|
|
111 ldu <u001E,u get LS 16 bits
|
|
112 lda <rawpath get path
|
|
113 os9 I$Seek seek
|
|
114 puls u
|
|
115 bcs L01AC branch if error
|
|
116 leax <fdesc,u point to buffer
|
|
117 ldy #FD.SEG
|
|
118 os9 I$Read
|
|
119 bcs L01AC
|
|
120 os9 F$ID get ID
|
|
121 cmpy #$0000 super user?
|
|
122 beq L014B branch if so
|
|
123 cmpy <fdesc+FD.OWN,u is user same as file's owner?
|
|
124 bne L01C1 branch if not
|
|
125 L014B ldx <cmdperms point to perms on cmd line
|
|
126 lbsr L021D
|
|
127 bcs L018B
|
|
128 L0152 lbsr L021D
|
|
129 bcc L0152
|
|
130 clrb
|
|
131 lda ,x
|
|
132 cmpa #$0D
|
|
133 bne L01AC
|
|
134 pshs u
|
|
135 ldx <u001C,u
|
|
136 ldu <u001E,u
|
|
137 lda <rawpath
|
|
138 os9 I$Seek seek
|
|
139 puls u
|
|
140 bcs L01AC branch if error
|
|
141 leax <fdesc,u point to file desc
|
|
142 ldy #1 only 1 byte
|
|
143 os9 I$Write write out new attributes
|
|
144 bcs L01AC branch if error
|
|
145 os9 I$Close close file
|
|
146 bcs L01AC branch if error
|
|
147 lda <fpath get file path
|
|
148 os9 I$Close close file
|
|
149 bcs L01AC branch if error
|
|
150 ldb <u0007
|
|
151 beq L01BE
|
|
152 L018B ldb <fdesc,u get attribute
|
|
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
|
|
171 os9 I$WritLn
|
|
172 comb
|
|
173 puls b
|
|
174 L01BE os9 F$Exit
|
|
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
|
|
184 ldu #$0040
|
|
185 os9 I$Seek
|
|
186 ldu $04,s
|
|
187 bcs L01BE
|
|
188 L01E0 leax <u0028,u
|
|
189 ldy #$0020
|
|
190 os9 I$Read
|
|
191 bcs L01F7
|
|
192 tst ,x
|
|
193 beq L01E0
|
|
194 leax >L008F,pcr
|
|
195 clrb
|
|
196 bra L01B0
|
|
197 L01F7 puls u,y,x
|
|
198 cmpb #$D3
|
|
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
|
|
255 emod
|
|
256 eom equ *
|
|
257 end
|