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