.TITLE DSKFD AED 6200 disk driver .NLIST BEX .ENABL LC ; ; Pdp11/dcn aed 6200 disk driver ; *** does not support extended memory *** ; ; This module is an extension of the disk driver process. it services ; The advanced electronic devices 6200 disk controller with two drives. ; ; Max blocks: 1232, rt-11 directory segments: 4 (8 blocks), rt-11 id: 6 ; ; Note: standard csr/vector addresses are 764000/170 (770450/170 for 30k ; Systems). ; ; External symbols ; .GLOBL DSKINI,.WAIT,.SKED ; ; Entry symbols ; .GLOBL FDDPAT ;process control vector ; ; System definitions ; .ASECT .MCALL .COM,.PSA,.DFBLK,.DSK,.PAT ;dcnlib definitions .COM ;define common data .PSA ;define process save area .DFBLK ;define message codes .DSK ;define disk parameters ; ; Module definitions ; RTYCNT = 8. ;max error retry count MAXTRK = 77. ;maximum tracks per disk SECTRK = 16. ;sectors per track SECBLK = 1. ;sectors per block MAXBLK = MAXTRK*SECTRK/SECBLK ;blocks per disk SECLNG = 256./SECBLK ;words per sector ; ; Function codes (type 0 commands) ; WRITE0 = 0*20000 ;write sector mark 0 READ = 1*20000 ;read sector WRITE1 = 2*20000 ;write sector mark 1 INIT = 3*20000 ;initialize start/stop WRITE2 = 4*20000 ;write sector mark 2 READID = 5*20000 ;read sector i.d. WRITE3 = 6*20000 ;write sector mark 3 RZSEEK = 7*20000 ;rezero/seek ; ; Command words ; CMD0 = 000000 ;type 0 command word CMD1 = 001000 ;type 1 command word CMD2 = 002000 ;tyep 2 command word CMD3 = 003000 ;type 3 command word ; ; Modifier bits (type 0 commands) ; DL = 000400 ;door lock IS = 000200 ;inhibit seek ; ; Secondary status word bits ; IF = 100000 ;initialize flag IX = 040000 ;index bit DCKERR = 020000 ;data check error ADRERR = 010000 ;address error SELERR = 004000 ;select error NRFERR = 002000 ;no record found error WPRERR = 001000 ;write protect error INIERR = 000400 ;initialize error AEDID = 000040 ;6200 identifier (= 1) IM = 000020 ;initialize mode RWERR = 000010 ;read/write overrun OL = 000004 ;on-line DMID = 000003 ;data mark mask ; ; Process save area extension (fda) ; . = DASEND FDATWC: .BLKW 1 ;current block word count FDARZS: .BLKB 1 ;rezero/seek switch .EVEN .BLKW REGEND/2+DSKSTK ;process stack FDAEND = . ;end of psa extension ; ; Aed 6200 device registers ; . = 0 FDCS: .BLKW 1 ;command/secondary status register FDIE: .BLKW 1 ;interrupt control/primary status register FDBA: .BLKW 1 ;bus address register FDWC: .BLKW 1 ;word count register .PAGE ; ; Procedure segment ; ; Supervisor-state procedure ; Dsects: r2 = dev, r3 = par, r4 = reg, r5 = psa ; .PSECT $KERI,RO,I ; ; Start i/o operation ; DSKGO: JSR PC,.WAIT ;switch to wait state DSK10: MOV DASBLK(R5),R1 ;extract track/sector addresses CLR R0 DIV #SECTRK,R0 BIS #CMD0+READ,R0 ;construct type 0 command BIS #CMD1,R1 ;construct type 1 command MOV R1,-(SP) ;set drive number MOVB DASDRV(R5),R1 ASH #11.,R1 BIS R1,R0 BIS R1,@SP MOV (SP)+,FDCS(R2) ;load type 1 command MOV DASADR(R5),FDBA(R2) ;load current address MOV DASRWC(R5),R1 ;compute word count CMP R1,#SECLNG BLOS 1$ MOV #SECLNG,R1 1$: MOV R1,FDATWC(R5) ;save for later NEG R1 MOV R1,FDWC(R2) ;load word count TSTB FDARZS(R5) ;is this rezero/seek BEQ 2$ ;branch if no ADD #RZSEEK-READ,R0 ;yes. construct type 0 command BR 3$ ; 2$: CMPB #BC.WRT+CHNCTL,DASOPN(R5) ;what operation is this BNE 3$ ;branch if read ADD #WRITE3-READ,R0 ;write. construct type 0 command 3$: MOVB DASADX(R5),R1 ;load address 16-17 ASH #12.,R1 BIS #100,R1 MOV R1,FDIE(R2) MOV R0,FDCS(R2) ;load command RTS PC ; ; I/o interrupt service ; DSKINT: MOV FDCS(R2),R0 ;fetch disk status TST FDIE(R2) ;is this error BMI ERROR ;branch if yes ROLB FDARZS(R5) ;no. is rezero/seek in progress BCS DSK10 ;branch if yes INC DASBLK(R5) ;no. update transfer parameters MOV FDATWC(R5),R0 SUB R0,DASRWC(R5) ASL R0 ADD R0,DASADR(R5) ADCB DASADX(R5) TST DASRWC(R5) ;are there more blocks BNE DSK10 ;branch if yes BR DONE ;no. mosey on home ; ERROR: TSTB DASERC(R5) ;is this the first one BNE 1$ ;branch if no INC PARTRY(R3) ;yes. record total faults 1$: INCB DASERC(R5) ;bump retry count CMPB DASERC(R5),#RTYCNT ;is it exceeded BHI 3$ ;branch if yes BIT #SELERR+WPRERR+INIERR,R0 ;no. is this recoverable BNE 3$ ;branch if no BIT #ADRERR+NRFERR,R0 ;yes. is rezero/seek required BNE 2$ ;branch if yes INC PARCRC(R3) ;no. record data check BR DSK10 ; 2$: INC PARSEK(R3) ;record seek check MOVB #200,FDARZS(R5) ;do rezero/seek BR DSK10 ; 3$: BIS #1,REGPS(R4) ;record hard error MOV R0,@R4 DONE: CLR FDIE(R2) ;clear interrupts JMP .SKED ;shortcut ; ; Data segment ; .PSECT $KERD,RO,D ; ; Process header ; FDDPAT: .PAT FDAEND,DSKINI,PRI2,<0,0,DSKGO,DSKINT> ; .END