Mercurial > hg > Members > kono > nitros9-code
annotate level1/modules/ccdisk.asm @ 1071:853a796a1bcd
Removed logbook
author | boisy |
---|---|
date | Mon, 31 Mar 2003 14:10:56 +0000 |
parents | c93ecc262253 |
children | b4beed49ef37 |
rev | line source |
---|---|
0 | 1 ******************************************************************** |
2 * CCDisk - WD1773 disk driver for Tandy/Radio Shack controller | |
3 * | |
4 * $Id$ | |
5 * | |
6 * Ed. Comments Who YY/MM/DD | |
7 * ------------------------------------------------------------------ | |
201 | 8 * 4 From Tandy OS-9 Level One VR 02.00.00 |
208
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
9 * 5 Patched to handle 6ms step rate and ds drives BGP 02/07/14 |
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
10 * from Kissable OS-9, Rainbow, October 1988 |
0 | 11 |
12 nam CCDisk | |
13 ttl WD1773 disk driver for Tandy/Radio Shack controller | |
14 | |
15 * Disassembled 98/08/23 17:21:46 by Disasm v1.6 (C) 1988 by RML | |
16 | |
17 ifp1 | |
18 use defsfile | |
19 use rbfdefs | |
20 endc | |
21 | |
22 tylg set Drivr+Objct | |
23 atrv set ReEnt+rev | |
24 rev set $01 | |
201 | 25 edition set 5 |
0 | 26 |
243 | 27 MaxDrv set 4 |
28 | |
208
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
29 L0000 mod eom,name,tylg,atrv,start,size |
0 | 30 |
257 | 31 rmb DRVBEG |
208
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
32 u000F rmb 38 |
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
33 u0035 rmb 8 |
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
34 u003D rmb 18 |
0 | 35 u004F rmb 27 |
36 u006A rmb 5 | |
37 u006F rmb 56 | |
243 | 38 CurDMem rmb 2 |
39 DrivSel rmb 1 | |
0 | 40 u00AA rmb 1 |
233 | 41 VfyBuf rmb 2 |
0 | 42 u00AD rmb 4 |
243 | 43 DevStRg rmb 1 |
0 | 44 size equ . |
233 | 45 |
256 | 46 fcb DIR.+SHARE.+PREAD.+PWRIT.+PEXEC.+READ.+WRITE.+EXEC. |
0 | 47 |
48 name fcs /CCDisk/ | |
49 fcb edition | |
50 | |
51 start lbra Init | |
52 lbra Read | |
53 lbra Write | |
54 lbra GetStat | |
55 lbra SetStat | |
56 lbra Term | |
57 | |
58 IRQPkt fcb $00,$01,$0a | |
59 | |
60 * Init | |
61 * | |
62 * Entry: | |
63 * Y = address of device descriptor | |
64 * U = address of device memory area | |
65 * | |
66 * Exit: | |
67 * CC = carry set on error | |
68 * B = error code | |
69 * | |
70 Init clra | |
71 sta <D.DskTmr | |
72 ldx #DPort | |
73 leax $08,x | |
74 lda #$D0 | |
75 sta ,x | |
76 lbsr L0294 | |
77 lda ,x | |
78 lda #$FF | |
243 | 79 L003D ldb #MaxDrv |
233 | 80 leax DRVBEG,u |
0 | 81 L0041 sta ,x |
243 | 82 sta <V.TRAK,x |
233 | 83 leax <DRVMEM,x |
0 | 84 decb |
85 bne L0041 | |
233 | 86 leax >NMIRtn,pcr |
248 | 87 stx >D.XNMI |
0 | 88 lda #$7E |
248 | 89 sta >D.XSWI+1 |
0 | 90 pshs y |
243 | 91 leay >DevStRg,u |
0 | 92 tfr y,d |
233 | 93 leay >IRQRtn,pcr |
0 | 94 leax >IRQPkt,pcr |
95 os9 F$IRQ | |
96 puls y | |
97 bcs L0082 | |
98 ldd #256 | |
99 pshs u | |
100 os9 F$SRqMem | |
101 tfr u,x | |
102 puls u | |
103 bcs L0082 | |
233 | 104 stx >VfyBuf,u |
0 | 105 |
106 * GetStat | |
107 * | |
108 * Entry: | |
109 * A = function code | |
110 * Y = address of path descriptor | |
111 * U = address of device memory area | |
112 * | |
113 * Exit: | |
114 * CC = carry set on error | |
115 * B = error code | |
116 * | |
117 GetStat | |
118 | |
119 * Term | |
120 * | |
121 * Entry: | |
122 * U = address of device memory area | |
123 * | |
124 * Exit: | |
125 * CC = carry set on error | |
126 * B = error code | |
127 * | |
128 Term clrb | |
129 L0082 rts | |
130 | |
131 * Read | |
132 * | |
133 * Entry: | |
134 * B = MSB of the disk's LSN | |
135 * X = LSB of the disk's LSN | |
136 * Y = address of path descriptor | |
137 * U = address of device memory area | |
138 * | |
139 * Exit: | |
140 * CC = carry set on error | |
141 * B = error code | |
142 * | |
143 Read lda #$91 | |
248 | 144 cmpx #$0000 LSN0? |
145 bne L00AD branch if not | |
146 bsr L00AD else branch subroutine | |
0 | 147 bcs L00A3 |
248 | 148 ldx PD.BUF,y get pointer to buffer |
0 | 149 pshs y,x |
243 | 150 ldy >CurDMem,u |
248 | 151 ldb #DD.SIZ-1 copy bytes from buffer to LSN0 buffer |
0 | 152 L0099 lda b,x |
153 sta b,y | |
154 decb | |
155 bpl L0099 | |
156 clrb | |
157 puls pc,y,x | |
158 L00A3 rts | |
159 L00A4 bcc L00AD | |
160 pshs x,b,a | |
161 lbsr L02D0 | |
162 puls x,b,a | |
248 | 163 |
0 | 164 L00AD pshs x,b,a |
165 bsr L00B8 | |
166 puls x,b,a | |
167 bcc L00A3 | |
168 lsra | |
169 bne L00A4 | |
170 L00B8 lbsr L019E | |
171 bcs L00A3 | |
248 | 172 ldx PD.BUF,y |
0 | 173 pshs y,cc |
174 ldb #$80 | |
175 bsr L00E6 | |
176 L00C5 bita >DPort+8 | |
177 bne L00DC | |
178 leay -$01,y | |
179 bne L00C5 | |
243 | 180 lda >DrivSel,u |
0 | 181 ora #$08 |
182 sta >DPort | |
183 puls y,cc | |
184 lbra L026F | |
185 L00DC lda >DPort+$0B | |
186 sta ,x+ | |
187 stb >DPort | |
188 bra L00DC | |
189 L00E6 orcc #IntMasks | |
190 stb >DPort+8 | |
191 ldy #$FFFF | |
192 ldb #$28 | |
243 | 193 orb >DrivSel,u |
0 | 194 stb >DPort |
195 ldb #$A8 | |
243 | 196 orb >DrivSel,u |
0 | 197 lbsr L0294 |
198 lda #$02 | |
199 rts | |
200 | |
201 * Write | |
202 * | |
203 * Entry: | |
204 * B = MSB of the disk's LSN | |
205 * X = LSB of the disk's LSN | |
206 * Y = address of path descriptor | |
207 * U = address of device memory area | |
208 * | |
209 * Exit: | |
210 * CC = carry set on error | |
211 * B = error code | |
212 * | |
213 Write lda #$91 | |
214 L0106 pshs x,b,a | |
215 bsr L0129 | |
216 puls x,b,a | |
217 bcs L0119 | |
248 | 218 tst <PD.VFY,y |
0 | 219 bne L0117 |
233 | 220 bsr Verify |
0 | 221 bcs L0119 |
222 L0117 clrb | |
223 L0118 rts | |
224 L0119 lsra | |
225 lbeq L023E | |
226 bcc L0106 | |
227 pshs x,b,a | |
228 lbsr L02D0 | |
229 puls x,b,a | |
230 bra L0106 | |
231 L0129 bsr L019E | |
232 bcs L0118 | |
248 | 233 ldx PD.BUF,y |
0 | 234 ldb #$A0 |
235 L0131 pshs y,cc | |
236 bsr L00E6 | |
237 L0135 bita >DPort+8 | |
238 bne L014C | |
239 leay -$01,y | |
240 bne L0135 | |
243 | 241 lda >DrivSel,u |
0 | 242 ora #$08 |
243 sta >DPort | |
244 puls y,cc | |
245 lbra L023E | |
246 L014C lda ,x+ | |
247 sta >DPort+$0B | |
248 stb >DPort | |
249 bra L014C | |
233 | 250 |
251 NMIRtn leas $0C,s | |
0 | 252 puls y,cc |
253 ldb >DPort+8 | |
254 bitb #$04 | |
255 lbne L026F | |
256 lbra L0241 | |
233 | 257 |
258 Verify pshs x,b,a | |
259 ldx PD.BUF,y | |
0 | 260 pshs x |
233 | 261 ldx >VfyBuf,u |
262 stx PD.BUF,y | |
0 | 263 ldx $04,s |
264 lbsr L00B8 | |
265 puls x | |
233 | 266 stx PD.BUF,y |
0 | 267 bcs L019C |
268 lda #$20 | |
269 pshs u,y,a | |
233 | 270 ldy >VfyBuf,u |
0 | 271 tfr x,u |
272 L0188 ldx ,u | |
273 cmpx ,y | |
274 bne L0198 | |
257 | 275 leau $08,u |
0 | 276 leay $08,y |
277 dec ,s | |
278 bne L0188 | |
279 bra L019A | |
280 L0198 orcc #Carry | |
281 L019A puls u,y,a | |
282 L019C puls pc,x,b,a | |
283 L019E clr >u00AA,u | |
284 bsr L020D | |
285 tstb | |
286 bne L01B8 | |
287 tfr x,d | |
243 | 288 ldx >CurDMem,u |
209 | 289 cmpd #$0000 |
0 | 290 beq L01DD |
291 cmpd $01,x | |
292 bcs L01BC | |
293 L01B8 comb | |
294 ldb #E$Sect | |
295 rts | |
296 L01BC clr ,-s | |
297 bra L01C2 | |
298 L01C0 inc ,s | |
243 | 299 L01C2 subd #18 |
0 | 300 bcc L01C0 |
243 | 301 addb #18 |
302 lbra L0350 | |
208
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
303 fcb $15 |
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
304 L01CD bls L01DD |
0 | 305 pshs a |
243 | 306 lda >DrivSel,u |
0 | 307 ora #$10 |
243 | 308 sta >DrivSel,u |
0 | 309 puls a |
310 L01DD incb | |
311 stb >DPort+$0A | |
312 L01E1 ldb <$15,x | |
313 stb >DPort+9 | |
314 tst >u00AA,u | |
315 bne L01F2 | |
316 cmpa <$15,x | |
317 beq L0207 | |
318 L01F2 sta <$15,x | |
319 sta >DPort+$0B | |
208
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
320 clrb |
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
321 lbsr L0372 |
0 | 322 pshs x |
248 | 323 * ldx #$222E |
324 ldx #$082E | |
0 | 325 L0201 leax -$01,x |
326 bne L0201 | |
327 puls x | |
328 L0207 clrb | |
329 rts | |
233 | 330 |
331 DrvSel fcb $01,$02,$04,$40 | |
332 | |
0 | 333 L020D lbsr L02EB |
233 | 334 lda <PD.DRV,y $21,y |
243 | 335 cmpa #MaxDrv |
0 | 336 bcs L021B |
337 comb | |
338 ldb #E$Unit | |
339 rts | |
233 | 340 |
0 | 341 L021B pshs x,b,a |
233 | 342 leax >DrvSel,pcr |
0 | 343 ldb a,x |
243 | 344 stb >DrivSel,u |
345 leax DRVBEG,u | |
233 | 346 ldb #DRVMEM |
0 | 347 mul |
348 leax d,x | |
243 | 349 cmpx >CurDMem,u |
0 | 350 beq L023C |
243 | 351 stx >CurDMem,u |
0 | 352 com >u00AA,u |
353 L023C puls pc,x,b,a | |
354 L023E ldb >DPort+8 | |
355 L0241 bitb #$F8 | |
356 beq L0259 | |
357 bitb #$80 | |
358 bne L025B | |
359 bitb #$40 | |
360 bne L025F | |
361 bitb #$20 | |
362 bne L0263 | |
363 bitb #$10 | |
364 bne L0267 | |
365 bitb #$08 | |
366 bne L026B | |
367 L0259 clrb | |
368 rts | |
369 L025B comb | |
370 ldb #E$NotRdy | |
371 rts | |
372 L025F comb | |
373 ldb #E$WP | |
374 rts | |
375 L0263 comb | |
376 ldb #E$Write | |
377 rts | |
378 L0267 comb | |
379 ldb #E$Seek | |
380 rts | |
381 L026B comb | |
382 ldb #E$CRC | |
383 rts | |
384 L026F comb | |
385 ldb #E$Read | |
386 rts | |
387 L0273 bsr L0292 | |
388 L0275 ldb >DPort+8 | |
389 bitb #$01 | |
390 beq L029A | |
391 ldd #$00F0 | |
392 std >u00AD,u | |
393 bra L0275 | |
394 L0285 lda #$08 | |
243 | 395 ora >DrivSel,u |
0 | 396 sta >DPort |
397 stb >DPort+8 | |
398 rts | |
399 L0292 bsr L0285 | |
400 L0294 lbsr L0297 | |
401 L0297 lbsr L029A | |
402 L029A rts | |
403 | |
404 * SetStat | |
405 * | |
406 * Entry: | |
407 * A = function code | |
408 * Y = address of path descriptor | |
409 * U = address of device memory area | |
410 * | |
411 * Exit: | |
412 * CC = carry set on error | |
413 * B = error code | |
414 * | |
233 | 415 SetStat ldx PD.RGS,y |
416 ldb R$B,x | |
417 cmpb #SS.Reset | |
0 | 418 beq L02D0 |
233 | 419 cmpb #SS.WTrk |
0 | 420 beq L02AB |
421 comb | |
422 ldb #E$UnkSvc | |
423 L02AA rts | |
424 L02AB lbsr L020D | |
243 | 425 ldb >DrivSel,u |
208
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
426 lbra L0341 |
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
427 nop |
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
428 L02B6 bls L02BA |
0 | 429 orb #$10 |
243 | 430 L02BA stb >DrivSel,u |
431 ldx >CurDMem,u | |
0 | 432 lbsr L01E1 |
433 bcs L02AA | |
233 | 434 ldx PD.RGS,y |
435 ldx R$X,x | |
0 | 436 ldb #$F0 |
437 lbra L0131 | |
438 L02D0 lbsr L020D | |
243 | 439 ldx >CurDMem,u |
0 | 440 clr <$15,x |
441 lda #$05 | |
208
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
442 L02DC ldb #$40 |
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
443 nop |
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
444 nop |
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
445 nop |
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
446 lbsr L0374 |
0 | 447 deca |
448 bne L02DC | |
208
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
449 clrb |
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
450 lbra L036C |
0 | 451 L02EB pshs y,x,b,a |
452 lda <D.DskTmr | |
453 bmi L0301 | |
454 bne L0309 | |
455 lda #$08 | |
456 sta >DPort | |
457 ldx #$A000 | |
458 L02FB nop | |
459 nop | |
460 leax -$01,x | |
461 bne L02FB | |
462 L0301 bsr L0312 | |
463 bcc L0309 | |
464 ldb #$80 | |
465 stb <D.DskTmr | |
466 L0309 ldd #$00F0 | |
467 std >u00AD,u | |
468 puls pc,y,x,b,a | |
233 | 469 |
0 | 470 L0312 lda #$01 |
471 sta <D.DskTmr | |
472 ldx #$0001 | |
473 leay >u00AD,u | |
474 clr $04,y | |
475 ldd #$00F0 | |
476 os9 F$VIRQ | |
477 rts | |
233 | 478 |
479 IRQRtn pshs a | |
0 | 480 tst <D.DMAReq |
481 beq L0330 | |
482 bsr L0312 | |
483 bra L033F | |
484 L0330 clr >DPort | |
243 | 485 lda >DevStRg,u |
0 | 486 anda #$FE |
243 | 487 sta >DevStRg,u |
0 | 488 clr <D.DskTmr |
489 L033F puls pc,a | |
490 | |
243 | 491 L0341 lda R$Y+1,x get density byte |
492 bita #DNS.MFM | |
208
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
493 bne L0349 |
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
494 orb #$40 |
243 | 495 L0349 lda R$U+1,x get track lo-byte |
208
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
496 cmpa #$15 |
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
497 lbra L02B6 |
233 | 498 |
243 | 499 L0350 lda <DD.FMT,x |
500 bita #DNS.MFM | |
208
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
501 beq L0365 |
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
502 lsr ,s |
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
503 bcc L0365 |
243 | 504 lda >DrivSel,u |
208
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
505 ora #$40 |
243 | 506 sta >DrivSel,u |
208
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
507 L0365 puls a |
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
508 cmpa #$15 |
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
509 lbra L01CD |
243 | 510 |
511 L036C orb <PD.STP,y | |
208
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
512 lbra L0273 |
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
513 L0372 addb #$10 |
243 | 514 L0374 orb <PD.STP,y |
208
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
515 pshs a |
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
516 lbsr L0273 |
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
517 puls a |
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
518 rts |
d3107f6c407b
ccdisk.asm now has code from Rainbow October 1988 page 157 for double
boisy
parents:
201
diff
changeset
|
519 |
0 | 520 emod |
521 eom equ * | |
522 end | |
523 |