Mercurial > hg > Members > kono > nitros9-code
comparison level1/modules/rb1773.asm @ 1631:ec6fb5543b22
Robert Gault's modifications for correcting timing errors
author | boisy |
---|---|
date | Mon, 12 Jul 2004 01:38:08 +0000 |
parents | c228f9fbe3b8 |
children | 93d5b9ff0f4a |
comparison
equal
deleted
inserted
replaced
1630:7af4d12008f4 | 1631:ec6fb5543b22 |
---|---|
66 * would be quite difficult and probably not worth the effort to permit | 66 * would be quite difficult and probably not worth the effort to permit |
67 * selection of both Sleep and IRQ SCII drivers. However, both normal | 67 * selection of both Sleep and IRQ SCII drivers. However, both normal |
68 * and Alt SCII I/O registers are supported. | 68 * and Alt SCII I/O registers are supported. |
69 * | 69 * |
70 * Cleaned up some errors in the last version of rb1773. | 70 * Cleaned up some errors in the last version of rb1773. |
71 * | |
72 * 2004/07/11 Robert Gault | |
73 * Corrected the error handling code for read & write to separate SCII errors | |
74 * from OS-9 errors. Changed drive test from compare #4 to compare #N.Drives to | |
75 * permit up to 6 drives using alternate table. | |
71 | 76 |
72 nam rb1773 | 77 nam rb1773 |
73 ttl Western Digital 1773 Disk Controller Driver | 78 ttl Western Digital 1773 Disk Controller Driver |
74 | 79 |
75 * These lines needed if assembling with on a Color computer. | 80 * These lines needed if assembling with on a Color computer. |
465 tst flag512,u SCII must use halt mode for 512 byte sectors | 470 tst flag512,u SCII must use halt mode for 512 byte sectors |
466 bne L0176B | 471 bne L0176B |
467 ENDC | 472 ENDC |
468 lda #7 SCII read, buffered mode, masked NMI | 473 lda #7 SCII read, buffered mode, masked NMI |
469 bsr L01A1B send commands and wait | 474 bsr L01A1B send commands and wait |
470 lbcs L03AF get the errors | 475 * New lines needed because the SCII has error other than OS-9 errors. RG |
471 IFNE H6309 | 476 bcs ngood |
472 pshs y | 477 * This now becomes a subroutine call. RG |
478 * lbcs L03AF get the errors | |
479 lbsr L03AF get the errors | |
480 bcc good | |
481 ngood rts | |
482 IFNE H6309 | |
483 good pshs y | |
473 ldw #128 set counter | 484 ldw #128 set counter |
474 ldy #RW.DAT source of data | 485 ldy #RW.DAT source of data |
475 IFNE SCIIHACK | 486 IFNE SCIIHACK |
476 tst flag512,u | 487 tst flag512,u |
477 beq sc2rlp | 488 beq sc2rlp |
485 sc2rlp ldd ,y read two bytes from SCII | 496 sc2rlp ldd ,y read two bytes from SCII |
486 std ,x++ transfer two bytes to system buffer | 497 std ,x++ transfer two bytes to system buffer |
487 decw update counter | 498 decw update counter |
488 bne sc2rlp | 499 bne sc2rlp |
489 ELSE | 500 ELSE |
490 ldy #128 | 501 good ldy #128 |
491 IFNE SCIIHACK | 502 IFNE SCIIHACK |
492 tst flag512,u | 503 tst flag512,u |
493 beq sc2rlp | 504 beq sc2rlp |
494 ldy #256 | 505 ldy #256 |
495 ENDC | 506 ENDC |
699 bne wrbuf | 710 bne wrbuf |
700 ENDC | 711 ENDC |
701 puls y | 712 puls y |
702 ldb #$A0 Write sector command | 713 ldb #$A0 Write sector command |
703 lda #6 SCII masked NMI, buffered mode, write | 714 lda #6 SCII masked NMI, buffered mode, write |
704 lbra L01A1B send command to controller | 715 * See Read section for explanation of error changes below. RG |
716 * lbra L01A1B send command to controller | |
717 lbsr L01A1B send command to controller | |
718 bcs wngood SCII error, then go | |
719 lbra L03AF check for OS-9 errors | |
720 wngood rts | |
705 ENDC | 721 ENDC |
706 wr512 ldb #S$Format | 722 wr512 ldb #S$Format |
707 | 723 |
708 * Format track comes here with B=$F0 (write track) | 724 * Format track comes here with B=$F0 (write track) |
709 * as does write sector with B=$A0 | 725 * as does write sector with B=$A0 |
932 fcb $40 Drive 3 / Side select | 948 fcb $40 Drive 3 / Side select |
933 | 949 |
934 * Changes regD; X,Y,U preserved | 950 * Changes regD; X,Y,U preserved |
935 L0376 clr >u00AA,u clear drive change flag | 951 L0376 clr >u00AA,u clear drive change flag |
936 chkdrv lda <PD.DRV,y Get drive # requested | 952 chkdrv lda <PD.DRV,y Get drive # requested |
937 cmpa #4 Drive 0-3? | 953 * It is possible to have more than 4 drive # so the change below. RG |
954 * cmpa #4 Drive 0-3? | |
955 cmpa #N.Drives Drive 0-6 if alternate table used? | |
938 blo L0385 Yes, continue normally | 956 blo L0385 Yes, continue normally |
939 NoHW comb Illegal drive # error | 957 NoHW comb Illegal drive # error |
940 ldb #E$Unit | 958 ldb #E$Unit |
941 rts | 959 rts |
942 | 960 |
956 L03A6 clr >currside,u Set side (head) flag to side 1 | 974 L03A6 clr >currside,u Set side (head) flag to side 1 |
957 lbsr L04B3 Go set up VIRQ to wait for drive motor | 975 lbsr L04B3 Go set up VIRQ to wait for drive motor |
958 puls pc,x,d Restore sector #,drive #,B & return | 976 puls pc,x,d Restore sector #,drive #,B & return |
959 | 977 |
960 L03AF ldb >DPort+WD_Stat Get status register from FDC | 978 L03AF ldb >DPort+WD_Stat Get status register from FDC |
979 * This line needed when returning to Disk Basic but probably | |
980 * not needed for OS-9. RG | |
981 IFNE SCII | |
982 clr RW.Ctrl return SCII to halt mode | |
983 ENDC | |
961 L03B2 bitb #%11111000 any of the error bits set? | 984 L03B2 bitb #%11111000 any of the error bits set? |
962 beq L03CA No, exit without error | 985 beq L03CA No, exit without error |
963 aslb Drive not ready? | 986 aslb Drive not ready? |
964 bcs L03CC Yes, use that error code | 987 bcs L03CC Yes, use that error code |
965 aslb Write protect error? | 988 aslb Write protect error? |
1297 puls pc,x Restore original LSN & return | 1320 puls pc,x Restore original LSN & return |
1298 | 1321 |
1299 emod | 1322 emod |
1300 eom equ * | 1323 eom equ * |
1301 end | 1324 end |
1325 |