151
|
1 ********************************************************************
|
|
2 * CCHDisk - Tandy hard disk driver
|
|
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
|
151
|
9
|
0
|
10 nam CCHDisk
|
|
11 ttl Tandy hard disk driver
|
|
12
|
|
13 * Disassembled 98/08/23 17:28:39 by Disasm v1.6 (C) 1988 by RML
|
|
14
|
|
15 ifp1
|
|
16 use defsfile
|
|
17 use rbfdefs
|
|
18 endc
|
|
19
|
|
20 tylg set Drivr+Objct
|
|
21 atrv set ReEnt+rev
|
|
22 rev set $01
|
201
|
23 edition set 4
|
0
|
24
|
|
25 mod eom,name,tylg,atrv,start,size
|
|
26
|
257
|
27 rmb DRVBEG
|
0
|
28 u000F rmb 91
|
|
29 u006A rmb 61
|
|
30 u00A7 rmb 2
|
|
31 u00A9 rmb 1
|
|
32 u00AA rmb 1
|
|
33 u00AB rmb 2
|
|
34 u00AD rmb 2
|
|
35 u00AF rmb 1
|
|
36 u00B0 rmb 1
|
|
37 u00B1 rmb 1
|
|
38 u00B2 rmb 1
|
|
39 u00B3 rmb 1
|
|
40 u00B4 rmb 1
|
|
41 u00B5 rmb 1
|
|
42 u00B6 rmb 1
|
|
43 u00B7 rmb 1
|
|
44 u00B8 rmb 1
|
|
45 u00B9 rmb 1
|
|
46 u00BA rmb 1
|
|
47 u00BB rmb 1
|
|
48 u00BC rmb 2
|
|
49 u00BE rmb 1
|
|
50 u00BF rmb 2
|
|
51 u00C1 rmb 2
|
|
52 size equ .
|
256
|
53
|
|
54 fcb DIR.+SHARE.+PREAD.+PWRIT.+PEXEC.+READ.+WRITE.+EXEC.
|
0
|
55
|
|
56 name fcs /CCHDisk/
|
|
57 fcb edition
|
|
58
|
|
59 start lbra Init
|
|
60 lbra Read
|
|
61 lbra Write
|
|
62 lbra GetStat
|
|
63 lbra SetStat
|
|
64 lbra Term
|
|
65
|
|
66 * Init
|
|
67 *
|
|
68 * Entry:
|
|
69 * Y = address of device descriptor
|
|
70 * U = address of device memory area
|
|
71 *
|
|
72 * Exit:
|
|
73 * CC = carry set on error
|
|
74 * B = error code
|
|
75 *
|
|
76 Init lbsr L04D4
|
|
77 lda >$FF51
|
|
78 cmpa #$08
|
|
79 beq L0037
|
|
80 comb
|
|
81 ldb #E$NotRdy
|
|
82 bra L0083
|
|
83 L0037 lbsr L04C0
|
|
84 bcs L0083
|
|
85 ldd #$FFFF
|
|
86 std >u00A9,u
|
|
87 std >u00A7,u
|
|
88 leax <$25,y
|
|
89 ldd ,x++
|
|
90 sta >u00B3,u
|
|
91 stb >u00BE,u
|
|
92 ldd ,x++
|
|
93 std >u00BF,u
|
|
94 ldd ,x++
|
|
95 std >u00C1,u
|
|
96 lda ,x
|
|
97 sta >u00B2,u
|
|
98 lda #$04
|
|
99 leay u000F,u
|
|
100 ldb #$FF
|
|
101 L006C stb ,y
|
|
102 stb <$15,y
|
|
103 leay <$26,y
|
|
104 deca
|
|
105 bne L006C
|
|
106 ldd #256
|
|
107 pshs u
|
|
108 os9 F$SRqMem
|
|
109 tfr u,x
|
|
110 puls u
|
|
111 L0083 bcs L00C7
|
|
112 stx >u00AB,u
|
|
113 leax >$0100,x
|
|
114 stx >u00AD,u
|
|
115 bra L00C6
|
|
116
|
|
117 * Term
|
|
118 *
|
|
119 * Entry:
|
|
120 * U = address of device memory area
|
|
121 *
|
|
122 * Exit:
|
|
123 * CC = carry set on error
|
|
124 * B = error code
|
|
125 *
|
|
126 Term pshs u
|
|
127 ldu >u00AB,u
|
|
128 ldd #256
|
|
129 os9 F$SRtMem
|
|
130 puls u
|
|
131
|
|
132 * GetStat
|
|
133 *
|
|
134 * Entry:
|
|
135 * A = function code
|
|
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 GetStat clrb
|
|
144 rts
|
|
145
|
|
146 * Read
|
|
147 *
|
|
148 * Entry:
|
|
149 * B = MSB of the disk's LSN
|
|
150 * X = LSB of the disk's LSN
|
|
151 * Y = address of path descriptor
|
|
152 * U = address of device memory area
|
|
153 *
|
|
154 * Exit:
|
|
155 * CC = carry set on error
|
|
156 * B = error code
|
|
157 *
|
|
158 Read lbsr L04D4
|
|
159 cmpx #$0000
|
|
160 bne L00CB
|
|
161 tstb
|
|
162 bne L00CB
|
|
163 bsr L00D1
|
|
164 bcs L00C7
|
|
165 ldx $08,y
|
|
166 pshs y,x
|
|
167 ldy >u00A7,u
|
|
168 ldb #$14
|
|
169 L00BD lda b,x
|
|
170 sta b,y
|
|
171 decb
|
|
172 bpl L00BD
|
|
173 puls y,x
|
|
174 L00C6 clrb
|
|
175 L00C7 lbsr L04E1
|
|
176 rts
|
|
177 L00CB bsr L00D1
|
|
178 bcs L00C7
|
|
179 bra L00C6
|
|
180 L00D1 lbsr L033F
|
|
181 bcs L00E3
|
|
182 ldx $08,y
|
|
183 lda #$02
|
|
184 sta >u00B9,u
|
|
185 lda #$20
|
|
186 lbsr L028C
|
|
187 L00E3 rts
|
|
188
|
|
189 * Write
|
|
190 *
|
|
191 * Entry:
|
|
192 * B = MSB of the disk's LSN
|
|
193 * X = LSB of the disk's LSN
|
|
194 * Y = address of path descriptor
|
|
195 * U = address of device memory area
|
|
196 *
|
|
197 * Exit:
|
|
198 * CC = carry set on error
|
|
199 * B = error code
|
|
200 *
|
|
201 Write lbsr L04D4
|
|
202 bsr L014A
|
|
203 bcs L00C7
|
|
204 pshs x,b
|
|
205 bsr L0100
|
|
206 puls x,b
|
|
207 bcs L00C7
|
|
208 tst <$28,y
|
|
209 bne L00C6
|
|
210 bsr L0113
|
|
211 bcc L00C6
|
|
212 ldb <$00F5
|
|
213 bra L00C7
|
|
214 L0100 lbsr L033F
|
|
215 bcs L0112
|
|
216 lda #$03
|
|
217 sta >u00B9,u
|
|
218 lda #$30
|
|
219 ldx $08,y
|
|
220 lbsr L028C
|
|
221 L0112 rts
|
|
222 L0113 pshs x,b,a
|
|
223 ldx $08,y
|
|
224 pshs x
|
|
225 ldx >u00AB,u
|
|
226 stx $08,y
|
|
227 ldx $04,s
|
|
228 bsr L00D1
|
|
229 puls x
|
|
230 stx $08,y
|
|
231 bcs L0148
|
|
232 lda #$20
|
|
233 pshs u,y,a
|
|
234 ldy >u00AB,u
|
|
235 tfr x,u
|
|
236 L0134 ldx ,u
|
|
237 cmpx ,y
|
|
238 bne L0144
|
257
|
239 leau $08,u
|
0
|
240 leay $08,y
|
|
241 dec ,s
|
|
242 bne L0134
|
|
243 bra L0146
|
|
244 L0144 orcc #Carry
|
|
245 L0146 puls u,y,a
|
|
246 L0148 puls pc,x,b,a
|
|
247 L014A pshs b
|
|
248 ldb >$FF50
|
|
249 beq L0179
|
|
250 lda <$21,y
|
|
251 bne L015C
|
|
252 andb #$80
|
|
253 bne L0174
|
|
254 bra L0179
|
|
255 L015C cmpa #$01
|
|
256 bne L0166
|
|
257 andb #$40
|
|
258 bne L0174
|
|
259 bra L0179
|
|
260 L0166 cmpa #$02
|
|
261 bne L0170
|
|
262 andb #$20
|
|
263 bne L0174
|
|
264 bra L0179
|
|
265 L0170 andb #$10
|
|
266 beq L0179
|
|
267 L0174 comb
|
|
268 ldb #E$WP
|
|
269 stb ,s
|
|
270 L0179 puls pc,b
|
|
271
|
|
272 * SetStat
|
|
273 *
|
|
274 * Entry:
|
|
275 * A = function code
|
|
276 * Y = address of path descriptor
|
|
277 * U = address of device memory area
|
|
278 *
|
|
279 * Exit:
|
|
280 * CC = carry set on error
|
|
281 * B = error code
|
|
282 *
|
|
283 SetStat lbsr L04D4
|
|
284 lbsr L0460
|
|
285 ldx PD.RGS,y
|
|
286 ldb R$B,x
|
|
287 cmpb #SS.Reset
|
|
288 bne L018E
|
|
289 lbsr L04A5
|
|
290 bra L01A1
|
|
291 L018E cmpb #SS.WTrk
|
|
292 bne L0196
|
|
293 bsr L01B5
|
|
294 bra L01A1
|
|
295 L0196 cmpb #SS.SQD
|
|
296 bne L019E
|
|
297 bsr L01A8
|
|
298 bra L01A1
|
|
299 L019E comb
|
|
300 ldb #E$UnkSvc
|
|
301 L01A1 lbcs L00C7
|
|
302 lbra L00C6
|
|
303
|
|
304 L01A8 ldd <$25,y
|
|
305 exg a,b
|
|
306 std >u00B6,u
|
|
307 lbsr L0496
|
|
308 rts
|
|
309
|
|
310 L01B5 ldd $8,x
|
|
311 cmpd #$0000
|
|
312 bne L01C3
|
|
313 ldd $6,x
|
|
314 cmpa #$00
|
|
315 beq L01C5
|
|
316 L01C3 clrb
|
|
317 rts
|
|
318 L01C5 pshs u,y,x
|
|
319 clr >u00AF,u
|
|
320 clr >u00B0,u
|
|
321 clr >u00B1,u
|
|
322 lda <$2A,y
|
|
323 bsr L023D
|
|
324 L01D8 lda <$2A,y
|
|
325 sta >u00B4,u
|
|
326 lda >u00B2,u
|
|
327 sta >u00B5,u
|
|
328 lda >u00B8,u
|
|
329 anda #$F8
|
|
330 sta >u00B8,u
|
|
331 lda >u00B1,u
|
|
332 ora >u00B8,u
|
|
333 sta >u00B8,u
|
|
334 ldd >u00AF,u
|
|
335 exg a,b
|
|
336 std >u00B6,u
|
|
337 lda #$03
|
|
338 sta >u00B9,u
|
|
339 lda #$50
|
|
340 ldx >u00AB,u
|
|
341 bsr L028C
|
|
342 bcs L023B
|
|
343 lda >u00B1,u
|
|
344 inca
|
|
345 sta >u00B1,u
|
|
346 cmpa <$27,y
|
|
347 bcs L01D8
|
|
348 clr >u00B1,u
|
|
349 ldd >u00AF,u
|
|
350 addd #$0001
|
|
351 std >u00AF,u
|
|
352 cmpd <$25,y
|
|
353 bcs L01D8
|
|
354 clrb
|
|
355 L023B puls pc,u,y,x
|
|
356 L023D pshs y,x,b,a
|
|
357 ldb <$2D,y
|
|
358 stb >u00BB,u
|
|
359 sta >u00BA,u
|
|
360 lsla
|
|
361 ldx >u00AB,u
|
|
362 leay a,x
|
|
363 nega
|
|
364 pshs y,x,b,a
|
|
365 clra
|
|
366 L0255 clr ,x
|
|
367 sta $01,x
|
|
368 inca
|
|
369 cmpa >u00BA,u
|
|
370 beq L0278
|
|
371 ldb >u00BB,u
|
|
372 lslb
|
|
373 abx
|
|
374 cmpx $04,s
|
|
375 bcs L026E
|
|
376 ldb ,s
|
|
377 leax b,x
|
|
378 L026E cmpx $02,s
|
|
379 bne L0255
|
|
380 leax $02,x
|
|
381 stx $02,s
|
|
382 bra L0255
|
|
383 L0278 ldy $04,s
|
|
384 lda #$00
|
|
385 L027D cmpy >u00AD,u
|
|
386 beq L0288
|
|
387 sta ,y+
|
|
388 bra L027D
|
|
389 L0288 leas $06,s
|
|
390 puls pc,y,x,b,a
|
|
391 L028C pshs y,x,a
|
|
392 leax >u00B3,u
|
|
393 ldy #$FF59
|
|
394 ldb #$06
|
|
395 L0298 lda ,x+
|
|
396 sta ,y+
|
|
397 decb
|
|
398 bne L0298
|
|
399 lda ,s
|
|
400 sta ,y
|
|
401 ldy $03,s
|
|
402 ldx $01,s
|
|
403 lda >u00B9,u
|
|
404 cmpa #$03
|
|
405 beq L02C6
|
|
406 bsr L02E1
|
|
407 cmpa #$02
|
|
408 beq L02BA
|
|
409 L02B6 bsr L02F2
|
|
410 puls pc,y,x,a
|
|
411 L02BA bsr L02EB
|
|
412 L02BC lda >$FF58
|
|
413 sta ,x+
|
|
414 decb
|
|
415 bne L02BC
|
|
416 bra L02B6
|
|
417 L02C6 lda ,x+
|
|
418 sta >$FF58
|
|
419 decb
|
|
420 bne L02C6
|
|
421 bsr L02E1
|
|
422 bra L02B6
|
|
423 L02D2 lda >$FF5F
|
|
424 pshs a
|
|
425 lda >$FF5F
|
|
426 cmpa ,s
|
|
427 leas $01,s
|
|
428 bne L02D2
|
|
429 rts
|
|
430 L02E1 pshs a
|
|
431 L02E3 bsr L02D2
|
|
432 anda #$80
|
|
433 bne L02E3
|
|
434 puls pc,a
|
|
435 L02EB bsr L02D2
|
|
436 bita #$08
|
|
437 beq L02EB
|
|
438 rts
|
|
439 L02F2 bsr L02D2
|
|
440 bita #$01
|
|
441 bne L02FA
|
|
442 clrb
|
|
443 rts
|
|
444 L02FA comb
|
|
445 bita #$02
|
|
446 beq L0302
|
|
447 lbsr L04F1
|
|
448 L0302 lda >$FF59
|
|
449 bita #$80
|
|
450 bne L0332
|
|
451 bita #$40
|
|
452 bne L031F
|
|
453 bita #$10
|
|
454 bne L0322
|
|
455 bita #$04
|
|
456 bne L0336
|
|
457 bita #$02
|
|
458 bne L0322
|
|
459 bita #$01
|
|
460 bne L0326
|
|
461 clrb
|
|
462 rts
|
|
463 L031F ldb #E$CRC
|
|
464 rts
|
|
465 L0322 comb
|
|
466 ldb #E$Seek
|
|
467 rts
|
|
468 L0326 comb
|
|
469 ldb #E$Read
|
|
470 rts
|
|
471 comb
|
|
472 ldb #E$Write
|
|
473 rts
|
|
474 L032E comb
|
|
475 ldb #E$NotRdy
|
|
476 rts
|
|
477 L0332 comb
|
|
478 ldb #E$Unit
|
|
479 rts
|
|
480 L0336 lda >$FF5F
|
|
481 bita #$10
|
|
482 beq L0322
|
|
483 bra L032E
|
|
484 L033F lbsr L0460
|
|
485 bcs L0346
|
|
486 bsr L0347
|
|
487 L0346 rts
|
|
488 L0347 pshs y,x,b
|
|
489 lbsr L04C0
|
|
490 lbcs L0428
|
|
491 stx >u00BC,u
|
|
492 tstb
|
|
493 bne L0380
|
|
494 cmpx #$0000
|
|
495 bne L0380
|
|
496 leax >u00B4,u
|
|
497 ldd #$0001
|
|
498 sta $01,x
|
|
499 sta $02,x
|
|
500 sta $03,x
|
|
501 stb ,x
|
|
502 lda >u00B8,u
|
|
503 anda #$F8
|
|
504 sta >u00B8,u
|
|
505 tst >u00AA,u
|
|
506 lbne L040B
|
|
507 lbra L0427
|
|
508 L0380 ldy >u00A7,u
|
|
509 cmpb ,y
|
|
510 lbhi L042E
|
|
511 bcs L0393
|
|
512 cmpx $01,y
|
|
513 lbcc L042E
|
|
514 L0393 clr >u00B6,u
|
|
515 clr >u00B7,u
|
|
516 ldb ,s
|
|
517 ldx $01,s
|
|
518 ldy $03,s
|
|
519 tstb
|
|
520 bne L03B4
|
|
521 pshs x,b,a
|
|
522 lda <$2A,y
|
|
523 ldb <$27,y
|
|
524 mul
|
|
525 subd $02,s
|
|
526 puls x,b,a
|
|
527 bhi L03D5
|
|
528 L03B4 pshs u,y,x,b,a
|
|
529 lda >u00BE,u
|
|
530 ldy >u00BF,u
|
|
531 ldu >u00C1,u
|
|
532 bsr L0435
|
|
533 ldu $06,s
|
|
534 std >u00BC,u
|
|
535 tfr x,d
|
|
536 exg a,b
|
|
537 std >u00B6,u
|
|
538 puls u,y,x,b,a
|
|
539 L03D5 clra
|
|
540 ldb <$2A,y
|
|
541 beq L042E
|
|
542 pshs b,a
|
|
543 pshs a
|
|
544 ldd >u00BC,u
|
|
545 L03E3 subd $01,s
|
|
546 bcs L03EB
|
|
547 inc ,s
|
|
548 bra L03E3
|
|
549 L03EB addd $01,s
|
|
550 stb >u00B5,u
|
|
551 lda >u00B8,u
|
|
552 anda #$F8
|
|
553 ora ,s
|
|
554 sta >u00B8,u
|
|
555 leas $03,s
|
|
556 lda #$01
|
|
557 sta >u00B4,u
|
|
558 tst >u00AA,u
|
|
559 beq L0427
|
|
560 L040B clr >u00AA,u
|
|
561 ldy >u00A7,u
|
|
562 lda <$15,y
|
|
563 ldy $03,s
|
|
564 cmpa #$FF
|
|
565 bne L0423
|
|
566 lbsr L04A5
|
|
567 bra L0428
|
|
568 L0423 bsr L0496
|
|
569 bra L0428
|
|
570 L0427 clrb
|
|
571 L0428 bcc L042C
|
|
572 stb ,s
|
|
573 L042C puls pc,y,x,b
|
|
574 L042E puls b
|
|
575 comb
|
|
576 ldb #E$Sect
|
|
577 puls pc,y,x
|
|
578 L0435 pshs u,y,x,b,a
|
|
579 ldd $01,s
|
|
580 L0439 subd $04,s
|
|
581 bcc L0443
|
|
582 addd $04,s
|
|
583 andcc #^Carry
|
|
584 bra L0445
|
|
585 L0443 orcc #Carry
|
|
586 L0445 rol $03,s
|
|
587 rolb
|
|
588 rola
|
|
589 dec ,s
|
|
590 bne L0439
|
|
591 std ,s
|
|
592 andb $06,s
|
|
593 stb $02,s
|
|
594 ldb $07,s
|
|
595 beq L045E
|
|
596 L0457 lsr ,s
|
|
597 ror $01,s
|
|
598 decb
|
|
599 bne L0457
|
|
600 L045E puls pc,u,y,x,b,a
|
|
601 L0460 lda <$21,y
|
|
602 cmpa #$04
|
|
603 lbcc L0332
|
|
604 cmpa >u00A9,u
|
|
605 beq L0495
|
|
606 sta >u00A9,u
|
|
607 dec >u00AA,u
|
|
608 lsla
|
|
609 lsla
|
|
610 lsla
|
|
611 pshs a
|
|
612 lda >u00B8,u
|
|
613 anda #$E7
|
|
614 ora ,s
|
|
615 leas $01,s
|
|
616 sta >u00B8,u
|
|
617 pshs x
|
|
618 ldx <$1E,y
|
|
619 stx >u00A7,u
|
|
620 puls x
|
|
621 L0495 rts
|
|
622 L0496 clr >u00B9,u
|
|
623 lda <$22,y
|
|
624 anda #$0F
|
|
625 ora #$70
|
|
626 lbsr L028C
|
|
627 rts
|
|
628 L04A5 clr >u00B9,u
|
|
629 lda <$22,y
|
|
630 anda #$0F
|
|
631 ora #$10
|
|
632 lbsr L028C
|
|
633 bcs L04BF
|
|
634 ldx >u00A7,u
|
|
635 clr <$15,x
|
|
636 clr <$16,x
|
|
637 L04BF rts
|
|
638
|
|
639 L04C0 pshs b,a
|
|
640 clrb
|
|
641 L04C3 lda >$FF5F
|
|
642 bita #$40
|
|
643 bne L04D2
|
|
644 decb
|
|
645 bne L04C3
|
|
646 ldb #E$NotRdy
|
|
647 stb $01,s
|
|
648 comb
|
|
649 L04D2 puls pc,b,a
|
|
650
|
|
651 L04D4 dec <u006A
|
|
652 lda #$02
|
|
653 sta >MPI.Slct
|
|
654 lda #$08
|
|
655 L04DD sta >$FF51
|
|
656 rts
|
|
657
|
|
658 L04E1 pshs cc
|
|
659 lda #$00
|
|
660 sta >$FF51
|
|
661 lda #$03
|
|
662 sta >MPI.Slct
|
|
663 clr <u006A
|
|
664 puls pc,cc
|
|
665
|
|
666 L04F1 lda #$10
|
|
667 bra L04DD
|
|
668
|
|
669 emod
|
|
670 eom equ *
|
|
671 end
|
|
672
|