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