Jump to content



4

Understanding Atari floppy drive timing


75 replies to this topic

#1 Farb OFFLINE  

Farb

    Chopper Commander

  • 112 posts
  • Location:Colorado, USA

Posted Wed Jan 11, 2012 12:58 PM

As the result of discussions in various other forum topic, it's pretty clear that accurate drive timing emulation is necessary to properly pass many copy protection checks. I realize many people here already understand this really well. I'd simply like to get the information precisely detailed as a reference to others (including myself) who are just getting into this for the first time.

My understanding is that the only commercial disks released with copy protection were single-density (90k) disks, so I think it makes sense to limit the discussion to those types of disks only. I also realize that different drives had different specifications that might alter some of the variables. Unless someone feels otherwise, let's constrain the discussion to the behavior of the Atari 810 drive and its WD1771 controller.

I've taken the liberty of creating a diagram of how I currently understand an Atari disk to be physically structured (attached). Please let me know if any of the details are incorrect.

I am going under the following assumptions:

1. Track numbering is always consistent.
2. Sector layout/numbering can vary depending on how they were written to the disk.

Does this all make sense?

Attached Thumbnails

  • atari_sd_layout.jpg

Edited by Farb, Wed Jan 11, 2012 1:18 PM.


#2 Fox-1 / mnx OFFLINE  

Fox-1 / mnx

    Dragonstomper

  • 938 posts
  • BBSing is terminal...
  • Location:NL, Earth 2.0

Posted Wed Jan 11, 2012 1:37 PM

View PostFarb, on Wed Jan 11, 2012 12:58 PM, said:

My understanding is that the only commercial disks released with copy protection were single-density (90k) disks

Not at all. Many of the later releases are on Enhanced Density (130K).

#3 Bryan OFFLINE  

Bryan

    Quadrunner

  • 7,626 posts
  • Cruise Elroy = 4DB7
  • Location:Port St. Lucie, Florida

Posted Wed Jan 11, 2012 1:51 PM

Yes, a track is a fixed head position. If you have the right equipment, you can mess around with what's on the track and get different reactions from the floppy controller. You can also mess with where a track starts relative to other tracks (since Atari didin't use the index hole) so you can predict how long it should take for the drive to find and read a sector after a step. Since the controller is not directly accessible by the computer, even simple protection schemes are pretty effective unless you have a modified drive since you can't write anything out of the ordinary.

It's much more complicated on systems like the 64 where everything about the drive is under software control and you can upload your own code to the drive. The protections schemes on that system are nuts and may include non-standard track positions and an entirely new data encoding scheme. On the Atari you're restricted to using something the WD controller can read back (bad sectors not withstanding).

#4 Farb OFFLINE  

Farb

    Chopper Commander

  • 112 posts
  • Location:Colorado, USA

Posted Wed Jan 11, 2012 3:05 PM

View PostFox-1 / mnx, on Wed Jan 11, 2012 1:37 PM, said:

Not at all. Many of the later releases are on Enhanced Density (130K).

Is it safe to say that the majority of copy protected releases were SD?

I'd like to keep a single frame of reference and I assume the information captured here will be applicable to ED disks as well with minimum translation. I think it might complicate the discussions if we try to address 26 sectors per track simultaneously since it's a different physical layout.

If it's deemed critical, though, I'll try to incorporate it. We would have to change the discussion to use the 1050 as the point of reference drive since ED disks couldn't be read by standard 810s.

Edited by Farb, Wed Jan 11, 2012 3:08 PM.


#5 Sub(Function(:)) OFFLINE  

Sub(Function(:))

    Moonsweeper

  • 357 posts
  • Location:Athens, Greece

Posted Wed Jan 11, 2012 3:13 PM

you may want to look at.

Atari Software Protection Techniques (http://www.scribd.co...s-Apaha-Systems)
and Advanced ATARI protection techniques

as well as the archiver and Super Archiver manuals

These all have very good information on the techniques used to protect disks.

#6 Farb OFFLINE  

Farb

    Chopper Commander

  • 112 posts
  • Location:Colorado, USA

Posted Wed Jan 11, 2012 3:16 PM

Actually, my hope for this thread is to focus on drive timing emulation which is independent of any sort of copy protection. It just happens to have a positive effect on copy protection checks if the timing is correct :)

I have read the two Alpha Systems books (just recently actually) and they are very good references. I will have to find the Super Archiver manual as I've seen it mentioned a few times. Thanks for the suggestion.

Edited by Farb, Wed Jan 11, 2012 3:16 PM.


#7 Bryan OFFLINE  

Bryan

    Quadrunner

  • 7,626 posts
  • Cruise Elroy = 4DB7
  • Location:Port St. Lucie, Florida

Posted Wed Jan 11, 2012 3:16 PM

The A8 had a longer life in the UK and Europe and some ED disks came out after the US market had dried up. The differences aren't that big, though. It's just a higher data rate for more space on a track.

#8 www.atarimania.com OFFLINE  

www.atarimania.com

    Stargunner

  • 1,516 posts

Posted Wed Jan 11, 2012 3:39 PM

