2435
|
1 ********************************************************************
|
|
2 * RFM - Remote File Manager
|
|
3 *
|
|
4 *
|
|
5 * 1 2010/02/20 AAW
|
|
6 * first version - just send ops
|
|
7
|
|
8 nam RFM
|
|
9 ttl Remote File Manager
|
|
10
|
|
11 IFP1
|
|
12 use defsfile
|
|
13 use rfmdefs
|
|
14 use dwdefs.d
|
|
15 ENDC
|
|
16
|
|
17 tylg set FlMgr+Objct
|
|
18 atrv set ReEnt+rev
|
|
19 rev set 0
|
|
20 edition equ 1
|
|
21
|
2436
|
22 mod eom,RFMName,tylg,atrv,RFMEnt,size
|
2435
|
23
|
2436
|
24 pathtmp rmb 256
|
|
25 size equ *
|
|
26
|
2435
|
27 RFMName fcs /RFM/
|
|
28 fcb edition
|
|
29
|
|
30
|
|
31
|
|
32 ******************************
|
|
33 *
|
|
34 * file manager entry point
|
|
35 *
|
|
36 * Entry: Y = Path descriptor pointer
|
|
37 * U = Callers register stack pointer
|
|
38 *
|
|
39
|
|
40 RFMEnt lbra create Create path
|
|
41 lbra open Open path
|
|
42 lbra makdir Makdir
|
|
43 lbra chgdir Chgdir
|
|
44 lbra delete Delete
|
|
45 lbra seek Seek
|
|
46 lbra read Read character
|
|
47 lbra write Write character
|
|
48 lbra readln ReadLn
|
|
49 lbra writln WriteLn
|
|
50 lbra getstt Get Status
|
|
51 lbra setstt Set Status
|
|
52 lbra close Close path
|
|
53
|
|
54 create lda #DW.create
|
|
55 lbra sendit
|
2436
|
56
|
|
57 open pshs u
|
|
58
|
|
59 * put path # on stack
|
|
60 lda ,y
|
|
61 pshs a
|
|
62
|
|
63 * put rfm op and DW op on stack
|
|
64 ldb #DW.open
|
|
65 lda #OP_VFM
|
|
66 pshs d
|
|
67
|
|
68 leax ,s ; point X to stack
|
|
69 ldy #3 ; 3 bytes to send
|
|
70 ifgt Level-1
|
|
71 ldu <D.DWSubAddr
|
|
72 else
|
|
73 ldu >D.DWSubAddr
|
|
74 endc
|
|
75
|
|
76 jsr 6,u
|
|
77 leas 3,s ;clean stack
|
|
78
|
|
79 * now send path string
|
|
80
|
|
81 * copy path string
|
|
82
|
|
83 ldx <D.Proc get curr proc desc
|
|
84 ldb P$Task,x get task #
|
|
85
|
|
86 ldx ,s ; orig U is on stack
|
|
87 ldx R$X,x ; should be X from caller
|
|
88 leay pathtmp,pcr
|
|
89
|
|
90 clra
|
|
91 pshs a
|
|
92
|
|
93 open1 os9 f$ldabx
|
|
94 sta ,y+
|
|
95 leax 1,x
|
|
96 inc ,s
|
|
97 cmpa #$0D
|
|
98 bne open1
|
|
99
|
|
100 * send to server
|
|
101 clra
|
|
102 ldb ,s ; leave a byte on stack for response
|
|
103 tfr d,y
|
|
104 leax pathtmp,pcr
|
|
105 jsr 6,u
|
|
106
|
|
107 * read response from server -> B
|
|
108 leax ,s
|
|
109 ldy #1
|
|
110 jsr 3,u
|
|
111 puls b
|
2438
|
112 cmpb #0
|
|
113 beq open2
|
|
114 orcc #1 ;set error
|
|
115 open2 puls u
|
2436
|
116 rts
|
|
117
|
2435
|
118 makdir lda #DW.makdir
|
|
119 lbra sendit
|
|
120 chgdir lda #DW.chgdir
|
|
121 lbra sendit
|
|
122 delete lda #DW.delete
|
|
123 lbra sendit
|
|
124 seek lda #DW.seek
|
|
125 lbra sendit
|
|
126 read lda #DW.read
|
|
127 lbra sendit
|
|
128 write lda #DW.write
|
|
129 lbra sendit
|
2436
|
130
|
|
131 readln pshs u
|
|
132
|
|
133 * put path # on stack
|
|
134 lda ,y
|
|
135 pshs a
|
|
136
|
|
137 * put rfm op and DW op on stack
|
|
138 ldb #DW.readln
|
|
139 lda #OP_VFM
|
|
140 pshs d
|
|
141
|
|
142 leax ,s ; point X to stack
|
|
143 ldy #3 ; 3 bytes to send
|
|
144 ifgt Level-1
|
|
145 ldu <D.DWSubAddr
|
|
146 else
|
|
147 ldu >D.DWSubAddr
|
|
148 endc
|
|
149
|
|
150 jsr 6,u
|
|
151 leas 3,s ;clean stack
|
|
152
|
|
153 * send max bytes
|
|
154 ldx ,s
|
|
155 ldx R$Y,x
|
|
156 pshs x
|
|
157 leax ,s
|
|
158 ldy #2
|
|
159 jsr 6,u
|
|
160
|
|
161 leas 1,s
|
|
162
|
|
163 * read # bytes (0 = eof)
|
|
164 leax ,s
|
|
165 ldy #1
|
|
166 jsr 3,u
|
|
167
|
2437
|
168 ldb ,s
|
|
169 * bne readln1
|
2436
|
170
|
|
171 * eof
|
2437
|
172 leas 1,s
|
2436
|
173 ldb #211
|
|
174 orcc #1
|
|
175 puls u
|
|
176 rts
|
|
177
|
|
178 * read B chars into mem at addr in caller's X
|
|
179 * first into our buffer INCOMPLETE/FUBAR
|
2437
|
180 readln1 puls b
|
2436
|
181 leax pathtmp,pcr
|
|
182 clra
|
|
183 tfr d,y
|
|
184 jsr 3,u
|
|
185
|
|
186 puls u ; done with dwsub
|
|
187
|
|
188
|
|
189
|
|
190 clrb
|
|
191 rts
|
|
192
|
|
193
|
2435
|
194 writln lda #DW.writln
|
|
195 lbra sendit
|
|
196 getstt lda #DW.getstt
|
|
197 lbra sendit
|
|
198 setstt lda #DW.setstt
|
|
199 lbra sendit
|
2436
|
200
|
|
201 close pshs u
|
|
202
|
|
203 * put path # on stack
|
|
204 lda ,y
|
|
205 pshs a
|
|
206
|
|
207 * put rfm op and DW op on stack
|
|
208 ldb #DW.close
|
|
209 lda #OP_VFM
|
|
210 pshs d
|
|
211
|
|
212 leax ,s ; point X to stack
|
|
213 ldy #3 ; 3 bytes to send
|
|
214 ifgt Level-1
|
|
215 ldu <D.DWSubAddr
|
|
216 else
|
|
217 ldu >D.DWSubAddr
|
|
218 endc
|
|
219
|
|
220 jsr 6,u
|
|
221 leas 3,s ;clean stack
|
|
222
|
|
223 clrb
|
|
224 puls u
|
|
225 rts
|
|
226
|
|
227
|
2435
|
228 * just send OP_VMF + vfmop
|
|
229 sendit pshs u
|
|
230
|
|
231 pshs y
|
|
232 pshs a
|
|
233
|
2436
|
234 lda #OP_VFM ; load command
|
|
235 pshs a ; command store on stack
|
|
236 leax ,s ; point X to stack
|
|
237 ldy #2 ; 2 byte to send
|
2435
|
238 ifgt Level-1
|
|
239 ldu <D.DWSubAddr
|
|
240 else
|
|
241 ldu >D.DWSubAddr
|
|
242 endc
|
|
243
|
|
244 jsr 6,u
|
|
245 leas 2,s ;clean stack
|
|
246
|
|
247 puls x
|
|
248 ldy #107
|
|
249 jsr 6,u
|
2436
|
250
|
|
251
|
|
252 * copy path string
|
|
253
|
|
254 ldx <D.Proc get curr proc desc
|
|
255 ldb P$Task,x get task #
|
|
256
|
|
257 ldx ,s
|
|
258 ldx R$X,x ; should be X from caller
|
|
259 leay pathtmp,pcr
|
|
260
|
|
261 clra
|
|
262 pshs a
|
|
263
|
|
264 send1 os9 f$ldabx
|
|
265 sta ,y+
|
|
266 leax 1,x
|
|
267 inc ,s
|
|
268 cmpa #$0D
|
|
269 bne send1
|
|
270
|
|
271 * send to server
|
|
272 clra
|
|
273 puls b
|
|
274 tfr d,y
|
|
275 leax pathtmp,pcr
|
|
276 jsr 6,u
|
|
277
|
2435
|
278 puls u
|
|
279 clrb
|
|
280 rts
|
|
281
|
|
282
|
|
283 emod
|
|
284 eom equ *
|
|
285 end
|
|
286
|