I'm pretty exited about the progress I made during yesterdays snowstorm, so I figured I'd share it. Besides snow-blowing the driveway and flooding the skating rink, I was able to spend a lot of time working on the Disk ][ de-serializer. This is the function that reads the data coming off the disk.
This is implemented on Apple products by what eventually became known as the IWM or Integrated Woz Machine. The first iteration was done on the Apple II disk ][ interface, and it is implemented by a 2MZ dedicated ROM based sequencer that works hand in hand with the 6502 processor. There is a very good description of this in the book "Understanding the Apple ][" by Jim Sauther. After studying this design, I figured that I could implement it and the RWTS system that interfaces to it, on an 8MHZ AVR micro-controller, with no additional HW support. One of the main purposes of the current proof of principal board is to prove that this is doable.
My initial coding of the IWM didn't properly decode the data, though it did recover something that appeared to be data. This in itself was a good sign, especially in terms of the hardware I had implemented. After studying the problem, I realized that my code wasn't "tight" enough and the timing was sloppy.
I reduced the code to the bare minimum and used a SW based simulator to check and improve the timing. This version almost worked, but if the last bit of a byte was a zero, it would sometimes drop the first bit of a following byte. I had implemented the de-serializer as a subroutine and the call and return overhead were not leaving enough time for the RWTS function to process the byte and call the de-serializer function for the next byte. There is a 4 microsecond delay between bits on the drive, and it doesn't leave much time for processing, especially if the last bit is a zero which is detected a bit later than a one.
Further improvements were called for and I found a couple of ways to further tighten the code and improve timing. At this point, the code is about as tight as I can get it, without changing the subroutine into a macro. However, these last small changes did the trick and I am able to consistently read data off of this particular disk/drive combination. I'll eventually have to try a number of different disks and drives to make sure that there is plenty of tolerance in the design, but things are looking promising after last night.
I really figured that it would take several weeks of effort to get this basic read functionality going. It turns out that I didn't even have to get the oscilloscope out!
You can track progress and see a photo of my proof of principal board here: http://www.willegal.net/appleii/appleii-disk-int.htm