I can't think of many commercial disks in ED apart from some of the "newer" German or Polish titles. Most of the Rainbird games probably? Can't even remember whether they have protection...

--
Atari Frog
http://www.atarimania.com

#9 Rybags OFFLINE  

Rybags

    Quadrunner

  • 10,314 posts
  • Location:Australia

Posted Wed Jan 11, 2012 3:39 PM

Sector skew (layout) isn't necessarily consistent. In fact, a "stealthy" type of copy protection can be employed by simply changing the sector ordering on a track, which can give that track unique timing characteristics compared to the rest.

It's worthwhile considering ED disks - some protection schemes use less or more sectors / track (something like up to 22 for SD ?) so the formulas and algorithms you might use to replicate behaviour would need some flexibility anyway.

#10 Sub(Function(:)) OFFLINE  

Sub(Function(:))

    Moonsweeper

  • 357 posts
  • Location:Athens, Greece

Posted Wed Jan 11, 2012 3:46 PM

I found this:

http://nleaudio.com/...ucts/Sa_Upd.htm

As I remember I got a photocopy of the part of the SA manual and this document as a typed up set of instructions

I have the original manual here with me I can try and scan it at work if you want

Also just out of interest I found this site:

https://sites.google...l/superarchiver

Nice to see a picture of one again :)

#11 Farb OFFLINE  

Farb

    Chopper Commander

  • 112 posts
  • Location:Colorado, USA

Posted Wed Jan 11, 2012 4:07 PM

View PostBryan, on Wed Jan 11, 2012 1:51 PM, said:

