annotate level1/cmds/rename.asm @ 2848:94197db917c9 lwtools-port

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