Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!udel!princeton!phoenix!kadickey From: kadickey@phoenix.Princeton.EDU (Kent Andrew Dickey) Newsgroups: comp.sys.apple2 Subject: Re: DOS 3.3 Question Message-ID: <15239@phoenix.Princeton.EDU> Date: 10 Apr 90 05:32:43 GMT References: <9004091826.AA14659@mrcnext.cso.uiuc.edu> <1990Apr9.233636.12939@laguna.ccsf.caltech.edu> Reply-To: kadickey@phoenix.Princeton.EDU (Kent Andrew Dickey) Organization: Princeton University, NJ Lines: 101 [ Lots of stuff from lots of people deleted.... ] Ah...the intricacies of Apple // disk software. A quick introduction to disk arm moving: Moving the Disk II drive arm requires turning on stepper magnets in a specified order, with specified delays. Imagine it as pulling the drive arm around using a magnet which you keep moving in front of it. These magnets can take one of four different phases--and once you've stepped through each phase once, you start over with the first one again. "Stepping" consists of turning these magnets on and off at specified minimum times (After you turn the magnet on, you have to make sure the drive arm GETS there before you go to the next phase!). Each cycle through these 4 phases is generally referred to as "one phase" or "one half track." Yeah, computer terminology is meant to be confusing. :-) Why is it only a half-track? As others have pointed out, the drive read/write head is quite large physically--large enough to cause its magnetic field to scramble stuff a phase away. Therefore, writing on every phase is impossible. So, Woz decided to just make every OTHER phase a TRACK, and so we get 35 tracks on our 70 phase drive mechanisms. So, half-tracks are very easy to seek to and copy-protection writers soon started using them to store valid data (using the data layout of: Tracks 0, 1.5, 2.5, 3.5, etc...So all the data was AT LEAST 2 phases apart). These protections are easily defeated by merely copying the proper tracks. Little known fact: some old protected software had its data written using a higher density disk mechanism, i.e., one that COULD write to consecutive phases on the disk (half-tracks). The Disk II drive head could READ this data, but never reproduce it--leading to the first un-bit-copyable software (unless you bought the same type of disk drive). I believe mostly this consisted of using tracks 4, 4.5, and 5, and the copy protection software just checked for certain valid data on all three of those. I would assume that the data would be slightly flaky (since the drive couldn't WRITE it at that density, READing might be a little iffy on some drives), so I wouldn't want a full disk of 80 tracks of important information stored on the disk.... OK, so what about half tracks? Conceptually, it's pretty simple. Remember how we're leading the drive arm around the disk by pulling it ahead by turning on magnets in a specified sequence? Well, how about after engaging, say, the third phase of the 4-cycle phase transition, we turn on phase two SIMULTANEOUSLY? Ah...now, the drive arm centers itself nicely BETWEEN the two positions!! Let it settle there a short while, and shut both magnets off simultaneously, and we've just seeked to a 1/4-track. Clearly, this is not the most accurate of positionings (if the magnets do not put out exactly the same amount of power, then the head will be pulled more to one side then the other...), so you probably wouldn't want to trust various disk drives to seek properly to this position. However, since writing doesn't seem to affect data 3/4 of a track away, it's conceptually possible to format a disk using 3/4 track spacing (giving 140/3 = 46 tracks == 44K extra). No one that I know of has ever tried doing this...mostly, I assume, because the 1/4 track position is not all that accurate... So, why have we all heard of 1/4 tracks then? Well, Broderbund pioneered a real nasty protection scheme (I believe first used on Choplifter) called track spiralling. The idea is to write, say, 3 sectors on track 1, in the middle of the track seek to the next higher 1/4 track (1.25), write another 3 sectors, seek to track 1.5, write another 3 sectors, etc. The reason for only 3 sectors per quarter-track is that the data CANNOT overlap closer than 3/4 of a track away, and due to a certain amount of time required to move the drive arm, this space was lost. However, if space was not a premium, this is a difficult protection scheme to copy....(Note, it's called track spiralling since the data looks like it spirals outward from the center). Other neat Disk II facts: The SEEKABS routine already optimizes the timing delays to move the drive arm as fast as possible. That is, it's smart enough to know that once the drive arm has picked up momentum, it needn't wait as long to move it forward yet another track! Similarly, it does the reverse to slow it down when it approaches the destination track. Thus, seeking from track 35 to track 0 is quite quick, much faster than calling SEEKABS to step from 35 to 34, and then to 33, and then, etc....It's impressive that it can achieve this result using so little code. (Well, alright, it's not 'optimal', but it has to operate within the tolerance of the drive mechanism...as in, on your drive, you might be able to get by with lower delays, while my 10 year old drive might need every last microsecond of delay in order to work properly). For any more Disk II trivia/information, feel free to send me e-mail. (I haven't even covered DATA FORMATS on the disk itself, just how to move the arm around....it's pretty easy to get 18 sectors per track, and there is a VERY complicated way to get nearly 20 sectors!) So, 20 sectors/track * ( 40 * 4/3) = 1060 sectors = 265K, on one side of the disk! Therefore, the Disk II can store 530K on the two sides of a SINGLE density disk, whereas IBM's double density disk can only hold 360K on two sides! Oh, and this is all done in software... Kent Dickey kadickey@phoenix.Princeton.EDU