Mercurial > hg > Members > kono > nitros9-code
annotate level1/cmds/attr.asm @ 2307:2f90c1624ab4
Removed earlier port signal defintions, now S$Peer is used
author | boisy |
---|---|
date | Sun, 03 Jan 2010 14:29:29 +0000 |
parents | 028161cd3535 |
children |
rev | line source |
---|---|
0 | 1 ******************************************************************** |
2 * Attr - Modify file attributes | |
3 * | |
4 * $Id$ | |
5 * | |
1325
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
921
diff
changeset
|
6 * Edt/Rev YYYY/MM/DD Modified by |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
921
diff
changeset
|
7 * Comment |
0 | 8 * ------------------------------------------------------------------ |
1325
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
921
diff
changeset
|
9 * 11 ????/??/?? |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
921
diff
changeset
|
10 * From Tandy OS-9 Level Two VR 02.00.01. |
1919 | 11 * |
12 * 12 2005/11/23 CRH | |
13 * Now uses SS.FD to read and write the FD sector | |
0 | 14 |
15 nam Attr | |
16 ttl Modify file attributes | |
17 | |
18 * Disassembled 98/09/11 11:44:51 by Disasm v1.6 (C) 1988 by RML | |
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 ifp1 |
0 | 21 use defsfile |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
22 endc |
0 | 23 |
921
617c1b90e623
Added DOHELP conditionals, set all to zero to eliminate help from commands
boisy
parents:
873
diff
changeset
|
24 DOHELP set 0 |
617c1b90e623
Added DOHELP conditionals, set all to zero to eliminate help from commands
boisy
parents:
873
diff
changeset
|
25 |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
26 tylg set Prgrm+Objct |
0 | 27 atrv set ReEnt+rev |
1325
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
921
diff
changeset
|
28 rev set $00 |
1919 | 29 edition set 12 |
0 | 30 |
31 mod eom,name,tylg,atrv,start,size | |
32 | |
33 fpath rmb 1 | |
34 parmptr rmb 2 | |
35 cmdperms rmb 2 | |
36 u0006 rmb 1 | |
37 u0007 rmb 1 | |
1919 | 38 pathopts rmb 32 |
39 dirent rmb 32 | |
0 | 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 |
1919 | 73 lda #WRITE. need write to change attrs |
873 | 74 os9 I$Open open file on commandline |
75 bcc L00D9 branch if ok | |
1919 | 76 * If error, try to open without write permissions |
873 | 77 ldx <parmptr get saved param ptr |
1919 | 78 clra |
79 os9 I$Open | |
80 bcc L00D9 branch if ok | |
81 * If error, try to open as directory with read/write permissions | |
82 ldx <parmptr get saved param ptr | |
83 lda #DIR.+UPDAT. load perms | |
873 | 84 os9 I$Open open as directory |
85 bcc L00D9 branch if ok | |
86 * One last time, try open as directory only | |
87 ldx <parmptr get param ptr | |
88 lda #DIR. load different perms | |
89 os9 I$Open try one more time | |
90 bcs L0114 branch if error | |
91 L00D9 sta <fpath save off path | |
92 stx <cmdperms save updated parm ptr | |
93 leax pathopts,u point X to buffer | |
94 ldb #SS.Opt load with status code | |
95 os9 I$GetStt get status | |
96 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
|
97 clrb |
1919 | 98 lda ,x get path type |
873 | 99 cmpa #DT.RBF check if rbf path |
100 lbne ShowHelp branch if not | |
0 | 101 lda <fpath |
1919 | 102 ldb #SS.FD Get my file descriptor |
103 leax fdesc,u point to buffer | |
0 | 104 ldy #FD.SEG |
1919 | 105 os9 I$GetStt |
106 L0114 bcs ShowHelp | |
873 | 107 os9 F$ID get ID |
108 cmpy #$0000 super user? | |
109 beq L014B branch if so | |
110 cmpy <fdesc+FD.OWN,u is user same as file's owner? | |
111 bne L01C1 branch if not | |
112 L014B ldx <cmdperms point to perms on cmd line | |
0 | 113 lbsr L021D |
114 bcs L018B | |
115 L0152 lbsr L021D | |
116 bcc L0152 | |
117 clrb | |
118 lda ,x | |
226 | 119 cmpa #C$CR |
873 | 120 bne ShowHelp |
1919 | 121 lda <fpath |
122 ldb #SS.FD Set my file descriptor | |
123 leax fdesc,u point to file desc | |
873 | 124 ldy #1 only 1 byte |
1919 | 125 os9 I$SetStt write out new attributes |
873 | 126 bcs ShowHelp branch if error |
127 lda <fpath get file path | |
128 os9 I$Close close file | |
129 bcs ShowHelp branch if error | |
0 | 130 ldb <u0007 |
131 beq L01BE | |
873 | 132 L018B ldb <fdesc,u get attribute |
133 leax >Attrs,pcr | |
0 | 134 leay <u0078,u |
135 lda ,x+ | |
136 L0197 lslb | |
137 bcs L019C | |
138 lda #'- | |
139 L019C sta ,y+ | |
140 lda ,x+ | |
141 bpl L0197 | |
142 lda #C$CR | |
143 sta ,y+ | |
144 leax <u0078,u | |
145 clrb | |
146 bra L01B0 | |
921
617c1b90e623
Added DOHELP conditionals, set all to zero to eliminate help from commands
boisy
parents:
873
diff
changeset
|
147 ShowHelp equ * |
846 | 148 IFNE DOHELP |
921
617c1b90e623
Added DOHELP conditionals, set all to zero to eliminate help from commands
boisy
parents:
873
diff
changeset
|
149 leax >HelpMsg,pcr |
617c1b90e623
Added DOHELP conditionals, set all to zero to eliminate help from commands
boisy
parents:
873
diff
changeset
|
150 ELSE |
617c1b90e623
Added DOHELP conditionals, set all to zero to eliminate help from commands
boisy
parents:
873
diff
changeset
|
151 clrb |
617c1b90e623
Added DOHELP conditionals, set all to zero to eliminate help from commands
boisy
parents:
873
diff
changeset
|
152 bra L01BE |
846 | 153 ENDC |
0 | 154 L01B0 pshs b |
155 lda #2 | |
156 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
|
157 os9 I$WritLn |
0 | 158 comb |
159 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
|
160 L01BE os9 F$Exit |
0 | 161 L01C1 clrb |
873 | 162 leax >NotOwner,pcr |
0 | 163 bra L01B0 |
873 | 164 L01C8 leax >UseMkDir,pcr |
0 | 165 clrb |
166 bra L01B0 | |
167 L01CF pshs u,y,x | |
168 lda <fpath | |
169 ldx #$0000 | |
226 | 170 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
|
171 os9 I$Seek |
0 | 172 ldu $04,s |
173 bcs L01BE | |
1919 | 174 L01E0 leax <dirent,u |
226 | 175 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
|
176 os9 I$Read |
0 | 177 bcs L01F7 |
178 tst ,x | |
179 beq L01E0 | |
873 | 180 leax >DirNtEmt,pcr |
0 | 181 clrb |
182 bra L01B0 | |
183 L01F7 puls u,y,x | |
226 | 184 cmpb #E$EOF |
873 | 185 bne ShowHelp |
0 | 186 rts |
187 L01FE fdb $ff41 | |
188 fdb $ff80,$44ff,$4053,$ff01,$52ff,$0257,$ff04,$45ff | |
189 fdb $0850,$52ff,$1050,$57ff,$2050,$45ff | |
190 fcb $00 | |
191 L021D clr <u0006 | |
192 L021F lda ,x+ | |
193 cmpa #C$SPAC | |
194 beq L021F | |
195 cmpa #C$COMA | |
196 beq L021F | |
197 cmpa #'- | |
198 bne L0231 | |
199 com <u0006 | |
200 lda ,x+ | |
201 L0231 leax -1,x | |
202 leay >L01FE,pcr | |
203 L0237 ldb ,y+ | |
204 pshs y,x | |
205 beq L027F | |
206 L023D lda ,x+ | |
207 eora ,y+ | |
208 anda #$DF | |
209 beq L023D | |
210 lda -1,y | |
211 bmi L0251 | |
212 puls y,x | |
213 L024B lda ,y+ | |
214 bpl L024B | |
215 bra L0237 | |
216 L0251 lda ,-x | |
217 cmpa #$30 | |
218 bcc L027F | |
219 cmpb #$FF | |
220 beq L0278 | |
221 bitb #$80 | |
222 beq L0268 | |
223 tst <u0006 | |
224 lbeq L01C8 | |
225 lbsr L01CF | |
226 L0268 puls y,b,a | |
227 lda <fdesc,u | |
228 eora <u0006 | |
229 ora -$01,y | |
230 eora <u0006 | |
231 sta <fdesc,u | |
232 clrb | |
233 rts | |
234 L0278 eorb <u0006 | |
235 stb <u0007 | |
236 clrb | |
237 puls pc,y,b,a | |
238 L027F coma | |
239 puls pc,y,x | |
240 | |
187
0d02be492d77
Brought up to same attr command in OS-9 Level Two, which is the same exact
boisy
parents:
0
diff
changeset
|
241 emod |
0 | 242 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
|
243 end |