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