[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DSK to NIB Instruction



Ed Eastman <noone@nowhere.net> wrote:
>> These extra bits are not directly visible to the Apple's 
>> CPU, only to the controller card itself.
> 
> Correct, they are discarded by the read circuit of the A2 floppy disk 
> drive.  They are only detectable by the CPU with very sharp timing of 
> the read byte from disk routine. Bad example follows to illustrate:

It is possible to write a read routine that can tell the difference
between a sync byte and a non-sync byte.  The same routine can't tell the
difference between a 9-bit byte and a 10-bit byte, because the timing is
too close.

Each bit is 4usec, so an 8-bit byte shows up every 32usec.  Every
instruction on the 6502 takes at least 2usec, some take a lot more.
You have to wait for the byte, verify the timing, and write it with or
without the high bit set into a buffer that gradually fills up, all the
while maintaining the correct cycle timing.

The clock used to write the floppy isn't going to run at exactly the same
speed as the 6502 clock, so sometimes it's going to take 31 or 33 usec
to get the next byte.  A "normal" read routine just sits and spins until
the high bit gets set, so the tolerances are pretty loose in RWTS.

> The controller can only read bytes that start with a 1, but you can 
> write any 8 bits...

For sync bytes, it's a matter of waiting for an extra 4 or 8 usec before
sending the next byte.  Unlike the read loop, the write loop does need
to be precise, issuing a new byte every 32usec.

-- 
Send mail to fadden@fadden.com (Andy McFadden) - http://www.fadden.com/
CD-Recordable FAQ - http://www.cdrfaq.org/
CiderPress Apple II archive utility for Windows - http://www.faddensoft.com/
Fight Internet Spam - http://spam.abuse.net/spam/ & http://spamcop.net/