# HG changeset patch # User Robert Gault # Date 1390688406 -3600 # Node ID 824019cd874451b359d0ab60d9011311cda7006c # Parent 011a5f26e9da9f490b5ba7ae156ebef57540db16 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives Deny the disk destroying write with the narrower heads of the 96 tpi drive when the user has placed a 48 tpi disk in the 96 tpi drive so he can read it. Double stepping the drive is then done automatically so as to stay in mechanical synch with the tracks on a 48 tpi disk. But that, until now, did not make the disk read-only, this patch does that. Patch by Gene Heskett and Robert Gault. diff -r 011a5f26e9da -r 824019cd8744 level1/modules/rb1773.asm --- a/level1/modules/rb1773.asm Sat Jan 25 23:19:38 2014 +0100 +++ b/level1/modules/rb1773.asm Sat Jan 25 23:20:06 2014 +0100 @@ -85,6 +85,17 @@ * * 2009/03/19 Robert Gault * Removed slow down hack from format and write sector but left code just in case. +* +* 2013/12/16 Robert Gault and Gene Heskett +* Added two new flags, flagWP flagFMT, to prevent disk damage by Writes where +* the drive head width does not match the disk track density. +* flagWP <>0 write protects; flagFMT <>0 overrules flagWP so that a Format can +* write to a disk. +* A descriptor that does not match your drive can still cause Writes to disks that +* could possibly cause disk corruption. This cannot be prevented. +* +* When LSN0 is read using a 3.5" drive, most of the checks of density, sides, etc. +* are bypassed as not needed. nam rb1773 ttl Western Digital 1773 Disk Controller Driver @@ -172,6 +183,8 @@ * physlsn rmb 2 PCDOS (512 byte sector) # flag512 rmb 1 PCDOS (512 byte sector) 0=no, 1=yes flagform rmb 1 SCII format flag +flagWP rmb 1 write protection <>0 +flagFMT rmb 1 format flag size equ . fcb DIR.+SHARE.+PEXEC.+PWRIT.+PREAD.+EXEC.+UPDAT. @@ -204,6 +217,8 @@ clr RW.Ctrl clear SCII control register clr flagform,u clear SCII format flag ENDC + clr flagWP,u + clr flagFMT,u ldx V.PORT,u get Base port address lda WD_Data,x get byte at FDC Data register coma complement it to modify it @@ -415,6 +430,10 @@ ldy >lastdrv,u Get drive table ptr back lda DPort+WD_Sect Save into Sector register ldx >lastdrv,u Get last drive table accessed ldb DPort+WD_Trak Save current track # onto controller * From here to the line before L0307 is for write precomp, but is not used. @@ -1066,7 +1104,7 @@ * fcb $8C *L03E0 ldb #E$Read Read error - orcc #Carry set carry +L03E0 orcc #Carry set carry rts L03E4 bsr L0404 Send command to controller & waste some time @@ -1127,7 +1165,9 @@ ldb #E$UnkSvc return illegal service request error rts -SSWTrk pshs u,y preserve register stack & descriptor +SSWTrk stb flagFMT,u permit unconditional write on format + clr flagWP,u don't protect on a format + pshs u,y preserve register stack & descriptor * Level 2 Code IFGT Level-1