The Bad Sector:
What is it and how can it be used for software protection? As we know when the disk is formatted on a standard Atari drive there are 720 sectors each containing 128 bytes of data. Actually bad sectors are no sectors at all. They are created on special drives with hardware enhancements. If you had a disk and say sectors 40 through 50 were bad, in reality sectors 40 through 50 would not be on that disk. They would be missing. These bad or missing sectors are used to copyguard disks.
They can be used in several ways. The placing of the bad sectors on a disk can cause the copying of that disk to be very hard an time consuming. If say you were to place hundreds of bad sectors before your program it would be a tremendous annoyance to someone trying to copy it. Regular DOS would not do it.
There are sector copiers available which will copy through the bad sectors but each bad sector encountered will cause the disk drive to make a horrible grinding noise as it has to retry the bad sector from two to four times. Upon returning an error 144 it will then go on to the next sector. Few people have the patience or the nerve to let their disk drives grind for a half hour or so to get through 200 or so bad sectors. But there are always some people that will let the disk drive run forever, until they have copied the entire disk regardless of how many bad sectors are on the disk even though this will eventually ruin a disk drive. The placing of many bad sectors upon a disk is a good way to discourage people from copying that disk and making it an annoying job.
It is much better to place many bad sectors on a disk and have the software check for one or more of the bad sectors. For copyguarding to be effective the custom formatting or bad sectors must be part of your program. We will give an example on how this can be used. Say we had a program we wanted to protect. We could make sector 40 bad assuming we had special hardware allowing us to accomplish this. There are other ways to make a bad sector but for the time being let's just say that we could make sector 40 a bad sector. We will want our software to read sector 40 to check and see that it is bad. The Atari disk drive checks all sectors to be read and returns a status on these sectors. The status returned is a 1 for a good sector and a 0 for a bad sector. We can use this to our advantage in protecting a program. We would now want our program to return the status on our bad sector (example is sector 40). If for example the status of 0 is returned we then know that sector 40 is bad and we can instruct our program to continue or run. If a status of 1 is returned which means a good sector, we could instruct our program to lock-up or not run. Knowing that a good sector being read by our program means that it has been transferred to another disk and it has been copied we would know it is a pirated copy because they would have copied all of our program except for the bad sector. They could reproduce our program byte for byte but they could not reproduce the bad sector with a stock Atari disk drive.
The status check on sector 40 can be done in machine language or basic. More than likely this would be done in machine language. You should have knowledge of machine language and programming skills to accomplish this. We will give an idea here of how this is done. We would want to setup a device control block (ex. Into address 301 we would put the number of disk drives used. Into address 302 we put the command to read. Address 303 would return the status of the sector we wanted to read. We would then set the buffer address where the information is to be returned. We would then call the resident disk handler whose address will always be 53 E4. This will return the status of the bad sector.) Without making this too complicated our software must check for that bad sector. In other words the bad sector has become part of our program and it must be there in order for our program to run. The duplication of our program without the bad sector will not allow the program to run.
There are many ways which people use to reproduce a bad sector thus allowing them to copy a copyguarded disk. One trick that people use is called slowing down the disk drive. The normal Atari disk drive must run at approximately 288 RPM's + or -3 RPM's. If the disk drive is slowed down to around 220 RPM's and sectors are written they will be bad sectors. Some people have found out about this and some copy programs sold instruct you on how to slow your drive down. This is done by removing the disk drive cover. To access the drive you must remove four small tabs with an exacto knife or other thin sharp object. You lift the four round tabs off allowing you access to the four screws which secure the cover of the disk drive. After removing these screws from the disk drive you may now lift off the cover. On the newer drives toward the rear of the drive on the P.C. board you will locate a small green potentiometer. It will usually be marked R106. On the older drives there will be a larger white nylon circular potentiometer which you may turn with your fingers. On the newer drives you will use a very small thin bladed screw driver for this purpose. To reproduce a bad sector you will want to set the drive speed to approximately 220 RPM's. We have provided you with an RPM program in which to do this with. You must provide the screwdriver yourself. After the RPM's are set to 220 allow a few seconds for it to stabilize. The sectors that you now write when read back at normal speed will be bad. You may use our sector writing program to experiment with this. There are other ways to write a bad sector. We do not recommend them for they are dangerous and could cause damage to your equipment. We will discuss them. One way is to use a piece of scotch tape by cutting a piece of tape about 5" long. Fold the tape in half and attach this piece of tape to the end of your disk. You could now stick that disk in your drive and when you close the door you will have a few inches of tape sticking out. By pulling on the tape while writing a sector, the pressure you exert on the disk will cause the drive to slow down thus writing a bad sector. This technique is known as "milking the cow" because you have to jerk the tape in a back and forth motion. As silly as this may sound many (so-called) code crackers have become very proficient at this. They will use this technique in trying to copy your software. Another method used by people with knowledge of disk drive hardware is to locate the 1771 controller chip. They will then wire-up a switch which will short out the pin that is responsible for writing. Once this device is installed in a disk drive they can write bad sectors simply by flipping a switch.
There are kits available for the 810 disk drive that will automatically write bad sectors. These are sold as hardware enhancements. Their hardware will allow the user to copy just about any custom format including bad-sectored disks. Unfortunately for those that wish to protect their software there is no defense against these hardware enhanced disk drives but they are expensive and require disk drive disassembly to install so there are not that many in use. The bad sector while good is not the best copyguarding technique to use. When first introduced it was good but not many people know how to slow down their disk drives and reproduce a bad sector. The fact that anybody can simply slow down their disk drive and reproduce a disk copyguarded by bad sectors alone make this form of copyguarding not all that secure. With the proper hardware you can produce custom formats which the stock 810 disk drive cannot.
The double-sector has become a popular form of copyguarding. A normal disk contains forty tracks. These tracks are circular like the grooves on a phonograph record. Each track contains 18 sectors, which is the standard Atari format. With special hardware you could produce a track or tracks with 19 sectors. You could now have one extra sector into which unique data could be placed. The standard 810 drive could not reproduce this custom format as whereby slowing down the disk drive they can duplicate the bad sector. They would not be able to duplicate your 19 sector format regardless of slowing down or speeding up RPM schemes. The standard unenhanced 810 disk drive can simply not reproduce 19 sectors or more per track. To protect your software you could take advantage of the 810 disk drives' limitations. As with the bad sector protecting technique, your copyguarded software must check the 19th sector to assure that it is on the disk. As in all cases your code must check for your custom formatting. If you hide the code that does these checks your software will be even more secure.
The code crackers will go through your entire disk a sector at a time checking every byte if necessary until they find where you are checking status or confirming special formats. They will then remove your software checks (i.e. where you do a status check of a bad sector, say in previous example, we were checking sector 40 for a bad sector they will remove that or where they see you doing status on sector 40 they would change the command to do status on an out of range sector like sector 2000. By instructing the disk drive to return status on an out of range sector it will try and in trying to do the impossible it would return an error.) Thus they would fool the copied disk into thinking that it had a bad sector. With tricks like this code crackers can uncopyguard a copyguarded disk. Once this is done the copyguarded disk can now be reproduced with standard DOS duplication.