comparison level1/modules/rfm.asm @ 2447:adfd8492a455

Updated
author boisy
date Fri, 26 Feb 2010 17:12:59 +0000
parents 0ae4857f8f82
children a4ac68ad79e4
comparison
equal deleted inserted replaced
2446:0ae4857f8f82 2447:adfd8492a455
55 create ldb #DW.create 55 create ldb #DW.create
56 bra create1 56 bra create1
57 57
58 58
59 open ldb #DW.open 59 open ldb #DW.open
60 create1 pshs u,y ; RD Regs 60 create1
61 61 ldx PD.DEV,y ; get ptr to our static storage
62 ldx PD.DEV,y ; to our static storage 62 pshs b,x,y,u ; save all on stack
63 pshs x ; PD.DEV PD Regs
64
65 * put path # on stack
66 lda ,y
67 sta V.PATHNUM,x
68 pshs a ; p# PD.DEV PD Regs
69
70 * put rfm op and DW op on stack
71
72 lda #OP_VFM
73 pshs d ; DWOP RFMOP p# PD.DEV PD Regs
74 63
75 * TODO lets not create multiple buffers when multiple open/create on same path 64 * TODO lets not create multiple buffers when multiple open/create on same path
76 * get system mem 65 * get system mem
77 ldd #256 66 ldd #256
78 os9 F$SRqMem ; ask for D bytes (# bytes server said is coming) 67 os9 F$SRqMem ; ask for D bytes (# bytes server said is coming)
79 ldx 3,s ; PD.DEV 68 puls a
69 bcs open2
80 stu V.BUF,x 70 stu V.BUF,x
71
72 * put path # on stack
73 ldb PD.PD,y
74 stb V.PATHNUM,x
75 pshs cc
76 pshs d ; p# PD.DEV PD Regs
77
78 * put rfm op and DW op on stack
79 lda #OP_VFM
80 pshs a ; DWOP RFMOP p# PD.DEV PD Regs
81 81
82 leax ,s ; point X to stack 82 leax ,s ; point X to stack
83 ldy #3 ; 3 bytes to send 83 ldy #3 ; 3 bytes to send
84 84
85 ifgt Level-1 85 ifgt Level-1
86 ldu <D.DWSubAddr 86 ldu <D.DWSubAddr
87 else 87 else
88 ldu >D.DWSubAddr 88 ldu >D.DWSubAddr
89 endc 89 endc
90 90
91 orcc #IntMasks
91 jsr 6,u 92 jsr 6,u
92 leas 3,s ;clean stack PD.DEV PD Regs 93 leas 3,s ;clean stack PD.DEV PD Regs
93 94
94 * now send path string 95 * now send path string
95 96
98 clr ,-s ; set size ctr to 0 99 clr ,-s ; set size ctr to 0
99 100
100 ldx <D.Proc ; get curr proc desc 101 ldx <D.Proc ; get curr proc desc
101 ldb P$Task,x ; get task # 102 ldb P$Task,x ; get task #
102 103
103 ldx 5,s ; original U - Regs 104 ldx 6,s ; original U - Regs
104 ldx R$X,x ; should be X from caller 105 ldx R$X,x ; should be X from caller
105 106
106 ldy 1,s ; pd.dev 107 ldy 2,s ; pd.dev
107 ldy V.BUF,y 108 ldy V.BUF,y
108 109
109 open1 os9 f$ldabx 110 open1 os9 F$LDABX
110 sta ,y+ 111 sta ,y+
111 leax 1,x 112 leax 1,x
112 inc ,s 113 inc ,s
113 cmpa #C$CR 114 cmpa #C$CR
114 bne open1 115 bne open1
115 116
116 * store advanced X in calling process (SCF does this.. ?) 117 * store advanced X in calling process (SCF does this.. ?)
117 leax -1,x 118 leax -1,x
118 ldy 5,s ; original U 119 ldy 6,s ; original U
119 stx R$X,y 120 stx R$X,y
120 121
121 * send to server 122 * send to server
122 clra 123 clra
123 ldb ,s ; counter 124 ldb ,s ; counter
124 tfr d,y ; set Y to pathlen 125 tfr d,y ; set Y to pathlen
125 ldx 1,s ; pd.dev 126 ldx 2,s ; pd.dev
126 ldx V.BUF,x 127 ldx V.BUF,x
127 jsr 6,u 128 jsr 6,u
128 129
129 * read response from server -> B 130 * read response from server -> B
130 leax ,s 131 leax ,s
131 ldy #1 132 ldy #1
132 jsr 3,u 133 jsr 3,u
133 134
134 * pull server's response into B 135 * pull server's response into B
135 puls b ; PD.DEV PD Regs 136 puls b ; PD.DEV PD Regs
137 puls cc
136 tstb 138 tstb
137 beq open2 139 beq open2
138 140
139 orcc #1 ;set error 141 coma ; set error
140 open2 leas 4,s ; Regs 142 open2 leas 6,s ; clean stack
141 puls u,pc ; clean stack & return 143 rts
142 144
143 makdir lda #DW.makdir 145 makdir lda #DW.makdir
144 lbra sendit 146 lbra sendit
145 chgdir lda #DW.chgdir 147 chgdir lda #DW.chgdir
146 lbra sendit 148 lbra sendit
158 lbra sendit 160 lbra sendit
159 161
160 162
161 163
162 readln ldb #DW.readln 164 readln ldb #DW.readln
163 read1 pshs y,u 165 read1 ldx PD.DEV,y ; to our static storage
164 166 pshs x,y,u
165 ldx PD.DEV,y ; to our static storage
166 pshs x ; PD.DEV PD Regs
167 167
168 * put path # on stack 168 * put path # on stack
169 lda ,y 169 lda PD.PD,y
170 sta V.PATHNUM,x 170 sta V.PATHNUM,x
171 pshs cc
171 pshs a ; p# PD.DEV PD Regs 172 pshs a ; p# PD.DEV PD Regs
172 173
173 * put rfm op and DW op on stack 174 * put rfm op and DW op on stack
174 175
175 lda #OP_VFM 176 lda #OP_VFM
184 else 185 else
185 ldu >D.DWSubAddr 186 ldu >D.DWSubAddr
186 endc 187 endc
187 188
188 * send dw op, rfm op, path # 189 * send dw op, rfm op, path #
190 orcc #IntMasks
189 jsr 6,u 191 jsr 6,u
190 leas 3,s ;clean stack - PD.DEV PD Regs 192 leas 3,s ;clean stack - PD.DEV PD Regs
191 193
192 * put caller's Y on stack (maximum allowed bytes) 194 * put caller's Y on stack (maximum allowed bytes)
193 ldx 4,s 195 ldx 5,s
194 ldx R$Y,x 196 ldx R$Y,x
195 pshs x 197 pshs x
196 198
197 * send 2 bytes from stack 199 * send 2 bytes from stack
198 leax ,s 200 leax ,s
210 clra 212 clra
211 puls b ;PD.DEV PD Regs 213 puls b ;PD.DEV PD Regs
212 214
213 215
214 * check for 0 216 * check for 0
215 tstb 217 tstb
216 beq readln1 ; 0 bytes = EOF 218 beq readln1 ; 0 bytes = EOF
217 219
218 * read the data from server if > 0 220 * read the data from server if > 0
219 pshs d ;xfersz PD.DEV PD Regs 221 go_on pshs d ;xfersz PD.DEV PD Regs
220 222
221 * load data from server into mem block 223 * load data from server into mem block
222 ldx 2,s ; pd.dev 224 ldx 3,s ; pd.dev
223 ldx V.BUF,x 225 ldx V.BUF,x
224 ldy ,s ;xfersz 226 ldy ,s ;xfersz
225 jsr 3,u 227 jsr 3,u
226 228
227 * F$Move 229 * F$Move
232 * U = dest ptr 234 * U = dest ptr
233 235
234 * move from our mem to caller 236 * move from our mem to caller
235 237
236 puls y ;Y = byte count (already set?) - PD.DEV PD Regs 238 puls y ;Y = byte count (already set?) - PD.DEV PD Regs
239 puls cc
237 240
238 ldx 4,s 241 ldx 4,s
239 ldu R$X,x ; U = caller's X = dest ptr 242 ldu R$X,x ; U = caller's X = dest ptr
240 243
241 lda <D.SysTsk ; A = system task # 244 lda <D.SysTsk ; A = system task #
252 * assume everything worked (not good) 255 * assume everything worked (not good)
253 clrb 256 clrb
254 *ldy xfersz,pc ; Y is supposed to be set to bytes read.. do we need to set this in the caller's regs? 257 *ldy xfersz,pc ; Y is supposed to be set to bytes read.. do we need to set this in the caller's regs?
255 bra readln2 258 bra readln2
256 259
257 readln1 ldb #E$EOF 260 readln1
258 ldy #0 ; Y should be 0 if we didnt read any? in callers regs? 261 puls cc
259 orcc #1 ; set error bit 262 comb
263 ldb #E$EOF
260 leas 2,s ; clean stack down 264 leas 2,s ; clean stack down
261
262 readln2 puls y,u,pc 265 readln2 puls y,u,pc
263
264 *ldu origu,pc ; put U back to the entry value.. needed?
265 * rts
266 266
267 267
268 writln lda #DW.writln 268 writln lda #DW.writln
269 lbra sendit 269 lbra sendit
270 270