You can also mess with where a track starts relative to other tracks (since Atari didin't use the index hole) so you can predict how long it should take for the drive to find and read a sector after a step.

That's a good point and let's dive into that. The Atari uses soft sectoring (no index hole) vs. hard sectoring (index hole used). So, the Atari drive's floppy controller has to rely on the track data to figure out where the first sector on the track begins.

I found Frankenstein's excellent article in Mega Magazine #6 that describes the layout of an SD track. Attached is a diagram I put together from the information.

So when you refer to where a track "starts", you mean the physical position of the "start of track" index mark within the track ring (the red area in my first diagram), correct?

I'm also assuming that when people refer to sector skew alignment being consistent, it means that those "start of track" index marks are all aligned with each other across all tracks.

Am I getting it so far?

Attached Thumbnails

  • atari-sd-track-layout.jpg

Edited by Farb, Wed Jan 11, 2012 4:11 PM.


#12 Farb OFFLINE  

Farb

    Chopper Commander

  • 112 posts
  • Location:Colorado, USA

Posted Wed Jan 11, 2012 4:16 PM

View PostSub(Function(':)'), on Wed Jan 11, 2012 3:46 PM, said:

I have the original manual here with me I can try and scan it at work if you want.

That would be awesome!

#13 Rybags OFFLINE  

Rybags

    Quadrunner

  • 10,314 posts
  • Location:Australia

Posted Wed Jan 11, 2012 4:19 PM

I'm not sure if the beginning of tracks line up.

The smart thing to do would be to optimise it such that 2 consecutive reads that involve a head skip will have minimum latency.

Whether they attempted to do that, I don't know.

Slightly unrelated - I found a long time ago with some testing that on a 1050 you actually got a quicker read rate by reading a track backwards.

Edited by Rybags, Wed Jan 11, 2012 4:20 PM.


#14 Farb OFFLINE  

Farb

    Chopper Commander

  • 112 posts
  • Location:Colorado, USA

Posted Wed Jan 11, 2012 4:30 PM

View PostRybags, on Wed Jan 11, 2012 4:19 PM, said:

I'm not sure if the beginning of tracks line up.

So you mean this?

Attached Thumbnails

  • skew-alignment.jpg


#15 Bryan OFFLINE  

Bryan

    Quadrunner

  • 7,626 posts
  • Cruise Elroy = 4DB7
  • Location:Port St. Lucie, Florida

Posted Wed Jan 11, 2012 4:38 PM

View PostFarb, on Wed Jan 11, 2012 4:07 PM, said:

So when you refer to where a track "starts", you mean the physical position of the "start of track" index mark within the track ring (the red area in my first diagram), correct?

Yes, if you consider the index hole to be 12 o'clock, then the start of a track could be anywhere but each track can be different and will be skewed by changes in rotational speed and whatnot. I would imagine that the drive is programmed to produce fairly accurate skew if the speed is 288RPM. Anyway, we know that a rotation is about 208ms. So, if track 7 is written with sector 1 at 12 o'clock and track 8 is written with sector 1 at 6 o'clock, then we could read T7S1, step, T8S1 and we'd expect there to be a 104ms elapsed time between the two (assuming you stay within the step/settle timing). The stock Atari drive can't reproduce the custom skewing, so a working copy can't be made.

#16 Bryan OFFLINE  

Bryan

    Quadrunner

  • 7,626 posts
  • Cruise Elroy = 4DB7
  • Location:Port St. Lucie, Florida

Posted Wed Jan 11, 2012 4:44 PM

View PostFarb, on Wed Jan 11, 2012 4:30 PM, said:

View PostRybags, on Wed Jan 11, 2012 4:19 PM, said:

I'm not sure if the beginning of tracks line up.

So you mean this?
Sort of, except you need to allow for any rotation amount, not just sector intervals. If we found the index pulse code in the 1050 controller we could determine how close it is to ideal. Or, you can format a disk and then read sector 1 of each successive track to get the time interval. I bet it's close to being aligned.

#17 Farb OFFLINE  

Farb

    Chopper Commander

  • 112 posts
  • Location:Colorado, USA

Posted Wed Jan 11, 2012 5:11 PM

View PostBryan, on Wed Jan 11, 2012 4:44 PM, said:

Sort of, except you need to allow for any rotation amount, not just sector intervals.

This better?

Attached Thumbnails

  • skew-alignment2.jpg


#18 Bryan OFFLINE  

Bryan

    Quadrunner

  • 7,626 posts
  • Cruise Elroy = 4DB7
  • Location:Port St. Lucie, Florida

Posted Wed Jan 11, 2012 5:29 PM

Much better. I bet an actual Atari disk probably looks mostly like the 2nd picture, with a small skew from track to track so the green line is more of a curve, but it would be dependent on drive speed. A protected disk might look like the 1st pic on some tracks. Early disks just used bad sectors, or a different number of sectors per track, or duplicate sectors (so sector 1 could be read twice per track, with two sets of data).

#19 Farb OFFLINE  

Farb

    Chopper Commander

  • 112 posts
  • Location:Colorado, USA

Posted Wed Jan 11, 2012 5:38 PM

That makes sense. The extremeness of the skew in the diagram is probably better for illustrative purposes so I'll pretend I already knew it's more subtle in reality ;-)

I'll take a shot at some timing examples. What is the step speed of the 810 drive head?

#20 Bryan OFFLINE  

Bryan

    Quadrunner

  • 7,626 posts
  • Cruise Elroy = 4DB7
  • Location:Port St. Lucie, Florida

Posted Wed Jan 11, 2012 6:02 PM

I just thought of the best way to do it. Digitally record the audio of a drive formatting. Open the file in a wav editor and the steps will be perfectly timestamped.

#21 Rybags OFFLINE  

Rybags

    Quadrunner

  • 10,314 posts
  • Location:Australia

Posted Wed Jan 11, 2012 7:29 PM

That won't really help - the format does a write operation then the seek.

I'm not sure we could work it out from the computer side - most commands should "Ack" right away and Read/Write doesn't send "Complete" until the operation is complete.

IIRC the ST controller had options for 5, 6, 7 and 8 ms - there's a fair chance the 5.25 drives are even higher. And the 1050 mech at least performs two stepping operations to move between tracks.

As well as that, there might be a soft "settling" delay built in - a look at the firmware should reveal if there is.

Possibly the datasheet for the controller might shed some light... although again I suspect the firmware might set the motor phases directly.

#22 Bryan OFFLINE  

Bryan

    Quadrunner

  • 7,626 posts
  • Cruise Elroy = 4DB7
  • Location:Port St. Lucie, Florida

Posted Wed Jan 11, 2012 7:53 PM

Gary,

I want the step rate during format. The assumption is that every track is written by the same routine:

Step
Wait for Pulse
Write Track
(verify track)
Step
Wait for Pulse
Write Track
etc...

The head should step at 1x or 2x (3x?) the pulse rate. If the step rate is ~208ms or ~416ms (I think some drives do the verify during the format), then we can safely assume that the drive tries to align the tracks as well as it can. If the step rate is something else, then there's probably a track skew of some sort.

#23 Rybags OFFLINE  

Rybags

    Quadrunner

  • 10,314 posts
  • Location:Australia

Posted Wed Jan 11, 2012 8:09 PM

What do you mean by "check for pulse" ?

Re verify - I don't think any of the 810 or 1050 variants do it during format (as in the initial 40 track operation)
Behaviour I've observed - 810 formats 39 to 0 then verifies 0-39, 1050 formats 0-39 then verifies 39-0.

I guess one way to confirm the theory would be to try format a head-cleaning floppy and see when it fails.

Maybe we're thinking too much about this. They could easily have optimised the formatting while developing the firmware. Just experiment with half a dozen or so delay factors after seek. Then pick the best one or two and tweak it from there.

Edited by Rybags, Wed Jan 11, 2012 8:09 PM.


#24 Bryan OFFLINE  

Bryan

    Quadrunner

  • 7,626 posts
  • Cruise Elroy = 4DB7
  • Location:Port St. Lucie, Florida

Posted Wed Jan 11, 2012 8:16 PM

The WD controller requires an index pulse to format. It doesn't come from the drive, it comes from the PIA and is software generated. I just want to know if it mimics a 288 RPM drive which would create a fairly well aligned set of tracks.

#25 Rybags OFFLINE  

Rybags

    Quadrunner

  • 10,314 posts
  • Location:Australia

Posted Wed Jan 11, 2012 8:32 PM

You've probably got these - I think they're both reverse-engineered listings but there might be some clues inside:

Attached File  1050 Firmware revB.ZIP   17.02K   20 downloads
Attached File  1050 Src.zip   74.13K   19 downloads




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users