******› DISKSAVR1.BAS DOCS!› The program is on this disk!›› Ever copy a disk only to have the› routine choke on ONE bad sector? Well› DiskSaver! is the remedy! Works on› Sparta Sngl. or Enh. Density. Uses› direct disk access thru USR.› Allocates bad sectors in bit-map so› no data can be written to them.› Writes to the boot sectors so "DIR"› will show the correct amount of free› sectors. Will also fix disks that› show freespace greater than the whole› disk. Ever have that happen? I hope› you find this routine useful. Watch› for a dbl density version on: The REM› lab. The WeB BBs 24hr 7 days 708-884-› 0315› * DiskSaver! v1.0 (c) 1990 by REMlab› *************************************› First things first.› I got to looking at the pile of disks› I had that wouldn't format for one› reason or another and got to› wondering just how large that pile› was going to get before having to pay› extra rent. Then I started to wonder› just why those disks wouldn't format.› Using a sector editor, I discovered› that most of the disks had a bad› sector or two. Realizing that a box› of "cheap" disks cost as much as $6› retail, I would be throwing them away› to the tune of over $20.00. Yes, I› had a pile of over thirty disks that› wouldn't format correctly! So, I› decided to see if I could get ANY use› out of that pile.› I discovered that I could fix the› disks using a sector editor. This› required a great deal of typing to› write the boot sectors the way they› were intended.› Then I discovered I could fool the› editor by starting off with a› properly formatted blank disk,› reading the boot sectors, one at a› time, and swapping disks to write› those sectors to the "bad" disk.› Still alot of typing and time› consuming too. I wanted a routine› that I could just load and run and› let the machine do the work like it› was intended to do. No problem, just› read the boot sectors of a good disk› and write them to the bad one. It's› that easy. ›› WRONG!!!!!!!!› You can't read the boot sectors like› you would a read a file! And even if› you could, what about the bad› sector/s? How do you prevent data› from being written to those sectors?› I thought of creating a file using› the bad sectors. But, then how would› I get DOS to write the file to those› particular sectors and if the file› ever got accidentally erased how› could DOS be prevented from writing› data to those sectors? ›› Things seemed impossible and I was› about to give up when I was messing› with the sector editor again and› realized I might be able to allocate› sectors without having to create a› file that uses those sectors. It› worked! Now I had to find a way of› getting the machine to do all the› work so I wouldn't have to use the› editor sector by sector. I found a 49› byte USR routine in a BASIC utility› package I had laying around that› would allow direct access to the› disk, one sector at a time, and any› sector on the disk.› Using that USR routine I could read› each sector except the bad ones and a› simple error trap would branch to a› line that would tell me which sector› was bad.› Now came the hard part, changing the› sector map so DOS would skip the bad› sectors. I tried and tried until I› discovered that the sector map allows› for sector 0. SECTOR 0 DOESN'T› EXIST!!! But, it's in the sector› map!› Figure that one out! Okay, the sector› editor, then the USR routine,› allocate the bad sectors, a bad disk› becomes a good disk, right?›› WRONG!!!!!!!!› I had a "fixed" disk and I started to› copy some files to that disk. I did a› "DIR" in the disk and guess what it› showed. 123 FREE SECTORS I tried to› copy one more file, a 121 sector› file.›› ERROR 162!? How can that be? How› could I be so dumb? I forgot to› change the bytes that tell you how› many free sectors are on the disk. Oh› well, just remember that there are› fewer sectors on the disk than a› "DIR" shows.›› WRONG!!!!!!!!› Finding the free sector bytes› required alot of trial and error. ie;› sector editor, change a byte, exit to› DOS, "DIR", wrong bytes, sector› editor, change a byte, back to DOS,› "DIR", wrong bytes, etc. etc....›› It about drove me nuts! Back to the› ol' drawing board? No! I only had to› add a few lines that would keep a› count of the bad sector and change› the free sector bytes before writing› the boot sectors and sector map to› the disk.›› So, here's beta-test version 1.› DiskSaver! by REMlab.› It loads from DOS with BASIC enabled.› Sorry, SpartaDos 3.2 only in this› version and no double density, yet.› (But, I'm still working on it. When› perfected, it will handle ALL DOSes› known to the Atari 8-bit [I hope].)› Before I forget, DiskSaver! has taken› up a large chunk of my time, and, I'm› not yet through with it. But, I still› gotta eat! Any donations will be› gladly accepted and will be devoted› to writing more useful stuff and to› the running of my board.› If you feel the need, send it to:› REMlab % R. Cook, P.O. Box 1144› Arlington Hts., IL, 60006-1144› Atari! Power without the price! › **END**›