Mercurial > hg > Members > kono > nitros9-code
comparison level1/modules/rbdw3.asm @ 2636:4e5ff2c5b512
Optimized Term routine
author | Boisy Pitre <boisy.pitre@nuance.com> |
---|---|
date | Mon, 27 Feb 2012 22:06:39 -0600 |
parents | b8c7b7fbf3c9 |
children | 8d24c482646e |
comparison
equal
deleted
inserted
replaced
2635:1a75c932f607 | 2636:4e5ff2c5b512 |
---|---|
75 * Exit: | 75 * Exit: |
76 * CC = carry set on error | 76 * CC = carry set on error |
77 * B = error code | 77 * B = error code |
78 * | 78 * |
79 Term | 79 Term |
80 clrb | |
81 pshs cc | |
80 * Send OP_TERM to the server | 82 * Send OP_TERM to the server |
81 clrb clear Carry | 83 IFGT LEVEL-1 |
82 pshs cc then push CC on stack | 84 ldu <D.DWSubAddr |
83 lda #OP_TERM | 85 ELSE |
84 pshs a | 86 ldu >D.DWSubAddr |
85 leax ,s | 87 ENDC |
86 ldy #$0001 | |
87 IFGT LEVEL-1 | |
88 ldu <D.DWSubAddr | |
89 ELSE | |
90 ldu >D.DWSubAddr | |
91 ENDC | |
92 * Fix crash in certain cases | 88 * Fix crash in certain cases |
93 beq no@ | 89 beq no@ |
94 orcc #IntMasks | 90 ldy #$0001 |
95 jsr 6,u | 91 lda #OP_TERM |
96 no@ puls a | 92 pshs a |
97 puls cc,pc | 93 leax ,s |
94 orcc #IntMasks | |
95 jsr DW$Write,u | |
96 clrb | |
97 puls a | |
98 no@ puls cc,pc | |
98 | 99 |
99 * Init | 100 * Init |
100 * | 101 * |
101 * Entry: | 102 * Entry: |
102 * Y = address of device descriptor | 103 * Y = address of device descriptor |
145 stu <D.DWSubAddr | 146 stu <D.DWSubAddr |
146 ELSE | 147 ELSE |
147 stu >D.DWSubAddr | 148 stu >D.DWSubAddr |
148 ENDC | 149 ENDC |
149 * Initialize the low level device | 150 * Initialize the low level device |
150 jsr ,u | 151 jsr DW$Init,u |
151 lda #OP_INIT | 152 lda #OP_INIT |
152 leax ,s | 153 leax ,s |
153 ldy #$0001 | 154 ldy #$0001 |
154 jsr 6,u | 155 jsr DW$Write,u |
155 clrb | 156 clrb |
156 | 157 |
157 InitEx | 158 InitEx |
158 IFGT Level-1 | 159 IFGT Level-1 |
159 puls a,x | 160 puls a,x |
182 sta retries,u | 183 sta retries,u |
183 cmpx #$0000 LSN 0? | 184 cmpx #$0000 LSN 0? |
184 bne ReadSect branch if not | 185 bne ReadSect branch if not |
185 tstb LSN 0? | 186 tstb LSN 0? |
186 bne ReadSect branch if not | 187 bne ReadSect branch if not |
187 * At this point we're reading LSN0 | 188 * At this point we are reading LSN0 |
188 bsr ReadSect read the sector | 189 bsr ReadSect read the sector |
189 bcs CpyLSNEx if error, exit | 190 bcs CpyLSNEx if error, exit |
190 leax DRVBEG,u point to start of drive table | 191 leax DRVBEG,u point to start of drive table |
191 ldb <PD.DRV,y get drive number | 192 ldb <PD.DRV,y get drive number |
192 NextDrv beq CopyLSN0 branch if terminal count | 193 NextDrv beq CopyLSN0 branch if terminal count |
222 ldu <D.DWSubAddr | 223 ldu <D.DWSubAddr |
223 ELSE | 224 ELSE |
224 ldu >D.DWSubAddr | 225 ldu >D.DWSubAddr |
225 ENDC | 226 ENDC |
226 orcc #IntMasks | 227 orcc #IntMasks |
227 jsr 6,u | 228 jsr DW$Write,u |
228 | 229 |
229 * Get 256 bytes of sector data | 230 * Get 256 bytes of sector data |
230 ldx 5,s | 231 ldx 5,s |
231 ldx PD.BUF,x get buffer pointer into X | 232 ldx PD.BUF,x get buffer pointer into X |
232 ldy #$0100 | 233 ldy #$0100 |
233 jsr 3,u | 234 jsr DW$Read,u |
234 bcs ReadEr1 | 235 bcs ReadEr1 |
235 bne ReadEr1 | 236 bne ReadEr1 |
236 pshs y | 237 pshs y |
237 leax ,s | 238 leax ,s |
238 ldy #$0002 | 239 ldy #$0002 |
239 jsr 6,u write checksum to server | 240 jsr DW$Write,u write checksum to server |
240 | 241 |
241 * Get error code byte | 242 * Get error code byte |
242 leax ,s | 243 leax ,s |
243 ldy #$0001 | 244 ldy #$0001 |
244 jsr 3,u | 245 jsr DW$Read,u |
245 bcs ReadEr0 branch if we timed out | 246 bcs ReadEr0 branch if we timed out |
246 bne ReadEr0 | 247 bne ReadEr0 |
247 puls d | 248 puls d |
248 tfr a,b transfer byte to B (in case of error) | 249 tfr a,b transfer byte to B (in case of error) |
249 tstb is it zero? | 250 tstb is it zero? |
299 ldu <D.DWSubAddr | 300 ldu <D.DWSubAddr |
300 ELSE | 301 ELSE |
301 ldu >D.DWSubAddr | 302 ldu >D.DWSubAddr |
302 ENDC | 303 ENDC |
303 orcc #IntMasks | 304 orcc #IntMasks |
304 jsr 6,u | 305 jsr DW$Write,u |
305 | 306 |
306 * Compute checksum on sector we just sent and send checksum to server | 307 * Compute checksum on sector we just sent and send checksum to server |
307 ldy 5,s get Y from stack | 308 ldy 5,s get Y from stack |
308 ldx PD.BUF,y point to buffer | 309 ldx PD.BUF,y point to buffer |
309 ldy #256 | 310 ldy #256 |
311 leax -256,x | 312 leax -256,x |
312 bsr DoCSum | 313 bsr DoCSum |
313 pshs d | 314 pshs d |
314 leax ,s | 315 leax ,s |
315 ldy #$0002 | 316 ldy #$0002 |
316 jsr 6,u | 317 jsr DW$Write,u |
317 | 318 |
318 * Await acknowledgement from server on receipt of sector | 319 * Await acknowledgement from server on receipt of sector |
319 leax ,s | 320 leax ,s |
320 ldy #$0001 | 321 ldy #$0001 |
321 jsr 3,u read ack byte from server | 322 jsr DW$Read,u read ack byte from server |
322 bcs WritEx0 | 323 bcs WritEx0 |
323 bne WritEx0 | 324 bne WritEx0 |
324 puls d | 325 puls d |
325 tsta | 326 tsta |
326 beq WritEx yep | 327 beq WritEx yep |