Mercurial > hg > Members > kono > nitros9-code
comparison level1/cmds/rename.asm @ 1213:4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
author | boisy |
---|---|
date | Sat, 28 Jun 2003 18:41:05 +0000 |
parents | c155aac72190 |
children | 84ea83668304 |
comparison
equal
deleted
inserted
replaced
1212:c2f6949523f6 | 1213:4e235f213651 |
---|---|
22 edition set 6 | 22 edition set 6 |
23 | 23 |
24 mod eom,name,tylg,atrv,start,size | 24 mod eom,name,tylg,atrv,start,size |
25 | 25 |
26 org 0 | 26 org 0 |
27 u0000 rmb 1 | 27 parmptr rmb 1 |
28 u0001 rmb 1 | 28 u0001 rmb 1 |
29 u0002 rmb 2 | 29 u0002 rmb 2 |
30 u0004 rmb 1 | 30 u0004 rmb 1 |
31 u0005 rmb 2 | 31 nextparm rmb 2 |
32 u0007 rmb 1 | 32 u0007 rmb 1 |
33 u0008 rmb 24 | 33 u0008 rmb 24 |
34 u0020 rmb 26 | 34 pathopts rmb 26 |
35 u003A rmb 2 | 35 u003A rmb 2 |
36 u003C rmb 405 | 36 u003C rmb 2 |
37 rmb 2 | |
38 rmb 401 | |
37 size equ . | 39 size equ . |
38 | 40 |
39 name fcs /Rename/ | 41 name fcs /Rename/ |
40 fcb edition | 42 fcb edition |
41 | 43 |
42 start cmpd #$0004 | 44 start cmpd #$0004 at least 3 chars + CR on cmd line? |
43 lbcs L00A8 | 45 lbcs bpnam branch if less than |
44 stx <u0000 | 46 stx <parmptr save parameter pointer |
45 lda #WRITE. | 47 lda #WRITE. write mode |
46 os9 I$Open | 48 os9 I$Open open file to rename in write mode |
47 bcc L0032 | 49 bcc L0032 branch if ok |
48 cmpb #E$FNA | 50 cmpb #E$FNA file not accessible? |
49 bne L00A5 | 51 bne Exit branch if any other error |
50 ldx <u0000 | 52 ldx <parmptr else get pointer to file |
51 lda #DIR.+WRITE. | 53 lda #DIR.+WRITE. and try open as directory |
52 os9 I$Open | 54 os9 I$Open try opening again |
53 bcs L00A5 | 55 bcs Exit branch if error |
54 L0032 stx <u0005 | 56 L0032 stx <nextparm save off updated param pointer |
55 ldb #SS.Opt | 57 ldb #SS.Opt |
56 leax <u0020,u | 58 leax <pathopts,u |
57 os9 I$GetStt | 59 os9 I$GetStt get path options |
58 bcs L00A5 | 60 bcs Exit branch if error |
59 os9 I$Close | 61 os9 I$Close close path to file |
60 bcs L00A5 | 62 bcs Exit branch if error |
61 ldb <u0020 | 63 ldb <pathopts |
62 cmpb #$01 | 64 cmpb #$01 |
63 bne L00A8 | 65 bne bpnam |
64 bsr L00AE | 66 bsr L00AE |
65 bcs L00A5 | 67 bcs Exit |
66 ldx <u0002 | 68 ldx <u0002 |
67 lda #C$CR | 69 lda #C$CR |
68 sta -1,x | 70 sta -1,x |
69 ldx <u0000 | 71 ldx <parmptr |
70 lda #READ.+WRITE. | 72 lda #READ.+WRITE. |
71 os9 I$ChgDir | 73 os9 I$ChgDir |
72 bcs L00A5 | 74 bcs Exit |
73 ldx <u0005 | 75 ldx <nextparm |
74 ldb <u0008 | 76 ldb <u0008 |
75 decb | 77 decb |
76 lda b,x | 78 lda b,x |
77 ora #$80 | 79 ora #$80 |
78 sta b,x | 80 sta b,x |
81 bne L0075 | 83 bne L0075 |
82 leay ,x | 84 leay ,x |
83 ldx <u0002 | 85 ldx <u0002 |
84 os9 F$CmpNam | 86 os9 F$CmpNam |
85 bcc L0082 | 87 bcc L0082 |
86 L0075 ldx <u0005 | 88 L0075 ldx <nextparm |
87 lda #READ. | 89 lda #READ. |
88 os9 I$Open | 90 os9 I$Open |
89 bcc L00A8 | 91 bcc bpnam |
90 cmpb #E$PNNF | 92 cmpb #E$PNNF |
91 bne L00A8 | 93 bne bpnam |
92 L0082 leax <L00AC,pcr | 94 L0082 leax <Dot,pcr point to . |
93 lda #DIR.!UPDAT. | 95 lda #DIR.!UPDAT. open as directory in update mode |
94 os9 I$Open | 96 os9 I$Open do it! |
95 bcs L00A5 | 97 bcs Exit branch if error |
96 ldx <u003A | 98 ldx <u003A get file directory entry ptr (PD.DCP) |
97 ldu <u003C | 99 ldu <u003C |
98 os9 I$Seek | 100 os9 I$Seek seek |
99 bcs L00A5 | 101 bcs Exit branch if error |
100 ldx <u0005 | 102 ldx <nextparm get ptr to name to rename |
101 ldy <u0007 | 103 ldy <u0007 |
102 os9 I$Write | 104 os9 I$Write |
103 bcs L00A5 | 105 bcs Exit |
104 os9 I$Close | 106 os9 I$Close |
105 bcs L00A5 | 107 bcs Exit |
106 clrb | 108 clrb |
107 L00A5 os9 F$Exit | 109 Exit os9 F$Exit |
108 L00A8 ldb #E$BPNam | 110 bpnam ldb #E$BPNam |
109 bra L00A5 | 111 bra Exit |
110 L00AC fcc "." | 112 |
113 Dot fcc "." | |
111 fcb C$CR | 114 fcb C$CR |
112 L00AE ldx <u0000 | 115 |
116 L00AE ldx <parmptr | |
113 bsr L00F6 | 117 bsr L00F6 |
114 ldu <u0000 | 118 ldu <parmptr |
115 lda ,u | 119 lda ,u |
116 cmpa #PDELIM | 120 cmpa #PDELIM |
117 beq L00C7 | 121 beq L00C7 |
118 lda ,y | 122 lda ,y |
119 cmpa #PDELIM | 123 cmpa #PDELIM |
120 beq L00C7 | 124 beq L00C7 |
121 leau <L00AC,pcr | 125 leau <Dot,pcr |
122 stu <u0000 | 126 stu <parmptr |
123 bra L00CD | 127 bra L00CD |
124 L00C7 leax ,y | 128 L00C7 leax ,y |
125 bsr L00F6 | 129 bsr L00F6 |
126 bcs L00F2 | 130 bcs L00F2 |
127 L00CD stx <u0002 | 131 L00CD stx <u0002 |
129 leax ,y | 133 leax ,y |
130 bsr L00F6 | 134 bsr L00F6 |
131 bcc L00CD | 135 bcc L00CD |
132 ldb <u0004 | 136 ldb <u0004 |
133 beq L00F2 | 137 beq L00F2 |
134 ldx <u0005 | 138 ldx <nextparm |
135 os9 F$PrsNam | 139 os9 F$PrsNam |
136 bcs L00F2 | 140 bcs L00F2 |
137 lda ,y | 141 lda ,y |
138 cmpa #PDELIM | 142 cmpa #PDELIM |
139 beq L00F2 | 143 beq L00F2 |
140 cmpb #$1E | 144 cmpb #$1E |
141 bcc L00F2 | 145 bcc L00F2 |
142 stx <u0005 | 146 stx <nextparm |
143 clra | 147 clra |
144 std <u0007 | 148 std <u0007 |
145 rts | 149 rts |
146 L00F2 comb | 150 L00F2 comb |
147 ldb #E$BPNam | 151 ldb #E$BPNam |
151 clrb | 155 clrb |
152 leau ,x | 156 leau ,x |
153 L00FE lda ,u+ | 157 L00FE lda ,u+ |
154 bpl L0107 | 158 bpl L0107 |
155 incb | 159 incb |
156 cmpa #$AE | 160 cmpa #C$PERD!$80 |
157 bne L010C | 161 bne L010C |
158 L0107 incb | 162 L0107 incb |
159 cmpa #C$PERD | 163 cmpa #C$PERD |
160 beq L00FE | 164 beq L00FE |
161 L010C decb | 165 L010C decb |
162 beq L0118 | 166 beq L0118 |
163 leay -u0001,u | 167 leay -1,u |
164 cmpb #$03 | 168 cmpb #$03 |
165 bcc L0118 | 169 bcc L0118 |
166 clrb | 170 clrb |
167 bra L0119 | 171 bra L0119 |
168 L0118 coma | 172 L0118 coma |