0
|
1 ********************************************************************
|
|
2 * SDisk - D.P. Johnson floppy driver for CoCo
|
|
3 *
|
|
4 * $Id$
|
|
5 *
|
|
6 * Ed. Comments Who YY/MM/DD
|
|
7 * ------------------------------------------------------------------
|
|
8 * 18 D.P. Johnson original version
|
|
9
|
|
10 nam SDisk
|
|
11 ttl D.P. Johnson floppy driver for CoCo
|
|
12
|
|
13 ifp1
|
|
14 use defsfile
|
|
15 endc
|
|
16
|
|
17 tylg set Drivr+Objct
|
|
18 atrv set ReEnt+rev
|
|
19 rev set $02
|
|
20 edition set $12
|
|
21
|
|
22 mod eom,name,tylg,atrv,start,size
|
|
23
|
|
24 rmb DRVBEG+(DRVMEM*3)
|
|
25 u0081 rmb 2
|
|
26 u0083 rmb 1
|
|
27 u0084 rmb 1
|
|
28 u0085 rmb 1
|
|
29 u0086 rmb 1
|
|
30 u0087 rmb 1
|
|
31 u0088 rmb 2
|
|
32 u008A rmb 2
|
|
33 u008C rmb 1
|
|
34 u008D rmb 1
|
|
35 u008E rmb 1
|
|
36 size equ .
|
|
37
|
|
38 fcb $FF
|
|
39
|
|
40 name fcs /SDisk/
|
|
41 fcb edition
|
|
42
|
|
43 fcc "Copyright 1984 D.P.Johnson"
|
|
44 fcb $0D
|
|
45 fcc "ALL RIGHTS RESERVED"
|
|
46
|
|
47 start lbra Init
|
|
48 lbra Read
|
|
49 lbra Write
|
|
50 lbra GetStat
|
|
51 lbra SetStat
|
|
52 lbra Term
|
|
53
|
|
54 Init clra
|
|
55 sta >D.DskTmr
|
|
56 sta >u0086,u
|
|
57 lda #$D0
|
|
58 sta >$FF48
|
|
59 lbsr L0419
|
|
60 lda >$FF48
|
|
61 lda #$FF
|
|
62 ldb #$03
|
|
63 leax DRVBEG,u
|
|
64 L006D sta $01,x
|
|
65 sta <$15,x
|
|
66 leax <$26,x
|
|
67 decb
|
|
68 bne L006D
|
|
69 leax >L0235,pcr
|
|
70 stx >$010A
|
|
71 lda #$7E
|
|
72 sta >$0109
|
|
73 ldd #256
|
|
74 pshs u
|
|
75 os9 F$SRqMem
|
|
76 tfr u,x
|
|
77 puls u
|
|
78 bcs L0097
|
|
79 stx >u0088,u
|
|
80 clrb
|
|
81 L0097 rts
|
|
82
|
|
83 Term ldu >u0088,u
|
|
84 ldd #256
|
|
85 os9 F$SRtMem
|
|
86 L00A2 rts
|
|
87
|
|
88 Read lbsr L0150
|
|
89 lda #$91
|
|
90 cmpx #$0000 LSN0?
|
|
91 bne L00D5 branch if not
|
|
92 bsr L00D5
|
|
93 bcs L00A2
|
|
94 tst >u0086,u
|
|
95 bne L00A2
|
|
96 ldx $08,y
|
|
97 pshs y,x
|
|
98 ldy >u0081,u
|
|
99 ldb #$14
|
|
100 L00C2 lda b,x
|
|
101 sta b,y
|
|
102 decb
|
|
103 bpl L00C2
|
|
104 clrb
|
|
105 puls pc,y,x
|
|
106 L00CC bcc L00D5
|
|
107 pshs x,b,a
|
|
108 lbsr L04D4
|
|
109 puls x,b,a
|
|
110 L00D5 pshs x,b,a
|
|
111 bsr L00E0
|
|
112 puls x,b,a
|
|
113 bcc L00A2
|
|
114 lsra
|
|
115 bne L00CC
|
|
116 L00E0 lbsr L02A5
|
|
117 bcs L00A2
|
|
118 ldx $08,y
|
|
119 pshs y,cc
|
|
120 orcc #IntMasks
|
|
121 ldy #$0000
|
|
122 ldb #$80
|
|
123 stb >$FF48
|
|
124 ldb #$08
|
|
125 orb >u0085,u
|
|
126 stb >$FF40
|
|
127 ldb #$88
|
|
128 orb >u0085,u
|
|
129 lbsr L041C
|
|
130 lda #$02
|
|
131 tst >u0084,u
|
|
132 beq L012F
|
|
133 L010E bita >$FF48
|
|
134 bne L0125
|
|
135 leay -$01,y
|
|
136 bne L010E
|
|
137 L0117 lda >u0085,u
|
|
138 ora #$08
|
|
139 sta >$FF40
|
|
140 puls y,cc
|
|
141 lbra L026A
|
|
142 L0125 lda >$FF4B
|
|
143 sta ,x+
|
|
144 stb >$FF40
|
|
145 bra L0125
|
|
146 L012F ldb >u008D,u
|
|
147 L0133 bita >$FF48
|
|
148 bne L0145
|
|
149 leay -$01,y
|
|
150 bne L0133
|
|
151 bra L0117
|
|
152 L013E lda #$02
|
|
153 bita >$FF48
|
|
154 beq L013E
|
|
155 L0145 lda >$FF4B
|
|
156 sta ,x+
|
|
157 decb
|
|
158 bne L013E
|
|
159 lbra L0237
|
|
160 L0150 clr >u008D,u
|
|
161 clr >u008C,u
|
|
162 rts
|
|
163
|
|
164 Write bsr L0150
|
|
165 L015B lda #$91
|
|
166 L015D pshs x,b,a
|
|
167 bsr L017F
|
|
168 puls x,b,a
|
|
169 bcs L0171
|
|
170 tst <$28,y
|
|
171 bne L016F
|
|
172 lbsr L026E
|
|
173 bcs L0171
|
|
174 L016F clrb
|
|
175 L0170 rts
|
|
176 L0171 lsra
|
|
177 beq L01C1
|
|
178 bcc L015D
|
|
179 pshs x,b,a
|
|
180 lbsr L04D4
|
|
181 puls x,b,a
|
|
182 bra L015D
|
|
183 L017F lbsr L02A5
|
|
184 bcs L0170
|
|
185 ldx $08,y
|
|
186 ldb #$A0
|
|
187 pshs y,cc
|
|
188 orcc #IntMasks
|
|
189 ldy #$0000
|
|
190 stb >$FF48
|
|
191 ldb #$08
|
|
192 orb >u0085,u
|
|
193 stb >$FF40
|
|
194 ldb #$88
|
|
195 orb >u0085,u
|
|
196 lbsr L041C
|
|
197 lda #$02
|
|
198 tst >u0084,u
|
|
199 beq L01CE
|
|
200 L01AD bita >$FF48
|
|
201 bne L01C4
|
|
202 leay -$01,y
|
|
203 bne L01AD
|
|
204 L01B6 lda >u0085,u
|
|
205 ora #$08
|
|
206 sta >$FF40
|
|
207 puls y,cc
|
|
208 L01C1 lbra L0266
|
|
209 L01C4 lda ,x+
|
|
210 sta >$FF4B
|
|
211 stb >$FF40
|
|
212 bra L01C4
|
|
213 L01CE ldb >u008D,u
|
|
214 L01D2 bita >$FF48
|
|
215 bne L01E4
|
|
216 leay -$01,y
|
|
217 bne L01D2
|
|
218 bra L01B6
|
|
219 L01DD lda #$02
|
|
220 L01DF bita >$FF48
|
|
221 beq L01DF
|
|
222 L01E4 lda ,x+
|
|
223 sta >$FF4B
|
|
224 decb
|
|
225 bne L01DD
|
|
226 bra L0237
|
|
227 L01EE pshs y,cc
|
|
228 orcc #IntMasks
|
|
229 ldy #$0000
|
|
230 stb >$FF48
|
|
231 ldb #$08
|
|
232 orb >u0085,u
|
|
233 stb >$FF40
|
|
234 ldb #$88
|
|
235 orb >u0085,u
|
|
236 lbsr L041C
|
|
237 lda #$02
|
|
238 tst >u0084,u
|
|
239 bne L01AD
|
|
240 ldb #$01
|
|
241 L0215 bita >$FF48
|
|
242 bne L022E
|
|
243 leay -$01,y
|
|
244 bne L0215
|
|
245 bra L01B6
|
|
246 L0220 lda #$02
|
|
247 L0222 bita >$FF48
|
|
248 bne L022E
|
|
249 bitb >$FF48
|
|
250 bne L0222
|
|
251 bra L0237
|
|
252 L022E lda ,x+
|
|
253 sta >$FF4B
|
|
254 bra L0220
|
|
255 L0235 leas $0C,s
|
|
256 L0237 puls y,cc
|
|
257 ldb >$FF48
|
|
258 bitb #$FC
|
|
259 beq L0260
|
|
260 bitb #$04
|
|
261 bne L026A
|
|
262 lda #$F6
|
|
263 bitb #$80
|
|
264 bne L0262
|
|
265 lda #$F2
|
|
266 bitb #$40
|
|
267 bne L0262
|
|
268 bitb #$20
|
|
269 bne L0266
|
|
270 lda #$F7
|
|
271 bitb #$10
|
|
272 bne L0262
|
|
273 lda #$F3
|
|
274 bitb #$08
|
|
275 bne L0262
|
|
276 L0260 clrb
|
|
277 rts
|
|
278 L0262 comb
|
|
279 tfr a,b
|
|
280 rts
|
|
281 L0266 comb
|
|
282 ldb #$F5
|
|
283 rts
|
|
284 L026A comb
|
|
285 ldb #$F4
|
|
286 rts
|
|
287 L026E pshs x,b,a
|
|
288 ldx $08,y
|
|
289 pshs x
|
|
290 ldx >u0088,u
|
|
291 stx $08,y
|
|
292 ldx $04,s
|
|
293 lbsr L00E0
|
|
294 puls x
|
|
295 stx $08,y
|
|
296 bcs L02A3
|
|
297 lda #$20
|
|
298 pshs u,y,a
|
|
299 ldy >u0088,u
|
|
300 tfr x,u
|
|
301 L0290 ldx ,u
|
|
302 cmpx ,y
|
|
303 bne L02A0
|
|
304 leau 8,u
|
|
305 leay $08,y
|
|
306 dec ,s
|
|
307 bne L0290
|
|
308 bra L02A1
|
|
309 L02A0 coma
|
|
310 L02A1 puls u,y,a
|
|
311 L02A3 puls pc,x,b,a
|
|
312 L02A5 clr >u0087,u
|
|
313 lbsr L03C1
|
|
314 tst >u008C,u
|
|
315 beq L02D3
|
|
316 ldx $06,y
|
|
317 ldd $06,x
|
|
318 bitb #$01
|
|
319 beq L02BE
|
|
320 com >u0083,u
|
|
321 L02BE bitb #$02
|
|
322 beq L02C8
|
|
323 lda #$20
|
|
324 sta >u0084,u
|
|
325 L02C8 ldd $08,x
|
|
326 stb >$FF4A
|
|
327 ldx >u0081,u
|
|
328 bra L034E
|
|
329 L02D3 tstb
|
|
330 bne L02E7
|
|
331 tfr x,d
|
|
332 ldx >u0081,u
|
|
333 cmpd #$0000
|
|
334 beq L0329
|
|
335 cmpd $01,x
|
|
336 bcs L02EB
|
|
337 L02E7 comb
|
|
338 ldb #$F1
|
|
339 rts
|
|
340 L02EB subd <$2B,y
|
|
341 bcc L02F5
|
|
342 addd <$2B,y
|
|
343 bra L0329
|
|
344 L02F5 clr ,-s
|
|
345 pshs b
|
|
346 ldb <$10,x
|
|
347 lsrb
|
|
348 puls b
|
|
349 bcc L0310
|
|
350 L0301 com >u0083,u
|
|
351 bne L0309
|
|
352 inc ,s
|
|
353 L0309 subd <$11,x
|
|
354 bcc L0301
|
|
355 bra L0317
|
|
356 L0310 inc ,s
|
|
357 subd <$11,x
|
|
358 bcc L0310
|
|
359 L0317 lda <$10,x
|
|
360 bita #$02
|
|
361 beq L0324
|
|
362 lda #$20
|
|
363 sta >u0084,u
|
|
364 L0324 puls a
|
|
365 addb <$12,x
|
|
366 L0329 pshs a
|
|
367 lda <$23,y
|
|
368 bita #$20
|
|
369 beq L0342
|
|
370 incb
|
|
371 lda #$20
|
|
372 sta >u0084,u
|
|
373 lda #$15
|
|
374 cmpa ,s
|
|
375 bcc L0342
|
|
376 lbsr L04BF
|
|
377 L0342 puls a
|
|
378 stb >$FF4A
|
|
379 L0347 ldb <$10,x
|
|
380 stb >u008E,u
|
|
381 L034E pshs a
|
|
382 ldb <$15,x
|
|
383 pshs b
|
|
384 ldb >u008E,u
|
|
385 lsrb
|
|
386 bitb #$02
|
|
387 beq L036B
|
|
388 eorb <$24,y
|
|
389 bitb #$02
|
|
390 beq L0375
|
|
391 leas $02,s
|
|
392 comb
|
|
393 ldb #$F9
|
|
394 rts
|
|
395 L036B eorb <$24,y
|
|
396 bitb #$02
|
|
397 beq L0375
|
|
398 lsla
|
|
399 lsl ,s
|
|
400 L0375 puls b
|
|
401 stb >$FF49
|
|
402 tst >u0087,u
|
|
403 bne L0387
|
|
404 ldb ,s
|
|
405 cmpb <$15,x
|
|
406 beq L03A2
|
|
407 L0387 sta <$15,x
|
|
408 sta >$FF4B
|
|
409 ldb #$1B
|
|
410 eorb <$22,y
|
|
411 bsr L03FA
|
|
412 pshs b,a
|
|
413 lda #$1E
|
|
414 L0398 ldb #$B2
|
|
415 L039A decb
|
|
416 bne L039A
|
|
417 deca
|
|
418 bne L0398
|
|
419 puls b,a
|
|
420 L03A2 puls a
|
|
421 sta <$15,x
|
|
422 sta >$FF49
|
|
423 ldb #$40
|
|
424 andb >u0083,u
|
|
425 orb >u0084,u
|
|
426 orb >u0085,u
|
|
427 stb >u0085,u
|
|
428 clrb
|
|
429 rts
|
|
430 L03BE fcb $01,$02,$04
|
|
431 L03C1 lbsr L04F8
|
|
432 lda <$21,y
|
|
433 cmpa #$03
|
|
434 bcs L03CF
|
|
435 comb
|
|
436 ldb #$F0
|
|
437 rts
|
|
438 L03CF pshs x,b,a
|
|
439 leax >L03BE,pcr
|
|
440 ldb a,x
|
|
441 stb >u0085,u
|
|
442 leax DRVBEG,u
|
|
443 ldb #$26
|
|
444 mul
|
|
445 leax d,x
|
|
446 cmpx >u0081,u
|
|
447 beq L03F0
|
|
448 stx >u0081,u
|
|
449 com >u0087,u
|
|
450 L03F0 clr >u0083,u
|
|
451 clr >u0084,u
|
|
452 puls pc,x,b,a
|
|
453 L03FA bsr L0417
|
|
454 L03FC ldb >$FF48
|
|
455 bitb #$01
|
|
456 beq L041F
|
|
457 lda #$F0
|
|
458 sta >$006F
|
|
459 bra L03FC
|
|
460 L040A lda #$08
|
|
461 ora >u0085,u
|
|
462 sta >$FF40
|
|
463 stb >$FF48
|
|
464 rts
|
|
465 L0417 bsr L040A
|
|
466 L0419 lbsr L041C
|
|
467 L041C lbsr L041F
|
|
468 L041F rts
|
|
469
|
|
470 GetStat ldx $06,y
|
|
471 ldb $02,x
|
|
472 cmpb #$80
|
|
473 bne L046F
|
|
474 bsr L0439
|
|
475 lda #$91
|
|
476 lbsr L00D5
|
|
477 L042F pshs b,cc
|
|
478 ldd >u008A,u
|
|
479 std $08,y
|
|
480 puls pc,b,cc
|
|
481 L0439 ldd $08,y
|
|
482 std >u008A,u
|
|
483 lda #$01
|
|
484 sta >u008C,u
|
|
485 ldx $06,y
|
|
486 ldd $04,x
|
|
487 std $08,y
|
|
488 ldd $06,x
|
|
489 sta >u008D,u
|
|
490 stb >u008E,u
|
|
491 rts
|
|
492
|
|
493 SetStat ldx $06,y
|
|
494 ldb $02,x
|
|
495 cmpb #$03
|
|
496 beq L04D4
|
|
497 cmpb #$04
|
|
498 beq L0482
|
|
499 cmpb #$0A
|
|
500 beq L0473
|
|
501 clra
|
|
502 cmpb #$81
|
|
503 beq L0475
|
|
504 cmpb #$80
|
|
505 beq L047B
|
|
506 L046F comb
|
|
507 ldb #$D0
|
|
508 L0472 rts
|
|
509 L0473 lda #$FF
|
|
510 L0475 sta >u0086,u
|
|
511 clrb
|
|
512 L047A rts
|
|
513 L047B bsr L0439
|
|
514 lbsr L015B
|
|
515 bra L042F
|
|
516 L0482 lbsr L03C1
|
|
517 bcs L0472
|
|
518 lda $09,x
|
|
519 ldb <$23,y
|
|
520 bitb #$20
|
|
521 beq L0496
|
|
522 cmpa #$15
|
|
523 bls L0496
|
|
524 bsr L04BF
|
|
525 L0496 ldb $07,x
|
|
526 ldx >u0081,u
|
|
527 stb <$10,x
|
|
528 bitb #$01
|
|
529 beq L04A7
|
|
530 com >u0083,u
|
|
531 L04A7 bitb #$02
|
|
532 beq L04B1
|
|
533 ldb #$20
|
|
534 stb >u0084,u
|
|
535 L04B1 lbsr L0347
|
|
536 bcs L0472
|
|
537 ldx $06,y
|
|
538 ldx $04,x
|
|
539 ldb #$F0
|
|
540 lbra L01EE
|
|
541 L04BF pshs a
|
|
542 lda <$26,y
|
|
543 cmpa #$23
|
|
544 bne L04D2
|
|
545 lda >u0085,u
|
|
546 ora #$10
|
|
547 sta >u0085,u
|
|
548 L04D2 puls pc,a
|
|
549 L04D4 lbsr L03C1
|
|
550 bcs L047A
|
|
551 ldx >u0081,u
|
|
552 clr <$15,x
|
|
553 lda #$05
|
|
554 L04E2 ldb #$4B
|
|
555 pshs a
|
|
556 eorb <$22,y
|
|
557 bsr L04F5
|
|
558 puls a
|
|
559 deca
|
|
560 bne L04E2
|
|
561 ldb #$0B
|
|
562 eorb <$22,y
|
|
563 L04F5 lbra L03FA
|
|
564 L04F8 pshs x,b,a
|
|
565 lda >$006F
|
|
566 bne L050D
|
|
567 lda #$08
|
|
568 sta >$FF40
|
|
569 ldx #$A000
|
|
570 L0507 nop
|
|
571 nop
|
|
572 leax -$01,x
|
|
573 bne L0507
|
|
574 L050D lda #$F0
|
|
575 sta >$006F
|
|
576 puls pc,x,b,a
|
|
577 fcb $01
|
|
578 fcb $E9 i
|
|
579
|
|
580 emod
|
|
581 eom equ *
|
|
582 end
|